Skip to content

Commit e31a3f7

Browse files
committed
stuff agents into types and update default ports
1 parent 5520e16 commit e31a3f7

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 } 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
};
@@ -118,7 +120,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
118120
agents: async () => {
119121
return {
120122
agentic_chat: new AgnoAgent({
121-
url: "http://localhost:8000/agui",
123+
url: `${envVars.agnoUrl}/agui`,
122124
}),
123125
};
124126
},
@@ -128,16 +130,16 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
128130
agents: async () => {
129131
return {
130132
agentic_chat: new LlamaIndexAgent({
131-
url: "http://localhost:9000/agentic_chat/run",
133+
url: `${envVars.llamaIndexUrl}/agentic_chat/run`,
132134
}),
133135
human_in_the_loop: new LlamaIndexAgent({
134-
url: "http://localhost:9000/human_in_the_loop/run",
136+
url: `${envVars.llamaIndexUrl}/human_in_the_loop/run`,
135137
}),
136138
agentic_generative_ui: new LlamaIndexAgent({
137-
url: "http://localhost:9000/agentic_generative_ui/run",
139+
url: `${envVars.llamaIndexUrl}/agentic_generative_ui/run`,
138140
}),
139141
shared_state: new LlamaIndexAgent({
140-
url: "http://localhost:9000/shared_state/run",
142+
url: `${envVars.llamaIndexUrl}/shared_state/run`,
141143
}),
142144
};
143145
},
@@ -147,22 +149,22 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
147149
agents: async () => {
148150
return {
149151
agentic_chat: new CrewAIAgent({
150-
url: "http://localhost:8000/agentic_chat",
152+
url: `${envVars.crewAiUrl}/agentic_chat`,
151153
}),
152154
human_in_the_loop: new CrewAIAgent({
153-
url: "http://localhost:8000/human_in_the_loop",
155+
url: `${envVars.crewAiUrl}/human_in_the_loop`,
154156
}),
155157
tool_based_generative_ui: new CrewAIAgent({
156-
url: "http://localhost:8000/tool_based_generative_ui",
158+
url: `${envVars.crewAiUrl}/tool_based_generative_ui`,
157159
}),
158160
agentic_generative_ui: new CrewAIAgent({
159-
url: "http://localhost:8000/agentic_generative_ui",
161+
url: `${envVars.crewAiUrl}/agentic_generative_ui`,
160162
}),
161163
shared_state: new CrewAIAgent({
162-
url: "http://localhost:8000/shared_state",
164+
url: `${envVars.crewAiUrl}/shared_state`,
163165
}),
164166
predictive_state_updates: new CrewAIAgent({
165-
url: "http://localhost:8000/predictive_state_updates",
167+
url: `${envVars.crewAiUrl}/predictive_state_updates`,
166168
}),
167169
};
168170
},
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)