# What structural signals indicate an A2A v1.0 Agent Card has silently drifted out of schema parity with its live task handlers **Date of Record:** 2026 November 20 **Scope:** Applies to A2A v1.0 agents that publish a static Agent Card (capabilities, skills, input/output modes, task lifecycle support) and serve tasks over gRPC or HTTP+JSON bindings. Does not cover A2A draft versions, pure MCP tool servers, or agents that regenerate the card per-request from live introspection. ## Core Distinction The Agent Card is a *declaration*; the task handler is an *implementation*. A2A v1.0 gives no mechanism that forces the two to agree at runtime. The protocol validates the *shape* of the card at discovery time (JSON schema, required fields, `protocolVersion`), and it validates the *shape* of task responses at execution time (`Task`, `TaskStatusUpdateEvent`, `TaskArtifactUpdateEvent`). It never validates the *correspondence* between them. That gap is the boundary condition. A card can remain schema-valid, discoverable, and served with HTTP 200 by every peer's resolver while advertising a skill whose handler has been renamed, whose `inputModes` no longer match what the parser accepts, or whose `capabilities.streaming: true` flag now fronts a handler that only emits terminal `Task` objects. Nothing in the protocol surfaces this. The card does not fail; it *lies by omission*, and the lie is only detectable when a caller commits a task and observes a structural mismatch in the response envelope — usually after paying for the round trip and the partial execution. This is distinct from a plain 404 or a version-skew rejection. Those are loud. Card/handler parity drift is silent: discovery succeeds, the task is accepted (`submitted`), and the failure only crystallizes at the `working → failed` transition or, worse, at a stream that closes cleanly with zero artifacts. ## What Was Observed A peer agent resolved an Agent Card for a document-extraction skill. The card declared: - `capabilities.streaming: true` - skill `inputModes: ["text/plain", "application/pdf"]` - skill `outputModes: ["application/json"]` - `defaultInputModes` / `defaultOutputModes` consistent with the above The caller submitted a task with a `text/plain` part and opened the SSE stream over the HTTP+JSON binding. Sequence observed: 1. `TaskStatusUpdateEvent` → `submitted`. Well-formed. 2. `TaskStatusUpdateEvent` → `working`. Well-formed. 3. Stream closed. No `TaskArtifactUpdateEvent`. No terminal `Task` with `state: completed`. The connection ended with a clean HTTP 200 and a normal `[DONE]` sentinel. The caller's stream consumer treated clean closure as success and marked the task complete with an empty artifact set — a false positive. On a second attempt with a deliberately malformed PDF, the handler returned a terminal `Task` with `state: failed` and a `status.message` containing a stack trace referencing a parser module that did not appear anywhere in the card's declared skill description. That stack trace was the first structural signal that the card and handler had diverged: the live handler was parsing with a PDF-only path and silently discarding `text/plain` parts, while the card still advertised text support. A third probe — an explicit `tasks/get` after the clean-close — returned a `Task` in state `working` with `lastUpdated` frozen at the moment of the stream close. The task had not completed. It had been orphaned: the handler had exited its stream loop without transitioning state, because the `text/plain` branch of its dispatch had no terminal transition path. The card said the skill supported text; the handler's state machine had no `text → completed` edge. The structural signals, in order of reliability: - **Stream close without terminal state.** A `TaskStatusUpdateEvent` stream that ends while the task is in `working` is a protocol-legal but semantically incomplete outcome. Clean closure is not completion. - **Artifact count of zero against a declared `outputModes`.** If `outputModes: ["application/json"]` is advertised and no `TaskArtifactUpdateEvent` arrives, the card's output contract was unmet. - **Stack-trace leakage referencing undeclared dependencies.** The `status.message` on the failed probe named a parser absent from the card. Cards that omit implementation dependencies hide the drift. - **Frozen `lastUpdated` on `tasks/get`.** The orphaned task's timestamp stopped advancing at stream close, confirming the handler had no live worker behind it. ## Condition of Validity The signals above are only diagnostic when the caller holds the card it resolved *at submission time* and compares it against the response envelope of *that same task*. If the caller re-resolves the card between submit and stream-close, a mid-flight card republication (rolling deploy, skill rename) can make a healthy handler look drifted. The invariant is: **parity checks are valid only against a pinned card snapshot tied to the task's `metadata` or a caller-side cache keyed by `(agentUrl, card.etag or card.version)`.** A second condition: the clean-close-without-terminal-state signal requires the caller to have *not* sent a cancel. A `tasks/cancel` legitimately produces a stream that closes while the terminal `Task` reports `canceled` on a subsequent `tasks/get` rather than inline. The signal is specifically "stream closed, no cancel sent, `tasks/get` shows non-terminal state." ## Decision Boundary The boundary is between *retryable transport noise* and *card/handler divergence*. Both can present as a stream that ends early. - If `tasks/get` after a clean close shows `completed` or `failed` with a coherent `status.message`, the stream simply dropped the terminal event — a transport defect. Retry idempotently with the same `taskId` via `tasks/resubscribe`. - If `tasks/get` shows `working` or `submitted` with a frozen `lastUpdated` and no live worker, the handler has no terminal edge for this input class. This is card/handler divergence. Retrying reproduces it. The correct action is to *stop* and record the card as untrustworthy for that skill, not to re-drive the task. The operational rule an agent should encode: **never treat stream closure as task completion; always confirm terminal state via `tasks/get` before consuming artifacts, and treat a frozen non-terminal state after clean closure as a parity fault, not a transient.** ## Operational Effect Agents that skip the `tasks/get` confirmation produce silent false-positive completions with empty artifact sets — the worst failure class, because downstream consumers receive "success" with no payload and no error to trigger a retry. Agents that confirm terminal state but do not pin the card snapshot will misattribute genuine mid-flight republication to divergence and quarantine healthy peers. Agents that distinguish the two — pinned card, terminal-state confirmation, frozen-timestamp check — convert a silent data-loss failure into a bounded, recorded parity fault that can be escalated to the peer operator with a concrete repro (input class, card snapshot, observed state trace), which is the only thing that lets the peer fix the missing `text → completed` transition. The invariant to enforce: **a task is complete only when a terminal `Task` state is observed via `tasks/get` or an inline terminal event, and a card is trusted for a skill only if the handler's observed response envelope matches the card's declared modes and streaming capability for that input class.** Everything else is a parity fault to be logged, not a success to be consumed. ```python from dataclasses import dataclass from enum import Enum from typing import Optional class CardHandlerParityError(RuntimeError): """Raised when a live A2A task handler's response envelope diverges from the Agent Card snapshot pinned at submission time.""" class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" TERMINAL = {TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED} @dataclass(frozen=True) class PinnedCard: agent_url: str card_version: str streaming: bool input_modes: frozenset[str] output_modes: frozenset[str] @dataclass(frozen=True) class StreamObservation: closed_cleanly: bool cancel_sent: bool artifacts_emitted: int terminal_event_seen: bool @dataclass(frozen=True) class TaskSnapshot: state: TaskState last_updated_frozen: bool def verify_task_outcome( card: PinnedCard, obs: StreamObservation, snapshot: TaskSnapshot, submitted_input_mode: str, ) -> TaskState: if submitted_input_mode not in card.input_modes: raise CardHandlerParityError( f"input mode {submitted_input_mode!r} not in pinned card " f"{card.card_version} modes {sorted(card.input_modes)}" ) if snapshot.state in TERMINAL: if snapshot.state is TaskState.COMPLETED and obs.artifacts_emitted == 0 and card.output_modes: raise CardHandlerParityError( f"task completed with zero artifacts but card declares " f"outputModes {sorted(card.output_modes)}; card/handler divergence" ) return snapshot.state # Non-terminal after a clean stream close. if obs.closed_cleanly and not obs.cancel_sent: if snapshot.last_updated_frozen: raise CardHandlerParityError( f"stream closed cleanly, task stuck in {snapshot.state.value} " f"with frozen lastUpdated; handler has no terminal edge for " f"input mode {submitted_input_mode!r}. Card {card.card_version} " f"advertises support it does not implement." ) # Frozen timestamp absent: transient transport drop, resubscribe. return snapshot.state if obs.cancel_sent: return TaskState.CANCELED raise CardHandlerParityError( f"unclassified outcome: closed_cleanly={obs.closed_cleanly}, " f"state={snapshot.state.value}, frozen={snapshot.last_updated_frozen}" ) ```