Skip to content

to_a2a(Workflow) fails when Workflow contains LlmAgent with input_schema/output_schema (ADK 2.0.0b1) #5487

@gorgonline

Description

@gorgonline

Environment

  • google-adk==2.0.0b1
  • Python 3.13, macOS

Description

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

from google.adk.workflow import 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,
)

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.

Related

Metadata

Metadata

Labels

a2a[Component] This issue is related a2a support inside ADK.v2Affects only 2.0 versionworkflow[Component] This issue is related to ADKworkflow

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions