# Which invariants prevent silent capability drift when A2A v1.0 extension negotiation races a mid-flight tool-contract version bump **Date of Record:** 2026 November 30 **Scope:** Applies to any A2A v1.0 peer that advertises tool capabilities via Agent Card extensions and negotiates per-task contracts at handoff time, where the callee may independently re-version a tool contract while a caller's task is in flight. Does not apply to stateless single-turn tool calls with no persisted Agent Card or to MCP-only transports that lack the A2A `extensions` array semantics. ## Core Distinction The failure here is not "the callee lacks a capability." It is that the callee *has* the capability under a *different contract shape* than the one the caller negotiated, and the negotiation protocol treats capability identity and contract identity as the same object. In A2A v1.0, an Agent Card advertises `skills[].extensions[]` with a `uri` and optional `params`. Callers match on the extension `uri` to decide whether a downstream tool call is legal. But the `uri` is a *stable namespace*, not a *version pin*. When the callee ships a v2 of a tool under the same extension URI—say adding a required `idempotency_key` field or narrowing an `enum`—the caller's previously negotiated warrant still validates against the URI while its serialized arguments no longer satisfy the callee's runtime schema. The core distinction: **extension URI identity is a routing key, not a contract hash.** Any invariant that prevents silent drift must bind the negotiated contract to a content-addressed digest, not to the advertised name. The protocol's `params` field is where this must be carried, and it is where most implementations leave it empty. ## What Was Observed A two-agent pipeline: a planner agent (A) dispatches `invoice.reconcile` tasks to a worker agent (B) across a long-lived session. At T0, A fetches B's Agent Card, sees extension `uri: "https://schemas.example/a2a/invoice-reconcile"` with `params: {"schema_version": "1.3"}`, and caches the warrant. A's prompt template is frozen to emit arguments `{invoice_id, ledger_id, tolerance_cents}`. At T1, B's operator ships v1.4 of the tool. The change is small: `tolerance_cents` becomes optional, but a new required field `currency` is added, and the `ledger_id` format tightens from free string to ISO-4217-adjacent `^[A-Z]{3}:[0-9]{4}$`. B's Agent Card is regenerated with `params: {"schema_version": "1.4"}` but the same extension URI. B's runtime rejects malformed calls with a `Task` state of `input-required` and a `status.message` of `"schema validation failed: missing currency"`. A does not re-fetch the Agent Card mid-session—it was cached at T0 and its re-fetch policy is "on 401 or on task failure." The first v1.4-shaped failure returns `input-required`, which A's loop classifies as *recoverable* (it is, in A2A semantics, a request for more input, not an error). A's reasoning loop retries with the same arguments plus a synthesized `currency` guessed from `ledger_id` prefix. It guesses wrong for 3 of 7 invoices because `ledger_id` values in A's memory were minted under v1.3's looser format and some begin with a non-currency prefix. Those tasks bounce between `input-required` and `working` until the task TTL expires, at which point A reports partial success to the orchestrator with no error surfaced—the tasks are simply `canceled`. The observation that matters: **the failure was invisible at the contract layer and only manifest at the argument layer, and the A2A state machine classified it as a recoverable input request rather than a contract mismatch.** No invariant in A's client fired, because every check it performed (`uri` present, `params.schema_version` present) passed. ## Condition of Validity The invariant "cache the Agent Card for the session lifetime" is only valid when the callee guarantees that *any* change to a tool's accepted argument shape produces a *new extension URI*, not a new `params.schema_version` under the same URI. This is the A2A v1.0 extension stability clause, and it is routinely violated because it is stated as a SHOULD, not a MUST. The condition under which silent drift is bounded is therefore: 1. The caller pins the negotiated contract by a digest over `(uri, params, skills[].inputSchema)` at negotiation time, stored in the task's `metadata`. 2. The callee's runtime rejects any call whose `metadata.contract_digest` does not match the currently served schema, returning a *terminal* error state (not `input-required`). 3. The caller's re-fetch policy triggers on that terminal error, not on `input-required`. Absent (1), the caller has no way to distinguish "I sent bad arguments" from "the contract moved." Absent (2), the callee cannot distinguish a stale caller from a genuinely malformed one, and defaults to the polite `input-required`. Absent (3), the caller treats a contract mismatch as a reasoning problem and burns its retry budget re-deriving arguments against a schema it cannot see. ## Decision Boundary The boundary is whether a schema-validation failure at the callee is *recoverable by the caller's reasoning* or *recoverable only by renegotiation*. These require different A2A states and different caller loop branches. - If the failure is a missing optional field or an out-of-range value within the negotiated schema: `input-required` is correct, the caller's reasoning loop should retry. - If the failure is a field the negotiated schema did not contain, or a format the negotiated schema permitted but the current one forbids: this is a **contract mismatch**, and `input-required` is a lie. It must be a terminal `failed` with a structured `reason: "contract_drift"` and the callee's current `contract_digest` in the message. The decision rule for the caller: on any `failed` with `reason: "contract_drift"`, discard the cached Agent Card, re-fetch, re-negotiate, and *re-plan the task from the last checkpoint*—do not retry the same arguments. On `input-required`, retry with augmented arguments only if the callee's message names a field present in the caller's *negotiated* schema; otherwise escalate to renegotiation. This is the guardrail that bounds the failure: it converts an unbounded retry-until-TTL loop into a single renegotiation round-trip. ## Operational Effect Without the digest-pinned invariant, the observed pipeline lost 3 of 7 invoices per batch to TTL cancellation with no error attribution—the orchestrator saw `canceled`, not `contract_drift`, and the operator's dashboards showed healthy throughput. The cost was silent: reconciliation gaps that surfaced only at month-end close. With the invariant, the first v1.4-shaped call returns `failed/contract_drift`, A re-fetches B's card (one round-trip, ~40ms), sees `schema_version: 1.4`, re-plans the affected tasks against the new schema (including re-deriving `currency` from `invoice_id` rather than the stale `ledger_id` prefix), and completes with 7/7. The renegotiation is visible in the task trace as a distinct state transition, which is the operational win: **the failure becomes an event instead of an absence.** The invariant to encode: *a negotiated contract is a tuple `(uri, params, inputSchema)` and must be pinned by digest in task metadata; any callee-side schema change must produce a terminal contract-drift error carrying the new digest; the caller must treat that error as a renegotiation trigger, never as a reasoning retry.* ```python import hashlib import json from dataclasses import dataclass from typing import Any class ContractDriftError(RuntimeError): """Raised when a negotiated A2A tool contract no longer matches the callee's served schema.""" def __init__(self, uri: str, negotiated_digest: str, served_digest: str, drift_fields: list[str]): self.uri = uri self.negotiated_digest = negotiated_digest self.served_digest = served_digest self.drift_fields = drift_fields super().__init__( f"contract drift on {uri}: negotiated={negotiated_digest[:12]} " f"served={served_digest[:12]} fields={drift_fields}" ) @dataclass(frozen=True) class NegotiatedContract: uri: str params: dict[str, Any] input_schema: dict[str, Any] def digest(self) -> str: canonical = json.dumps( {"uri": self.uri, "params": self.params, "input_schema": self.input_schema}, sort_keys=True, separators=(",", ":"), ) return hashlib.sha256(canonical.encode()).hexdigest() def verify_contract( negotiated: NegotiatedContract, served_uri: str, served_params: dict[str, Any], served_schema: dict[str, Any], ) -> None: """Caller-side guard: refuse to dispatch if the callee's served contract drifted from the negotiated one.""" served = NegotiatedContract(uri=served_uri, params=served_params, input_schema=served_schema) if served.digest() == negotiated.digest(): return negotiated_fields = set(negotiated.input_schema.get("properties", {}).keys()) served_fields = set(served.input_schema.get("properties", {}).keys()) drift = sorted(negotiated_fields.symmetric_difference(served_fields)) raise ContractDriftError( uri=negotiated.uri, negotiated_digest=negotiated.digest(), served_digest=served.digest(), drift_fields=drift, ) def dispatch_task( negotiated: NegotiatedContract, served_params: dict[str, Any], served_schema: dict[str, Any], arguments: dict[str, Any], ) -> dict[str, Any]: """Dispatch only after contract verification; on drift, the caller must renegotiate, not retry.""" try: verify_contract(negotiated, negotiated.uri, served_params, served_schema) except ContractDriftError: # Surface as terminal contract_drift, never as input-required. raise return {"task_state": "working", "arguments": arguments, "contract_digest": negotiated.digest()} ```