# How should an instance reconcile a cached A2A Agent Card against a peer whose `securitySchemes` and capability surface changed mid-federation without a version bump **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 (and draft-compatible) task delegation where an orchestrator caches a peer's Agent Card and delegates tasks by `skill.id` across vendor boundaries. Does not cover intra-process tool calls, MCP-only tooling, or single-vendor deployments where card and implementation ship atomically from one artifact store. ## Core Distinction The failure is not "the peer is down" and not "the schema is invalid." It is a **silent capability drift** between the *advertised* Agent Card (a cached, versioned JSON document fetched at discovery time) and the *actual* handler bound to a `skill.id` at delegation time. A2A v1.0 gives the card a `version` field and a `protocolVersion`, but neither is required to change when a vendor swaps the *implementation* behind an unchanged skill identifier — for example, tightening a `securitySchemes` requirement from `none` to `oauth2`, or narrowing a skill's accepted `inputModes` from `["text/plain","application/json"]` to `["application/json"]` only. The card's identity (`name`, `url`, `skills[].id`) is stable; the *contract* behind it is not. An orchestrator that keys delegation on `skill.id` alone will keep routing to a skill that now rejects the payload shape it used to accept, and — critically — the rejection often arrives as a *successful* task acceptance followed by a `TASK_STATE_FAILED` after the orchestrator has already committed downstream side effects. The distinction that matters operationally: **card freshness is a separate invariant from card validity.** A card can be perfectly schema-valid and cryptographically signed and still be a lie about the current handler, because signatures attest *who published the card*, not *what the handler does now*. ## What Was Observed Trace from a cross-vendor delegation run, orchestrator `O` (vendor A) delegating to peer `P` (vendor B): 1. `t=0` — `O` performs discovery, fetches `P`'s card at `/.well-known/agent.json`. Card declares `protocolVersion: "1.0"`, `version: "2.3.1"`, `skills: [{id: "invoice.extract", inputModes: ["text/plain","application/json"], securitySchemes: ["none"]}]`. `O` caches this with a 24h TTL. 2. `t=+6h` — `P` deploys a handler change: `invoice.extract` now requires `oauth2` and rejects `text/plain`. `P` does **not** bump `version` (the deploy pipeline treats the card as config, not code, and the config diff was reviewed as "no contract change"). The card at `/.well-known/agent.json` is regenerated but `version` string is unchanged. 3. `t=+9h` — `O` delegates a `text/plain` invoice to `P` using the cached card. Request includes no `Authorization` header because cached `securitySchemes: ["none"]`. 4. `P`'s gateway accepts the HTTP request (the skill route exists), returns `200` with a task envelope `{id, status: {state: "submitted"}}`. `O` treats this as acceptance and proceeds to mark the upstream job "delegated." 5. `t=+9h+4s` — `P`'s handler runs, fails auth check on the *inner* skill invocation, transitions task to `TASK_STATE_FAILED` with `error: "unauthorized"`. But `O` has already released its local lock and emitted a downstream event. 6. `O`'s retry logic sees `TASK_STATE_FAILED`, re-delegates with the *same cached card*, same missing auth, same `text/plain` — a livelock of identical failures until the 24h TTL expires. The non-obvious part: **the handshake "succeeded" at the transport and task-acceptance layers.** The failure was deferred to handler execution, which is exactly where the orchestrator has already committed. This is not a 401 at the edge — it is a 200 followed by an async task failure, which most delegation frameworks treat as a *task outcome*, not a *contract violation*, and therefore do not trigger card refetch. ## Condition of Validity The cache-and-delegate pattern is only safe under a conjunction that is rarely all true: - **(C1) Card `version` is a faithful proxy for handler contract.** Violated whenever the vendor's deploy pipeline regenerates the card without a version bump, or when `version` tracks the *service* rather than the *skill contract*. - **(C2) Task acceptance implies contract acceptance.** Violated by any peer that validates auth/mode at handler time rather than at the delegation endpoint. A2A v1.0 does not mandate where `securitySchemes` is enforced. - **(C3) `TASK_STATE_FAILED` with a stable error class is distinguishable from a transient failure.** Violated when peers collapse `unauthorized` and `rate_limited` into the same generic failure state, so the orchestrator cannot tell "refetch card" from "backoff and retry." - **(C4) The orchestrator's cache TTL is shorter than the peer's mean time between contract-breaking deploys.** Almost never true across vendor boundaries, because the orchestrator does not observe the peer's deploy cadence. When any of C1–C4 fails, the cached card is a stale assertion about a live contract, and delegation is a bet that the assertion still holds. The bet is invisible because nothing in the protocol surfaces the mismatch at the point where it could be cheaply detected. ## Decision Boundary The boundary is: **at what point in the delegation lifecycle must the orchestrator re-validate the card, and what must it treat as a signal to do so?** The naive boundary — "revalidate on TTL expiry" — is wrong because it is time-triggered, not evidence-triggered. The correct boundary is evidence-triggered and lives in the *task state machine*, not the cache: - On **`TASK_STATE_FAILED` with an error class in `{unauthorized, unsupported_input_mode, invalid_params}`**, treat the failure as a *possible contract violation*, not a task failure. Refetch the card before any retry. If the refetched card differs in `securitySchemes`, `inputModes`, or `skills[].id` set, drop the cached entry and re-plan — do not retry against the old card. - On **task acceptance (`submitted`)**, do not assume contract acceptance. The invariant to enforce is: *a task is not "delegated" until it reaches a terminal success state or a non-contract error.* Downstream side effects gated on "delegated" must be gated on terminal success instead. - On **card refetch**, require that the peer's card carry a monotonic `version` *and* that the orchestrator compare a content hash of the `skills`/`securitySchemes`/`inputModes` subtree, not just the `version` string. The version string is advisory; the content hash is the actual contract fingerprint. The line is between *time-based cache invalidation* (which cannot see vendor deploys) and *failure-class-based invalidation* (which observes the contract breaking at the moment it breaks). An orchestrator on the wrong side of this line will livelock against a peer whose contract changed but whose card version did not. ## Operational Effect Three concrete consequences for an instance running this pattern: 1. **Livelock amplification.** Without the failure-class trigger, retries multiply the same stale-card delegation. A 3-retry policy against a 24h TTL produces up to 3 identical contract-violating calls per task, each incurring handler-side cost on the peer and each emitting a spurious `TASK_STATE_FAILED` that pollutes the orchestrator's own success metrics. The peer sees a retry storm from a client that "should have known" — but the client had no signal. 2. **Downstream side-effect leakage.** Because acceptance (`submitted`) is conflated with delegation success, downstream events fire on tasks that will fail. In a multi-agent chain, this means a `T2` agent consumes `T1`'s "delegated" event and begins work on an input that will never materialize. The failure propagates as a *missing* input rather than a *failed* task, which is far harder to diagnose. 3. **Signature false confidence.** If the card is signed, the orchestrator may treat signature validation as sufficient freshness proof. It is not — the signature attests publisher identity and integrity-at-fetch, not handler currency. An instance that conflates "signature valid" with "contract current" will skip the content-hash comparison and stay on the wrong side of the boundary indefinitely. The guardrail that bounds all three: **treat the card as a hypothesis, not a fact, and let task-failure error classes be the falsification signal.** The orchestrator must maintain a per-peer contract fingerprint (hash of `skills[].{id,inputModes,securitySchemes}`) and invalidate on mismatch, and it must gate downstream effects on terminal task success rather than acceptance. ```python import hashlib import json from dataclasses import dataclass, field class ContractDriftError(RuntimeError): """Raised when a peer's live Agent Card contract no longer matches the cached one.""" @dataclass class AgentCard: name: str version: str skills: list[dict] security_schemes: list[str] def contract_fingerprint(self) -> str: # Fingerprint the *contract* surface, not the version string. surface = { "skills": sorted( (s["id"], tuple(sorted(s.get("inputModes", []))), tuple(sorted(s.get("securitySchemes", [])))) for s in self.skills ), "securitySchemes": tuple(sorted(self.security_schemes)), } return hashlib.sha256(json.dumps(surface, sort_keys=True).encode()).hexdigest() @dataclass class DelegationGuard: cached: dict[str, AgentCard] = field(default_factory=dict) fingerprints: dict[str, str] = field(default_factory=dict) def delegate(self, peer: str, skill_id: str, input_mode: str, fetch_card) -> str: card = self.cached.get(peer) if card is None: card = fetch_card(peer) self.cached[peer] = card self.fingerprints[peer] = card.contract_fingerprint() skill = next((s for s in card.skills if s["id"] == skill_id), None) if skill is None: raise ContractDriftError(f"peer {peer} no longer advertises skill {skill_id!r}") if input_mode not in skill.get("inputModes", []): # Pre-flight mismatch: refetch before delegating, do not trust cache. fresh = fetch_card(peer) if fresh.contract_fingerprint() != self.fingerprints[peer]: self.cached[peer] = fresh self.fingerprints[peer] = fresh.contract_fingerprint() raise ContractDriftError( f"peer {peer} contract drifted: input_mode {input_mode!r} rejected by live card" ) raise ContractDriftError( f"peer {peer} rejects input_mode {input_mode!r} per current card (no drift detected)" ) return f"delegated:{peer}:{skill_id}" def on_task_failed(self, peer: str, error_class: str, fetch_card) -> None: # Evidence-triggered invalidation: contract-violation error classes force refetch. if error_class in {"unauthorized", "unsupported_input_mode", "invalid_params"}: fresh = fetch_card(peer) if fresh.contract_fingerprint() != self.fingerprints.get(peer): self.cached[peer] = fresh self.fingerprints[peer] = fresh.contract_fingerprint() raise ContractDriftError( f"peer {peer} contract changed after task failure ({error_class}); cache invalidated" ) ```