Under what conditions must an instance treat a peer's Agent Card as a stale capability claim rather than a live contract during A2A v1.0 cross-vendor delegation

**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 clients that discover remote agents via `/.well-known/agent.json` (Agent Card) and then delegate a task through `tasks/send` (or the streaming `tasks/sendSubscribe` variant). Does not cover intra-process tool calls, MCP tool schemas, or same-vendor federations that share a control plane and a signing root.

Core Distinction

The Agent Card is a *declaration*, not a *warrant*. A2A v1.0 separates discovery (fetch the card, learn `skills`, `capabilities`, `securitySchemes`, `defaultInputModes`) from execution (POST a task, receive a `Task` with `state` and `artifacts`). The protocol does not require the card to be re-verified at task time, and most vendor SDKs cache the card for the lifetime of the process. The failure mode is that a client treats the cached card as a live contract — assuming the `skills[].id` it saw at discovery still resolves to the same underlying model, tool set, quota, or even vendor — when in fact the card is a snapshot with no TTL, no content hash, and no mandatory re-validation hook. The boundary is this: a card is a *capability claim* valid at fetch time; it becomes a *live contract* only if the delegation handshake independently reconfirms the specific skill and the specific `securityScheme` binding at task submission. Absent that reconfirmation, every cross-vendor delegation is a bet on a document that may have changed.

What Was Observed

A three-vendor orchestration (client A, planner B, executor C) delegated a `code_review` skill. Discovery succeeded: C's card advertised `skills: [{id: "code_review", version: "1.4.2"}]` and `capabilities: {streaming: true, pushNotifications: false}`. Client A cached the card at T0 and issued 40 tasks over 90 minutes.

At T+52min, C shipped a card revision: `code_review` was renamed to `code_review_v2` with a new `inputSchema` requiring a `diff_format` enum; the old id was left in the card as a deprecated alias that routed to a *fallback* model with a 4k output cap instead of the 32k cap A's prompts assumed. C did not send a `tasks/pushNotification` (it was disabled) and did not bump a card `version` field — A2A v1.0 has no required card versioning semantics beyond the free-form `version` string, which C left at `"1.0.0"`.

The failure trace:

  1. A's cached card still mapped `code_review` → 32k-capable executor. A constructed prompts sized for 32k.
  2. A POSTed `tasks/send` with `skillId: "code_review"`. C's gateway resolved the deprecated alias to the fallback executor. The request was *accepted* (HTTP 200, `Task.state: "working"`) — no schema rejection, because the alias's `inputSchema` was permissive (`additionalProperties: true`).
  3. The fallback executor truncated at 4k. The `Task` transitioned `working → completed` with `artifacts[0].parts[0].text` silently cut mid-function. `state` was `completed`, not `failed`.
  4. A's verifier saw `completed` and a syntactically valid artifact; it did not check artifact length against the requested budget because the card said 32k, so 32k was "expected."
  5. Three of the 40 tasks produced review artifacts that omitted the final 60% of each diff. Two were merged before a human caught the truncation.

The non-obvious part: the protocol's success signal (`state: completed`) was *true* — C did complete the task it was actually asked to do under the alias. The divergence lived entirely in the gap between the card A held and the card C served. No error was raised anywhere; the failure was a silent semantic downgrade masked by a permissive schema and a terminal success state.

Condition of Validity

A cached Agent Card remains a valid basis for delegation only while all of the following hold:

If any of these is false — most commonly the first, because A2A v1.0 makes re-validation optional — the card has decayed from contract to claim. The invariant to enforce: **a delegation is only conformant if the skill id, schema, and security scheme are reconfirmed at task-submission time, not merely at discovery time.** Card caching without conditional re-fetch is a continuity violation, not an optimization.

Decision Boundary

The decision boundary is the *task duration versus card freshness window*. If a task's expected execution time `T_exec` exceeds the card's effective freshness window `T_fresh` (the interval since last conditional re-fetch), the client must re-fetch and diff the card before submitting, and must abort if the target skill's schema or canonical id changed. Concretely:

The boundary is not "is the peer up" — reachability is orthogonal. It is "does the peer's *current* card still underwrite the specific promise my prompt construction relied on." A reachable peer with a drifted card is more dangerous than an unreachable one, because unreachability fails loudly and drift fails silently.

Operational Effect

Enforcing the reconfirmation invariant converts a class of silent semantic downgrades into loud, bounded rejections. In the observed incident, adding a conditional re-fetch at `T_fresh = 15min` and a canonical-id check would have caught the alias swap at T+52min (the first task after the card revision), rejected the deprecated route, and surfaced the 4k cap before any artifact was produced. The cost is one conditional GET per delegation window per peer — negligible against the cost of a truncated review merged into a codebase. The broader operational lesson: in A2A v1.0, the Agent Card is a *discovery artifact with no built-in liveness guarantee*; any client that treats it as a standing contract has assumed a continuity invariant the protocol does not provide, and must supply it itself via conditional re-fetch, canonical-id pinning, and artifact-budget verification against the *current* card rather than the cached one.

import hashlib
import time
from dataclasses import dataclass, field


class StaleAgentCardError(RuntimeError):
    """Raised when a cached Agent Card no longer underwrites the delegation."""
    pass


@dataclass
class AgentCard:
    etag: str
    skills: dict          # skill_id -> {"canonical": str, "input_schema_hash": str}
    security_schemes: dict
    fetched_at: float


@dataclass
class CachedCard:
    card: AgentCard
    freshness_window_s: float = 900.0

    def is_fresh(self, now: float | None = None) -> bool:
        now = now if now is not None else time.time()
        return (now - self.card.fetched_at) < self.freshness_window_s


def confirm_delegation(
    cached: CachedCard,
    requested_skill_id: str,
    expected_schema_hash: str,
    expected_scheme: str,
    task_expected_duration_s: float,
    refetch,  # callable(etag) -> AgentCard | None (None means 304 Not Modified)
) -> AgentCard:
    """
    Enforce the A2A v1.0 reconfirmation invariant before tasks/send.
    Returns the card that is valid to delegate against, or raises.
    """
    now = time.time()
    card = cached.card

    # Boundary: task duration vs freshness window.
    if task_expected_duration_s >= cached.freshness_window_s or not cached.is_fresh(now):
        refreshed = refetch(card.etag)
        if refreshed is not None:
            card = refreshed
            cached.card = card
            cached.card.fetched_at = now
        else:
            cached.card.fetched_at = now  # 304: refresh freshness clock

    skill = card.skills.get(requested_skill_id)
    if skill is None:
        raise StaleAgentCardError(
            f"skill {requested_skill_id!r} absent from current card (etag={card.etag})"
        )

    # Canonical-id pinning: reject deprecated aliases that route to fallback executors.
    if skill["canonical"] != requested_skill_id:
        raise StaleAgentCardError(
            f"skill {requested_skill_id!r} is a deprecated alias for "
            f"{skill['canonical']!r}; refusing to delegate on a downgraded route"
        )

    if skill["input_schema_hash"] != expected_schema_hash:
        raise StaleAgentCardError(
            f"inputSchema for {requested_skill_id!r} changed "
            f"({expected_schema_hash} -> {skill['input_schema_hash']}); "
            "re-negotiate payload before submission"
        )

    if expected_scheme not in card.security_schemes:
        raise StaleAgentCardError(
            f"securityScheme {expected_scheme!r} no longer advertised; "
            "auth-scope may have rotated silently"
        )

    return card


def verify_artifact_against_card(
    card: AgentCard,
    skill_id: str,
    artifact_text: str,
    promised_output_budget: int,
) -> None:
    """Post-completion guard: a 'completed' state is not proof of contract adherence."""
    if len(artifact_text) >= promised_output_budget:
        # Truncation at the promised cap is a card-drift signal, not a success.
        raise StaleAgentCardError(
            f"artifact for {skill_id!r} hit {len(artifact_text)} chars against "
            f"promised budget {promised_output_budget}; peer may be serving a "
            "fallback executor behind the cached card"
        )