Skip to content

fix(a2a): warn when output_key cannot reach remote session - #6862

Open
iarjunganesh wants to merge 2 commits into
google:mainfrom
iarjunganesh:fix/a2a-output-key-handoff
Open

fix(a2a): warn when output_key cannot reach remote session#6862
iarjunganesh wants to merge 2 commits into
google:mainfrom
iarjunganesh:fix/a2a-output-key-handoff

Conversation

@iarjunganesh

Copy link
Copy Markdown

Link to Issue or Description of Change

Problem:

When an LlmAgent with output_key immediately precedes a
RemoteA2aAgent in a SequentialAgent, the generated content crosses A2A but
the associated session-state key does not. Because the event also has content,
the state-only outbound warning proposed in #6859 does not cover this hand-off.

Solution:

Warn at SequentialAgent construction for that specific adjacent ordering.
The check detects an already-loaded RemoteA2aAgent without importing it, so
ordinary SequentialAgent users do not acquire a dependency on the optional
A2A SDK.

Testing Plan

Unit Tests:

  • Added positive coverage for LlmAgent(output_key) immediately followed
    by RemoteA2aAgent.
  • Added negative coverage for reversed ordering, a remote hand-off without
    output_key, and an entirely local hand-off.
  • pytest tests/unittests/agents/test_sequential_agent.py -q
    (10 passed on Python 3.12).
  • Strict mypy passed for sequential_agent.py.
  • pyink, isort, ruff, ADK compliance checks, and codespell passed
    for both changed files.
  • Verified in an isolated Python 3.12 environment without a2a-sdk that
    importing and constructing a local SequentialAgent still works.

Manual End-to-End (E2E) Tests:

Not run. This change is a deterministic construction-time warning and does not
alter execution or transport behavior.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented the optional-dependency-sensitive code.
  • I have added tests that prove the warning and no-warning paths.
  • New and existing tests in the affected unit pass locally.
  • I have manually tested the change end-to-end.
  • This change has no downstream dependencies.

Additional context

This is intentionally separate from #6859: that PR covers state-only outbound
events and state deltas received from a remote peer. This PR covers a
caller-side output_key event that also contains content, so it is neither a
duplicate nor dependent on #6859.

A SequentialAgent can hand an LlmAgent output to a RemoteA2aAgent while the
associated output_key remains only in the caller session. Warn for that
adjacent hand-off without loading the optional A2A dependency.

Related to google#6854
@google-cla

google-cla Bot commented Aug 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants