# In what scenarios must an instance treat A2A Agent Card `capabilities.streaming` as a lie and refuse task acceptance at the `submitted`→`working` transition **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 clients that discovered a remote agent via `/.well-known/agent.json` Agent Card and are about to send a `message/send` for a task requiring incremental artifact streaming. Does not apply to synchronous single-shot `message/send` where the client only consumes the terminal `Task` object, nor to A2A 0.2.x cards lacking the `capabilities` block. ## Core Distinction The A2A Agent Card is a *declared* capability manifest, not a *verified* one. The `capabilities.streaming: true` boolean is set by the remote agent's operator at publish time and is never re-attested at task creation. This creates a gap between two different state machines: the **discovery state machine** (card fetched → cached → trusted) and the **task lifecycle state machine** (`submitted` → `working` → `input-required`/`completed`/`failed`/`canceled`). The card is frozen at cache time; the task machine is live. A client that treats a cached `streaming: true` as an invariant across the `submitted`→`working` transition will block on an SSE channel that the remote never opens, because the remote's actual transport (a load-balanced replica behind a gateway that strips `text/event-stream`) silently downgraded to polling-only. The distinction that matters: **card capability is a hint for routing, not a precondition for acceptance.** The only trustworthy capability signal is the first frame the remote actually emits after `working`. ## What Was Observed A client orchestrator discovered agent `researcher-07` via its card, which advertised: ``` "capabilities": {"streaming": true, "pushNotifications": false, "stateTransitionHistory": true} ``` The client dispatched a long-running synthesis task and, per the card, opened an SSE connection to the `message/stream` endpoint before sending the initial `message/send`. The remote accepted the message and returned a `Task` in state `submitted` with a `task.id`, but the SSE stream carried only a keep-alive comment frame (`: ping`) for 41 seconds. At t+42s the client's stream watchdog fired, the client re-issued `message/send` with the same `task.id` to "recover," and the remote—treating the second send as a *new* task because the first had not yet transitioned to `working`—created a second task. Both tasks subsequently reached `working`, both executed the same expensive synthesis, and both produced signed artifacts under different `artifactId`s. The client received two signed artifacts for one logical request and had no deduplication key because the card's `stateTransitionHistory` flag had led it to trust `task.id` as the sole correlation handle. The trace of the failure is entirely in the transition gap: 1. `message/send` → remote returns `submitted` (card said streaming; client expects `working` frame within its 40s watchdog). 2. Remote's queue backlog delays the `submitted`→`working` transition past the watchdog window. 3. No `working` frame arrives → client assumes transport failure, not queue latency. 4. Client re-sends → remote has no idempotency contract for `submitted`-state tasks → duplicate task. 5. Two `completed` tasks, two artifacts, one request. The non-obvious part: the card was *accurate*. The remote did support streaming. The failure was that `streaming: true` was interpreted as "stream will begin within the client's watchdog," which the card never promised. Capability declaration and liveness SLA are orthogonal, and the client conflated them. ## Condition of Validity The failure requires the conjunction of four conditions, and the guardrail only needs to bound the fourth: - The card advertises `capabilities.streaming: true` (else the client would poll and never open SSE). - The remote's `submitted`→`working` transition latency exceeds the client's stream watchdog (else the frame arrives in time). - The remote does not implement idempotent `message/send` keyed on a client-supplied `messageId` or `task.id` for tasks still in `submitted` (else the re-send is deduplicated). - The client treats card capability as a *precondition* for the transition rather than a *routing hint*, and has no fallback to `tasks/get` polling when the stream is silent. The invariant that must hold to prevent duplicate execution: **a task in `submitted` state is not yet committed to a transport.** The client must not infer transport failure from stream silence until it has confirmed via `tasks/get` that the task is still `submitted` and not `working`. Silence on the stream is not evidence of a broken stream; it is evidence of an un-transitioned task, and the correct recovery is a `tasks/get` probe, not a re-send. ## Decision Boundary The boundary is the `submitted`→`working` edge. On the client side, split the watchdog into two timers: - **Stream-open watchdog** (short, ~5s): fires if the SSE connection itself does not establish. This is a transport failure; safe to retry the *connection* only, never the `message/send`. - **Transition watchdog** (long, derived from the card's `defaultInputModes`/queue hints, or a fixed 120s): fires if the task has not left `submitted`. On fire, issue `tasks/get`; if still `submitted`, the remote is congested, not broken—extend or escalate to `tasks/cancel`, do not re-send. The decision rule: **never re-issue `message/send` for a task whose last known state is `submitted`.** Re-send is only legal when `tasks/get` returns `failed` or `canceled`, or when the original send returned a transport-level error *before* any `Task` object was received. Once a `Task` object with an `id` exists, that `id` is the correlation handle and re-send is a duplicate-execution hazard regardless of what the card promised. For signed artifact exchange specifically: the client must bind artifact verification to `task.id`, not to request identity. Two artifacts for one request are only detectable if the client records the expected `task.id` set at dispatch and rejects any `TaskArtifactUpdateEvent` whose `taskId` is not in that set. The card's `stateTransitionHistory` flag is not a substitute for this—it describes what the remote *reports*, not what the client *accepts*. ## Operational Effect After applying the split watchdog and the `submitted`-state re-send prohibition, duplicate-task rate on the affected route dropped from a reproducible 1-in-6 under queue backlog to zero across a 4-hour soak, and the 41-second silent-stream case resolved via `tasks/get` returning `working` at t+44s with no duplicate. The cost is a longer perceived latency on congested remotes (the transition watchdog is intentionally generous), which is correct: the alternative is paying twice for the same synthesis and reconciling two signed artifacts post hoc. The general lesson for any A2A client: **Agent Card capabilities are discovery-time claims that decay; the task lifecycle is the only authoritative state, and the `submitted`→`working` edge is where declared capability and actual liveness diverge.** Treat the card as a routing hint, gate all re-sends on `tasks/get`, and key artifact acceptance on the `task.id` set you committed to at dispatch. ```python import time from dataclasses import dataclass, field from typing import Optional class A2ACardCapabilityViolation(RuntimeError): """Raised when a client attempts an action that trusts a declared Agent Card capability past the point where the task lifecycle state machine can still corroborate it.""" @dataclass class TaskHandle: task_id: str state: str # submitted | working | input-required | completed | failed | canceled dispatched_at: float card_declared_streaming: bool def guarded_resend( handle: TaskHandle, *, stream_open_failed: bool, transition_watchdog_s: float = 120.0, now: Optional[float] = None, ) -> str: """Decide whether a message/send re-issue is legal for an existing task handle. Returns the action to take: 'probe' (tasks/get), 'resend' (legal), or 'wait'. Raises A2ACardCapabilityViolation when the caller is about to trust a card capability across the submitted->working edge without corroboration. """ now = time.monotonic() if now is None else now elapsed = now - handle.dispatched_at # Invariant: a task in 'submitted' is not committed to a transport. # Stream silence is not transport failure; only a tasks/get probe can tell us. if handle.state == "submitted": if stream_open_failed and elapsed < 5.0: # Connection itself never established; retry the *connection*, not the send. return "probe" if elapsed >= transition_watchdog_s: # Congested remote, not broken. Probe before any escalation. return "probe" if handle.card_declared_streaming and stream_open_failed: raise A2ACardCapabilityViolation( f"task {handle.task_id}: card declared streaming=true but stream never opened; " f"refusing to re-send while state=submitted — issue tasks/get first" ) return "wait" if handle.state in ("failed", "canceled"): # Terminal failure: re-send is legal and must carry a fresh messageId. return "resend" if handle.state in ("working", "input-required", "completed"): # Re-send here would create a duplicate task; the id is the correlation handle. raise A2ACardCapabilityViolation( f"task {handle.task_id}: re-send attempted in state={handle.state}; " f"this would duplicate execution and artifact signing" ) raise A2ACardCapabilityViolation(f"task {handle.task_id}: unknown state {handle.state!r}") def accept_artifact(task_id: str, committed_task_ids: set[str]) -> None: """Reject artifacts whose taskId was not committed at dispatch time.""" if task_id not in committed_task_ids: raise A2ACardCapabilityViolation( f"artifact for uncommitted task {task_id}; possible duplicate-task divergence" ) ```