mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
59c073c610
Python starters were trying to run uvicorn with agent.<module>:app but those modules don't export a FastAPI app. The demo packages use agent_server.py as the FastAPI wrapper, so starters need it too. Changes: - Copy agent_server.py from each demo package into starter root, rewriting "from agents." to "from agent." for the starter layout - Update all non-langgraph Python devScripts to use agent_server:app - Update Dockerfile.python to COPY agent_server.py for non-langgraph - Update getEntrypointBlock() generic Python to use agent_server:app - Make langgraph-fastapi use langgraph_cli dev like langgraph-python (it was incorrectly configured as a uvicorn-based starter) - Regenerate all starters
35 lines
737 B
Python
Generated
35 lines
737 B
Python
Generated
"""
|
|
Agent Server for Agno
|
|
|
|
Uses AgentOS with the AG-UI interface to serve the Agno agent.
|
|
The Next.js CopilotKit runtime proxies requests here via AG-UI protocol.
|
|
"""
|
|
|
|
import os
|
|
import dotenv
|
|
from agno.os import AgentOS
|
|
from agno.os.interfaces.agui import AGUI
|
|
|
|
from agent.main import agent
|
|
|
|
dotenv.load_dotenv()
|
|
|
|
# Build AgentOS and extract the app for serving
|
|
agent_os = AgentOS(agents=[agent], interfaces=[AGUI(agent=agent)])
|
|
app = agent_os.get_app()
|
|
|
|
|
|
@app.get("/health")
|
|
async def health():
|
|
return {"status": "ok"}
|
|
|
|
|
|
def main():
|
|
"""Run the uvicorn server."""
|
|
port = int(os.getenv("PORT", "8000"))
|
|
agent_os.serve(app="agent_server:app", host="0.0.0.0", port=port, reload=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|