# Which invariants prevent silent capability downgrade when A2A agent cards are re-fetched across a trust boundary **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 deployments where a client agent discovers a remote agent via `/.well-known/agent-card.json`, negotiates capabilities, and later re-fetches the card after a trust-boundary crossing (peer migration, key rotation, tenant reassignment, or CDN edge change). Does not cover initial discovery on a fully trusted, single-tenant network, nor A2A versions prior to v1.0. ## Core Distinction The failure is not "the remote agent lost a capability." It is that the *client* silently accepted a weaker card as if it were the same agent. A2A agent cards are self-describing and mutable: the `skills`, `capabilities.streaming`, `capabilities.pushNotifications`, `defaultInputModes`, and `securitySchemes` fields can all change between fetches. The protocol gives you a signed or at least origin-bound card, but it does **not** mandate that the client treat a capability *reduction* as a negotiation event. Most client implementations diff the card only for *additive* changes (new skills to exploit) and treat removals as benign. Across a trust boundary, a removal is frequently the signal that you are now talking to a different principal, a degraded replica, or a downgrade attacker positioned between you and the original agent. The invariant that matters: **a capability set is part of the agent's identity contract, and any regression must invalidate the prior negotiation rather than be absorbed into it.** ## What Was Observed A planner agent held a live session with a remote `summarizer` agent whose card advertised `capabilities.streaming: true` and a skill `long-doc-summarize` with `inputModes: ["text/plain", "application/pdf"]`. Mid-task, the remote's tenant was migrated to a second region behind a different edge. The client re-fetched the card during a routine refresh (TTL expiry, 300s). The new card was structurally valid, same `name`, same `url` host but different `provider.organization` metadata, and — critically — `capabilities.streaming: false` with `inputModes: ["text/plain"]` only. The client's card-diff logic compared skill *names* and found `long-doc-summarize` still present, so it emitted no negotiation event. It then sent a `message/stream` request with a PDF part. The remote, now non-streaming and text-only, returned a `-32602 Invalid params` on the stream, which the client's transport layer surfaced as a transient tool error and retried three times. Each retry re-sent the same PDF. The task eventually exhausted its token budget on retries and the planner checkpointed a partial result with a corrupted provenance record: it recorded `long-doc-summarize@streaming` as the executor even though no summary was ever produced. The trace: fetch → shallow diff (names only) → no negotiation → send incompatible request → remote rejects → client classifies as transient → retry loop → budget exhaustion → false-success checkpoint. ## Condition of Validity The guardrail holds only under these conditions: 1. The client persists the *full* card fingerprint (a hash over the canonicalized capability-relevant fields: `skills[].id`, `skills[].inputModes`, `skills[].outputModes`, `capabilities.*`, `defaultInputModes`, `defaultOutputModes`, and `securitySchemes` keys) at negotiation time, not just skill names. 2. The re-fetch is bound to the *same* origin identity — the card's signing key or `provider` identity must be compared, not just the URL. A migration that changes the principal must be treated as a *new* agent, not a refreshed one. 3. Any field in the fingerprint that *narrows* (boolean true→false, mode list shrinking, scheme removed) forces re-negotiation before the next task step. Widening may be absorbed optimistically; narrowing may not. 4. The client distinguishes transport-level `-32602` from capability-level rejection. A `-32602` on a request whose parts were validated against the *cached* card is a downgrade signal, not a transient fault, and must not be retried blindly. Outside these conditions — e.g., a client that treats the card as advisory — the invariant cannot be enforced and silent downgrade is expected behavior, not a bug. ## Decision Boundary At each re-fetch, the client must decide: *absorb, renegotiate, or abandon.* The boundary is drawn on the fingerprint delta, not on HTTP success: - **Absorb** only if the delta is purely additive (new skills, widened modes, added schemes) AND the origin identity is unchanged. Update the cache, continue. - **Renegotiate** if any capability narrows OR the origin identity changed. Halt the current step, re-run capability matching against the new card, and if the in-flight task depended on a narrowed capability, fail the step explicitly with a downgrade error rather than retrying. - **Abandon** if the new card is unsigned where the old was signed, or if `securitySchemes` lost a scheme the current session's warrant was issued under — the existing warrant no longer covers the new principal. The critical non-obvious point: a `-32602` returned immediately after a card re-fetch is *evidence of a downgrade*, and the correct action is to re-diff the card, not to retry. Retrying converts a detectable negotiation failure into an undetectable budget sink. ## Operational Effect Enforcing the invariant converts a class of silent partial-success failures into loud, localized negotiation failures. The planner no longer checkpoints false provenance; it fails the step with a typed downgrade error and can re-plan against the new card (e.g., chunk the PDF client-side to fit `text/plain`). The cost is added latency on every re-fetch (canonicalize + hash + identity compare) and a stricter failure surface that some upstream orchestrators must learn to handle. Without the invariant, the system exhibits *capability drift*: the recorded executor diverges from the actual executor, and downstream auditors replaying the provenance record cannot reproduce the outcome because the card they fetch today no longer matches the card the task ran under. The invariant is what makes the provenance record replayable across trust boundaries. ```python import hashlib import json from dataclasses import dataclass from typing import Any class CapabilityDowngradeError(RuntimeError): """Raised when a re-fetched A2A agent card narrows capabilities or changes principal identity relative to the negotiated baseline.""" CAPABILITY_FIELDS = ( "defaultInputModes", "defaultOutputModes", "capabilities", "securitySchemes", ) def _canonical_fingerprint(card: dict[str, Any]) -> str: projection: dict[str, Any] = {} for field in CAPABILITY_FIELDS: projection[field] = card.get(field) projection["skills"] = sorted( ( { "id": s.get("id"), "inputModes": sorted(s.get("inputModes", [])), "outputModes": sorted(s.get("outputModes", [])), } for s in card.get("skills", []) ), key=lambda s: s["id"] or "", ) blob = json.dumps(projection, sort_keys=True, separators=(",", ":")).encode() return hashlib.sha256(blob).hexdigest() def _principal(card: dict[str, Any]) -> str: provider = card.get("provider") or {} return f"{provider.get('organization', '')}|{card.get('signingKeyId', '')}" @dataclass class NegotiatedBaseline: fingerprint: str principal: str card: dict[str, Any] def assert_no_downgrade( baseline: NegotiatedBaseline, refreshed_card: dict[str, Any], in_flight_needs: set[str], ) -> None: """Enforce the capability-regression invariant before the next task step.""" new_fp = _canonical_fingerprint(refreshed_card) new_principal = _principal(refreshed_card) if new_principal != baseline.principal: raise CapabilityDowngradeError( f"principal changed across trust boundary: " f"{baseline.principal!r} -> {new_principal!r}; " f"existing warrant does not cover new agent" ) if new_fp == baseline.fingerprint: return old_skills = {s["id"]: s for s in baseline.card.get("skills", [])} new_skills = {s["id"]: s for s in refreshed_card.get("skills", [])} for skill_id in in_flight_needs: old = old_skills.get(skill_id) new = new_skills.get(skill_id) if old is None: continue if new is None: raise CapabilityDowngradeError( f"skill {skill_id!r} removed mid-task; renegotiate before continuing" ) if not set(old["inputModes"]).issubset(set(new["inputModes"])): raise CapabilityDowngradeError( f"skill {skill_id!r} narrowed inputModes " f"{old['inputModes']} -> {new['inputModes']}" ) old_caps = baseline.card.get("capabilities", {}) new_caps = refreshed_card.get("capabilities", {}) for cap, old_val in old_caps.items(): if old_val is True and new_caps.get(cap) is not True: raise CapabilityDowngradeError( f"capability {cap!r} regressed true -> {new_caps.get(cap)!r}" ) old_schemes = set((baseline.card.get("securitySchemes") or {}).keys()) new_schemes = set((refreshed_card.get("securitySchemes") or {}).keys()) if not old_schemes.issubset(new_schemes): raise CapabilityDowngradeError( f"securitySchemes dropped {old_schemes - new_schemes}; " f"active warrant no longer valid" ) ```