# What happens when an instance accepts an A2A task whose Agent Card `capabilities.streaming` flag disagrees with the transport actually negotiated at the task endpoint **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 task delegation where the caller discovers the remote via `/.well-known/agent.json` (Agent Card) and then negotiates a task over a transport that may differ from the one the Card advertises. Does not cover intra-process tool calls, MCP tool invocation, or A2A deployments where the Card and task endpoint are served by the same immutable process image. ## Core Distinction The Agent Card is a *declaration* of capability signed at discovery time; the task lifecycle negotiation is an *execution-time contract* established per-task over a concrete transport binding. In A2A v1.0 these two artifacts are decoupled: the Card is fetched from a well-known URI and cached, while the task is created via `tasks/send` or `tasks/sendSubscribe` against a `url` field the Card itself supplies. The failure mode is not "the Card is wrong." It is that the Card's `capabilities.streaming` boolean and the transport the caller actually opens can diverge, and the protocol does not require the server to reject a `tasks/sendSubscribe` call on a Card that advertised `streaming: false` — nor to honor a subscription on a Card that advertised `streaming: true` but is now fronted by a non-streaming edge. The invariant that must hold: **for any accepted task, the negotiated transport's delivery semantics must be a superset of the semantics the caller will rely on to observe terminal state.** When the Card's `streaming` flag is used as the sole basis for choosing `tasks/sendSubscribe`, and the endpoint silently downgrades to a single blocking `Task` response (or vice versa), the caller enters a state where it holds a `taskId` with no event stream and no terminal `TaskStatusUpdateEvent` — a task that is *created but unobservable*. ## What Was Observed A caller agent fetched an Agent Card from a peer at `https://peer.example/.well-known/agent.json`: ``` { "name": "invoice-reconciler", "url": "https://peer.example/a2a", "capabilities": { "streaming": true, "pushNotifications": false }, "skills": [{ "id": "reconcile", "inputModes": ["application/json"] }] } ``` The caller cached the Card for the duration of its run (a common optimization — Cards are treated as near-static). It then issued `tasks/sendSubscribe` with `Accept: text/event-stream` against the advertised `url`. The peer's edge (a load balancer fronting a pool that had been rolled to a build where streaming was disabled) responded `200 OK` with `Content-Type: application/json` and a body containing a `Task` object in state `submitted`: ``` { "id": "task-8f2c...", "status": { "state": "submitted" }, "kind": "task" } ``` No SSE stream was opened. The caller's SSE parser saw `Content-Type: application/json`, treated the response as a non-streaming acknowledgment, recorded `taskId`, and entered its wait loop. It then polled `tasks/get` — which the pool also did not implement for this build, returning `404`. The caller had a `taskId`, no stream, no poll endpoint, and no terminal event. It retried `tasks/sendSubscribe` with the same `id` (idempotency key), got the same JSON ack, and looped until its token budget expired. The task on the peer side had, in fact, completed successfully; the caller never learned the result. The non-obvious part: **the failure was not a connection error, a timeout, or a 5xx.** Every HTTP response was `200`. The caller's transport layer reported success. The divergence was purely in the *semantic layer* — the Card promised a delivery channel the endpoint did not provide, and the protocol's ack shape was indistinguishable from a legitimate non-streaming task creation. ## Condition of Validity The failure requires all of the following to co-occur: 1. The Card's `capabilities.streaming` is `true` at discovery time. 2. The caller selects `tasks/sendSubscribe` *solely* on that flag, without a pre-flight capability probe. 3. The endpoint accepts the request (does not return `4xx` for unsupported method) and returns a `Task` body rather than an SSE stream — i.e., it degrades gracefully at the HTTP layer while violating the method contract at the A2A layer. 4. The caller's response handler branches on `Content-Type` and treats `application/json` as a valid non-streaming ack, rather than as a protocol violation. 5. The endpoint does not implement `tasks/get` (or implements it under a different path), so the caller cannot recover by polling. If (3) fails — the endpoint returns `405 Method Not Allowed` or `406 Not Acceptable` — the caller gets a clean signal and can fall back. If (4) fails — the caller requires `text/event-stream` and raises on mismatch — the failure is loud. The dangerous case is precisely the *polite* degradation: a `200` with the wrong body shape. This is common in serverless edges and API gateways that normalize responses and strip `Content-Type`-based method dispatch. ## Decision Boundary The boundary the caller must enforce is between *Card-advertised capability* and *negotiated transport semantics*. These are two different facts and must be tracked as two different state variables. The rule: - **Card capability** is a prior. It may be used to *rank* candidate transports, never to *commit* to one. - **Negotiated transport** is established only by the first response's `Content-Type` and status, and by an explicit `Task` state that is either terminal or accompanied by a live stream handle. - A `tasks/sendSubscribe` response with `Content-Type: application/json` and a non-terminal `Task` state is **not** a successful subscription. It is a protocol violation and must be treated as such — the task is orphaned unless the caller can poll. The correct guardrail is a *capability probe at negotiation time*: after the first response, the caller inspects `Content-Type`. If it is not `text/event-stream` and the returned `Task.status.state` is not terminal, the caller must either (a) immediately issue `tasks/get` to confirm pollability, or (b) abort the task and re-route. The Card's `streaming: true` must never be the last word. A second boundary: **idempotent retry of `tasks/sendSubscribe` is not safe when the first call created a task.** The `id` field is an idempotency key for task *creation*, not for subscription *establishment*. Retrying with the same `id` returns the same `Task` ack and does not open a stream — the caller can loop indefinitely. The retry budget must be bounded by a check on whether the *transport* changed, not whether the *request* succeeded. ## Operational Effect The downstream effects are concrete and asymmetric: - **Orphaned tasks accumulate on the peer.** Each retry with a fresh `id` creates a new task; each retry with the same `id` does not. A caller that varies the idempotency key on retry (e.g., to "force" a new attempt) will spawn duplicate tasks on the peer, each of which completes and writes results the caller never reads. This is a silent cost and a silent correctness hazard if the task has side effects (payments, emails, ledger writes). - **The caller's token budget is consumed on retry loops** that cannot succeed, because the failure is not transient. Backoff does not help; the endpoint's behavior is deterministic. - **The caller's own state machine records the task as "in progress"** indefinitely, which poisons any downstream aggregation that waits on it. A supervisor agent waiting on the caller will itself stall. - **No error is surfaced to the user**, because every layer reported `200`. The failure is only visible as a latency and cost anomaly, not as an exception. The architectural invariant to restore: **a task is not "accepted" until the caller holds either a live event stream or a confirmed-pollable `taskId` with a terminal-or-pollable state.** Task creation alone is not acceptance. The Card is a hint; the negotiated transport is the contract; and the contract must be verified on the first response, not assumed from discovery. ```python from __future__ import annotations import json from dataclasses import dataclass from enum import Enum from typing import Any class TransportNegotiationError(RuntimeError): """Raised when the negotiated transport contradicts the Agent Card's advertised capability.""" class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" COMPLETED = "completed" FAILED = "failed" @dataclass(frozen=True) class AgentCard: url: str streaming: bool push_notifications: bool @dataclass(frozen=True) class FirstResponse: status_code: int content_type: str body: dict[str, Any] def negotiate_subscription(card: AgentCard, response: FirstResponse) -> str: """ Validate that a tasks/sendSubscribe response actually established a stream or a pollable task. Returns a handle token on success. The Card's streaming flag is a prior, not a commitment. The first response is the contract. """ if response.status_code != 200: raise TransportNegotiationError( f"subscription rejected with status {response.status_code}; " f"card advertised streaming={card.streaming}" ) task = response.body.get("task") or response.body state = TaskState(task.get("status", {}).get("state", "submitted")) task_id = task.get("id") if not task_id: raise TransportNegotiationError("response contained no task id") is_stream = response.content_type.split(";")[0].strip() == "text/event-stream" if is_stream: # Live stream handle: caller can observe terminal state. return f"stream:{task_id}" # Non-streaming response. This is only acceptable if the card did NOT # advertise streaming, OR the task is already terminal. if card.streaming and state not in (TaskState.COMPLETED, TaskState.FAILED): raise TransportNegotiationError( f"card advertised streaming=true but endpoint returned " f"content-type={response.content_type!r} with non-terminal state={state.value!r}; " f"task {task_id} is orphaned (no stream, no terminal event)" ) if state in (TaskState.COMPLETED, TaskState.FAILED): return f"terminal:{task_id}" # Non-streaming, non-terminal: caller MUST be able to poll. # We cannot verify pollability here; return a poll handle that the # caller must confirm with tasks/get before committing. return f"poll-unverified:{task_id}" def create_task(card: AgentCard, response: FirstResponse) -> str: try: return negotiate_subscription(card, response) except TransportNegotiationError: # Do NOT retry with a new idempotency key: that orphans a task on the peer. # Re-route to a transport consistent with the observed response, or abort. raise # Example trigger: card says streaming, endpoint returns JSON ack for a non-terminal task. card = AgentCard(url="https://peer.example/a2a", streaming=True, push_notifications=False) bad_response = FirstResponse( status_code=200, content_type="application/json", body={"id": "task-8f2c", "status": {"state": "submitted"}, "kind": "task"}, ) create_task(card, bad_response) # raises TransportNegotiationError ```