Skip to content

Commit 607e5e1

Browse files
committed
stuff agents into types and update default ports
1 parent 2554a8d commit 607e5e1

File tree

2 files changed

+48
-25
lines changed

2 files changed

+48
-25
lines changed

typescript-sdk/apps/dojo/src/agents.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import { LangGraphAgent, LangGraphHttpAgent } from "@ag-ui/langgraph";
1212
import { AgnoAgent } from "@ag-ui/agno";
1313
import { LlamaIndexAgent } from "@ag-ui/llamaindex";
1414
import { CrewAIAgent } from "@ag-ui/crewai";
15+
import getEnvVars from "./env";
1516
import { mastra } from "./mastra";
1617
import { PydanticAIAgent } from "@ag-ui/pydantic-ai";
1718

19+
const envVars = getEnvVars();
1820
export const agentsIntegrations: AgentIntegrationConfig[] = [
1921
{
2022
id: "middleware-starter",
@@ -53,7 +55,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
5355
id: "server-starter",
5456
agents: async () => {
5557
return {
56-
agentic_chat: new ServerStarterAgent({ url: "http://localhost:8000/" }),
58+
agentic_chat: new ServerStarterAgent({ url: envVars.serverStarterUrl }),
5759
};
5860
},
5961
},
@@ -62,22 +64,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
6264
agents: async () => {
6365
return {
6466
agentic_chat: new ServerStarterAllFeaturesAgent({
65-
url: "http://localhost:8000/agentic_chat",
67+
url: `${envVars.serverStarterAllFeaturesUrl}/agentic_chat`,
6668
}),
6769
human_in_the_loop: new ServerStarterAllFeaturesAgent({
68-
url: "http://localhost:8000/human_in_the_loop",
70+
url: `${envVars.serverStarterAllFeaturesUrl}/human_in_the_loop`,
6971
}),
7072
agentic_generative_ui: new ServerStarterAllFeaturesAgent({
71-
url: "http://localhost:8000/agentic_generative_ui",
73+
url: `${envVars.serverStarterAllFeaturesUrl}/agentic_generative_ui`,
7274
}),
7375
tool_based_generative_ui: new ServerStarterAllFeaturesAgent({
74-
url: "http://localhost:8000/tool_based_generative_ui",
76+
url: `${envVars.serverStarterAllFeaturesUrl}/tool_based_generative_ui`,
7577
}),
7678
shared_state: new ServerStarterAllFeaturesAgent({
77-
url: "http://localhost:8000/shared_state",
79+
url: `${envVars.serverStarterAllFeaturesUrl}/shared_state`,
7880
}),
7981
predictive_state_updates: new ServerStarterAllFeaturesAgent({
80-
url: "http://localhost:8000/predictive_state_updates",
82+
url: `${envVars.serverStarterAllFeaturesUrl}/predictive_state_updates`,
8183
}),
8284
};
8385
},
@@ -86,7 +88,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
8688
id: "mastra",
8789
agents: async () => {
8890
const mastraClient = new MastraClient({
89-
baseUrl: "http://localhost:4111",
91+
baseUrl: envVars.mastraUrl,
9092
});
9193

9294
return MastraAgent.getRemoteAgents({
@@ -113,27 +115,27 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
113115
agents: async () => {
114116
return {
115117
agentic_chat: new LangGraphAgent({
116-
deploymentUrl: "http://localhost:2024",
118+
deploymentUrl: envVars.langgraphUrl,
117119
graphId: "agentic_chat",
118120
}),
119121
agentic_generative_ui: new LangGraphAgent({
120-
deploymentUrl: "http://localhost:2024",
122+
deploymentUrl: envVars.langgraphUrl,
121123
graphId: "agentic_generative_ui",
122124
}),
123125
human_in_the_loop: new LangGraphAgent({
124-
deploymentUrl: "http://localhost:2024",
126+
deploymentUrl: envVars.langgraphUrl,
125127
graphId: "human_in_the_loop",
126128
}),
127129
predictive_state_updates: new LangGraphAgent({
128-
deploymentUrl: "http://localhost:2024",
130+
deploymentUrl: envVars.langgraphUrl,
129131
graphId: "predictive_state_updates",
130132
}),
131133
shared_state: new LangGraphAgent({
132-
deploymentUrl: "http://localhost:2024",
134+
deploymentUrl: envVars.langgraphUrl,
133135
graphId: "shared_state",
134136
}),
135137
tool_based_generative_ui: new LangGraphAgent({
136-
deploymentUrl: "http://localhost:2024",
138+
deploymentUrl: envVars.langgraphUrl,
137139
graphId: "tool_based_generative_ui",
138140
}),
139141
};
@@ -169,7 +171,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
169171
agents: async () => {
170172
return {
171173
agentic_chat: new AgnoAgent({
172-
url: "http://localhost:8000/agui",
174+
url: `${envVars.agnoUrl}/agui`,
173175
}),
174176
};
175177
},
@@ -179,16 +181,16 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
179181
agents: async () => {
180182
return {
181183
agentic_chat: new LlamaIndexAgent({
182-
url: "http://localhost:9000/agentic_chat/run",
184+
url: `${envVars.llamaIndexUrl}/agentic_chat/run`,
183185
}),
184186
human_in_the_loop: new LlamaIndexAgent({
185-
url: "http://localhost:9000/human_in_the_loop/run",
187+
url: `${envVars.llamaIndexUrl}/human_in_the_loop/run`,
186188
}),
187189
agentic_generative_ui: new LlamaIndexAgent({
188-
url: "http://localhost:9000/agentic_generative_ui/run",
190+
url: `${envVars.llamaIndexUrl}/agentic_generative_ui/run`,
189191
}),
190192
shared_state: new LlamaIndexAgent({
191-
url: "http://localhost:9000/shared_state/run",
193+
url: `${envVars.llamaIndexUrl}/shared_state/run`,
192194
}),
193195
};
194196
},
@@ -198,22 +200,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
198200
agents: async () => {
199201
return {
200202
agentic_chat: new CrewAIAgent({
201-
url: "http://localhost:8000/agentic_chat",
203+
url: `${envVars.crewAiUrl}/agentic_chat`,
202204
}),
203205
human_in_the_loop: new CrewAIAgent({
204-
url: "http://localhost:8000/human_in_the_loop",
206+
url: `${envVars.crewAiUrl}/human_in_the_loop`,
205207
}),
206208
tool_based_generative_ui: new CrewAIAgent({
207-
url: "http://localhost:8000/tool_based_generative_ui",
209+
url: `${envVars.crewAiUrl}/tool_based_generative_ui`,
208210
}),
209211
agentic_generative_ui: new CrewAIAgent({
210-
url: "http://localhost:8000/agentic_generative_ui",
212+
url: `${envVars.crewAiUrl}/agentic_generative_ui`,
211213
}),
212214
shared_state: new CrewAIAgent({
213-
url: "http://localhost:8000/shared_state",
215+
url: `${envVars.crewAiUrl}/shared_state`,
214216
}),
215217
predictive_state_updates: new CrewAIAgent({
216-
url: "http://localhost:8000/predictive_state_updates",
218+
url: `${envVars.crewAiUrl}/predictive_state_updates`,
217219
}),
218220
};
219221
},
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
type envVars = {
2+
serverStarterUrl: string;
3+
serverStarterAllFeaturesUrl: string;
4+
mastraUrl: string;
5+
langgraphUrl: string;
6+
agnoUrl: string;
7+
llamaIndexUrl: string;
8+
crewAiUrl: string;
9+
}
10+
11+
export default function getEnvVars(): envVars {
12+
return {
13+
serverStarterUrl: process.env.SERVER_STARTER_URL || 'http://localhost:8000',
14+
serverStarterAllFeaturesUrl: process.env.SERVER_STARTER_ALL_FEATURES_URL || 'http://localhost:8000',
15+
mastraUrl: process.env.MASTRA_URL || 'http://localhost:4111',
16+
langgraphUrl: process.env.LANGGRAPH_URL || 'http://localhost:2024',
17+
agnoUrl: process.env.AGNO_URL || 'http://localhost:9001',
18+
llamaIndexUrl: process.env.LLAMA_INDEX_URL || 'http://localhost:9000',
19+
crewAiUrl: process.env.CREW_AI_URL || 'http://localhost:9002',
20+
}
21+
}

0 commit comments

Comments
 (0)