Skip to content

Commit 08d4528

Browse files
committed
make examples have configurable ports
1 parent 7dd37fe commit 08d4528

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

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)