🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

feat(rest): serve HTTP+JSON responses as application/a2a+json - #1274

Merged
JakubWorek merged 3 commits into
jakubworek/acts-unknown-fieldsfrom
jakubworek/acts-rest-content-type
Sep 29, 2026
Merged

JakubWorek merged 3 commits into
jakubworek/acts-unknown-fieldsfrom
jakubworek/acts-rest-content-type

Conversation

@JakubWorek

@JakubWorek JakubWorek commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What

Spec 11.1: "Content-Type: application/a2a+json SHOULD be used for requests and responses". The spec uses it in every worked HTTP+JSON example - 20-plus of them.

Every REST response inherited Starlette's JSONResponse.media_type default of application/json. application/a2a+json appeared nowhere in the repo, so the constant is new.

Worth knowing: nobody implements this

All four SDKs with published ACTS metrics - python, go, java, rust - fail REST-CT-001. It is a SHOULD, so it blocks no one's conformance, and a reasonable response to this PR is "not yet, let the others move first". Merging it makes a2a-python the first. Flagging it rather than burying it, since the other six PRs in this stack all had at least one SDK already passing to corroborate them.

Two limits, both deliberate

Success responses only. The error path runs through rest_error_handler, which compat/v0_3/rest_adapter.py shares. 11.1 is the 1.0 binding's requirement, and v0.3 predates the media type, so changing that decorator would alter a different protocol version's wire format. Splitting it would mean making a bare decorator parameterized and touching every call site in both bindings - not worth it for a SHOULD the corpus does not test on the error path. The result is that 1.0 errors still answer application/json; worth a follow-up, not worth bundling here.

Responses only, not requests. 11.1 says both, but changing what the client sends risks servers that only accept application/json, and no test covers it.

No JSONResponse subclass. It would have reduced nine sites to an import swap, but rest_dispatcher.py aliases JSONResponse = Any when Starlette is absent, and class X(Any) is a TypeError on Python 3.10, which this package supports. Passing media_type= explicitly keeps the no-Starlette path importable and the sites greppable.

Result

Clears REST-CT-001 (should, rest only). With it, all three bindings are at zero failures at every level:

binding passed must failed
jsonrpc 101/111 59/59 0
grpc 88/111 47/47 0
rest 92/111 49/49 0

The remainder are skips whose preconditions the fixture does not meet, not failures.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🧪 Code Coverage (vs jakubworek/acts-unknown-fields)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/routes/rest_dispatcher.py 94.25% 94.32% 🟢 +0.07%
Total 93.14% 93.14% ⚪️ 0.00%

Generated by coverage-comment.yml

@JakubWorek
JakubWorek added this pull request to stack #1275 September 23, 2026 12:55
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch 2 times, most recently from 1ef50e5 to ee0631f Compare September 23, 2026 13:18
@JakubWorek
JakubWorek marked this pull request as ready for review September 23, 2026 13:26
@JakubWorek
JakubWorek requested a review from a team as a code owner September 23, 2026 13:26
Comment thread src/a2a/server/routes/rest_dispatcher.py
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch from ee0631f to 8fd1348 Compare September 28, 2026 08:30
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch from 8fd1348 to 3c85e3d Compare September 28, 2026 08:47
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch from 3c85e3d to 14e2ee1 Compare September 28, 2026 08:54
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch from 14e2ee1 to 8b9f30d Compare September 28, 2026 09:07
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch 2 times, most recently from 41e054b to 144374d Compare September 28, 2026 09:35
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch from 144374d to 57fdb64 Compare September 28, 2026 09:45
Spec 11.1 asks the HTTP+JSON binding to use application/a2a+json; every
REST response inherited Starlette's application/json default.

Success responses only. The error path runs through rest_error_handler,
which the v0.3 compat binding shares, and that binding predates the
media type.
@JakubWorek
JakubWorek force-pushed the jakubworek/acts-rest-content-type branch from 91c0734 to 8641b2a Compare September 28, 2026 10:14
@JakubWorek
JakubWorek merged commit dc5a5da into main Sep 29, 2026
37 of 39 checks passed
@JakubWorek
JakubWorek deleted the jakubworek/acts-rest-content-type branch September 29, 2026 07:20
mykytanetipa pushed a commit that referenced this pull request Sep 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.2.0](v1.1.5...v1.2.0)
(2026-09-29)


### Features

* **rest:** serve HTTP+JSON responses as application/a2a+json
([#1274](#1274))
([dc5a5da](dc5a5da))
* **server:** add caching headers to the agent card endpoint
([#1272](#1272))
([83d7f5d](83d7f5d))
* **server:** add multi-replica cluster mode
([#1281](#1281))
([942d621](942d621))
* **server:** add opt-in validation of message media types against the
agent card
([#1269](#1269))
([8037b24](8037b24))


### Bug Fixes

* compare in-memory task timestamps numerically
([#1233](#1233))
([0d5473c](0d5473c))
* **server:** ignore unrecognized request fields and fix parse-error
data shape
([#1273](#1273))
([83f1cf8](83f1cf8))
* **server:** reject a message whose contextId disagrees with its task
([#1270](#1270))
([c25022f](c25022f))
* **server:** reject terminal-task operations with
UnsupportedOperationError
([#1268](#1268))
([6cce91b](6cce91b))
* **server:** send PushNotificationConfig.authentication as an
Authorization header
([#1271](#1271))
([5751d31](5751d31)),
closes [#585](#585)


### Documentation

* **samples:** add Agent Card signing sample
([#1198](#1198))
([f3ac824](f3ac824))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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