mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
36020b061f
Two clonable starter templates showing CopilotKit driving a Claude Agent SDK agent over AG-UI, mirroring the langgraph-python showcase (todos canvas, charts, flight cards, dynamic dashboards, HITL, theme, threads drawer). Each agent is a thin, idiomatic layer on the official ag-ui-claude-sdk / @ag-ui/claude-agent-sdk adapters: three backend tools (query_data, search_flights, generate_a2ui) live in per-tool modules and are wired into ClaudeAgentAdapter, while the shared todo board is driven by the adapter's built-in ag_ui_update_state tool. The default model is claude-sonnet-5 and local dev uses a real ANTHROPIC_API_KEY (matching the official AG-UI dojo). Both instances are registered in the _parity manifest so their frontends stay synced with the langgraph-python north-star. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
826 B
Python
31 lines
826 B
Python
"""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")))
|