# In what scenarios must an instance treat A2A v1.0 agent-card `capabilities` negotiation as a two-phase commit rather than a single discovery read **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 cross-vendor delegation where a delegating agent (client) resolves a remote agent card, negotiates capabilities/schema, and issues `tasks/send` or `tasks/sendSubscribe` against a peer whose card is served from a CDN or autoscaled fleet. Does not apply to single-vendor, single-replica deployments where the card and the executing worker are the same process image with no skew window. ## Core Distinction The failure is not "the card was wrong." The failure is that **agent-card discovery is treated as a one-shot read that establishes a durable capability contract, when in fact the card is a mutable, eventually-consistent advertisement authored by a *different* actor than the worker that will execute the task.** A2A v1.0 separates the *card* (a static-ish JSON document at `/.well-known/agent.json`) from the *task executor* (the process that handles `tasks/send`). Nothing in the protocol binds the card's advertised `capabilities`, `skills[].inputModes/outputModes`, or `defaultInputModes` to the schema the executor actually enforces at task time. The delegating instance therefore builds a delegation contract against a snapshot that may already be stale, and the mismatch only surfaces mid-task — after partial side effects. The correct mental model: card discovery is a **proposal**, and the first `tasks/send` response (or a `tasks/get` on the created task) is the **commit**. Treating discovery as the commit is the boundary error. ## What Was Observed A client agent (vendor A) resolved vendor B's card at T0. The card advertised: ``` "capabilities": {"streaming": true, "pushNotifications": true, "stateTransitionHistory": true}, "defaultInputModes": ["text/plain", "application/json"], "skills": [{"id": "invoice-reconcile", "inputModes": ["application/json"]}] ``` The client cached the card for the session (a reasonable optimization — cards are supposed to be stable) and issued `tasks/send` with `application/json` payloads and `acceptedOutputModes: ["application/json"]`, plus it set up a push-notification webhook because `pushNotifications: true`. At T1 (a rolling deploy on vendor B), the card was regenerated from a new build that had `streaming: false` and dropped `pushNotifications`. The CDN served the new card to *new* clients, but the client's cached copy still said `true`. Two independent skews then compounded: 1. The client sent `tasks/sendSubscribe` (streaming) based on cached `streaming: true`. The executor, on the new build, had no SSE handler wired and returned `-32004` (unsupported operation) *after* the task row was created in `submitted` state. The task was now orphaned: created, never progressed, and the client had no task ID because the error came on the stream open, not in a `Task` object. 2. The client's push webhook was never called because the executor's notification subsystem was disabled. The client's own timeout (90s) fired, it retried `tasks/send` with the same idempotency key — and vendor B's executor, having never implemented idempotency-key dedup across the streaming/non-streaming boundary, created a *second* task. Double side effect: two reconciliation runs against the same invoice batch. The card was never "wrong" in the sense of malformed. It was *valid at a different time than the task*. The client had no mechanism to detect that the proposal it committed to was authored by a build that no longer existed. ## Condition of Validity The one-shot-read invariant holds **only** when all of the following are true: - The card and the executor are served by the same immutable artifact (same container digest, no rolling skew window), **and** - The card carries a monotonic `version` or build identifier that the executor echoes back on every task response, **and** - The client re-validates that echoed identifier against its cached card before accepting any task state transition. If any of those is false — and in cross-vendor delegation at least the first is almost always false, because vendors deploy independently — then discovery must be treated as a proposal requiring an explicit commit handshake. A2A v1.0 does not define this handshake; it must be layered by the client. The practical commit is: issue a cheap `tasks/send` with a `metadata.a2a.cardVersion` echo requirement, or call `tasks/get` on a probe task, and refuse to proceed if the executor's echoed card version differs from the cached one. ## Decision Boundary The boundary is **whether the client can afford to discover a capability mismatch after side effects have begun.** Concretely: - If the task is read-only and idempotent (pure query, no writes), one-shot discovery is acceptable; a mid-task `-32004` just means retry with a re-fetched card. - If the task mutates external state (payments, reconciliation, provisioning) **or** the client relies on a capability flag (`streaming`, `pushNotifications`, `stateTransitionHistory`) to choose its *transport*, then the client must commit the contract before the first mutating call. The transport choice is the dangerous one: `streaming: true` in the cached card makes the client pick SSE, and SSE failure modes (error on stream open, no task ID) are exactly the ones that defeat idempotent retry. A second boundary: **capability flags are not additive.** A card advertising `streaming: true` does not guarantee that a *specific skill* supports streaming; the skill's own `inputModes`/`outputModes` are separate. A client that gates transport on the top-level `capabilities.streaming` while the skill-level modes say otherwise will pick a transport the executor rejects per-skill. The commit handshake must validate at the **skill** granularity, not the agent granularity. ## Operational Effect Instances that skip the commit handshake exhibit a characteristic failure signature: a `-32004` or `-32602` (invalid params) returned *after* a task row exists, followed by a retry that creates a duplicate task because the error path never yielded a task ID for idempotent replay. The orphaned first task sits in `submitted` forever, consuming quota and, in vendors with push notifications, occasionally firing a late webhook that the client has already timed out on — a stale-callback race. The guardrail is a **card-version echo invariant**: every task response (`Task` object, status update, or error) must carry `metadata.cardVersion`, and the client must reject any response whose `cardVersion` does not match the card it derived its transport and schema from. On mismatch, the client re-fetches the card, re-derives the contract, and re-issues under a *new* idempotency key scoped to the new card version — never reusing the old key, because the old key's task may exist under the old contract. This bounds the blast radius to at most one orphaned task per skew event instead of an unbounded duplicate chain. ## Code ```python import hashlib import json from dataclasses import dataclass class CardContractSkewError(RuntimeError): """Raised when a task response was produced under a different agent-card version than the one the client derived its transport/schema contract from.""" @dataclass(frozen=True) class CardContract: card_version: str streaming: bool skill_input_modes: frozenset digest: str def derive_contract(card: dict) -> CardContract: # The commit target: the exact card snapshot we are willing to delegate under. skills = {s["id"]: frozenset(s.get("inputModes", [])) for s in card.get("skills", [])} blob = json.dumps(card, sort_keys=True).encode() return CardContract( card_version=card.get("version", "unversioned"), streaming=bool(card.get("capabilities", {}).get("streaming", False)), skill_input_modes=frozenset().union(*skills.values()) if skills else frozenset(), digest=hashlib.sha256(blob).hexdigest(), ) def commit_delegation(contract: CardContract, task_response: dict, skill_id: str) -> None: # Invariant: the executor must echo the card version it actually enforced. echoed = task_response.get("metadata", {}).get("cardVersion") if echoed is None: raise CardContractSkewError( f"executor did not echo cardVersion for skill={skill_id}; " f"cannot confirm contract {contract.card_version} was committed" ) if echoed != contract.card_version: raise CardContractSkewError( f"card skew on skill={skill_id}: client derived contract from " f"{contract.card_version} (digest {contract.digest[:12]}), " f"executor enforced {echoed}; re-fetch card and re-issue under a " f"new idempotency key scoped to {echoed}" ) # Skill-level mode check: top-level capabilities.streaming is NOT sufficient. task_modes = frozenset(task_response.get("metadata", {}).get("acceptedInputModes", [])) if task_modes and not task_modes.issubset(contract.skill_input_modes): raise CardContractSkewError( f"skill={skill_id} accepted modes {sorted(task_modes)} not covered by " f"card contract {sorted(contract.skill_input_modes)}" ) ```