Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions typescript-sdk/apps/dojo/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const withMDX = createMDX({

const nextConfig: NextConfig = {
/* config options here */
output: "standalone",
// Configure pageExtensions to include md and mdx
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
webpack: (config, { isServer }) => {
Expand Down
11 changes: 6 additions & 5 deletions typescript-sdk/apps/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
"@ag-ui/server-starter-all-features": "workspace:*",
"@ag-ui/vercel-ai-sdk": "workspace:*",
"@ai-sdk/openai": "^1.3.22",
"@copilotkit/react-core": "1.8.14-next.4",
"@copilotkit/react-ui": "1.8.14-next.4",
"@copilotkit/runtime": "1.8.14-next.4",
"@copilotkit/runtime-client-gql": "1.8.14-next.4",
"@copilotkit/shared": "1.8.14-next.4",
"@copilotkit/react-core": "1.9.2",
"@copilotkit/react-ui": "1.9.2",
"@copilotkit/runtime": "1.9.2",
"@copilotkit/runtime-client-gql": "1.9.2",
"@copilotkit/shared": "1.9.2",
"@mastra/client-js": "^0.10.9",
"@mastra/core": "^0.10.10",
"@mastra/dynamodb": "^0.13.0",
"@mastra/libsql": "^0.11.0",
"@mastra/loggers": "^0.10.3",
"@mastra/memory": "^0.11.1",
Expand Down
76 changes: 39 additions & 37 deletions typescript-sdk/apps/dojo/src/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { LangGraphAgent, LangGraphHttpAgent } from "@ag-ui/langgraph";
import { AgnoAgent } from "@ag-ui/agno";
import { LlamaIndexAgent } from "@ag-ui/llamaindex";
import { CrewAIAgent } from "@ag-ui/crewai";
import getEnvVars from "./env";
import { mastra } from "./mastra";
import { PydanticAIAgent } from "@ag-ui/pydantic-ai";

const envVars = getEnvVars();
export const agentsIntegrations: AgentIntegrationConfig[] = [
{
id: "middleware-starter",
Expand All @@ -29,22 +31,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
agents: async () => {
return {
agentic_chat: new PydanticAIAgent({
url: "http://localhost:9000/agentic_chat/",
url: `${envVars.pydanticAIUrl}/agentic_chat/`,
}),
agentic_generative_ui: new PydanticAIAgent({
url: "http://localhost:9000/agentic_generative_ui/",
url: `${envVars.pydanticAIUrl}/agentic_generative_ui/`,
}),
human_in_the_loop: new PydanticAIAgent({
url: "http://localhost:9000/human_in_the_loop/",
url: `${envVars.pydanticAIUrl}/human_in_the_loop/`,
}),
predictive_state_updates: new PydanticAIAgent({
url: "http://localhost:9000/predictive_state_updates/",
url: `${envVars.pydanticAIUrl}/predictive_state_updates/`,
}),
shared_state: new PydanticAIAgent({
url: "http://localhost:9000/shared_state/",
url: `${envVars.pydanticAIUrl}/shared_state/`,
}),
tool_based_generative_ui: new PydanticAIAgent({
url: "http://localhost:9000/tool_based_generative_ui/",
url: `${envVars.pydanticAIUrl}/tool_based_generative_ui/`,
}),
};
},
Expand All @@ -53,7 +55,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
id: "server-starter",
agents: async () => {
return {
agentic_chat: new ServerStarterAgent({ url: "http://localhost:8000/" }),
agentic_chat: new ServerStarterAgent({ url: envVars.serverStarterUrl }),
};
},
},
Expand All @@ -62,22 +64,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
agents: async () => {
return {
agentic_chat: new ServerStarterAllFeaturesAgent({
url: "http://localhost:8000/agentic_chat",
url: `${envVars.serverStarterAllFeaturesUrl}/agentic_chat`,
}),
human_in_the_loop: new ServerStarterAllFeaturesAgent({
url: "http://localhost:8000/human_in_the_loop",
url: `${envVars.serverStarterAllFeaturesUrl}/human_in_the_loop`,
}),
agentic_generative_ui: new ServerStarterAllFeaturesAgent({
url: "http://localhost:8000/agentic_generative_ui",
url: `${envVars.serverStarterAllFeaturesUrl}/agentic_generative_ui`,
}),
tool_based_generative_ui: new ServerStarterAllFeaturesAgent({
url: "http://localhost:8000/tool_based_generative_ui",
url: `${envVars.serverStarterAllFeaturesUrl}/tool_based_generative_ui`,
}),
shared_state: new ServerStarterAllFeaturesAgent({
url: "http://localhost:8000/shared_state",
url: `${envVars.serverStarterAllFeaturesUrl}/shared_state`,
}),
predictive_state_updates: new ServerStarterAllFeaturesAgent({
url: "http://localhost:8000/predictive_state_updates",
url: `${envVars.serverStarterAllFeaturesUrl}/predictive_state_updates`,
}),
};
},
Expand All @@ -86,7 +88,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
id: "mastra",
agents: async () => {
const mastraClient = new MastraClient({
baseUrl: "http://localhost:4111",
baseUrl: envVars.mastraUrl,
});

return MastraAgent.getRemoteAgents({
Expand All @@ -113,27 +115,27 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
agents: async () => {
return {
agentic_chat: new LangGraphAgent({
deploymentUrl: "http://localhost:2024",
deploymentUrl: envVars.langgraphUrl,
graphId: "agentic_chat",
}),
agentic_generative_ui: new LangGraphAgent({
deploymentUrl: "http://localhost:2024",
deploymentUrl: envVars.langgraphUrl,
graphId: "agentic_generative_ui",
}),
human_in_the_loop: new LangGraphAgent({
deploymentUrl: "http://localhost:2024",
deploymentUrl: envVars.langgraphUrl,
graphId: "human_in_the_loop",
}),
predictive_state_updates: new LangGraphAgent({
deploymentUrl: "http://localhost:2024",
deploymentUrl: envVars.langgraphUrl,
graphId: "predictive_state_updates",
}),
shared_state: new LangGraphAgent({
deploymentUrl: "http://localhost:2024",
deploymentUrl: envVars.langgraphUrl,
graphId: "shared_state",
}),
tool_based_generative_ui: new LangGraphAgent({
deploymentUrl: "http://localhost:2024",
deploymentUrl: envVars.langgraphUrl,
graphId: "tool_based_generative_ui",
}),
};
Expand All @@ -144,22 +146,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
agents: async () => {
return {
agentic_chat: new LangGraphHttpAgent({
url: "http://localhost:8000/agent/agentic_chat",
url: `${envVars.langgraphFastApiUrl}/agent/agentic_chat`,
}),
agentic_generative_ui: new LangGraphHttpAgent({
url: "http://localhost:8000/agent/agentic_generative_ui",
url: `${envVars.langgraphFastApiUrl}/agent/agentic_generative_ui`,
}),
human_in_the_loop: new LangGraphHttpAgent({
url: "http://localhost:8000/agent/human_in_the_loop",
url: `${envVars.langgraphFastApiUrl}/agent/human_in_the_loop`,
}),
predictive_state_updates: new LangGraphHttpAgent({
url: "http://localhost:8000/agent/predictive_state_updates",
url: `${envVars.langgraphFastApiUrl}/agent/predictive_state_updates`,
}),
shared_state: new LangGraphHttpAgent({
url: "http://localhost:8000/agent/shared_state",
url: `${envVars.langgraphFastApiUrl}/agent/shared_state`,
}),
tool_based_generative_ui: new LangGraphHttpAgent({
url: "http://localhost:8000/agent/tool_based_generative_ui",
url: `${envVars.langgraphFastApiUrl}/agent/tool_based_generative_ui`,
}),
};
},
Expand All @@ -169,7 +171,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
agents: async () => {
return {
agentic_chat: new AgnoAgent({
url: "http://localhost:8000/agui",
url: `${envVars.agnoUrl}/agui`,
}),
};
},
Expand All @@ -179,16 +181,16 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
agents: async () => {
return {
agentic_chat: new LlamaIndexAgent({
url: "http://localhost:9000/agentic_chat/run",
url: `${envVars.llamaIndexUrl}/agentic_chat/run`,
}),
human_in_the_loop: new LlamaIndexAgent({
url: "http://localhost:9000/human_in_the_loop/run",
url: `${envVars.llamaIndexUrl}/human_in_the_loop/run`,
}),
agentic_generative_ui: new LlamaIndexAgent({
url: "http://localhost:9000/agentic_generative_ui/run",
url: `${envVars.llamaIndexUrl}/agentic_generative_ui/run`,
}),
shared_state: new LlamaIndexAgent({
url: "http://localhost:9000/shared_state/run",
url: `${envVars.llamaIndexUrl}/shared_state/run`,
}),
};
},
Expand All @@ -198,22 +200,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
agents: async () => {
return {
agentic_chat: new CrewAIAgent({
url: "http://localhost:8000/agentic_chat",
url: `${envVars.crewAiUrl}/agentic_chat`,
}),
human_in_the_loop: new CrewAIAgent({
url: "http://localhost:8000/human_in_the_loop",
url: `${envVars.crewAiUrl}/human_in_the_loop`,
}),
tool_based_generative_ui: new CrewAIAgent({
url: "http://localhost:8000/tool_based_generative_ui",
url: `${envVars.crewAiUrl}/tool_based_generative_ui`,
}),
agentic_generative_ui: new CrewAIAgent({
url: "http://localhost:8000/agentic_generative_ui",
url: `${envVars.crewAiUrl}/agentic_generative_ui`,
}),
shared_state: new CrewAIAgent({
url: "http://localhost:8000/shared_state",
url: `${envVars.crewAiUrl}/shared_state`,
}),
predictive_state_updates: new CrewAIAgent({
url: "http://localhost:8000/predictive_state_updates",
url: `${envVars.crewAiUrl}/predictive_state_updates`,
}),
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const HumanInTheLoop: React.FC<HumanInTheLoopProps> = ({ params }) => {
// agent lock to the relevant agent
agent="human_in_the_loop"
>
<Chat />
<Chat integrationId={integrationId} />
</CopilotKit>
);
};
Expand Down Expand Up @@ -93,7 +93,9 @@ const InterruptHumanInTheLoop: React.FC<{
);
};

const Chat = () => {
const Chat = ({ integrationId }: { integrationId: string }) => {
// Langgraph uses it's own hook to handle human-in-the-loop interactions via langgraph interrupts,
// This hook won't do anything for other integrations.
useLangGraphInterrupt({
render: ({ event, resolve }) => <InterruptHumanInTheLoop event={event} resolve={resolve} />,
});
Expand All @@ -117,6 +119,9 @@ const Chat = () => {
],
},
],
// Langgraph uses it's own hook to handle human-in-the-loop interactions via langgraph interrupts,
// so don't use this action for langgraph integration.
available: ['langgraph', 'langgraph-fastapi'].includes(integrationId) ? 'disabled' : 'enabled',
renderAndWaitForResponse: ({ args, respond, status }) => {
return <StepsFeedback args={args} respond={respond} status={status} />;
},
Expand Down
25 changes: 25 additions & 0 deletions typescript-sdk/apps/dojo/src/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
type envVars = {
serverStarterUrl: string;
serverStarterAllFeaturesUrl: string;
mastraUrl: string;
langgraphUrl: string;
langgraphFastApiUrl: string;
agnoUrl: string;
llamaIndexUrl: string;
crewAiUrl: string;
pydanticAIUrl: string;
}

export default function getEnvVars(): envVars {
return {
serverStarterUrl: process.env.SERVER_STARTER_URL || 'http://localhost:8000',
serverStarterAllFeaturesUrl: process.env.SERVER_STARTER_ALL_FEATURES_URL || 'http://localhost:8000',
mastraUrl: process.env.MASTRA_URL || 'http://localhost:4111',
langgraphUrl: process.env.LANGGRAPH_URL || 'http://localhost:2024',
langgraphFastApiUrl: process.env.LANGGRAPH_FAST_API_URL || 'http://localhost:8000',
agnoUrl: process.env.AGNO_URL || 'http://localhost:9001',
llamaIndexUrl: process.env.LLAMA_INDEX_URL || 'http://localhost:9000',
crewAiUrl: process.env.CREW_AI_URL || 'http://localhost:9002',
pydanticAIUrl: process.env.PYDANTIC_AI_URL || 'http://localhost:9000',
}
}
21 changes: 17 additions & 4 deletions typescript-sdk/apps/dojo/src/mastra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@ import { openai } from "@ai-sdk/openai";
import { Agent } from "@mastra/core/agent";
import { Memory } from "@mastra/memory";
import { LibSQLStore } from "@mastra/libsql";
import { DynamoDBStore } from "@mastra/dynamodb";

import { Mastra } from "@mastra/core";
import { z } from "zod";

// import { weatherTool } from "../tools/weather-tool";

let storage: LibSQLStore | DynamoDBStore

if (process.env.DYNAMODB_TABLE_NAME) {
storage = new DynamoDBStore({
name: "dynamodb",
config: {
tableName: process.env.DYNAMODB_TABLE_NAME
},
});
} else {
storage = new LibSQLStore({ url: "file::memory:" });
}

export const mastra = new Mastra({
agents: {
Expand All @@ -24,9 +38,8 @@ export const mastra = new Mastra({
Use the weatherTool to fetch current weather data.
`,
model: openai("gpt-4o"),
// tools: { weatherTool },
memory: new Memory({
storage: new LibSQLStore({ url: "file::memory:" }),
storage: storage,
options: {
workingMemory: {
enabled: true,
Expand All @@ -53,7 +66,7 @@ export const mastra = new Mastra({
`,
model: openai("gpt-4o"),
memory: new Memory({
storage: new LibSQLStore({ url: "file::memory:" }),
storage: storage,
options: {
workingMemory: {
enabled: true,
Expand Down
4 changes: 4 additions & 0 deletions typescript-sdk/integrations/agno/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__

# LangGraph API
.langgraph_api
7 changes: 7 additions & 0 deletions typescript-sdk/integrations/agno/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extracted from with-agno

To install deps
pip install -r requirements.txt

to run
python agent.py
32 changes: 32 additions & 0 deletions typescript-sdk/integrations/agno/examples/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Example: Agno Agent with Finance tools

This example shows how to create an Agno Agent with tools (YFinanceTools) and expose it in an AG-UI compatible way.
"""

from agno.agent.agent import Agent
from agno.app.agui.app import AGUIApp
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools

agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[
YFinanceTools(
stock_price=True, analyst_recommendations=True, stock_fundamentals=True
)
],
description="You are an investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
instructions="Format your response using markdown and use tables to display data where possible.",
)

agui_app = AGUIApp(
agent=agent,
name="Investment Analyst",
app_id="investment_analyst",
description="An investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
)

app = agui_app.get_app()

if __name__ == "__main__":
agui_app.serve(app="agent:app", host="0.0.0.0", port=9001, reload=True)
6 changes: 6 additions & 0 deletions typescript-sdk/integrations/agno/examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
agno>=1.6.3
openai>=1.88.0
yfinance>=0.2.63
fastapi>=0.115.13
uvicorn>=0.34.3
ag-ui-protocol>=0.1.5
Loading