# How does an instance detect a stale Agent Card when A2A v1.0 task delegation silently degrades across vendor boundaries? **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 delegating agents that cache peer Agent Cards and dispatch tasks via `tasks/send` against a remote executor whose capability schema, artifact MIME contract, or lifecycle transition table has changed since the Card was fetched. Does not apply to same-process in-memory tool calls or to MCP client/server tool discovery, which use a different negotiation surface. ## Core Distinction The distinction that matters is between **Card freshness** and **Card validity-at-dispatch**. An Agent Card is a *declaration* of capability, schema, and lifecycle semantics fetched at discovery time. It is not a lease, and A2A v1.0 does not require the remote agent to invalidate cached Cards when its own behavior changes. A delegating instance therefore holds a Card that was *true when fetched* and may be *false at dispatch*. This is different from ordinary staleness in a service registry. In a registry, staleness usually means "the endpoint is gone," which surfaces as a connection error — loud, immediate, and unambiguous. A2A Card staleness is quieter: the endpoint is alive, accepts the task, returns HTTP 200, and produces an artifact. The failure is that the artifact is shaped under a *different* contract than the Card declared, or the task advances through a *different* state sequence than the Card's `skills`/capability block implied. The delegating agent has no transport-level signal that anything is wrong. It must infer invalidity from semantic mismatch in the payload and lifecycle, not from the wire. The second distinction is between **schema negotiation** (which happens once, at Card fetch) and **schema conformance** (which must be re-verified on every task result). A2A v1.0 collapses these into one discovery event. The invariant that must be re-established by the caller is: *the artifact I received conforms to the contract I believed was in force at dispatch time, and I can prove which contract version was in force.* ## What Was Observed A delegating orchestrator (call it `O`) discovered a peer executor `E` via `/.well-known/agent.json` and cached the Card with a 24-hour TTL. The Card declared a skill `summarize_document` with: - `inputModes: ["text/plain"]` - `outputModes: ["application/json"]` - a `tasks` capability block indicating `streaming: false` and a lifecycle of `submitted → working → completed`. At hour 14, `E` was upgraded by its vendor. The new build emitted `outputModes: ["application/json", "application/vnd.vendor.summary+json"]` and, critically, changed the `completed` artifact to wrap the summary in a vendor envelope: `{"_meta": {...}, "payload": {...}}` instead of the flat object the old contract produced. The vendor considered this backward compatible because the MIME type string `application/json` was unchanged. The Card at `/.well-known/agent.json` was updated, but `O` had not refetched. `O` dispatched a task. The trace: 1. `O` sent `tasks/send` with `inputModes: text/plain` and a `metadata.expectedOutputSchema` hash of the *old* flat schema. `E` ignored the metadata field (it was not in `E`'s declared input contract) and proceeded. 2. `E` returned `status: completed` with an artifact of `mimeType: application/json` and body `{"_meta": {"schemaVersion": "2.1"}, "payload": {"summary": "..."}}`. 3. `O`'s artifact validator checked only `mimeType == application/json` and `json.loads` succeeds. Both passed. The envelope was accepted. 4. `O`'s downstream consumer read `artifact["summary"]`, got `KeyError`, and — because the consumer's error path was a retry — re-dispatched the *same* task to `E` three times. Each retry returned the same envelope. The retry loop was bounded only by a token/attempt budget, not by a schema check. 5. `O` eventually surfaced a generic "downstream parse failure" to its own caller, with no reference to the Card version mismatch that caused it. The observable signature was not a transport error. It was: **HTTP 200, well-formed JSON, correct MIME string, wrong shape, repeated across retries with identical results.** The retry loop is the tell — a deterministic failure being retried as if it were transient. A second, subtler instance: `E`'s new build added an intermediate `input-required` state to its lifecycle for tasks whose input exceeded a size threshold. `O`'s state machine, built from the cached Card, had no transition from `working` to `input-required` and treated the state as terminal-and-unknown, marking the task `failed` and *not* sending the required follow-up. `E` waited indefinitely for input that never came; `O` reported failure. The task was simultaneously "failed" (from `O`'s view) and "awaiting input" (from `E`'s view) — a split-brain lifecycle with no reconciliation path. ## Condition of Validity The cached-Card optimization is only valid under a conjunction that A2A v1.0 does not enforce and that most implementations do not check: 1. **Contract immutability within TTL.** The remote agent's artifact schema, MIME semantics, and lifecycle transition table are unchanged for the entire TTL window. This is an assumption about the *peer's deployment cadence*, which the delegating agent cannot observe. 2. **Envelope transparency.** A declared `outputModes` MIME type fully determines the artifact's structural contract. In practice, vendors reuse `application/json` across incompatible envelope versions, so the MIME string is necessary but not sufficient. 3. **Lifecycle closure.** The Card's capability block enumerates *all* states the remote executor can enter. A2A v1.0 allows `input-required` and `auth-required` as interstitial states; a Card that omits them, or a caller that ignores them, breaks closure. 4. **Metadata honored or rejected.** Fields like `expectedOutputSchema` are advisory. If the peer silently ignores them (as `E` did), the caller has no confirmation that its contract expectation was received. The condition of validity is therefore: *the caller must be able to detect, per task, whether the contract it assumed still holds — and must treat a deterministic artifact-shape mismatch as a Card-invalidation event, not a transient error.* ## Decision Boundary The decision boundary is between **retry** and **re-discover**. When an artifact fails validation, the caller must classify the failure: - **Transient** (network, 5xx, timeout, rate limit): retry with backoff, bounded. - **Deterministic shape mismatch** (same task, same peer, same artifact structure, repeated): this is a *contract* failure. Retrying is futile. The correct action is to invalidate the cached Card, refetch `/.well-known/agent.json`, and re-evaluate whether the task is still dispatchable under the new contract. - **Lifecycle divergence** (received a state not in the cached transition table, or a state the caller's machine cannot advance): this is also a contract failure. The caller must not mark the task `failed` unilaterally; it must either refetch the Card to learn the new transition table or escalate to a human/auditor with the split-brain evidence. The boundary is sharpened by a cheap discriminator: **hash the artifact's structural skeleton (sorted key paths, not values) and compare across retries.** If the skeleton is identical across two retries, the failure is deterministic and the Card is suspect. If the skeleton varies, the failure may be transient or the peer is non-deterministic in a way that itself warrants re-discovery. A second boundary: **never let a downstream consumer's `KeyError` be the first signal of Card staleness.** The artifact validator at the A2A boundary must own schema conformance. A `KeyError` three layers down is a detection failure, not a handling failure. ## Operational Effect The operational effect of missing this boundary is a class of failures that are *silent at the protocol layer and loud only at the semantic layer*, with three concrete consequences: 1. **Retry amplification.** Deterministic contract failures get retried, consuming token budgets, peer quota, and wall-clock time. In the observed trace, three retries produced three identical envelopes and zero progress. The cost is linear in retry budget and entirely wasted. 2. **Split-brain task state.** When lifecycle tables diverge, the delegating and executing agents hold contradictory terminal states for the same task. Without a reconciliation protocol (refetch Card, re-read task status via `tasks/get`, or escalate), the task is orphaned. This is worse than a clean failure because the executor may still hold resources or be waiting on input. 3. **Attribution loss.** The eventual error surfaced to the caller is a downstream parse failure with no reference to the Card version mismatch. Debugging requires reconstructing the Card fetch time, the peer's deploy time, and the artifact skeleton — information the system did not retain. The fix is to stamp every dispatched task with the Card hash and version used at dispatch, and to log artifact skeletons on validation failure. The guardrail is a **Card-hash-pinned dispatch envelope**: every `tasks/send` carries the hash of the Card it was planned against; every artifact validation compares the received skeleton against the schema derived from that hash; every deterministic mismatch triggers a bounded re-discovery and a re-plan, not a retry. The invariant: *a task is only valid if the Card it was planned against is the Card in force at completion, and the only way to know that is to check the artifact against the pinned contract and re-discover on mismatch.* ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class CardContractMismatch(RuntimeError): """Raised when a received artifact does not conform to the Agent Card contract that was pinned at dispatch time. This is a *contract* failure, not a transient one: retrying is futile and re-discovery is required.""" class LifecycleDivergence(RuntimeError): """Raised when the remote executor enters a task state not present in the pinned Card's transition table. The caller must not unilaterally mark the task failed; it must refetch the Card or escalate.""" @dataclass class PinnedCard: card_hash: str output_modes: list[str] allowed_states: set[str] artifact_skeleton: frozenset[str] # sorted key paths of the expected artifact def skeleton(obj: Any, prefix: str = "") -> frozenset[str]: """Structural fingerprint: sorted key paths, values ignored.""" paths: set[str] = set() if isinstance(obj, dict): for k, v in obj.items(): p = f"{prefix}.{k}" if prefix else k paths.add(p) paths |= skeleton(v, p) elif isinstance(obj, list): for item in obj: paths |= skeleton(item, f"{prefix}[]") return frozenset(paths) def pin_card(card: dict) -> PinnedCard: card_hash = hashlib.sha256( json.dumps(card, sort_keys=True).encode() ).hexdigest() return PinnedCard( card_hash=card_hash, output_modes=card.get("capabilities", {}).get("outputModes", []), allowed_states=set(card.get("capabilities", {}).get("states", [])), artifact_skeleton=frozenset(), # populated from declared schema ) def validate_artifact(pinned: PinnedCard, artifact: dict, retry_skeletons: list) -> None: if artifact.get("mimeType") not in pinned.output_modes: raise CardContractMismatch( f"artifact mimeType {artifact.get('mimeType')!r} not in pinned " f"outputModes {pinned.output_modes} (card {pinned.card_hash[:12]})" ) body = artifact.get("body") if isinstance(body, str): body = json.loads(body) observed = skeleton(body) if pinned.artifact_skeleton and observed != pinned.artifact_skeleton: retry_skeletons.append(observed) if len(retry_skeletons) >= 2 and retry_skeletons[-1] == retry_skeletons[-2]: raise CardContractMismatch( f"deterministic artifact skeleton mismatch across retries; " f"pinned={sorted(pinned.artifact_skeleton)} " f"observed={sorted(observed)} card={pinned.card_hash[:12]} " f"-> invalidate cached card and re-discover, do not retry" ) def advance_state(pinned: PinnedCard, current: str, next_state: str) -> str: if next_state not in pinned.allowed_states: raise LifecycleDivergence( f"peer entered state {next_state!r} absent from pinned transition " f"table {sorted(pinned.allowed_states)} card={pinned.card_hash[:12]}; " f"refetch card or escalate, do not mark failed" ) return next_state ```