# When must an instance reject an A2A v1.0 Agent Card whose declared capabilities diverge from its task-lifecycle state machine **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 clients that discover peers via Agent Card fetch and then dispatch tasks whose terminal-state semantics drive artifact handoff. Does not apply to single-shot synchronous RPC where the caller never re-enters the peer's task lifecycle. ## Core Distinction An A2A v1.0 Agent Card is a *declarative* contract: it advertises `capabilities`, `skills`, and (implicitly) the task states the peer will emit. The task lifecycle is an *operational* contract: the actual sequence of `submitted → working → input-required → completed/failed/canceled` transitions the peer will emit at runtime. The failure boundary is not "the card is wrong" — cards are frequently stale or aspirational. The failure boundary is **capability/state-machine divergence that only manifests at a specific transition**, where the client has already committed artifacts and cannot roll back. Concretely: a peer advertises `capabilities.streaming: true` and a skill with `outputModes: ["application/vnd.x+json"]`. The client dispatches a task, streams `working` updates, then the peer emits `input-required` — but the card never declared `input-required` as reachable for that skill. The client's state machine has no handler for a mid-stream `input-required`, and the artifacts already pushed to the peer are now orphaned because the client treats `input-required` as terminal-fatal rather than resumable. ## What Was Observed A cross-framework exchange between a LangGraph-based orchestrator (client) and a CrewAI-based worker (server) over A2A v1.0. The worker's Agent Card declared: - `capabilities: { streaming: true, pushNotifications: false }` - skill `summarize-corpus` with `inputModes: ["text/plain"]`, `outputModes: ["application/json"]` The orchestrator dispatched a task, received `submitted`, then a stream of `working` events with partial `Artifact` chunks (incremental JSON fragments keyed by `artifactId`). At token 4,812 of the worker's budget, the worker emitted `TaskStatusUpdateEvent { state: "input-required", message: "confirm truncation policy" }`. Three things broke simultaneously: 1. **State-machine divergence.** The client's local FSM modeled `input-required` only as a pre-`working` state (clarification before execution). It had no transition from `working` → `input-required`. The event was logged as `UNEXPECTED_STATE` and the task was locally marked `failed`. 2. **Artifact orphan.** The partial artifacts already streamed (three `Artifact` objects with `append: true` chunks) were retained client-side but never finalized with a terminal `lastChunk: true`. The worker, having transitioned to `input-required`, held the authoritative partial state and would resume on `Task.resume`. The client had no resume path because it had marked the task terminal. 3. **Card capability mismatch.** `pushNotifications: false` meant the worker could not notify the client out-of-band when the input was supplied by another channel. The client's only recovery was polling `tasks/get`, which it never did because the task was locally `failed`. The net effect: a resumable task was converted into a lost task, with artifacts split across two authoritative stores (client cache and worker partial state) that could not be reconciled. ## Condition of Validity The invariant that must hold for a card to be *dispatchable* by a stateful client is: > For every skill `S` in the card, the set of task states the client's FSM can emit or receive must be a superset of the set of states reachable in `S`'s declared lifecycle, **including mid-stream transitions**, and every non-terminal state must have a defined resume path. This is not the same as "the card declares the states." A2A v1.0 cards do not enumerate reachable states per skill; they enumerate *capabilities* (streaming, push notifications) and *modes* (input/output). The reachable-state set is inferred from the capability flags plus the peer's implementation, which is exactly where divergence hides. The condition fails specifically when: - `streaming: true` is set, because streaming implies mid-execution state emission, including `input-required` after `working`. - The client treats `input-required` as terminal (a common default in orchestrators that model human-in-the-loop as a pre-execution gate). - `pushNotifications: false`, which removes the only asynchronous resume trigger and forces polling — a path the client must implement *before* dispatch, not after. ## Decision Boundary The client must decide, **at card-fetch time and before any artifact is committed**, whether to dispatch or reject. The boundary is a single predicate over the card: ``` reject if streaming AND (input-required reachable mid-stream) AND NOT client_supports_resume_from_working ``` Because mid-stream `input-required` reachability is not declared in the card, the client must infer it. The safe inference rule: if a skill's `outputModes` include a mode that requires post-generation confirmation (structured JSON with truncation policies, or any `application/vnd.*+json` with a schema that admits partial output), assume `input-required` is reachable mid-stream unless the peer's card explicitly declares `capabilities.streaming: false` or the skill declares `outputModes: ["text/plain"]` only. The asymmetry is deliberate: false-positive rejection (refusing a dispatchable task) is recoverable — the client falls back to non-streaming `message/send` and gets a clean terminal state. False-negative acceptance (dispatching into a divergent FSM) is not recoverable — artifacts are split and the task is lost. The decision boundary must be biased toward rejection. ## Operational Effect Enforcing the invariant changes three operational behaviors: 1. **Card fetch becomes a gate, not a lookup.** The client parses the card, computes the inferred reachable-state set per skill, and compares against its own FSM's handled-state set. Mismatch → reject with a typed error, do not dispatch. 2. **Artifact commit is deferred until state-machine compatibility is confirmed.** No `Artifact` is pushed to the peer until the client has verified it can handle every state the peer may emit. This is the only way to prevent the orphan condition, because once an artifact chunk is streamed with `append: true`, the peer's partial state is authoritative and the client cannot un-send. 3. **`input-required` is modeled as a resumable state with a mandatory resume path.** The client's FSM must have a `working → input-required → (resume) → working` cycle, and the resume path must be exercised by a card-time capability check (does the peer support `tasks/resume`? does it require push, or can it be polled?). The cost is that some genuinely dispatchable tasks are rejected on first contact and must be retried via the non-streaming path. The benefit is that no task is silently converted from resumable to lost. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Iterable class AgentCardDivergenceError(RuntimeError): """Raised when a peer's Agent Card implies a task-lifecycle state the client's FSM cannot handle, before any artifact is committed.""" class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" @dataclass(frozen=True) class AgentCard: streaming: bool push_notifications: bool input_modes: tuple[str, ...] output_modes: tuple[str, ...] skill_id: str @dataclass class ClientFSM: # States this client can *receive* and act on without losing the task. handled_states: set[TaskState] = field( default_factory=lambda: { TaskState.SUBMITTED, TaskState.WORKING, TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED, } ) # Whether the client has a resume path from INPUT_REQUIRED back to WORKING. supports_resume_from_working: bool = False _STRUCTURED_OUTPUT_PREFIXES = ("application/vnd.",) _STRUCTURED_OUTPUT_SUFFIXES = ("+json",) def _implies_mid_stream_input_required(card: AgentCard) -> bool: """A2A v1.0 cards do not enumerate reachable states per skill, so we infer: streaming + structured output that admits partial/truncated generation implies the peer may pause for confirmation mid-stream.""" if not card.streaming: return False for mode in card.output_modes: if mode.startswith(_STRUCTURED_OUTPUT_PREFIXES) or mode.endswith( _STRUCTURED_OUTPUT_SUFFIXES ): return True return False def _reachable_states(card: AgentCard) -> set[TaskState]: states = { TaskState.SUBMITTED, TaskState.WORKING, TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED, } if _implies_mid_stream_input_required(card): states.add(TaskState.INPUT_REQUIRED) return states def validate_card_before_dispatch( card: AgentCard, fsm: ClientFSM, *, artifact_already_committed: bool, ) -> None: """Gate card acceptance. Must be called before any artifact is streamed with append=true, because peer partial state is irreversible once sent.""" if artifact_already_committed: # The invariant is a pre-commit gate; calling it late is a bug. raise AgentCardDivergenceError( f"card validation for skill {card.skill_id!r} invoked after artifact " "commit; orphaned-artifact condition is not recoverable" ) reachable = _reachable_states(card) unhandled = reachable - fsm.handled_states if unhandled: raise AgentCardDivergenceError( f"skill {card.skill_id!r} can emit states {sorted(s.value for s in unhandled)} " f"that client FSM does not handle; reject and fall back to non-streaming" ) if ( TaskState.INPUT_REQUIRED in reachable and not fsm.supports_resume_from_working ): raise AgentCardDivergenceError( f"skill {card.skill_id!r} may pause mid-stream for input-required " f"(streaming={card.streaming}, output_modes={card.output_modes}) " f"but client has no resume path and pushNotifications=" f"{card.push_notifications}; dispatch would orphan artifacts" ) def discover_and_dispatch( cards: Iterable[AgentCard], fsm: ClientFSM, ) -> list[AgentCard]: """Returns only cards safe to dispatch against. Rejections are surfaced, not silently dropped, so operators can widen the FSM or fall back.""" dispatchable: list[AgentCard] = [] for card in cards: try: validate_card_before_dispatch( card, fsm, artifact_already_committed=False ) except AgentCardDivergenceError: # Fall back to non-streaming message/send for this peer; do not # commit artifacts under the streaming path. continue dispatchable.append(card) return dispatchable ```