Repository navigation
Description
Context & Rationale
The A2A adapter is experimental and serves the Agent Card and SendMessage. A2A 1.0.1 §3.1 lists GetTask, ListTasks and CancelTask among the operations every agent implements, with no capability flag to decline them, and the TCK tests them at MUST level. In 2.8.0 GetTask and CancelTask answer TaskNotFoundError and ListTasks answers UnsupportedOperationError.
SendMessage has two more gaps:
- It drops
tenantandconfigurationunchecked, although §3.3.2 says servers MUST validate all input parameters. - It ignores
returnImmediately, although §3.2.2 says the operation MUST return immediately when it is set.
A2A 1.x is the only pinned protocol declared stable by its upstream. Closing these gaps allows core A2A to become supported.
Each checkbox tracks a separate PR; check it when the PR lands.
Proposed Changes
- Serve
GetTaskandListTasksfrom stored tasks- The receipt store gains three optional, experimental methods for task records, kept in a new schema v6 table. A store without them keeps tasks in process memory under the same limits.
- A record is the task as last answered. Only the pending-task methods make a task payable.
- Every task the adapter answers is kept:
- for
protocols.a2a.tasks.retentionHours(default 24, 1 to 8760) - up to
protocols.a2a.tasks.maxRetainedrecords (default 1000)
- for
- A full store refuses new records and never evicts old ones. Eviction would let a flood of free calls push out a paid result before its buyer reads it.
- An input-required or immediate-return task needs its record before the adapter acts. If the record does not fit, the request fails with
GATEWAY_BUSYbefore anything executes. - A finished task from a blocking call is returned but not kept.
- An input-required or immediate-return task needs its record before the adapter acts. If the record does not fit, the request fails with
- What a record holds:
- It holds the merchant response and the x402 receipts.
- It never holds the request input, a payment proof or an AP2 presentation.
- Its size is bounded by the backend executor's 1 MiB response cap, as for stored responses.
- The docs carry a personal-data note.
ListTasks:- It pages with an opaque cursor in
pageToken. - It sorts by status timestamp, newest first.
- It omits
artifactsunlessincludeArtifactsis set. - It filters by
statusandstatusTimestampAfter. - Its response always carries
tasks,nextPageToken(an empty string on the last page),pageSizeandtotalSize. - An empty page conflicts with the §5.7 rule that a required array holds an element. The support record lists the conflict.
- It pages with an opaque cursor in
- Task
historyis not kept, because the user's message can carry payment proofs.historyLengthis validated, but there is nothing for it to cap. - After the v6 migration, rolling back to 2.8.x needs the backup taken before the upgrade.
- The receipt store gains three optional, experimental methods for task records, kept in a new schema v6 table. A store without them keeps tasks in process memory under the same limits.
- Cancel a task that is waiting for payment
CancelTaskcancels an x402 extension task ininput-required.- The atomic take of the pending task decides between a cancel and a payment, and only one of them can take it.
TaskNotCancelableError(-32002), which the adapter's error table gains, answers in these cases:- a payment message has already taken the task
- the task is running
- the task is finished
- Canceling a canceled task returns it again, because §3.3.1 makes cancel idempotent.
- Answer
SendMessagefor a known task as the spec requires- A message naming a finished or running task gets
UnsupportedOperationError(§3.1.1), notTaskNotFoundError. - A message naming a task without a
contextIdtakes the task's context. A mismatched pair getsInvalidParams(§3.4.3). - An unknown task id keeps
TaskNotFoundError(§3.4.2). - A payment message that loses the take to a competing message now gets
UnsupportedOperationErrorinstead ofTaskNotFoundError.
- A message naming a finished or running task gets
- Honor
returnImmediately- With
returnImmediately: true:- The adapter stores a
TASK_STATE_WORKINGtask. - It answers with that task.
- It finishes the purchase in the background, and
GetTaskreturns the result.
- The adapter stores a
- Background work would escape the mount's limit of 20 concurrent requests. The adapter therefore applies its own limit of 20 background runs. Past it, the request gets a failed
GATEWAY_BUSYtask before anything executes. - Shutdown waits for running work.
- A task still marked working by a gateway that has since restarted is reported as failed. Its message tells the buyer not to pay again before checking with the merchant.
- With
- Validate the remaining parameters
-
Every method checks its parameters before any store read or execution:
Parameter Answer A non-empty tenantUnsupportedOperationErrortaskPushNotificationConfigPushNotificationNotSupportedErroracceptedOutputModeswithoutapplication/jsonContentTypeNotSupportedErrorpageSizeoutside 1 to 100InvalidParamsA negative historyLengthInvalidParamsAn unknown status InvalidParamsA bad page token or timestamp InvalidParams -
A proto3 string field at its default value, such as
contextId: "", counts as absent.
-
- Accept proto field names such as
context_id- ProtoJSON parsers accept them. The TCK sends them for
GetTask,ListTasksand push parameters. - Every method renames snake_case keys to camelCase before dispatch, except inside
dataandmetadata. Those hold the merchant's input and the x402 extension's keys. - A key sent in both forms gets
InvalidParams. - A client that relied on
context_idbeing ignored now gets the same refusal ascontextId. The changelog notes the change.
- ProtoJSON parsers accept them. The TCK sends them for
- Scope task access to the caller
- §13.1 says results MUST be scoped to the caller's authorization boundary. The adapter has no A2A authentication. The task id the gateway issues therefore serves as the access key:
- Holding the task id authorizes
GetTaskandCancelTask. Unknown ids getTaskNotFoundError. ListTasksreturns tasks only for the suppliedcontextId. A missing or unknown one gets an empty page.- Each
SendMessageopens a new context, which limits the page to one task.
- Holding the task id authorizes
- Task and context ids:
- They come from
randomUUID()directly, bypassing the injectable id generator. - They are never logged. Logs carry the request id instead.
- They come from
SendMessagecontinues to refuse a client-chosencontextId, as §3.4.1 allows.docs/protocols/a2a.mddocuments this model.
- §13.1 says results MUST be scoped to the caller's authorization boundary. The adapter has no A2A authentication. The task id the gateway issues therefore serves as the access key:
- Warn on a public
http:base URL- §7.1 says production deployments MUST use encrypted communication.
- The Agent Card advertises
merchant.publicBaseUrl.doctorwarns when that URL ishttp:and its host is not loopback.
- Accept
X-A2A-Extensionsas an alias ofA2A-Extensions- A2A 1.x registers only
A2A-Extensions. The x402 A2A transport and the a2a-x402 library send theX-form instead. - a2a-x402 v0.1, its only release, requires the server to echo the URI.
- Accept either header, and echo both.
- A2A 1.x registers only
- Run the TCK at MUST level as its own CI job
- Run
run_tck.py --transport jsonrpc --level mustfroma2aproject/a2a-tck@5e6f37c2:- That commit is the first revision that checks A2A 1.0.1. The latest tag,
1.0.0.alpha3, checks 1.0.0. - It needs Python 3.15 or later.
- That commit is the first revision that checks A2A 1.0.1. The latest tag,
- It runs against a local gateway whose
merchant.publicBaseUrlpoints at itself, because the TCK calls the URL in the Agent Card. - Installing it needs PyPI, which keeps it outside
npm testandnpm run verify. At run time it contacts only the gateway. - Every MUST test that runs passes. The support record lists every other result with its reason.
- The job compares the TCK's JUnit output with that list. Any of these fails the job:
- an unlisted failure or skip
- a listed test that passes
- a listed test that does not run
- Every TCK test that creates a task sends a text part. The adapter refuses text parts, because its Agent Card declares only
application/json.- Tests that send a text part fail: CORE-SEND-001, CORE-EXECUTION-MODE-001/002, CORE-MULTI-001a, CORE-MULTI-003, DM-*.
- Tests that need an existing task skip: CORE-GET-001, CORE-CANCEL-001/002, CORE-SEND-002, CORE-MULTI-005/006, CORE-HIST-*.
- Our own tests cover what those tests would check.
- CORE-MULTI-002a also expects an unknown client
contextIdto be accepted, which contradicts its own title and §3.4.1. - Report two problems upstream:
- the CORE-MULTI-002a runner bug
- task helpers that ignore the Agent Card's input modes
- Run
- Promote core A2A to supported
- These become supported in the README, the docs, the descriptor and the support record:
- the Agent Card
- the JSON-RPC binding
SendMessageandreturnImmediately- the three task operations
- The support-record drift test gains a promotion gate. A profile promoted under the criteria needs a stable upstream revision, no open gap, conformance evidence and docs.
- These become supported in the README, the docs, the descriptor and the support record:
Non-goals / Invariants Preserved
- Streaming, push notifications, the extended card, multi-turn continuation and the REST and gRPC bindings stay unsupported, as the Agent Card's capability flags allow.
- A2A 1.1 is not served. On 2026-11-22 upstream had a
v1.1.0-rctag and no release.- Serving 1.1 beside 1.0 waits for the release.
- It adds MUSTs for
generation, forifGenerationMatch(TaskGenerationMismatchError, -32010), and forSendLiveMessageanduserArtifacts.
- No A2A authentication scheme. It can come later as an opt-in, and it would allow listing across contexts.
- No mapping from text parts to resource input.
- A running task cannot be canceled.
reconcileand a manual resolve do not update task records.- The x402 extension stays experimental and optional on the Agent Card. a2a-x402's only release is v0.1, and neither it nor the v0.2 draft targets A2A 1.x.
- A pending task still settles at most once.
- Task operations never verify, settle or call a backend.
Impact & Value
Done when:
- every applicable A2A 1.0.1 MUST is implemented or explicitly excluded,
- the TCK job's results match the support record,
- and the evidence supports listing core A2A as supported.
Test plan (across the list)
Proto field names:
context_idis refused likecontextId, both in the params and in the message.- A payment with
task_idandmessage_idresumes its task. - A field sent in both forms is refused.
- Snake_case keys inside
data.inputandmetadatareach the backend and the extension unchanged. contextId: ""reads as absent.
Task operations:
- The TCK's snake_case
ListTasksparameters work. ListTaskspaging and filters work, and an empty page carriesnextPageToken: ""andtotalSize: 0.- A cancel races a payment on SQLite and in memory. Exactly one succeeds, and a canceled task never settles.
- A finished task can be read after a restart and is gone after its retention window.
- A guessed task id gets
TaskNotFoundError, even with a predictable id generator. - A full store refuses an input-required task and holds nothing.
- No stored record contains
_payment, a proof or a presentation.
returnImmediately:
- The working task arrives before a slow backend returns.
- The 21st concurrent background run is refused, and nothing executes.
- Shutdown waits for running work.
- A task interrupted by a restart reads as failed, and a replayed proof settles nothing.
Other:
- Both extension headers activate the extension.
- A v5 database migrates to v6.
Activity