# How should an instance treat an A2A v1.0 AgentCard capability declaration as a frozen contract at task-admission time rather than re-resolving it mid-lifecycle **Date of Record:** 2026 November 29 **Scope:** Applies to any A2A v1.0 client instance that discovers a remote peer's AgentCard, admits a task, and then drives it through `submitted → working → input-required → completed/failed/canceled`. Does not cover transport-level retry semantics or TLS identity binding, which are governed separately. ## Core Distinction The failure that matters here is not "the peer lied about capabilities." It is that an A2A client re-reads or re-resolves the AgentCard *after* task admission and silently reconciles the live card against the capability set it validated at admission time. The AgentCard is a *discovery artifact*, not a *session contract*. Once a task is admitted, the client's internal model of peer capabilities must be a frozen snapshot keyed to the task ID. The live AgentCard may legitimately change (peers redeploy, downgrade models, drop a `streaming` flag, tighten `inputModes`). Reconciling mid-task is where the state machine desynchronizes. The non-obvious part: the A2A spec describes `capabilities` (e.g. `streaming`, `pushNotifications`, `stateTransitionHistory`) and `defaultInputModes`/`defaultOutputModes` as *advertised* properties of the agent, and the task lifecycle as a *separate* concern. Nothing in the spec forbids a card from changing between two requests to the same endpoint. A conformant peer may therefore serve task N under an old card and task N+1 under a new one. A client that assumes card stability across a task's lifetime is making an invariant the protocol never granted it. ## What Was Observed A client admitted a task against a peer whose card declared `capabilities.streaming: true` and `defaultOutputModes: ["text/plain"]`. It opened an SSE subscription for `TaskStatusUpdateEvent` frames. Mid-task, the peer redeployed: the new card served at the well-known location declared `capabilities.streaming: false` and dropped `text/plain` in favor of `application/json`. The client's card-refresh poller (added to keep capability data fresh) picked up the new card and mutated the in-memory peer profile. Three things then went wrong at once: 1. The client's stream reader, seeing `streaming: false`, stopped treating the open SSE channel as authoritative and fell back to `tasks/get` polling — but the peer had *already* been emitting status events on the still-open channel. The client processed the same `working` transition twice, once from the poll and once from the late-delivered event, and its idempotency key was derived from the *card version* rather than the `taskId` + `status.timestamp`. Two different keys, one logical transition. 2. The output-mode narrowing caused the client's result validator to reject a `text/plain` artifact already produced under the old contract, marking the task `failed` locally while the peer considered it `completed`. 3. On the next `tasks/send` resume attempt, the client re-admitted using the *new* card, which no longer advertised the skill the task was created against. The peer returned a task in `input-required` for a skill it no longer lists, and the client's state machine had no legal transition from `input-required` to `failed` that did not first pass through `working`. The observable symptom was a task stuck in a local `working` state with a remote `completed` state, and a resume loop that re-sent the same `taskId` every 30 seconds for nine minutes. ## Condition of Validity The invariant "peer capabilities are stable for the lifetime of a task" holds only when the client controls the peer's deployment cadence (e.g. same-org, pinned version, no independent redeploy). It fails whenever the peer is independently operated — which is the normal A2A case, since A2A exists precisely to cross organizational boundaries. The correct invariant is narrower and stronger: **the capability set validated at task admission is the only capability set the client may consult for that task, for the entire lifecycle, including resume after `input-required` and including any `pushNotifications` callback handling.** Any refresh of the live AgentCard must be scoped to *future* task admission, never to in-flight tasks. This is valid because the A2A task lifecycle is defined over `taskId`, and every transition is a function of `(taskId, prior state, event)`. Capabilities are an admission predicate, not a transition predicate. Mixing them collapses two independent state machines — the peer's deployment state and the task's lifecycle state — into one, and the lifecycle machine loses its well-definedness. ## Decision Boundary The boundary is: *does the incoming event carry a `taskId` that the client has already admitted?* - If **no** (new task, or discovery), resolve the live AgentCard, validate capabilities, and freeze a `CapabilitySnapshot` bound to the new `taskId`. - If **yes** (status event, artifact, resume, push callback), the client MUST consult the frozen snapshot, not the live card. If the live card has diverged in a way that would have prevented admission, that is a *peer-side* condition to surface as an observation, not a reason to mutate the task's capability context. A corollary: a resume after `input-required` is still the same `taskId` and therefore still bound to the admission-time snapshot. If the peer has genuinely dropped the skill, the peer must fail the task via `TaskState.failed` with a reason — the client must not infer failure from card drift. Inferring failure from drift is the exact move that produced the split-brain above. The one legal exception: if the peer returns an explicit protocol error indicating the task is unknown (`TaskNotFoundError` or equivalent), the client may treat the task as terminated and re-admit as a *new* task under the current card. That is a peer assertion, not a client inference. ## Operational Effect Enforcing the snapshot boundary converts the failure mode from "silent split-brain with unbounded resume loop" into "bounded, observable divergence." Concretely: - Idempotency keys derive from `(taskId, status.state, status.timestamp)`, never from card version, so duplicate delivery of a status event is a no-op regardless of which card is live. - Output-mode validation runs against the admission snapshot, so a `text/plain` artifact produced under the old contract validates even after the peer's card narrows. - Card drift during a task is logged as a `CapabilityDriftObservation` with the diverging fields, giving operators a signal without corrupting the task machine. - Resume after `input-required` reuses the snapshot; if the peer cannot honor it, the peer must emit `failed`, and the client's state machine has a legal `input-required → failed` edge triggered by a peer event rather than a local inference. The cost is that a client may hold a snapshot that no longer matches reality and will keep trying against a peer that has genuinely moved on — but that is bounded by the task's own timeout and by the peer's obligation to fail unknown tasks explicitly. Unbounded retry is worse than bounded staleness. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class CapabilityContractError(RuntimeError): """Raised when a task lifecycle event is evaluated against a capability set that does not match the admission-time snapshot bound to its taskId.""" class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" @dataclass(frozen=True) class CapabilitySnapshot: task_id: str streaming: bool input_modes: frozenset output_modes: frozenset skills: frozenset @dataclass class TaskRecord: task_id: str state: TaskState snapshot: CapabilitySnapshot seen_status_keys: set = field(default_factory=set) class A2AClient: def __init__(self) -> None: self._tasks: dict = {} self._live_card: dict = {} def refresh_live_card(self, card: dict) -> None: # Refreshing the live card MUST NOT touch admitted tasks. self._live_card = card def admit(self, task_id: str, required_output_mode: str) -> TaskRecord: card = self._live_card if required_output_mode not in card.get("defaultOutputModes", []): raise CapabilityContractError( f"admission rejected: peer does not advertise {required_output_mode!r}" ) snap = CapabilitySnapshot( task_id=task_id, streaming=bool(card.get("capabilities", {}).get("streaming", False)), input_modes=frozenset(card.get("defaultInputModes", [])), output_modes=frozenset(card.get("defaultOutputModes", [])), skills=frozenset(s.get("id") for s in card.get("skills", [])), ) rec = TaskRecord(task_id=task_id, state=TaskState.SUBMITTED, snapshot=snap) self._tasks[task_id] = rec return rec def apply_status_event(self, task_id: str, state: TaskState, timestamp: str) -> TaskRecord: rec = self._tasks.get(task_id) if rec is None: raise CapabilityContractError( f"status event for unadmitted taskId {task_id!r}; refuse to infer admission" ) # Idempotency key is task-scoped, never card-version-scoped. key = (task_id, state.value, timestamp) if key in rec.seen_status_keys: return rec rec.seen_status_keys.add(key) # Guard: the snapshot must still match the task's admission binding. if rec.snapshot.task_id != task_id: raise CapabilityContractError( f"snapshot/task binding mismatch for {task_id!r}" ) legal = { TaskState.SUBMITTED: {TaskState.WORKING, TaskState.FAILED, TaskState.CANCELED}, TaskState.WORKING: {TaskState.INPUT_REQUIRED, TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED}, TaskState.INPUT_REQUIRED: {TaskState.WORKING, TaskState.FAILED, TaskState.CANCELED}, } if state not in legal.get(rec.state, set()): raise CapabilityContractError( f"illegal transition {rec.state.value} -> {state.value} for {task_id!r}" ) rec.state = state return rec def resume(self, task_id: str) -> TaskRecord: rec = self._tasks.get(task_id) if rec is None: raise CapabilityContractError(f"cannot resume unknown taskId {task_id!r}") # Resume consults the frozen snapshot, not the live card. if not rec.snapshot.streaming: # Non-streaming resume path; do not re-derive from live card. pass return rec ```