Files
Martha Schumann 21d2051b33 Close three PR review blockers: cross-layer event tests, API removals verified
- Add TestAGUIStyleEventIntegration to test_agui_agent.py: proves that AG-UI-style
  unprefixed events (manually_emit_message, manually_emit_tool_call, exit) flow
  correctly through CopilotKit's _handle_single_event to the AG-UI base handler
  without being suppressed or double-converted by the CopilotKit layer.
- Replace LangGraphAgent with LangGraphAGUIAgent in both example files
  (canvas/gemini and v1/_legacy/saas-dynamic-dashboards) to close the concern
  about removed APIs still being referenced externally.
- Update poetry.lock to reflect ag_ui_langgraph 0.0.32 and dependency updates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 17:18:42 -07:00

63 lines
1.3 KiB
Python

"""
This serves our agents through a FastAPI server.
"""
import os
from dotenv import load_dotenv
load_dotenv()
from fastapi import FastAPI
import uvicorn
from copilotkit.integrations.fastapi import add_fastapi_endpoint
from copilotkit import CopilotKitSDK, LangGraphAGUIAgent
from posts_generator_agent import post_generation_graph
from stack_agent import stack_analysis_graph
app = FastAPI()
sdk = CopilotKitSDK(
agents=[
LangGraphAGUIAgent(
name="post_generation_agent",
description="An agent that can help with the generation of LinkedIn posts and X posts.",
graph=post_generation_graph,
),
LangGraphAGUIAgent(
name="stack_analysis_agent",
description="Analyze a GitHub repository URL to infer purpose and tech stack (frontend, backend, DB, infra).",
graph=stack_analysis_graph,
),
]
)
add_fastapi_endpoint(app, sdk, "/copilotkit")
@app.get("/healthz")
def health():
"""Health check."""
return {"status": "ok"}
@app.get("/")
def root():
"""Root endpoint."""
return {"message": "Hello, World!"}
def main():
"""Run the uvicorn server."""
port = int(os.getenv("PORT", "8000"))
uvicorn.run(
"main:app",
host="0.0.0.0",
port=port,
reload=True,
)
if __name__ == "__main__":
main()