Skip to content

fix(client): send A2A-Version from the JSON-RPC and REST transports - #1508

Open
saquibjawedbit wants to merge 1 commit into
a2aproject:mainfrom
saquibjawedbit:fix/client-version-header
Open

saquibjawedbit wants to merge 1 commit into
a2aproject:mainfrom
saquibjawedbit:fix/client-version-header

Conversation

@saquibjawedbit

Copy link
Copy Markdown
Contributor

Description

The spec says "Clients MUST send the A2A-Version header with each request" (§3.6.1), and a missing value means 0.3 (§3.6.2). The gRPC transport and the v0.3 transports add it to every call, but the v1.0 JsonRpcTransport and RestTransport never did: they only sent it when ClientFactory had already put it on the httpx client. Built directly with your own httpx.AsyncClient (both classes are public exports), every request was read as 0.3 by a v1.0 server and rejected with VersionNotSupportedError. The integration tests worked around this by adding the header to the hand-built httpx clients.

Fix: a small helper in http_helpers.py adds A2A-Version to each request built by the two transports (unary, streaming, extended card). Precedence matches ClientFactory's setdefault: a value in the call's service parameters wins, then one on the httpx client, then ours. The integration-test workaround is removed, so those tests now cover this end to end.

Testing

New tests per transport: the header is sent on unary and streaming calls, and a caller-supplied a2a-version: 0.3 service param is kept; plus a JSON-RPC extended-card test.

Before the fix (main's source, new tests + integration tests without the workaround):

7 failed, 24 passed

Repro with a real v1.0 server and a hand-built httpx client:

before: FAILED VersionNotSupportedError  (JSON-RPC and REST)
after:  OK t1

Full suite, rebased on main (06cd528):

$ pytest tests --ignore=tests/integration/cross_version
2679 passed, 215 skipped, 4 xfailed, 1 xpassed

ruff check and ruff format pass.

Fixes #1507 🦕

The spec requires clients to send A2A-Version with each request. The gRPC
transport adds it to every call, but the JSON-RPC and REST transports
relied on ClientFactory setting it on the httpx client. A transport built
with any other httpx client sent no version, so a v1.0 server read the
request as 0.3 and answered VersionNotSupportedError.

Add the header per request unless the call's service parameters or the
httpx client already set one.
@saquibjawedbit
saquibjawedbit requested a review from a team as a code owner November 20, 2026 15:32
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/client/transports/http_helpers.py 93.51% 93.83% 🟢 +0.32%
src/a2a/server/agent_execution/active_task_registry.py 100.00% 97.80% 🔴 -2.20%
Total 94.11% 94.09% 🔴 -0.01%

Generated by coverage-comment.yml

This branch has not been deployed

No deployments
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.

[Bug]: JSON-RPC and REST client transports don't send A2A-Version, so a v1.0 server rejects them as 0.3

1 participant