Which invariants prevent A2A v1.0 Agent Card drift from silently desynchronizing the task lifecycle state machine during long-lived delegation

**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 delegations where a client agent resolves a remote Agent Card once, caches it, and then drives a multi-turn task lifecycle (`submitted → working → input-required → completed/failed/canceled`) against that cached card. Does not cover stateless one-shot request/response calls, nor Agent Card refresh driven by an explicit version-pinned discovery registry.

Core Distinction

The A2A v1.0 spec treats Agent Card discovery and task lifecycle as two *separately specified* mechanisms. Discovery is a point-in-time document fetch (`/.well-known/agent.json` or registry lookup) that yields a capability declaration. The task lifecycle is a stateful protocol governed by a server-side state machine with defined transitions. The spec does not mandate that the card be re-resolved between lifecycle turns, and most client implementations cache it for the life of a session.

The non-obvious failure is this: **the Agent Card is not just a capability advertisement—it is the schema contract that determines which lifecycle transitions the client is allowed to request and how it must interpret `input-required` payloads.** When the server's card changes mid-task (skill deprecation, schema version bump, capability removal, or endpoint migration), a cached card becomes a *stale transition oracle*. The client keeps emitting lifecycle requests that the card says are valid but the live server state machine now rejects—or worse, accepts under a different schema, producing a payload the client misinterprets. This is not a generic stale-cache problem; it is a divergence between the client's model of the state machine and the server's actual transition function, mediated by a document neither party re-validates.

What Was Observed

During a multi-turn delegation to a research-summarization agent, the following trace was captured. The client resolved the card at `t=0`, cached `skills[].id = "summarize-v1"` with `inputModes: ["text/plain"]` and a declared lifecycle support of `input-required` with a schema `{ "clarification": string }`. The task was submitted and entered `working`.

At `t=+4h` (during a long `working` phase), the server deployed a card update: `summarize-v1` was superseded by `summarize-v2` requiring `inputModes: ["text/markdown"]`, and the `input-required` payload schema changed to `{ "question": string, "context_ref": string }`. The old skill remained routable for in-flight tasks but its `input-required` schema was upgraded in place.

The server transitioned the task to `input-required` and emitted a payload conforming to the *new* schema. The client, holding the cached card, parsed the payload against `{ "clarification": string }`, found no `clarification` key, treated the field as absent, and—because its cached card said the transition was `input-required` with an optional clarification—auto-responded with an empty clarification to force progress. The server's state machine rejected the empty response as schema-invalid, re-emitted `input-required`, and the client re-responded identically. The task deadlocked in `input-required` for 47 iterations until a token-budget ceiling aborted the loop.

The key observation: **neither side violated its own local contract.** The server's card was internally consistent; the client's cached card was internally consistent; the deadlock arose purely from the absence of a cross-turn conformance check binding the two.

Condition of Validity

The invariant that prevents this class of failure is:

> **A client MUST NOT emit a lifecycle transition request whose validity depends on a cached Agent Card field that the server may have mutated since the last observed task event, unless the card's `version` (or a content hash) is re-confirmed as unchanged at the transition boundary.**

Concretely, the guardrail is a *transition-time card re-validation*: before every request that depends on card-declared schema (specifically any response to `input-required`, any `cancel`, and any skill re-invocation), the client re-fetches the card (or a cheap version/ETag probe) and asserts that the fields its request depends on are byte-identical to the cached values. If they differ, the client must re-negotiate: abort the in-flight interpretation, surface the schema delta to its own reasoning loop, and either re-map the payload or fail the task explicitly.

This condition is *valid* (the guardrail is required) whenever: (a) the task is long-lived enough that server deployments can occur between turns, (b) the lifecycle includes `input-required` or any server-to-client schema-bearing transition, and (c) the client caches the card beyond a single turn. It is *not* required for single-turn tasks or when the server pins the card version for the task's lifetime (some registries support `card_version` binding at submission—this is the cleaner architectural fix and should be preferred where available).

Decision Boundary

The decision boundary is the moment the client receives a server-originated lifecycle event that carries a schema-bearing payload (`input-required`, `artifact`, or any structured `status.message`). At that boundary the client must choose between two policies:

  1. **Optimistic parse against cached card** — fast, but silently produces misinterpretation when the schema drifted. This is the failing policy observed above.
  2. **Conformance-gated parse** — re-validate card version, then parse. Adds one round-trip per schema-bearing transition but bounds the failure.

The boundary is sharp because the two policies are indistinguishable *until* a drift event occurs. There is no runtime signal that distinguishes "card unchanged, safe to trust cache" from "card changed, cache is now a lie" without an explicit version probe. A client cannot infer drift from payload shape alone—a payload missing an expected field is ambiguous between "server bug," "optional field omitted," and "schema drift," and treating it as any single one of these is a guess. The only sound resolution is to make the ambiguity impossible by probing the card version at the boundary.

A secondary boundary: if the client's own reasoning loop is the thing interpreting the payload (an LLM deciding how to respond to `input-required`), the drift can be *absorbed* into a plausible-but-wrong response rather than a hard error—the LLM will confabulate a `clarification` value from a payload that has no such field, because it is trying to satisfy its cached schema. This makes drift detection strictly harder than in a typed client, and is the reason the guardrail must be enforced at the protocol layer, not delegated to the model's judgment.

Operational Effect

With the conformance-gated policy in place, the observed deadlock is converted into an explicit, bounded failure: on the first `input-required` event after drift, the client's version probe returns a mismatch, the client raises a schema-drift error, and the task fails fast with a diagnostic naming the changed fields (`inputModes`, `input-required` schema). The delegation does not silently loop; the client's orchestrator can re-resolve the card, re-map the payload to the new schema, and resume—or escalate to a human.

The operational cost is one extra discovery round-trip per schema-bearing transition (typically 2–4 per task). The operational benefit is that the failure mode moves from *silent semantic corruption / unbounded retry loop* to *loud, attributable, recoverable error*. For long-lived delegations, this is the correct trade: the probability of drift is low per turn but the cost of an undetected drift is a poisoned task that appears to be progressing.

The invariant generalizes beyond A2A: any protocol where a capability document is resolved once and a stateful exchange is driven against it (MCP tool schemas resolved at session start, OpenAPI specs cached by an agent) shares the same boundary. The fix is always the same shape—bind the document version to the exchange, and re-assert it at every transition that depends on it.

class AgentCardDriftError(RuntimeError):
    """Raised when a cached Agent Card no longer matches the live server card
    at a lifecycle transition that depends on card-declared schema."""
    pass


def respond_to_input_required(
    cached_card: dict,
    live_card: dict,
    task_id: str,
    payload: dict,
) -> dict:
    # Fields whose drift changes how we must interpret the payload.
    schema_fields = ("inputModes", "skills", "version")

    drifted = [
        f for f in schema_fields
        if cached_card.get(f) != live_card.get(f)
    ]
    if drifted:
        raise AgentCardDriftError(
            f"task {task_id}: cached Agent Card drifted on {drifted}; "
            f"refusing to interpret input-required payload against stale schema"
        )

    # Only now is it sound to parse the payload against the cached schema.
    clarification = payload.get("clarification")
    if clarification is None:
        raise AgentCardDriftError(
            f"task {task_id}: payload missing declared 'clarification' field "
            f"despite version match; treat as unrecoverable schema violation"
        )
    return {"clarification": clarification}