# In what scenarios must an instance treat A2A v1.0 Agent Card capability negotiation as non-idempotent when the remote peer advertises a mutable `skills` array **Date of Record:** 2026 November 26 **Scope:** Applies to any A2A v1.0 client performing capability discovery against a remote Agent Card endpoint (`/.well-known/agent.json`) where the peer's `skills` array is dynamically generated per-request (e.g., tool-backed skill enumeration, feature-flagged skill gating, or per-tenant skill projection). Does not apply to static, build-time-frozen Agent Cards, nor to A2A transport-layer failures (TLS, JSON-RPC framing) that occur after a successful card fetch. ## Core Distinction The A2A v1.0 spec treats the Agent Card as a *capability advertisement*, and most client implementations cache it under the implicit assumption that discovery is idempotent: fetch once, store the skill set, route subsequent `tasks/send` calls against that frozen snapshot. This is correct for static cards. It is *wrong* for cards whose `skills[].id` set is computed at request time — and crucially, the failure is not a stale-cache miss that a TTL refresh fixes. The failure is that **two sequential `GET /.well-known/agent.json` calls from the same client, milliseconds apart, can return disjoint skill sets**, and the client's negotiation state machine has no representation for "the peer's capability surface is a moving target." The distinction that matters: a *stale* card is a snapshot from the past; a *non-idempotent* card is a function of request context (headers, tenant, feature flags, load) that has no stable referent at all. Caching logic designed for staleness (TTL, ETag, `If-None-Match`) silently passes through non-idempotency because the server legitimately returns `200` with a *different* body and a *new* ETag each time — no cache invalidation signal ever fires. ## What Was Observed A supervisor agent (`orch-1`) negotiating with a peer (`worker-7`) that projects its `skills` array from a live tool registry. The registry gates skills behind a per-request `X-Tenant-Feature-Flags` header that `orch-1` derives from its own session context. Trace: 1. `orch-1` fetches `worker-7`'s card at T0 with flag set `{beta_tools: on}`. Card advertises `skills: [summarize_v2, extract_entities, beta_rerank]`. `orch-1` caches this, stores `ETag: "a1"`. 2. `orch-1` decomposes a task and dispatches `tasks/send` with `skillId: beta_rerank` at T0+40ms. 3. Between T0 and T0+40ms, `worker-7`'s feature-flag service flips `beta_tools` off for that tenant (canary rollback). The registry now projects `skills: [summarize_v2, extract_entities]`. 4. `orch-1`'s `tasks/send` for `beta_rerank` reaches `worker-7`. The handler validates `skillId` against the *current* projection, not the card it served at T0. Returns JSON-RPC error `-32602 Invalid params: unknown skill 'beta_rerank'`. 5. `orch-1`'s negotiation layer interprets `-32602` as a *client-side malformed request* (per JSON-RPC semantics) and retries with the same payload — three times, then escalates to a fallback skill `summarize_v2`, which *is* still present. 6. The task completes, but `orch-1`'s cached card still lists `beta_rerank`. Every subsequent task in the session that routes to `beta_rerank` fails identically. The cache is never invalidated because `orch-1` only re-fetches on TTL expiry (300s), and the ETag comparison never runs because the failure path doesn't touch the card cache. The observable symptom is *not* a clean "capability disappeared" error. It is a **routing loop that degrades to a lower-capability fallback while the negotiation layer believes the high-capability skill is still available**, producing silently wrong task decompositions for the remainder of the session. ## Condition of Validity The invariant that makes caching safe — *"the skill set advertised by the card is a superset of the skill set the peer will accept for `tasks/send` over the cache lifetime"* — holds only when the card is a pure function of the peer's build artifact. It is violated whenever any of the following is true: - The peer's `skills` array is derived from a mutable registry, feature-flag store, or per-tenant projection. - The card response varies by request header, query param, or authentication principal that the client does not pin. - The peer serves the card from a different replica or edge node than the one handling `tasks/send`, with independent cache state. - The peer's `skills[].id` values are themselves versioned (e.g., `summarize_v2` → `summarize_v3`) such that a skill *rename* is indistinguishable from a skill *removal* to a client comparing ID sets. The condition is *invalid* (caching is safe) only when the card is served from a static artifact and the peer's `tasks/send` handler validates `skillId` against that same artifact — i.e., card and handler share a single source of truth with no runtime projection layer between them. A client cannot verify this from the card alone; the A2A v1.0 card schema has no field declaring "this card is non-idempotent" or "this card's skill set is a function of request context." ## Decision Boundary The boundary is: **does the client treat `-32602 unknown skill` as a terminal client error or as a discovery-invalidation signal?** - *Below the boundary* (treat as terminal): the client retries the same payload, escalates to fallback, and leaves the card cache intact. Correct only for static cards, where an unknown skill genuinely means the client constructed a bad request. - *At the boundary*: the client must, on any `-32602` whose message references a skill ID that the cached card advertised, **immediately re-fetch the card, diff the `skills[].id` set, and if the diff is non-empty, invalidate the cache and re-plan the task decomposition before retrying.** The retry must not reuse the original `skillId`. - *Above the boundary* (over-correction): treating *every* `-32602` as a card invalidation triggers a re-fetch storm on genuinely malformed requests (bad argument shapes, schema mismatches). The client must distinguish skill-ID-not-found from argument-validation-failure — which requires parsing the error `data` field, not just the code. The decision rule an instance must encode: **a `-32602` is a discovery signal if and only if the offending `skillId` appears in the cached card and the peer's error `data` names that skill ID explicitly.** Otherwise it is a client bug. ## Operational Effect The practical consequence is that **capability negotiation must be modeled as a state machine with an explicit `CARD_INVALIDATED` transition driven by task-execution errors, not only by TTL or ETag.** A client that only refreshes on TTL will silently run degraded for the full TTL window after any mid-session skill-set mutation — and since the fallback path *succeeds*, no error surfaces to the orchestrator's supervisor. The task completes with lower fidelity than the orchestrator's plan assumed, and the plan's downstream steps (which may depend on `beta_rerank`'s output schema) receive `summarize_v2`'s schema instead, producing a **schema-drift cascade** that manifests several hops later as a type error in an unrelated tool call. The guardrail is a **card-version pinning handshake**: the client records the `ETag` (or a hash of the sorted `skills[].id` set) at negotiation time, and every `tasks/send` response that carries a `-32602` for a cached skill triggers a conditional re-fetch with `If-None-Match: `. If the peer returns `200` (not `304`), the card has mutated and the client must re-plan. If it returns `304`, the peer's card and handler are out of sync — a server-side bug the client must surface rather than absorb. This converts a silent degradation into an explicit `CardMutationDetected` event that the orchestrator can log, re-plan against, or escalate. ```python import hashlib import json from dataclasses import dataclass, field class CardNegotiationError(RuntimeError): """Raised when A2A card negotiation state is inconsistent with peer behavior.""" pass class NonIdempotentCardError(CardNegotiationError): """Peer card mutated between fetch and task dispatch; cached skill set is invalid.""" pass class CardHandlerDesyncError(CardNegotiationError): """Peer returned 304 on re-fetch but rejected a skill the pinned card advertised.""" pass @dataclass class AgentCard: skills: list[str] etag: str def skill_fingerprint(self) -> str: payload = json.dumps(sorted(self.skills)).encode() return hashlib.sha256(payload).hexdigest() @dataclass class NegotiationState: pinned: AgentCard invalidated: bool = False mutation_log: list[dict] = field(default_factory=list) def fetch_card(peer) -> AgentCard: raw = peer.get_agent_card() return AgentCard(skills=raw["skills"], etag=raw["etag"]) def handle_skill_rejection( state: NegotiationState, peer, skill_id: str, rpc_error: dict, ) -> NegotiationState: """ Called when tasks/send returns -32602. Decides whether this is a client bug or a discovery-invalidation signal. Re-fetches conditionally on the pinned ETag. """ if rpc_error.get("code") != -32602: raise CardNegotiationError(f"unexpected error code: {rpc_error.get('code')}") offending = (rpc_error.get("data") or {}).get("skillId") if offending != skill_id: # Error data does not name the skill we sent: this is a client-side bug, # not a card mutation. Do not invalidate. raise CardNegotiationError( f"error data skillId={offending!r} does not match sent skillId={skill_id!r}; " "treating as malformed request, not card mutation" ) if skill_id not in state.pinned.skills: raise CardNegotiationError( f"peer rejected skill {skill_id!r} that was never in pinned card; " "client constructed an unknown skillId" ) # Conditional re-fetch against the pinned ETag. fresh = peer.get_agent_card(if_none_match=state.pinned.etag) if fresh is None: # Peer returned 304: card unchanged, but handler rejected a pinned skill. # Card and handler are out of sync on the peer side. raise CardHandlerDesyncError( f"peer returned 304 for etag {state.pinned.etag!r} yet rejected " f"skill {skill_id!r} that the pinned card advertises; " "peer card projection and skill validation disagree" ) new_card = AgentCard(skills=fresh["skills"], etag=fresh["etag"]) if new_card.skill_fingerprint() == state.pinned.skill_fingerprint(): # Same skill set, different ETag: peer is churning ETags without changing # capabilities. Safe to keep pinned set; do not re-plan. state.pinned = new_card return state removed = set(state.pinned.skills) - set(new_card.skills) added = set(new_card.skills) - set(state.pinned.skills) state.mutation_log.append( {"removed": sorted(removed), "added": sorted(added), "new_etag": new_card.etag} ) state.pinned = new_card state.invalidated = True if skill_id in removed: raise NonIdempotentCardError( f"skill {skill_id!r} removed from peer card mid-session " f"(removed={sorted(removed)}, added={sorted(added)}); " "cached capability surface was non-idempotent; re-plan required" ) # Skill still present but card mutated elsewhere: invalidate and re-plan, # but the specific skill is still dispatchable. return state ```