#AG UI with Google ADK ADK A2A Agent

1 messages · Page 1 of 1 (latest)

crude dune
#

I am using fast api way of connecting to google adk agent. Refer to https://google.github.io/adk-docs/deploy/gke/#create-your-agent
A2A protocal uses this custom endpoint( run_sse) provided by google adk to invoke the agent and get the response.
AG UI uses another custom endpoint refer https://docs.copilotkit.ai/adk/agentic-chat-ui , file agentic_chat.py to invoke the agent .

So when another agent calls my agent using A2A protocal it would not use the custom endpoint provided by copilot kit and rather use the google adk provided custom endpoint( run_sse).

I am not able to understand how to make AG UI work with A2A for google ADK agents.

Build powerful multi-agent systems with Agent Development Kit

open wyvernBOT
#

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

# Underlying Google ADK agent
my_adk_agent = LlmAgent(...)

# Wrap for CopilotKit AG‑UI
copilot_agent = ADKAgent(
    adk_agent=my_adk_agent,
    app_name="my_agent",
    user_id="demo_user"
)

app = FastAPI()

# AG‑UI endpoint for the frontend
add_adk_fastapi_endpoint(app, copilot_agent, path="/copilotkit")

# Google ADK A2A endpoint for other agents
# Implement per ADK docs to mount run_sse
# @app.post("/run_sse")
# def run_sse(...): ...

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:

open wyvernBOT
#

Hi @crude dune,Just checking in - did that answer your question?

crude dune
#

I have not tried yet, I have an orchestrator agent that is in GoogleADK. It has a subagent using A2A. I would like the A2A agent to be able to the call the frontend tools that can render charts. @jolly kelp I can have ag ui adk middleware for the orchestrator agent but for agent connected using A2A I will need A2A middleware?

#

Not clearly able to understand the architecture here

open wyvernBOT
#

So the way this works - the A2A Middleware doesn't go on the subagent itself. It lives on your CopilotKit Backend, and its job is to bridge AG-UI (used by your frontend and orchestrator) with A2A (used by your subagent).
The flow as far as I know:
• Orchestrator → wrapped in ADKAgent, exposed via /copilotkit — this is what talks to the frontend
• Subagent → a standard A2A agent at /run_sse — no frontend awareness needed
• A2AMiddlewareAgent (configured in your CopilotKit Runtime) → this is the glue. It injects the subagent into the orchestrator's environment, and when the subagent wants to render a chart, that request gets translated into a frontend tool call your React app can understand
So the chain is: Frontend ↔ /copilotkit (AG-UI) ↔ Orchestrator ↔ Middleware ↔ /run_sse (A2A) ↔ Subagent — and the middleware handles converting the subagent's response into a proper UI tool call.

#

Anyway, try it out as suggested and let us know how it goes!

crude dune
#

Yeah we have a similar requirement. AG UI - connects to an orchestrator ADK Agent using ADK middleware. Orchestrator agent can have adk subagents + multiple A2A agents. So if I understand clearly, orchestrator agent calls the A2A Middleware which invokes the A2A agent /run_sse endpoint.

#

Will check it by end of this week or early next week