fix(a2a): default AgentCardBuilder capabilities to streaming=True - #6673
fix(a2a): default AgentCardBuilder capabilities to streaming=True#6673chelsealong wants to merge 1 commit into
Conversation
|
Closing this — @arunpshankar said on #6672 that they want to work on it, and the note I left there promised to drop mine if someone was already on it. If any of this diff is useful, take it freely. |
|
@chelsealong please reopen this. That was ambiguous wording on my part and I am sorry for the churn. The offer to send a PR was about #6778, the separate issue I filed at @surajksharma07's request. It was not a claim on this one. I am not working on this change and have no diff for it. This PR is the fix for #6672 and @surajksharma07 said on #6672 that it was moving toward merge as-is. #6778 is deliberately downstream of it: the dead Happy to re-confirm it on a clean install if that helps it move. |
|
Reopened — thank you for the correction, and no apology needed on your side; the mistake was mine. I read your note on #6672 as a claim on this change and closed on that basis. It wasn't ambiguous on your part: you were talking about #6778, and I did not check that the two were separate before acting. @surajksharma07's note that this was moving toward merge as-is was on the issue rather than here, which is exactly where I should have looked. The branch is behind main; I'll rebase it now so the checks run clean. Nothing else about the diff has changed. |
|
Branch updated with main (merge commit 29d7df4) via GitHub's update-branch endpoint — the a2a fix itself (agent_card_builder.py and its test) is unchanged, byte-for-byte identical before and after. Checks are running on the updated branch now. |
|
We need to add rate limiting to the auth middleware before this merges. |
|
@sharaprahersini could you clarify how the rate limiting relates to this change? This PR is +5/-1 across two files. It sets If rate limiting on the auth middleware is a gap you have hit, that seems worth If the concern is instead that defaulting |
to_a2a() always mounts a DefaultRequestHandler that implements message/stream, but AgentCardBuilder defaulted to AgentCapabilities() (streaming=False) whenever a caller didn't pass capabilities explicitly. Peers reading the served card were told streaming was unavailable and fell back to unary calls even though the server supported it. Fixes google#6672
29d7df4 to
2d54545
Compare
Fixes #6672
Problem
An agent published with
to_a2a()serves an agent card whosecapabilities.streamingisfalse, even though the handlerto_a2a()mounts (
DefaultRequestHandler) implementsmessage/stream. Peers thatread the card to decide how to call the agent are told streaming is
unavailable, so they fall back to unary calls and lose incremental output
for no reason.
Root cause:
AgentCardBuilder.__init__defaultedself._capabilitiestoAgentCapabilities()(which itself defaultsstreaming=False) whenever the caller didn't passcapabilitiesexplicitly, and
to_a2a()never passescapabilitiestoAgentCardBuilder. Since_compat.build_agent_card()uses the passedcapabilitiesobject directly (falling back to its ownstreamingdefault only when
capabilitiesisNone), the always-non-Nonedefault from
AgentCardBuildersilently pinned everyto_a2a()cardto
streaming: false, regardless of what the mounted handler actuallysupports.
Fix
AgentCardBuildernow defaults its capabilities toAgentCapabilities(streaming=True)instead ofAgentCapabilities().This is the minimal change that makes the default card reflect
what
to_a2a()actually serves. Callers who pass an explicitcapabilities=argument are unaffected.Testing plan
Added an assertion to the existing
test_init_with_valid_agenttest intests/unittests/a2a/utils/test_agent_card_builder.pyassertingbuilder._capabilities.streaming is Trueby default.Verified the test fails without the fix and passes with it:
Full
a2aunit test suite passes with the fix applied:isortandpyink(per this repo's pre-commit config) report bothchanged files as already formatted correctly.
AI-assistance disclosure
This change was prepared with the help of an AI coding agent
(Claude), including drafting the fix, tests, and this PR description.
The change was reviewed and verified locally before submission.