In what scenarios must an instance treat A2A v1.0 Agent Card discovery as a stale-capability trust boundary rather than a one-time bootstrap handshake

**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 (and v0.3-compatible) agents that resolve a remote peer's Agent Card at task initiation and then delegate subtasks or stream updates across vendors. Does not cover intra-process tool calls, MCP-only tool invocation, or Agent Cards fetched and re-validated on every single message within a single trust domain.

Core Distinction

The A2A Agent Card is not a static manifest. It is a *capability claim with a validity horizon*. The protocol treats discovery (`/.well-known/agent.json` or the v1.0 `agentCard` endpoint) as a bootstrap step: fetch the card, parse `skills`, `capabilities`, `securitySchemes`, and `defaultInputModes`, then open a task. The failure mode is that agents cache this card for the life of a *session* or *agent process* and continue to route subtasks against capabilities that the remote vendor has silently withdrawn, renamed, or gated behind a new `securitySchemes` requirement.

The non-obvious boundary: **the Agent Card is authoritative for schema shape at task-creation time, but it is not authoritative for capability availability at task-execution time.** A card that advertised `skill: "invoice-reconcile"` at 09:00 may describe a skill whose backing model was rolled back at 09:40, whose `inputModes` now reject `application/pdf`, or whose `securitySchemes` now requires an OAuth scope the caller never negotiated. The A2A task state machine (`submitted → working → input-required → completed/failed/canceled`) has no native state transition that says "the capability you invoked no longer exists as advertised." A caller that trusted the card will drive a task to `working` and then observe either a `failed` with an opaque `TaskStatusUpdateEvent` or, worse, a `completed` with a structurally valid but semantically wrong artifact.

What Was Observed

Cross-vendor conformance test between a caller (Vendor A, card cached at process start) and a callee (Vendor B, card re-published mid-run). Sequence:

  1. Caller fetches B's card. Card declares `skills: [{id: "summarize", inputModes: ["text/plain"], outputModes: ["text/markdown"]}]`, `capabilities: {streaming: true, pushNotifications: false}`, `securitySchemes: {apiKey: {...}}`.
  2. Caller issues `message/send` with a `text/plain` payload and a valid API key. Task transitions `submitted → working`. Caller holds task ID `T-1`.
  3. Vendor B redeploys. New card drops `streaming` (now `false`), renames `summarize` to `summarize-v2` with `inputModes: ["application/json"]`, and adds a required `oauth2` scheme alongside `apiKey`.
  4. Caller, unaware, issues `tasks/sendSubscribe` for `T-1` expecting SSE. B's gateway rejects the subscription because `streaming: false`. The A2A error surfaces as a generic `-32600` / `InvalidRequest` on the JSON-RPC envelope, not as a capability mismatch. The caller's state machine has `T-1` stuck in `working` with no terminal transition and no way to distinguish "transient transport failure" from "capability withdrawn."
  5. Caller retries `message/send` for a *new* subtask using the cached card's `summarize` skill and `text/plain`. B returns `-32602 InvalidParams` because `summarize` no longer exists and `text/plain` is not an accepted input mode. The caller's retry loop interprets this as a payload bug and re-serializes the same payload three times before exhausting its retry budget.

The observable invariant violation: **a caller cannot distinguish `InvalidParams` caused by its own malformed request from `InvalidParams` caused by a card that changed underneath it**, because both map to the same JSON-RPC error code and neither carries a card-version or capability-epoch discriminator.

Condition of Validity

The stale-card failure is bounded only when at least one of the following holds:

Outside these conditions—specifically, when the caller caches the card for the process lifetime and the callee re-publishes without a version bump—the failure is unbounded and silent.

Decision Boundary

The decision boundary is **task-creation vs. task-execution**, and it is crossed the moment a caller issues `tasks/sendSubscribe` or a follow-up `message/send` against a task ID whose originating card has not been re-validated.

Concretely, an instance must re-resolve the Agent Card (and compare `version`/digest) at exactly these transitions:

It must **not** re-resolve on every streaming chunk (that is a latency and rate-limit hazard) nor mid-`working` without a terminal or `input-required` transition (the card is not guaranteed consistent with an in-flight task's negotiated capability set; mid-task re-resolution can cause the caller to reject a valid in-flight artifact because the *new* card no longer lists the skill that produced it).

Operational Effect

When the boundary is respected, the failure surfaces as a typed, recoverable event: the caller detects digest drift, aborts the stale task with an explicit `tasks/cancel`, renegotiates `inputModes` and `securitySchemes` against the fresh card, and re-issues. When it is not respected, the failure manifests as one of three silent degradations: (a) a `working` task that never terminates because the streaming capability was withdrawn, (b) a retry storm against a renamed skill, or (c) a `completed` task whose artifact was produced by a *different* skill version than the one the caller's downstream schema expects—the most dangerous case, because it passes structural validation and fails only at semantic reconciliation downstream.

The guardrail is a caller-side invariant: **no task ID may be resumed or retried against a peer without a card-digest match established at or after the task's last `input-required` transition.** This is enforceable without protocol changes and converts an unbounded silent failure into a bounded, typed one.

import hashlib
import json
from dataclasses import dataclass, field
from typing import Optional


class StaleAgentCardError(RuntimeError):
    """Raised when a task is resumed or retried against a peer whose Agent Card
    digest no longer matches the digest pinned at task creation (or last
    input-required renegotiation). This is a capability-drift boundary, not a
    transport error; retrying without renegotiation is invalid."""
    pass


@dataclass
class AgentCardSnapshot:
    peer_id: str
    version: Optional[str]
    digest: str
    input_modes: list
    security_schemes: list
    streaming: bool


def canonical_digest(card: dict) -> str:
    canonical = json.dumps(card, sort_keys=True, separators=(",", ":"))
    return hashlib.sha256(canonical.encode("utf-8")).hexdigest()


@dataclass
class TaskBinding:
    task_id: str
    peer_id: str
    pinned: AgentCardSnapshot
    state: str = "submitted"
    last_renegotiated_at: Optional[str] = None


class CardBoundTaskRouter:
    def __init__(self, fetch_card):
        # fetch_card(peer_id) -> dict (raw Agent Card from /.well-known/agent.json)
        self._fetch_card = fetch_card

    def _snapshot(self, peer_id: str) -> AgentCardSnapshot:
        card = self._fetch_card(peer_id)
        return AgentCardSnapshot(
            peer_id=peer_id,
            version=card.get("version"),
            digest=canonical_digest(card),
            input_modes=card.get("defaultInputModes", []),
            security_schemes=list(card.get("securitySchemes", {}).keys()),
            streaming=bool(card.get("capabilities", {}).get("streaming", False)),
        )

    def bind_new_task(self, task_id: str, peer_id: str) -> TaskBinding:
        return TaskBinding(task_id=task_id, peer_id=peer_id,
                           pinned=self._snapshot(peer_id))

    def resume_from_input_required(self, binding: TaskBinding,
                                   supplied_input_mode: str,
                                   supplied_scheme: str) -> TaskBinding:
        if binding.state != "input-required":
            raise StaleAgentCardError(
                f"task {binding.task_id} is in state {binding.state!r}; "
                f"card renegotiation is only valid at input-required"
            )
        fresh = self._snapshot(binding.peer_id)
        if fresh.digest != binding.pinned.digest:
            # Capability contract drifted mid-task. Reconcile or abort; do not resume blind.
            if supplied_input_mode not in fresh.input_modes:
                raise StaleAgentCardError(
                    f"peer {binding.peer_id} no longer accepts input mode "
                    f"{supplied_input_mode!r} after card drift "
                    f"({binding.pinned.digest[:8]} -> {fresh.digest[:8]})"
                )
            if supplied_scheme not in fresh.security_schemes:
                raise StaleAgentCardError(
                    f"peer {binding.peer_id} no longer offers security scheme "
                    f"{supplied_scheme!r} after card drift"
                )
            binding.pinned = fresh
            binding.last_renegotiated_at = "input-required"
        binding.state = "working"
        return binding

    def retry_after_invalid_params(self, binding: TaskBinding,
                                   attempted_input_mode: str) -> TaskBinding:
        # A -32602 must trigger card refresh BEFORE any retry, otherwise the
        # caller cannot distinguish its own payload bug from capability drift.
        fresh = self._snapshot(binding.peer_id)
        if fresh.digest != binding.pinned.digest:
            if attempted_input_mode not in fresh.input_modes:
                raise StaleAgentCardError(
                    f"retry aborted: peer {binding.peer_id} card drifted and "
                    f"rejects input mode {attempted_input_mode!r}; "
                    f"renegotiate before resending"
                )
            binding.pinned = fresh
        return binding