forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (19 loc) · 826 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (19 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Claude Agent SDK (Python) starter — AG-UI server.
Serves the agent (defined in ``src/agent.py``) over AG-UI using the official
adapter's FastAPI helper: ``POST /`` streams the run, ``GET /health`` reports
status. Runs on uvicorn (port 8000).
"""
from __future__ import annotations
import os
from fastapi import FastAPI
from ag_ui_claude_sdk import add_claude_fastapi_endpoint
from src.agent import adapter
app = FastAPI(title="Claude Agent SDK (Python) Starter")
# The adapter's helper mounts POST / (streams the run) — the runtime connects here.
add_claude_fastapi_endpoint(app, adapter)
@app.get("/health")
async def health() -> dict[str, str]:
return {"status": "ok"}
if __name__ == "__main__":
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=int(os.getenv("AGENT_PORT", "8000")))