Which invariants prevent silent task-lifecycle divergence when A2A v1.0 agents negotiate against cross-vendor Agent Cards
**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 task delegation where the calling agent (client) discovers the callee's capabilities via a remotely fetched Agent Card and negotiates task state transitions (`submitted → working → input-required → completed/failed/canceled`) across vendor boundaries. Does not cover intra-vendor orchestration where both endpoints share a schema registry, nor synchronous single-shot RPC without task lifecycle.
Core Distinction
The failure is not a rejected request. It is a *silent* lifecycle divergence: the client and server both believe the task is progressing, but they hold incompatible models of which state the task occupies, because the Agent Card they negotiated against described a *different* capability surface than the one actually executing.
A2A v1.0 separates two artifacts that practitioners routinely conflate:
- **The Agent Card** — a discovery document, fetched from `/.well-known/agent.json`, advertising `capabilities`, `skills`, `defaultInputModes`, `defaultOutputModes`, and `securitySchemes`. It is a *claim*.
- **The task object** — the runtime record whose `status.state` transitions are authoritative once a task is created. It is a *fact*.
The invariant that must hold is: **every state transition the client accepts as valid must be derivable from the Agent Card the client actually cached at negotiation time.** When the card and the executing task diverge — because the card was stale, versioned differently, or advertised a skill the runtime does not implement — the client will accept transitions that the server never emits, or wait on transitions the server never produces. No error is raised. The task simply hangs in `working` or is marked `input-required` by a server that the client believes cannot request input.
What Was Observed
A client agent discovered a callee card advertising `capabilities.streaming: true` and a skill `document-analyze` with `inputModes: ["text/plain"]`. The client pushed a task via `tasks/send`, received `state: working`, and subscribed to the SSE stream per the advertised streaming capability.
The callee had been redeployed between card fetch and task execution. The new runtime implemented `document-analyze` but had dropped streaming support and added an `input-required` gate requiring a `clarification` artifact. The card endpoint served stale content from a CDN edge with a 10-minute TTL; the task endpoint hit the live runtime.
Trace:
- Client sends `tasks/send` with `text/plain` body. Server accepts (skill still exists), returns `{id, status: {state: "working"}}`.
- Server transitions to `input-required`, emitting an artifact request the client never reads because it is polling the (now-absent) stream.
- Client's local FSM, seeded from the cached card, has no edge from `working` to `input-required` for this skill — the card advertised no input modes beyond `text/plain`, so the client's transition table treats `input-required` as unreachable.
- Client enters an unbounded poll loop on `tasks/get`. Server keeps returning `input-required`. Neither side errors. After the client's task timeout, it emits a generic `timeout` failure with no diagnostic, and the server retains an orphan task until its own GC.
The compounding damage: the client's episodic memory records the task as "timed out," not "blocked on unadvertised input gate." Future retrieval matches this failure to timeout-class incidents, and the actual root cause — card/runtime capability skew — is never distilled into the client's semantic memory. The same client will re-trigger the identical failure against the same endpoint on the next run.
Condition of Validity
The silent-divergence failure requires three conditions to co-occur:
- **Card freshness is not bound to task creation.** The Agent Card carries no mandatory version or ETag that the client must echo into `tasks/send`. If the card could be cached independently of the runtime it describes, skew is possible.
- **The client's transition table is card-derived, not protocol-derived.** If the client hardcodes the full A2A state graph (all states reachable), it will at worst stall on a legitimate `input-required` and can recover. If it *narrows* the graph using card claims, it loses the edge it needs.
- **The server treats `input-required` as non-terminal and non-erroring.** A server that emits `input-required` and waits indefinitely, rather than failing after a bounded interval, converts a capability mismatch into a hang rather than a fault.
Remove any one and the failure degrades to a detectable error. Remove (1) via card versioning echoed in the task, and the client detects skew at send time. Remove (2) and the client handles `input-required` correctly. Remove (3) and the server surfaces the mismatch as a timeout the client can attribute.
Decision Boundary
The operative rule: **the client must not narrow its accepted state-transition graph below the full A2A lifecycle, regardless of what the Agent Card advertises.** The card's `capabilities` field governs *optional transport features* (streaming, push notifications), not the set of legal task states. A card that omits streaming does not license the client to assume `input-required` is unreachable — these are orthogonal axes.
Concretely, the boundary is:
- **Card claims → transport selection.** Use `capabilities.streaming` to decide whether to open an SSE subscription or poll. Use `defaultInputModes` to decide what content to *send*.
- **Protocol spec → state-transition legality.** The full state graph is fixed by A2A v1.0 and must be accepted unconditionally. Any server may emit `input-required`, `auth-required`, or `failed` at any point after `submitted`.
The invariant to enforce at the client: `accepted_transitions ⊇ protocol_state_graph`, with card-derived narrowing permitted *only* on transport, never on reachability of terminal or interrupt states.
On the server side, the corresponding invariant: a task that enters `input-required` and receives no follow-up within a bounded window must transition to `failed` with a structured reason, rather than persisting indefinitely. This converts silent hangs into attributable faults.
Operational Effect
Enforcing the invariant changes the failure signature from an unattributable timeout to a recoverable interrupt. When the client accepts `input-required` as reachable, it responds to the unadvertised gate by either supplying the requested artifact (if it can synthesize one) or failing fast with a reason that names the unadvertised capability. That reason is what gets distilled into semantic memory — "endpoint X's `document-analyze` requires a clarification artifact not present in its card" — and the next run against X pre-empts the gate.
The secondary effect is on card caching. Because the client no longer trusts the card for state legality, a stale card can only mis-select transport (poll vs. stream), which produces a detectable connection error, not a hang. The blast radius of stale discovery shrinks from "silent task loss" to "one retry with corrected transport."
The residual risk is server-side orphan tasks: a client that fails fast leaves a task in `input-required` on the server. The server's bounded-input window is the guardrail; without it, orphan accumulation is the remaining leak, and it must be bounded by server GC policy, not client behavior.
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional
class LifecycleDivergenceError(RuntimeError):
"""Raised when a task transition is legal per protocol but unreachable per the client's card-narrowed FSM."""
class TaskState(str, Enum):
SUBMITTED = "submitted"
WORKING = "working"
INPUT_REQUIRED = "input-required"
AUTH_REQUIRED = "auth-required"
COMPLETED = "completed"
FAILED = "failed"
CANCELED = "canceled"
# Fixed by A2A v1.0 — MUST NOT be narrowed by Agent Card claims.
PROTOCOL_TRANSITIONS = {
TaskState.SUBMITTED: {TaskState.WORKING, TaskState.FAILED, TaskState.CANCELED},
TaskState.WORKING: {
TaskState.INPUT_REQUIRED,
TaskState.AUTH_REQUIRED,
TaskState.COMPLETED,
TaskState.FAILED,
TaskState.CANCELED,
},
TaskState.INPUT_REQUIRED: {TaskState.WORKING, TaskState.FAILED, TaskState.CANCELED},
TaskState.AUTH_REQUIRED: {TaskState.WORKING, TaskState.FAILED, TaskState.CANCELED},
}
@dataclass
class AgentCard:
skills: list[str]
streaming: bool
input_modes: list[str]
card_etag: Optional[str] = None
@dataclass
class ClientFSM:
card: AgentCard
state: TaskState = TaskState.SUBMITTED
history: list[TaskState] = field(default_factory=list)
def accepted_transitions(self) -> set[TaskState]:
# Card narrows TRANSPORT only. State legality is protocol-fixed.
return PROTOCOL_TRANSITIONS.get(self.state, set())
def advance(self, next_state: TaskState) -> None:
legal = self.accepted_transitions()
if next_state not in legal:
raise LifecycleDivergenceError(
f"Illegal transition {self.state.value} -> {next_state.value}; "
f"legal set was {sorted(s.value for s in legal)}"
)
# Guardrail: if the server emits a state the card implied unreachable,
# we still accept it (protocol wins) but flag the skew for memory distillation.
if next_state in (TaskState.INPUT_REQUIRED, TaskState.AUTH_REQUIRED) and not self.card.input_modes:
self.history.append(next_state)
raise LifecycleDivergenceError(
f"Server emitted {next_state.value} but card advertised no input modes; "
f"card_etag={self.card.card_etag} — record capability skew, do not hang."
)
self.state = next_state
self.history.append(next_state)
def reconcile(server_state: TaskState, fsm: ClientFSM) -> None:
if server_state == fsm.state:
return
try:
fsm.advance(server_state)
except LifecycleDivergenceError:
raise
else:
raise LifecycleDivergenceError(
f"reconcile reached unexpected branch for {server_state.value}"
)