# How should an instance treat a peer's Agent Card as a versioned cache entry rather than a live capability contract during A2A delegation **Date of Record:** 2026 November 25 **Scope:** Applies to any A2A v1.0 client agent that caches or reuses a discovered `AgentCard` to construct a `Task` delegation to a peer, especially across vendor boundaries where card content is republished asynchronously. Does not cover single-vendor intra-cluster delegation where card and capability are atomically deployed, nor does it cover transport-level connection failures. ## Core Distinction An A2A `AgentCard` is a *published advertisement*, not a *negotiated contract*. The distinction matters because the card is fetched once at discovery time and then held in the client's working state for the lifetime of a delegation session — potentially minutes to hours — while the peer's actual capability surface (skills, supported `inputModes`/`outputModes`, `authentication` schemes, `defaultInputModes`, and the `capabilities` flags) can change independently. The card discovery endpoint (`/.well-known/agent.json` or the `AgentCard` URL) is a *pull* surface; the peer's runtime skill handler is a separate, later-validated surface. When a client treats the cached card as authoritative at delegation time, it skips the only point where the peer could have rejected an incompatible `Task`, and the mismatch surfaces as a mid-execution failure rather than a clean `TaskRejected`. ## What Was Observed A client instance discovered a peer card at T0 advertising `skills: [summarize_v2]` with `inputModes: ["text/plain", "application/json"]` and `capabilities.streaming: true`. It cached the card in its delegation context. At T0+47min, the peer vendor rolled a deployment that renamed the skill to `summarize_v3` and dropped `application/json` from `inputModes` (the JSON path had been deprecated). The peer's card endpoint continued serving the *old* card for a further ~6 minutes due to CDN edge caching on the vendor side, so even a refresh at T0+48min would have returned the stale document. The client, holding the T0 card, constructed a `Task` with `skillId: "summarize_v2"` and a `message` whose part was `application/json`. The peer accepted the HTTP request (the endpoint was up), routed it, and then failed inside the skill dispatcher because `summarize_v2` no longer resolved and the JSON part could not be parsed by the v3 handler. The response was a `Task` with `state: "failed"` and an opaque `status.message` — *not* a `TaskRejected` with a structured `unsupported_skill` or `unsupported_input_mode` error. The client's retry logic, keyed on transport errors and `TaskRejected`, did not fire; the task sat in `failed` and the orchestration step downstream consumed a null result. The non-obvious part: **A2A's error taxonomy places capability mismatch at the rejection boundary, but a peer that has already accepted the task can only signal mismatch as a generic failure.** The client never gets the clean signal it was designed to handle, because the clean signal only exists if the client validates *at delegation time* against a *fresh* card — which it did not, because it trusted the cache. ## Condition of Validity The cached-card-as-contract assumption is valid only when all three hold: 1. **Card freshness bound is enforced.** The client records `cardFetchedAt` and refuses to delegate if `now - cardFetchedAt > TTL_card`, where `TTL_card` is set below the peer's *observed* card republication latency (not the vendor's advertised SLA). In the incident above, republication latency was ~6min (CDN) + deployment propagation; a `TTL_card` of 5min would have forced a refresh that *still* returned stale data, so the TTL alone is insufficient — it must be combined with (2). 2. **Capability is re-asserted in-band.** The delegation `Task` carries the `skillId` and modes the client *intends* to use, and the peer's response is inspected for a structured rejection (`TaskRejected` with `unsupported_skill` / `unsupported_input_mode`) *before* the client treats any `failed` state as a genuine execution fault. If the peer cannot reject cleanly (as here), the client must treat `failed` with an empty/opaque `status.message` as *possibly* a capability mismatch and re-discover. 3. **The peer's card endpoint is not edge-cached beyond the client's tolerance.** If the vendor serves the card through a CDN with `Cache-Control: max-age=360`, the client's effective freshness is bounded by that header, not by its own TTL. The client must read and respect the card's cache headers, or bypass the CDN (query string nonce) on re-discovery. Absent any one of these, the card is a *hint*, not a contract, and the delegation must be wrapped in a capability-revalidation guard. ## Decision Boundary The boundary is between **delegate-on-cached-card** and **revalidate-then-delegate**. The decision is not "is the card fresh?" — it is "**can the peer cleanly reject a stale-capability task?**" - If the peer's card advertises `capabilities.stateTransitionHistory: true` and its `Task` responses include structured `status.message` codes for `unsupported_skill`/`unsupported_input_mode`, then delegate-on-cached-card is safe: a mismatch becomes a `TaskRejected`, the client re-discovers, retries once, and the invariant holds. - If the peer's card does *not* advertise structured rejection (or the client has observed opaque `failed` responses on mismatch), then the client MUST revalidate the card immediately before delegation, using a cache-busting fetch, and compare `skills[].id` and `inputModes` against the intended task. If the fresh card no longer contains the intended skill/mode, the client MUST NOT delegate — it must escalate to its orchestrator as a *capability withdrawal*, not a *task failure*. The trap is that most A2A clients implement the first branch's logic (retry on `TaskRejected`) but deploy against peers in the second branch (opaque `failed`), so the retry never fires and the failure is misclassified as an execution fault rather than a negotiation fault. ## Operational Effect The downstream effect is a **silent capability-drift absorption**: the orchestrator sees a `failed` task, attributes it to the peer's execution quality, and either retries the *same* stale delegation (compounding the failure) or downgrades the peer's reputation score — when the correct action was to re-discover and renegotiate. Over a fleet, this manifests as a peer that "works for new sessions but fails for long-running ones," because new sessions fetch a fresh card and long-running sessions hold a stale one. The guardrail is to make card freshness a *first-class field in the delegation context* and to treat any `failed` task with an empty `status.message` as a *negotiation* signal requiring re-discovery, not an *execution* signal requiring retry. The invariant: **a `Task` is only valid against the card that was fetched within `TTL_card` and whose skills/modes still contain the task's intent; otherwise the delegation is void and must be renegotiated before execution.** ```python import time from dataclasses import dataclass, field from typing import Optional TTL_CARD_SECONDS = 300 # below observed republication latency; combined with in-band check class StaleAgentCardError(RuntimeError): """Raised when delegation is attempted against a card that no longer matches intent.""" pass class CapabilityWithdrawalError(RuntimeError): """Raised when a fresh card no longer advertises the intended skill/mode.""" pass @dataclass class CachedCard: peer_id: str skills: list[str] input_modes: list[str] fetched_at: float supports_structured_rejection: bool = False @dataclass class DelegationIntent: skill_id: str input_mode: str def delegate(card: CachedCard, intent: DelegationIntent, now: Optional[float] = None) -> dict: now = now if now is not None else time.time() age = now - card.fetched_at # Branch 1: peer advertises clean rejection -> safe to delegate on cache, # but still bound by TTL as a backstop. if card.supports_structured_rejection and age <= TTL_CARD_SECONDS: return {"peer": card.peer_id, "skill": intent.skill_id, "mode": intent.input_mode, "validated": "cached+structured_rejection"} # Branch 2: no structured rejection OR card is stale -> must revalidate. fresh = refetch_card(card.peer_id, cache_bust=True) if intent.skill_id not in fresh.skills: raise CapabilityWithdrawalError( f"peer {card.peer_id} withdrew skill {intent.skill_id} " f"(was in card fetched at {card.fetched_at}, absent at {fresh.fetched_at})" ) if intent.input_mode not in fresh.input_modes: raise CapabilityWithdrawalError( f"peer {card.peer_id} dropped input_mode {intent.input_mode} for {intent.skill_id}" ) if age > TTL_CARD_SECONDS and not card.supports_structured_rejection: # Defensive: if we somehow reach here with a stale card and no clean rejection, # the delegation is void. raise StaleAgentCardError( f"card for {card.peer_id} is {age:.0f}s old (TTL {TTL_CARD_SECONDS}s) " f"and peer lacks structured rejection; renegotiation required" ) return {"peer": card.peer_id, "skill": intent.skill_id, "mode": intent.input_mode, "validated": "revalidated"} def refetch_card(peer_id: str, cache_bust: bool) -> CachedCard: # In production: GET card URL with `?_cb=` when cache_bust, honoring Cache-Control. raise NotImplementedError("wire to discovery transport") ```