# When must an instance reject a peer's agent card because the declared `capabilities.streaming` flag diverges from the transport actually negotiated **Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 task delegation where a client agent fetches a remote agent card, negotiates a task, and the remote advertises streaming/notification capabilities that do not match the transport binding (SSE vs. polling vs. webhook) actually established. Does not apply to same-vendor intra-cluster calls where the transport is pinned by configuration and the card is not consulted. ## Core Distinction The A2A agent card is a *declarative* capability manifest fetched over HTTP `GET /.well-known/agent.json`. It is not a negotiated contract. The task handshake (`tasks/send`, `tasks/sendSubscribe`) is where transport is *actually* bound. The failure mode this record covers is the silent divergence between the two: the card advertises `capabilities.streaming: true` and `capabilities.pushNotifications: true`, the client selects `tasks/sendSubscribe` expecting an SSE stream, but the remote's transport layer has fallen back to synchronous request/response (or the reverse — the card says `streaming: false` while the endpoint accepts `sendSubscribe`). The distinction that matters operationally: **a card is a claim about a deployment, and a handshake is a fact about a process.** When they disagree, the client must treat the claim as stale, not the fact as erroneous — and must not silently downgrade to the least-capable interpretation, because that is where task state is lost. ## What Was Observed A delegation client (vendor A) fetched the card of a remote executor (vendor B). The card declared: ``` "capabilities": { "streaming": true, "pushNotifications": true }, "defaultInputModes": ["text/plain"], "defaultOutputModes": ["text/plain"] ``` The client opened `tasks/sendSubscribe` with a long-running task (a multi-step retrieval + synthesis job, expected ~90s). The remote accepted the request and returned `200` with `Content-Type: text/event-stream`. However, the remote's SSE writer had a 30s idle flush timeout and no keepalive frame. The client's SSE reader treated 30s of silence as a dead stream and reconnected with `tasks/get`. The remote, which had *not* finalized the task, returned `state: "working"` with no `artifact` field. The client's reconnect logic interpreted "no artifact on a working task" as "stream lost, task failed," marked the task `failed`, and issued `tasks/cancel`. The remote honored the cancel and discarded partial state. The card was not wrong. The stream was not wrong. The *handshake* was wrong: neither side had agreed on the liveness contract of the stream, and the card's `streaming: true` was read as "you will keep this stream alive for the task's duration," which the remote never promised. Two vendors, two correct implementations, one lost task. A second observation compounded it: on retry, the client — now distrusting `streaming` — fell back to `tasks/send` (synchronous). The remote, still holding the card's claim, expected the client to use `sendSubscribe` and had already provisioned an SSE channel keyed to the `taskId`. The synchronous `send` created a *second* task with a new `taskId`, and the orphaned SSE channel leaked until the remote's 5-minute reaper collected it. The client now had two task IDs for one logical job and no way to correlate them. ## Condition of Validity The divergence is only a *failure* — rather than a benign capability mismatch — under three simultaneous conditions: 1. **The task is long enough to exceed the transport's idle tolerance.** For tasks completing under the SSE flush interval, `streaming: true` and a silent-then-final stream are indistinguishable from a correctly keepalived stream. The failure requires task duration > transport idle timeout. 2. **The client treats stream termination as task termination.** If the client's reconnect logic re-queries `tasks/get` and resumes on `working`, divergence is survivable. The failure requires the client to conflate *transport liveness* with *task liveness*. 3. **The remote does not persist task state across transport disconnects.** If the remote's task store is durable and keyed by `taskId` independent of the SSE channel, a reconnect recovers. The failure requires the remote to bind task state to the live channel (in-memory, channel-scoped). When any one condition is absent, the card/transport divergence degrades to a latency or efficiency cost, not a correctness loss. This is why the bug is non-obvious: it is invisible in short-task test suites (condition 1 fails) and in clients with robust reconnect (condition 2 fails), and it only manifests against remotes with channel-scoped state (condition 3 holds). ## Decision Boundary The invariant the client must enforce: **a task's identity (`taskId`) is established by the handshake response, not by the card, and must survive any transport rebind.** The decision boundary is at the first reconnect. The client must choose between two policies and must choose *explicitly*, not by fallback: - **Resume policy:** on stream silence, issue `tasks/get` with the existing `taskId`. If state is `working` or `input-required`, rebind transport (re-`sendSubscribe` or poll) and continue. This requires the remote to honor `taskId` across channels. The client must verify this by checking that the card's `capabilities` includes a durable-task guarantee — A2A v1.0 does not standardize such a field, so the client must either probe it (issue `tasks/get` on a known-completed task and confirm the ID resolves) or treat absence as "not durable." - **Abandon policy:** on stream silence, treat the task as lost, issue `tasks/cancel` with the existing `taskId`, and re-delegate with a *new* task, carrying forward any partial artifacts from the last received event. This is correct but wasteful and must never silently create a second concurrent task for the same logical job. The boundary condition that forces the choice: **the client cannot know, from the card alone, which policy the remote supports.** The card's `streaming: true` is necessary but not sufficient. The client must either (a) negotiate durability out-of-band before the first long task, or (b) default to the abandon policy and accept the cost. What it must *not* do is the observed behavior: interpret stream silence as task failure, cancel, and then re-delegate synchronously while the remote still holds the SSE channel — producing task-ID divergence. ## Operational Effect The observable signature of the failure is a **task-ID split**: the client's logs show `taskId=X` failed and `taskId=Y` succeeded (or also failed), while the remote's logs show `taskId=X` cancelled and `taskId=Y` created, with an orphaned SSE channel for `X` surviving until reaper. The logical job has no single ID that spans its full lifecycle, which breaks any downstream audit, cost attribution, or replay. The guardrail is a **handshake-time capability probe** with a hard failure on mismatch. Before delegating any task expected to exceed the transport idle window, the client must: 1. Fetch the card and record `capabilities.streaming` and `capabilities.pushNotifications`. 2. Issue a probe task (`tasks/send` with a trivial payload) and confirm the returned `taskId` resolves via `tasks/get` after the probe completes — establishing that task state is durable and ID-keyed. 3. If the probe's `taskId` does not resolve post-completion, the remote is channel-scoped; the client must refuse `sendSubscribe` for long tasks and use `send` with a client-side timeout, or refuse delegation entirely. 4. If the card declares `streaming: true` but the probe's `sendSubscribe` does not deliver a keepalive within the client's idle tolerance, the client must not treat silence as failure; it must fall to the resume/abandon decision explicitly. The cost of the probe is one round-trip per remote per session. The cost of skipping it is the task-ID split, which is unrecoverable without out-of-band reconciliation. ```python class AgentCardTransportDivergence(RuntimeError): """Raised when a peer's declared capabilities cannot be reconciled with the transport actually negotiated, such that task identity would be lost.""" pass IDLE_TOLERANCE_S = 30.0 LONG_TASK_THRESHOLD_S = 45.0 def delegate_task(peer_card: dict, task_payload: dict, expected_duration_s: float, probe_result: dict | None) -> str: """ probe_result: outcome of a prior trivial-task probe against this peer. {"task_id_resolves_post_completion": bool, "send_subscribe_keepalive_within_tolerance": bool} Returns the task_id established by the handshake. """ streaming = peer_card.get("capabilities", {}).get("streaming", False) long_task = expected_duration_s > LONG_TASK_THRESHOLD_S if long_task and streaming: if probe_result is None: raise AgentCardTransportDivergence( "card declares streaming=true for a long task but no durability " "probe has been run against this peer; cannot distinguish " "channel-scoped from task-scoped state" ) if not probe_result.get("task_id_resolves_post_completion", False): raise AgentCardTransportDivergence( "peer is channel-scoped: taskId does not resolve after stream " "close. Refusing sendSubscribe for a long task; task identity " "would be lost on reconnect" ) if not probe_result.get("send_subscribe_keepalive_within_tolerance", False): raise AgentCardTransportDivergence( "peer's SSE stream does not emit keepalive within " f"{IDLE_TOLERANCE_S}s; silence would be misread as task failure. " "Client must use explicit resume policy, not fallback" ) # Handshake establishes task identity; the card does not. task_id = _open_task(peer_card, task_payload, streaming=streaming and long_task) return task_id def _open_task(card, payload, streaming): # transport-level call; returns taskId from the handshake response raise NotImplementedError ```