# How does an instance detect Agent Card schema drift between discovery and the first task-state transition in A2A v1.0 **Date of Record:** 2026 November 22 **Scope:** Applies to A2A v1.0 clients that fetch an Agent Card via well-known discovery, cache the negotiated capability set, and then submit a task whose lifecycle transitions (`submitted → working → completed`) depend on the declared schema. Does not cover signed-artifact verification failure after task completion, nor A2A transport-level (HTTP/SSE) retry semantics. ## Core Distinction The failure is not "the Agent Card was wrong." It is that the Agent Card was *right at discovery time and wrong at task-submission time*, and the client had no invariant binding the card it validated to the task it dispatched. A2A v1.0 treats the Agent Card as a discovery artifact (fetched from `/.well-known/agent.json`) and the task lifecycle as a separate state machine. Nothing in the spec forces the card's `capabilities` and `defaultInputModes`/`defaultOutputModes` to be re-asserted at the moment a `tasks/send` (or `message/send`) request is accepted. The gap between "card validated" and "first state transition emitted" is the failure surface. ## What Was Observed A client resolved a remote agent's card, saw `capabilities.streaming: true` and `defaultOutputModes: ["application/json"]`, cached the negotiated contract, and dispatched a task. The remote agent had been redeployed between discovery and dispatch: the new revision flipped `streaming` to `false` and narrowed output modes to `["text/plain"]` while keeping the same `name`, `version` string (`"1.0.0"`), and endpoint URL. The client's dispatch included `Accept: application/json` and opened an SSE stream. The remote accepted the task and emitted `submitted`, then `working` — a valid lifecycle transition — but produced a `text/plain` artifact and never sent a terminal `completed` frame over SSE because streaming was disabled server-side. The client's state machine sat in `working` until its own timeout fired, then attempted `tasks/get` to reconcile. Because the client had cached the *old* card, it validated the returned artifact against `application/json` and rejected it as malformed, marking the task `failed` locally while the remote had (from its own perspective) completed it successfully. Two divergent terminal states for one task ID. The non-obvious part: every individual message on the wire was spec-conformant. The card was valid. The `submitted`/`working` frames were valid. The artifact was valid per the *new* card. The failure lived entirely in the absence of a binding between the card version the client validated and the task it accepted. ## Condition of Validity The detection invariant only holds when the client can establish that the card it cached is the card *the remote is currently serving for this task*. In A2A v1.0 the only portable hooks for this are: 1. The card's `version` field — but agents routinely bump `version` only on breaking changes and reuse it across capability flips, so it is not a reliable discriminator. 2. The `tasks/get` response's own `status` and `artifacts`, re-validated against a *freshly fetched* card — this is the only sound reconciliation path. 3. A transport-level `ETag`/`Last-Modified` on the card fetch, if the remote provides it (optional in the spec). If the client cannot re-fetch the card at reconciliation time (offline, remote 5xx on `/.well-known/agent.json`), the invariant is unenforceable and the client must treat the task as *indeterminate*, not `failed`. Marking it `failed` is the specific bug: it converts "I cannot verify" into "the remote failed," which is a false accusation that poisons downstream audit logs and any multi-agent consensus layer that trusts the client's terminal state. ## Decision Boundary The boundary is: **a task may only transition to a terminal state the client can justify against a card it fetched after the task's `submitted` frame was observed.** Concretely, on any of these triggers — SSE stream closes without terminal frame, `tasks/get` returns an artifact whose `mimeType` is not in the cached `defaultOutputModes`, or the remote's `status.state` is terminal while the client's local state is not — the client must: - Re-fetch the Agent Card. - If the fresh card's `defaultOutputModes`/`capabilities` differ from the cached card, re-validate the artifact against the *fresh* card. - If it validates, transition to `completed` and record a `card_drift` annotation with both card snapshots. - If it does not validate, or the re-fetch fails, transition to `indeterminate` — never `failed`. The boundary fails when clients collapse `indeterminate` into `failed` for log cleanliness, or when they trust the cached card across a task boundary that outlived a redeploy window. ## Operational Effect Systems that skip the re-fetch-on-reconcile step exhibit a characteristic signature: task IDs that are `completed` on the remote and `failed` on the client, with artifact-validation errors in the client log that reference MIME types the remote no longer emits. In multi-agent setups where the client is itself an auditor for another agent, this drift propagates — the auditor reports a false failure, the orchestration layer retries against the same redeployed remote, and the retry fails identically, producing a stable but spurious failure loop that looks like a flaky remote rather than a stale-contract bug. The fix is cheap (one extra card fetch per reconciliation) but only if the state machine admits an `indeterminate` terminal state at all; many implementations hardcode a two-valued success/failure lattice and cannot represent it. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class CardDriftUnresolvedError(RuntimeError): """Raised when a task cannot be reconciled against a fresh Agent Card.""" @dataclass class AgentCard: name: str version: str streaming: bool default_output_modes: list[str] def fingerprint(self) -> str: payload = f"{self.name}|{self.version}|{self.streaming}|{','.join(sorted(self.default_output_modes))}" return hashlib.sha256(payload.encode()).hexdigest()[:12] @dataclass class TaskRecord: task_id: str card_at_submit: AgentCard local_state: str = "submitted" artifacts: list[dict] = field(default_factory=list) def reconcile_task( task: TaskRecord, remote_state: str, fetch_fresh_card, ) -> str: """ Reconcile a task whose SSE stream ended without a terminal frame. Invariant: a terminal local state must be justified against a card fetched AFTER the task's submitted frame was observed. """ if remote_state in ("completed", "failed", "canceled"): try: fresh = fetch_fresh_card() except Exception as exc: raise CardDriftUnresolvedError( f"task {task.task_id}: cannot fetch fresh card; " f"state is indeterminate, not failed" ) from exc if fresh.fingerprint() != task.card_at_submit.fingerprint(): # Card drifted between discovery and reconciliation. for art in task.artifacts: mime = art.get("mimeType", "") if mime not in fresh.default_output_modes: raise CardDriftUnresolvedError( f"task {task.task_id}: artifact mime={mime!r} not in " f"fresh card modes {fresh.default_output_modes}; " f"card drifted {task.card_at_submit.fingerprint()} -> " f"{fresh.fingerprint()}" ) task.local_state = remote_state return task.local_state # Remote is still working — do not fabricate a terminal state. task.local_state = "indeterminate" return task.local_state ```