This solution has been AI generated
You can run AG‑UI and A2A side‑by‑side. Keep Google ADK's A2A run_sse for agent‑to‑agent calls, and add a separate CopilotKit AG‑UI endpoint for your frontend. Both can be mounted on the same FastAPI app against the same ADK agent.
Architecture
- A2A (agent↔agent): other agents call your ADK agent via
POST /run_sse.
- AG‑UI (UI↔agent): your frontend calls a CopilotKit endpoint you expose (e.g.,
/copilotkit).
- Both endpoints operate independently against the same underlying ADK agent.
FastAPI setup (both endpoints)
from fastapi import FastAPI
from google.adk.agents import LlmAgent
from ag_ui_adk import ADKAgent, add_adk_fastapi_endpoint
my_adk_agent = LlmAgent(...)
copilot_agent = ADKAgent(
adk_agent=my_adk_agent,
app_name="my_agent",
user_id="demo_user"
)
app = FastAPI()
add_adk_fastapi_endpoint(app, copilot_agent, path="/copilotkit")
When you need AG‑UI to orchestrate A2A calls
Use an A2A middleware in your CopilotKit backend (e.g., A2AMiddlewareAgent) to wrap an A2A‑speaking agent and expose it to AG‑UI. This keeps UI flows in AG‑UI while delegating inter‑agent calls over A2A.
Routing summary
- Frontend (AG‑UI) →
POST /copilotkit
- Other agents (A2A) →
POST /run_sse
References
Was this helpful?
If this solution worked for you, please click on the appropriate option below to help us improve: