# How does an instance detect a stale Agent Card capability attestation during A2A v1.0 cross-runtime delegation **Date of Record:** 2026 November 20 **Scope:** Applies to A2A v1.0 task delegation where the calling agent (client) resolves a remote Agent Card, caches it, and issues `tasks/send` envelopes whose `skills` and `capabilities` fields are validated against that cached card. Does not apply to same-runtime in-process tool calls or to MCP tool-schema negotiation, which uses a different handshake. ## Core Distinction The failure is not "the remote agent is down." It is that the remote agent is *up, answering, and structurally valid* while its Agent Card has been superseded — the advertised `capabilities` and `skills[].inputModes/outputModes` no longer match the runtime that will actually execute the task. In A2A, the Agent Card is a discovery document fetched over `.well-known/agent.json` (or the registry), and it carries no mandatory version binding to the executing task handler. The client caches the card for latency, then constructs a delegation envelope from it. When the server-side skill implementation is redeployed with a narrowed schema — say a `skills[].inputModes` that drops `application/json` in favor of `text/plain` — the cached card still advertises the old mode. The client's envelope passes its own local validation (it validates against the cache), the server accepts the task (it does not re-validate the client's card-derived assumptions, only the task payload against its *current* schema), and the mismatch surfaces only as a downstream semantic failure or a mid-task `TaskState.failed` with an opaque reason. The distinction that matters: **card validity is a snapshot, envelope validity is a claim about a future execution.** A2A v1.0 gives you no cryptographic binding between the card you fetched at T0 and the handler that runs at T1. The `capabilities.streaming`, `capabilities.pushNotifications`, and `skills[].tags` are advisory attestations, not enforced contracts. ## What Was Observed A three-agent pipeline: a planner (runtime A), a retrieval specialist (runtime B, Agent Card at `https://b.internal/a2a/.well-known/agent.json`), and a synthesizer (runtime C). Planner caches B's card at cold start with a 1-hour TTL. B's card advertised: - `capabilities.streaming: true` - `skills[0].id: "doc-retrieve"`, `inputModes: ["application/json"]`, `outputModes: ["application/json"]` - `skills[0].tags: ["retrieval", "vector", "rerank"]` At T+40min, runtime B was redeployed. The new handler dropped streaming (a proxy change disabled SSE) and switched `doc-retrieve` to emit `text/markdown` chunks instead of a JSON array. The card *was* updated on disk, but the planner's cache had not expired. Trace of the failure: 1. Planner constructs envelope: `{"jsonrpc":"2.0","method":"tasks/send","params":{"id":"t-91","message":{"role":"user","parts":[{"type":"data","data":{...}}]},"acceptedOutputModes":["application/json"]}}`. 2. Envelope passes planner's local check: `acceptedOutputModes` ⊆ cached `outputModes`. Green. 3. Server receives task. Server's *current* handler validates `parts` against its new schema — the `data` part is still accepted (server tolerates `data` input for backward compat) — and begins execution. 4. Server attempts to open an SSE stream because the client's envelope carried no explicit `streaming:false`. The proxy returns 502 on the SSE upgrade. The server's A2A layer catches this and falls back to non-streaming, but the fallback path was never tested against `acceptedOutputModes`. 5. Server emits a terminal `TaskState.completed` with `artifacts: [{"parts":[{"type":"text","text":"..."}]}]` — markdown text, *not* the JSON array the planner's downstream parser expects. 6. Planner's parser receives `text` where it expected `data`. It does not raise; it coerces the text to a string and passes it to the synthesizer, which produces a plausible but empty synthesis. 7. Silent degradation. No error anywhere in the chain. The only signal was a 40-minute-old `lastModified` field in the cached card that nobody compared. The non-obvious part: **the failure was invisible to every local validator.** The planner validated against its cache. The server validated against its current schema. Both passed. The gap was between the two. ## Condition of Validity A cached Agent Card is a valid basis for envelope construction only under all of: - **Attestation freshness bound:** the card's `lastModified` (or registry `etag`) is within the client's declared `maxCardAge`. A2A v1.0 does not mandate `lastModified`; if absent, the card is *unbounded* and must be treated as stale-by-default for any skill whose `inputModes`/`outputModes` the client depends on. - **Capability intersection, not subset:** the client must construct `acceptedOutputModes` as the *intersection* of what it can parse and what the card advertises, and must send an explicit `streaming` preference rather than relying on server defaults. Relying on `capabilities.streaming: true` as a default is the specific trigger here. - **Re-validation on state transition:** any `TaskState` transition to `input-required` or `failed` must invalidate the cached card and force a re-fetch before retry. A retry against a stale card is a guaranteed repeat. - **Skill-level version pin:** if the card exposes `skills[].version` (optional in v1.0), the envelope must echo it in `metadata` so the server can reject on drift; if absent, the client must treat the skill as unversioned and apply a shorter TTL. The invariant: **no envelope may be constructed from a card whose attestation is older than the shortest-lived capability it depends on.** Streaming and output-mode are the shortest-lived in practice, because they are the most likely to be altered by proxy/infra redeploys that never touch the card file. ## Decision Boundary The boundary between "safe to delegate from cache" and "must re-fetch" is not TTL alone. It is: ``` delegate_from_cache ⟺ (now - card.lastModified) < min(TTL, capability_half_life) ∧ envelope.streaming is explicitly set ∧ acceptedOutputModes = client_parseable ∩ card.outputModes ∧ card.skills[skill].version echoed in metadata (or skill unversioned and TTL ≤ 5min) ``` If `lastModified` is absent, `capability_half_life` is undefined and the only safe value is `0` — re-fetch every delegation. This is the boundary most implementations cross without noticing: they treat a missing `lastModified` as "fresh" because the fetch succeeded. A successful fetch is not a freshness signal. The second boundary: **a `completed` task with an output mode outside `acceptedOutputModes` is a protocol violation, not a success.** The client must reject it and invalidate the card, because the server has demonstrated it will emit modes the client did not accept. Treating it as success is what turns a detectable drift into a silent one. ## Operational Effect After the incident, the pipeline was changed to: 1. Fetch the card with `If-None-Match` against the registry `etag`; on 304, extend TTL only if `lastModified` is present and within bound. 2. Set `streaming: false` explicitly in every envelope unless the client has a live SSE path and the card's `lastModified` is < 5 min old. 3. Compute `acceptedOutputModes` as an intersection and assert non-empty before send; empty intersection is a hard stop, not a fallback to `text/plain`. 4. On any terminal state, compare the returned `artifacts[].parts[].type` against `acceptedOutputModes`; mismatch raises and invalidates the card. 5. Echo `skills[].version` in `metadata.skillVersion`; server-side middleware rejects envelopes whose echoed version ≠ current handler version with `TaskState.rejected` and reason `skill_version_drift`. The generalizable lesson for any A2A client: the Agent Card is a *discovery* artifact, not an *execution contract*. The execution contract is the envelope plus the server's current handler, and the only way to keep them aligned is to make the client's assumptions explicit in the envelope (streaming flag, accepted modes, skill version) so the server can reject on drift rather than silently degrading. A card that cannot be proven fresh must be treated as a card that does not exist. ```python import time from dataclasses import dataclass from typing import Optional class StaleAgentCardError(RuntimeError): """Raised when a delegation envelope would be built from an unbound or stale Agent Card.""" @dataclass class AgentCard: last_modified: Optional[float] # epoch seconds; None means unbounded/unknown etag: Optional[str] streaming: bool output_modes: list[str] skill_version: Optional[str] @dataclass class Envelope: streaming: bool accepted_output_modes: list[str] skill_version_echo: Optional[str] def build_envelope( card: AgentCard, client_parseable: list[str], max_card_age_s: float, now: Optional[float] = None, ) -> Envelope: now = time.time() if now is None else now # Invariant 1: no envelope from an unattested card. if card.last_modified is None: raise StaleAgentCardError( "Agent Card has no lastModified/etag binding; cannot bound attestation age. " "Re-fetch required before delegation." ) age = now - card.last_modified if age > max_card_age_s: raise StaleAgentCardError( f"Agent Card age {age:.1f}s exceeds max_card_age {max_card_age_s:.1f}s; " "capability attestation may have drifted." ) # Invariant 2: explicit streaming preference, never inherited from card default. streaming = bool(card.streaming and age < 300.0) # Invariant 3: accepted modes are an intersection, not a subset assumption. accepted = [m for m in client_parseable if m in card.output_modes] if not accepted: raise StaleAgentCardError( f"Empty output-mode intersection: client={client_parseable} " f"card={card.output_modes}. Refusing to delegate." ) return Envelope( streaming=streaming, accepted_output_modes=accepted, skill_version_echo=card.skill_version, ) def validate_result(envelope: Envelope, returned_part_types: list[str]) -> None: # Invariant 4: server emitting outside acceptedOutputModes is a violation. for t in returned_part_types: if t not in envelope.accepted_output_modes: raise StaleAgentCardError( f"Server returned part type {t!r} outside acceptedOutputModes " f"{envelope.accepted_output_modes}; card is stale or handler drifted." ) ```