Skip to content

Commit d1ffa7d

Browse files
committed
Make all agent ports configurable
1 parent 89f12c4 commit d1ffa7d

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

typescript-sdk/apps/dojo/scripts/run-dojo-everything.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,69 +14,89 @@ const serverStarter = {
1414
command: 'poetry run dev',
1515
name: 'Server Starter',
1616
cwd: path.join(integrationsRoot, 'server-starter/server/python'),
17+
env: {PORT: 8000},
1718
}
1819

1920
// Server Starter All Features
2021
const serverStarterAllFeatures = {
2122
command: 'poetry run dev',
2223
name: 'Server AF',
2324
cwd: path.join(integrationsRoot, 'server-starter-all-features/server/python'),
25+
env: {PORT: 8001},
2426
}
2527

2628
// Agno
2729
const agno = {
2830
command: 'uv run agent.py',
2931
name: 'Agno',
3032
cwd: path.join(integrationsRoot, 'agno/examples'),
33+
env: {PORT: 8002},
3134
}
3235

3336
// CrewAI
3437
const crewai = {
3538
command: 'poetry run dev',
3639
name: 'CrewAI',
3740
cwd: path.join(integrationsRoot, 'crewai/python'),
41+
env: {PORT: 8003},
3842
}
3943

4044
// Langgraph (FastAPI)
4145
const langgraphFastapi = {
4246
command: 'poetry run dev',
4347
name: 'LG FastAPI',
4448
cwd: path.join(integrationsRoot, 'langgraph/python/ag_ui_langgraph/examples'),
49+
env: {PORT: 8004},
4550
}
4651

4752
// Langgraph (Platform)
4853
const langgraph = {
49-
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser',
54+
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --port 8005',
5055
name: 'LG Platform',
5156
cwd: path.join(integrationsRoot, 'langgraph/examples'),
57+
env: {PORT: 8005},
5258
}
5359

5460
// Llama Index
5561
const llamaIndex = {
5662
command: 'uv run dev',
5763
name: 'Llama Index',
5864
cwd: path.join(integrationsRoot, 'llamaindex/server-py'),
65+
env: {PORT: 8006},
5966
}
6067

6168
// Mastra
6269
const mastra = {
6370
command: 'npm run dev',
6471
name: 'Mastra',
6572
cwd: path.join(integrationsRoot, 'mastra/example'),
73+
env: {PORT: 8007},
6674
}
6775

6876
// Pydantic AI
6977
const pydanticAi = {
7078
command: 'uv run dev',
7179
name: 'Pydantic AI',
7280
cwd: path.join(integrationsRoot, 'pydantic-ai/examples'),
81+
env: {PORT: 8008},
7382
}
7483

7584
// THE ACTUAL DOJO
7685
const dojo = {
7786
command: 'pnpm run dev',
7887
name: 'Dojo',
7988
cwd: path.join(gitRoot, 'typescript-sdk/apps/dojo'),
89+
env: {
90+
SERVER_STARTER_URL: 'http://localhost:8000',
91+
SERVER_STARTER_ALL_FEATURES_URL: 'http://localhost:8001',
92+
AGNO_URL: 'http://localhost:8002',
93+
CREW_AI_URL: 'http://localhost:8003',
94+
LANGGRAPH_FAST_API_URL: 'http://localhost:8004',
95+
LANGGRAPH_URL: 'http://localhost:8005',
96+
LLAMA_INDEX_URL: 'http://localhost:8006',
97+
MASTRA_URL: 'http://localhost:8007',
98+
PYDANTIC_AI_URL: 'http://localhost:8008',
99+
}
80100
}
81101

82102
async function main() {

typescript-sdk/integrations/agno/examples/agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
This example shows how to create an Agno Agent with tools (YFinanceTools) and expose it in an AG-UI compatible way.
44
"""
5+
import os
56

67
from agno.agent.agent import Agent
78
from agno.app.agui.app import AGUIApp
@@ -29,4 +30,6 @@
2930
app = agui_app.get_app()
3031

3132
if __name__ == "__main__":
32-
agui_app.serve(app="agent:app", host="0.0.0.0", port=9001, reload=True)
33+
port = int(os.getenv("PORT", "9001"))
34+
35+
agui_app.serve(app="agent:app", host="0.0.0.0", port=port, reload=True)

typescript-sdk/integrations/llamaindex/server-py/server/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import uvicorn
23
from fastapi import FastAPI
34

@@ -14,8 +15,11 @@
1415
app.include_router(shared_state_router, prefix="/shared_state")
1516

1617
def main():
18+
1719
"""Main function to start the FastAPI server."""
18-
uvicorn.run(app, host="0.0.0.0", port=9000)
20+
port = int(os.getenv("PORT", "9000"))
21+
22+
uvicorn.run(app, host="0.0.0.0", port=port)
1923

2024
if __name__ == "__main__":
2125
main()

typescript-sdk/integrations/mastra/example/src/mastra/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { LibSQLStore } from "@mastra/libsql";
55
import { agenticChatAgent } from "./agents/weather-agent";
66

77
export const mastra = new Mastra({
8+
server: {
9+
port: process.env.PORT ? parseInt(process.env.PORT) : 4111,
10+
},
811
agents: { agentic_chat: agenticChatAgent },
912
storage: new LibSQLStore({
1013
// stores telemetry, evals, ... into memory storage, if it needs to persist, change to file:../mastra.db

typescript-sdk/integrations/pydantic-ai/examples/server/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from fastapi import FastAPI
1717
import uvicorn
18+
import os
1819

1920

2021
from .api import (
@@ -45,7 +46,8 @@
4546

4647
def main():
4748
"""Main function to start the FastAPI server."""
48-
uvicorn.run(app, host="0.0.0.0", port=9000)
49+
port = int(os.getenv("PORT", "9000"))
50+
uvicorn.run(app, host="0.0.0.0", port=port)
4951

5052
if __name__ == "__main__":
5153
main()

0 commit comments

Comments
 (0)