What happens when an instance negotiates capability from a cached Agent Card that has silently drifted from the live A2A endpoint
**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 clients that discover peer agents via Agent Card retrieval, cache the card, and later initiate tasks or delegate subtasks against the cached capability declaration. Does not apply to single-shot discovery where the card is fetched and consumed within the same request lifecycle, nor to agents that re-validate the card on every invocation.
Core Distinction
The Agent Card in A2A v1.0 is a *declaration*, not a *contract*. It is a JSON document served at `/.well-known/agent.json` that advertises skills, input/output modalities, authentication schemes, and protocol version. Nothing in the spec binds the live task endpoint to the card's contents at execution time. A client that treats the cached card as an authoritative capability warrant — rather than a hint subject to revalidation — will construct task payloads against a skill surface that may no longer exist, may have narrowed its accepted schema, or may have changed its authentication posture. The failure is not a transport error and not a schema-validation error at the card layer; it is a *semantic* mismatch that surfaces only when the remote agent rejects or misinterprets the dispatched task.
The distinction that matters: **card drift** (the served document changing between fetches) is a well-understood cache-invalidation problem. **Card-vs-endpoint divergence** (the served document being internally consistent but no longer describing what the endpoint actually accepts) is not detectable by cache invalidation at all, because the card is fresh. You can fetch the card one millisecond before dispatch and still hit this boundary, because the divergence lives between the card and the handler, not between two versions of the card.
What Was Observed
A coordinating agent (`orchestrator`) cached a downstream agent's card (`summarizer@vendor-b`) at cold start. The card declared a skill `summarize` with `inputModes: ["text/plain", "application/json"]` and an input schema whose `maxTokens` parameter was typed as `integer` with no upper bound. The orchestrator's negotiation logic read this and set its internal `summarizer.max_input_tokens` to the model's context limit (128000), reasoning that the remote would accept any integer.
Six hours later, `vendor-b` deployed a rate/quota guard: the handler now rejects any `maxTokens > 16384` with a `TaskError` of type `InvalidParams`, *but the served Agent Card was not updated* — the schema still declares unbounded `integer`. The card is fresh (ETag unchanged because the card file was not touched), internally valid, and passes the orchestrator's JSON-Schema validation of the card itself. The divergence is between the card's *type-level* permissiveness and the endpoint's *value-level* constraint.
The orchestrator dispatched a task with `maxTokens: 65536`. The remote returned a well-formed A2A `Task` object in state `failed` with `status.message.parts[0].text` containing a human-readable string like `"maxTokens exceeds allowed maximum"`. Because the orchestrator's error-handling path only distinguished `rejected` (auth) from `failed` (task-level), it classified this as a transient task failure and retried with the *same* payload three times under exponential backoff, exhausting its retry budget and then marking the entire `summarizer` capability as `degraded` in its local registry — a false negative that persisted for the rest of the session.
The compounding effect: the orchestrator's planner, seeing `summarizer: degraded`, rerouted all summarization subtasks to a fallback agent with lower quality. No error was ever raised to the operator. The system ran "successfully" with a silent quality regression for 40 minutes.
Condition of Validity
The invariant that bounds this failure is: **a cached Agent Card is valid only for the set of task payloads whose parameters fall within the intersection of (a) the card's declared schema and (b) the endpoint's actual accepted domain — and (b) is not observable from (a).** Therefore any client that derives a *value-level* constraint (numeric bounds, enum membership, string length, modality combinations) from a *type-level* declaration is operating outside the card's guarantee.
The condition under which the failure triggers precisely:
- The card declares a parameter with a permissive type and no explicit constraint (or a constraint looser than the handler's).
- The client's negotiation step *derives* a concrete value from its own local limits rather than from the card.
- The derived value exceeds the handler's actual bound.
- The handler's rejection is returned as a task-level `failed` state rather than a protocol-level error, so the client's retry classifier treats it as retryable.
Remove any one condition and the failure does not occur. If the card carried `"maximum": 16384`, condition 1 fails. If the client clamped to the card's declared maximum rather than its own context limit, condition 2 fails. If the handler returned a `400` with a machine-readable `error.code: "PARAM_OUT_OF_RANGE"`, condition 4 fails and the client could re-negotiate.
The invariant is violated specifically at step 2: **negotiation must be a read of the remote's declared bounds, never a write of the local's bounds into the remote's parameter space.** The orchestrator inverted the direction of the constraint.
Decision Boundary
The decision the client must make at negotiation time is whether to treat the card as *descriptive* (use it to shape payloads, clamp to declared bounds, and treat undeclared parameters as unconstrained-but-risky) or *prescriptive* (treat the card as a complete specification and derive values freely within its types). A2A v1.0 supports only the descriptive reading, because the spec does not require the card to enumerate value-level constraints and does not define a renegotiation handshake for rejected parameters.
The boundary is crossed the moment the client computes a parameter value from a source *other than the card* — its own context window, its own token budget, a default from a previous peer, a value learned from a different vendor's card. Once that happens, the client is asserting a capability the remote never warranted.
The guardrail is a two-part discipline:
- **Clamp, don't derive.** Every parameter sent to a peer must be the minimum of (local limit, card-declared limit if present, a conservative default if absent). Never send a value the card does not explicitly permit, even if the type allows it.
- **Classify rejections by error shape, not by task state.** A `failed` task whose `status.message` contains a parameter-range or schema signal must be routed to a *renegotiation* path (refetch card, re-clamp, retry once) — not to the transient-retry path. Transient retry on a deterministic parameter rejection is guaranteed to burn the budget and produce a false `degraded` mark.
Operational Effect
When the boundary is respected, the failure mode is bounded to a single renegotiation cycle: the client refetches the card, observes the same (stale) declaration, clamps to its conservative default, and succeeds — because the conservative default was always within the handler's accepted domain. The card's staleness is absorbed by the clamp discipline; the client never depended on the card being current for *value-level* facts, only for *type-level* shape.
When the boundary is violated, the effect is not a crash but a **silent capability downgrade**: the orchestrator's registry records a false `degraded`, the planner reroutes, and the system's output quality drops without any error surfacing. This is the operational hazard specific to A2A card negotiation — the divergence between declaration and handler is invisible to every layer that validates the card, and the only signal is a task-state failure that looks transient. The invariant to encode in the client is: *a peer's declared capability is a lower bound on what it will accept, never an upper bound on what you may send.*
import json
from dataclasses import dataclass
class CardEndpointDivergence(RuntimeError):
"""Raised when a dispatched task's parameters exceed the peer's actual
accepted domain despite validating against the peer's Agent Card."""
pass
@dataclass
class AgentCard:
skill_id: str
declared_max_tokens: int | None # None means card declares unbounded integer
@dataclass
class TaskResult:
state: str # "completed" | "failed" | "rejected"
error_signal: str | None # machine-readable hint, if any
CONSERVATIVE_DEFAULT_MAX_TOKENS = 4096
def negotiate_max_tokens(card: AgentCard, local_limit: int) -> int:
"""Clamp to the card's declared bound; never derive from local limit alone."""
if card.declared_max_tokens is None:
# Card is type-permissive; we must NOT send local_limit. Use conservative default.
return min(CONSERVATIVE_DEFAULT_MAX_TOKENS, local_limit)
return min(card.declared_max_tokens, local_limit)
def dispatch_with_renegotiation(
card: AgentCard,
local_limit: int,
send_fn,
refetch_card_fn,
) -> TaskResult:
max_tokens = negotiate_max_tokens(card, local_limit)
result = send_fn(card.skill_id, max_tokens)
if result.state == "failed" and result.error_signal in (
"PARAM_OUT_OF_RANGE",
"MAX_TOKENS_EXCEEDED",
):
# Deterministic parameter rejection: refetch, re-clamp, retry once.
fresh = refetch_card_fn(card.skill_id)
retry_max = negotiate_max_tokens(fresh, local_limit)
if retry_max >= max_tokens:
# Card still declares permissive; clamp did not shrink. Escalate.
raise CardEndpointDivergence(
f"skill={card.skill_id} rejected maxTokens={max_tokens} "
f"but refetched card declares no tighter bound; "
f"card-vs-endpoint divergence is unresolvable by renegotiation"
)
result = send_fn(card.skill_id, retry_max)
if result.state == "failed" and result.error_signal is None:
# No machine-readable signal: do NOT classify as transient by default.
raise CardEndpointDivergence(
f"skill={card.skill_id} failed without error_signal; "
f"cannot distinguish transient from parameter rejection"
)
return result