Skip to content

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

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

Activity

  1. added theissue type on Apr 25, 2026
  2. added
    workflow[Component] This issue is related to ADKworkflow
    on Apr 25, 2026
  3. sanketpatil06 commented on Apr 29, 2026

    @sanketpatil06

    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
    
  4. changed the issue type fromtoon Apr 30, 2026
  5. haranrk commented on Apr 30, 2026

    @haranrk
    Collaborator

    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!

  6. added
    a2a[Component] This issue is related a2a support inside ADK.
    on Apr 30, 2026
  7. gorgonline commented on May 19, 2026

    @gorgonline
    Author

    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:

    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.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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