Skip to content

Commit 05a14dc

Browse files
committed
stuff agents into types and update default ports
1 parent 0831f86 commit 05a14dc

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,8 +12,10 @@ 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

18+
const envVars = getEnvVars();
1719
export const agentsIntegrations: AgentIntegrationConfig[] = [
1820
{
1921
id: "middleware-starter",
@@ -27,7 +29,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
2729
id: "server-starter",
2830
agents: async () => {
2931
return {
30-
agentic_chat: new ServerStarterAgent({ url: "http://localhost:8000/" }),
32+
agentic_chat: new ServerStarterAgent({ url: envVars.serverStarterUrl }),
3133
};
3234
},
3335
},
@@ -36,22 +38,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
3638
agents: async () => {
3739
return {
3840
agentic_chat: new ServerStarterAllFeaturesAgent({
39-
url: "http://localhost:8000/agentic_chat",
41+
url: `${envVars.serverStarterAllFeaturesUrl}/agentic_chat`,
4042
}),
4143
human_in_the_loop: new ServerStarterAllFeaturesAgent({
42-
url: "http://localhost:8000/human_in_the_loop",
44+
url: `${envVars.serverStarterAllFeaturesUrl}/human_in_the_loop`,
4345
}),
4446
agentic_generative_ui: new ServerStarterAllFeaturesAgent({
45-
url: "http://localhost:8000/agentic_generative_ui",
47+
url: `${envVars.serverStarterAllFeaturesUrl}/agentic_generative_ui`,
4648
}),
4749
tool_based_generative_ui: new ServerStarterAllFeaturesAgent({
48-
url: "http://localhost:8000/tool_based_generative_ui",
50+
url: `${envVars.serverStarterAllFeaturesUrl}/tool_based_generative_ui`,
4951
}),
5052
shared_state: new ServerStarterAllFeaturesAgent({
51-
url: "http://localhost:8000/shared_state",
53+
url: `${envVars.serverStarterAllFeaturesUrl}/shared_state`,
5254
}),
5355
predictive_state_updates: new ServerStarterAllFeaturesAgent({
54-
url: "http://localhost:8000/predictive_state_updates",
56+
url: `${envVars.serverStarterAllFeaturesUrl}/predictive_state_updates`,
5557
}),
5658
};
5759
},
@@ -60,7 +62,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
6062
id: "mastra",
6163
agents: async () => {
6264
const mastraClient = new MastraClient({
63-
baseUrl: "http://localhost:4111",
65+
baseUrl: envVars.mastraUrl,
6466
});
6567

6668
return MastraAgent.getRemoteAgents({
@@ -87,27 +89,27 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
8789
agents: async () => {
8890
return {
8991
agentic_chat: new LangGraphAgent({
90-
deploymentUrl: "http://localhost:2024",
92+
deploymentUrl: envVars.langgraphUrl,
9193
graphId: "agentic_chat",
9294
}),
9395
agentic_generative_ui: new LangGraphAgent({
94-
deploymentUrl: "http://localhost:2024",
96+
deploymentUrl: envVars.langgraphUrl,
9597
graphId: "agentic_generative_ui",
9698
}),
9799
human_in_the_loop: new LangGraphAgent({
98-
deploymentUrl: "http://localhost:2024",
100+
deploymentUrl: envVars.langgraphUrl,
99101
graphId: "human_in_the_loop",
100102
}),
101103
predictive_state_updates: new LangGraphAgent({
102-
deploymentUrl: "http://localhost:2024",
104+
deploymentUrl: envVars.langgraphUrl,
103105
graphId: "predictive_state_updates",
104106
}),
105107
shared_state: new LangGraphAgent({
106-
deploymentUrl: "http://localhost:2024",
108+
deploymentUrl: envVars.langgraphUrl,
107109
graphId: "shared_state",
108110
}),
109111
tool_based_generative_ui: new LangGraphAgent({
110-
deploymentUrl: "http://localhost:2024",
112+
deploymentUrl: envVars.langgraphUrl,
111113
graphId: "tool_based_generative_ui",
112114
}),
113115
};
@@ -143,7 +145,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
143145
agents: async () => {
144146
return {
145147
agentic_chat: new AgnoAgent({
146-
url: "http://localhost:8000/agui",
148+
url: `${envVars.agnoUrl}/agui`,
147149
}),
148150
};
149151
},
@@ -153,16 +155,16 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
153155
agents: async () => {
154156
return {
155157
agentic_chat: new LlamaIndexAgent({
156-
url: "http://localhost:9000/agentic_chat/run",
158+
url: `${envVars.llamaIndexUrl}/agentic_chat/run`,
157159
}),
158160
human_in_the_loop: new LlamaIndexAgent({
159-
url: "http://localhost:9000/human_in_the_loop/run",
161+
url: `${envVars.llamaIndexUrl}/human_in_the_loop/run`,
160162
}),
161163
agentic_generative_ui: new LlamaIndexAgent({
162-
url: "http://localhost:9000/agentic_generative_ui/run",
164+
url: `${envVars.llamaIndexUrl}/agentic_generative_ui/run`,
163165
}),
164166
shared_state: new LlamaIndexAgent({
165-
url: "http://localhost:9000/shared_state/run",
167+
url: `${envVars.llamaIndexUrl}/shared_state/run`,
166168
}),
167169
};
168170
},
@@ -172,22 +174,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
172174
agents: async () => {
173175
return {
174176
agentic_chat: new CrewAIAgent({
175-
url: "http://localhost:8000/agentic_chat",
177+
url: `${envVars.crewAiUrl}/agentic_chat`,
176178
}),
177179
human_in_the_loop: new CrewAIAgent({
178-
url: "http://localhost:8000/human_in_the_loop",
180+
url: `${envVars.crewAiUrl}/human_in_the_loop`,
179181
}),
180182
tool_based_generative_ui: new CrewAIAgent({
181-
url: "http://localhost:8000/tool_based_generative_ui",
183+
url: `${envVars.crewAiUrl}/tool_based_generative_ui`,
182184
}),
183185
agentic_generative_ui: new CrewAIAgent({
184-
url: "http://localhost:8000/agentic_generative_ui",
186+
url: `${envVars.crewAiUrl}/agentic_generative_ui`,
185187
}),
186188
shared_state: new CrewAIAgent({
187-
url: "http://localhost:8000/shared_state",
189+
url: `${envVars.crewAiUrl}/shared_state`,
188190
}),
189191
predictive_state_updates: new CrewAIAgent({
190-
url: "http://localhost:8000/predictive_state_updates",
192+
url: `${envVars.crewAiUrl}/predictive_state_updates`,
191193
}),
192194
};
193195
},
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)