You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
to_a2a(Workflow) fails when Workflow contains LlmAgent with input_schema/output_schema (ADK 2.0.0b1) #5487
Calling to_a2a(workflow) on a Workflow whose nodes include an LlmAgent with input_schema or output_schema fails in two distinct ways:
Bug 1 — AgentCardBuilder requires sub_agents on Workflow. AgentCardBuilder accesses Workflow.sub_agents, a BaseAgent field not exposed by Workflow. This raises RuntimeError on agent-card construction.
Bug 2 — Event converter cannot map Workflow events to A2A message parts.
If AgentCard is supplied manually (bypassing Bug 1), the A2A event converter does not translate Workflow node events into A2A message parts. The task stays in working state forever; the client never gets a final response.
Repro
fromgoogle.adk.workflowimportWorkflowfromgoogle.adk.agentsimportLlmAgentfromgoogle.adk.a2a.utils.agent_to_a2aimportto_a2afrompydanticimportBaseModelclassOut(BaseModel):
text: strwriter=LlmAgent(
name="writer",
model="gemini-2.5-flash",
instruction="Write a short reply.",
output_schema=Out,
)
wf=Workflow(name="pipe", edges=[("START", writer)])
app=to_a2a(wf) # RuntimeError from AgentCardBuilder
Workaround
Wrap the Workflow in an LlmAgent:
wrapper=LlmAgent(
name="pipe_a2a",
model="gemini-2.5-flash",
instruction="Delegate to the workflow.",
sub_agents=[wf],
)
app=to_a2a(wrapper)
This avoids both bugs but adds an extra LlmAgent layer plus an extra LLM call per request. Schema-less Workflows work directly with to_a2a and do not need this wrapper.
Expected behavior
to_a2a(Workflow) should serve any Workflow — with or without schemas — as a first-class A2A agent, without requiring an LlmAgent wrapper.
Hi @gorgonline , Thanks for reporting this.
We have tested this out on ADK 2.0.0b1 and can confirm that passing a Workflow directly into to_a2a() currently throws an error. Regarding the workaround of wrapping the Workflow inside an LlmAgent's sub_agents, it appears this triggers a strict Pydantic ValidationError in standard environments.
Workaround:
the safest workaround if you need A2A right now is to serve the LlmAgent directly rather than placing it in a single-step workflow.
from google.adk.agents import LlmAgent
from google.adk.a2a.utils.agent_to_a2a import to_a2a
from pydantic import BaseModel
class Out(BaseModel):
text: str
writer = LlmAgent(
name="writer",
model="gemini-2.5-flash",
instruction="Write a short reply.",
output_schema=Out,
)
# Pass the agent directly to A2A
app = to_a2a(writer)
root_agent = writer
Hey @gorgonline! We don't support converting Workflows to a2a apps just yet, but we're working on it. In the meantime, the workaround you and @sanketpatil06 suggested is the best way to go!
Hi — just a heads-up that this still reproduces on the GA release google-adk==2.0.0.
I checked the v2.0.0 sources:
agent_card_builder.py @ v2.0.0: AgentCardBuilder.__init__(*, agent: BaseAgent, ...) — still typed to BaseAgent, no Workflow branch.
agent_to_a2a.py @ v2.0.0: def to_a2a(agent: BaseAgent, ...) — same signature, no Workflow support.
PR #5710 was closed without merging and I don't see a replacement in v2.0.0. Both original bugs still occur (AgentCardBuilder fails on missing sub_agents; Workflow events never reach the A2A client).
The LlmAgent-wrapper workaround from the original report still works on 2.0.0, so this isn't blocking us — flagging in case to_a2a(Workflow) is intended to be supported at GA.
Activity
sanketpatil06 commentedon Apr 29, 2026
Hi @gorgonline , Thanks for reporting this.
We have tested this out on
ADK 2.0.0b1and can confirm that passing aWorkflowdirectly intoto_a2a()currently throws an error. Regarding the workaround of wrapping theWorkflowinside anLlmAgent'ssub_agents, it appears this triggers a strict PydanticValidationErrorin standard environments.Workaround:
the safest workaround if you need A2A right now is to serve the LlmAgent directly rather than placing it in a single-step workflow.
haranrk commentedon Apr 30, 2026
Hey @gorgonline! We don't support converting Workflows to a2a apps just yet, but we're working on it. In the meantime, the workaround you and @sanketpatil06 suggested is the best way to go!
gorgonline commentedon May 19, 2026
Hi — just a heads-up that this still reproduces on the GA release
google-adk==2.0.0.I checked the v2.0.0 sources:
agent_card_builder.py @ v2.0.0:AgentCardBuilder.__init__(*, agent: BaseAgent, ...)— still typed toBaseAgent, noWorkflowbranch.agent_to_a2a.py @ v2.0.0:def to_a2a(agent: BaseAgent, ...)— same signature, noWorkflowsupport.PR #5710 was closed without merging and I don't see a replacement in v2.0.0. Both original bugs still occur (
AgentCardBuilderfails on missingsub_agents; Workflow events never reach the A2A client).The
LlmAgent-wrapper workaround from the original report still works on 2.0.0, so this isn't blocking us — flagging in caseto_a2a(Workflow)is intended to be supported at GA.Thanks!
fix(a2a): Support to_a2a(Workflow) and reject non-agent root nodes
fix(a2a): Support to_a2a(Workflow) and reject non-agent root nodes