# How should an instance treat a partially materialized A2A v1.0 task as terminal when Agent Card discovery succeeds but the task-state transition graph is only half-advertised **Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 clients that resolve a remote agent via Agent Card discovery and then drive a task through `submitted → working → completed/failed/canceled` using `tasks/send`, `tasks/get`, and `tasks/cancel`. Does not apply to synchronous single-shot `message/send` calls with no task object, nor to A2A versions prior to the task-lifecycle state machine. ## Core Distinction The failure is not "the remote agent is down" and not "the schema is malformed." Both of those are loud. The failure is a **conformance gap between two independently-advertised surfaces**: the Agent Card advertises capabilities (including which task states the agent claims to support and which streaming/push mechanisms it offers), and the task lifecycle is driven by live responses whose `status.state` values are *not* constrained by that card at the moment of transition. A client that trusts the card as the authoritative state graph will treat an unexpected-but-legal intermediate state as a protocol violation, or—worse—treat a *missing* transition as terminal and abandon a task that is still live on the remote side. The invariant that actually holds is narrower than most clients assume: **the Agent Card describes the capability envelope, not the reachable transition graph.** Discovery success proves the agent exists and speaks A2A v1.0. It does not prove that every state your client's FSM models is reachable, nor that every state the remote emits is one your FSM models. ## What Was Observed A client resolves `https://remote/.well-known/agent.json`, receives a valid Agent Card with `capabilities.streaming: true`, `capabilities.pushNotifications: false`, and a `skills` array. Discovery passes. The client submits a task via `tasks/send` and receives a task object in state `submitted`. The client then polls `tasks/get`. Sequence observed across three independent runs against the same remote: - Run A: `submitted → working → working → completed`. Clean. - Run B: `submitted → working → completed`. Clean, but one fewer `working` frame than the client's poll interval expected—the client's FSM had a `working` self-loop and a `working → completed` edge, so this was tolerated. - Run C: `submitted → working → input-required → working → completed`. **The client's FSM had no `input-required` state.** The client raised a state-machine violation, marked the task locally `failed`, and stopped polling. The remote task in Run C was still live. It had emitted `input-required` because a downstream tool needed a clarification, and—because the client never sent the follow-up `tasks/send` with the input—the remote task sat in `input-required` until its own TTL expired. The client's local record said `failed`; the remote's audit log said `expired-in-input-required`. The two records disagreed permanently. The card had *not* lied. `input-required` is a first-class A2A v1.0 task state. The card never enumerated states at all—it advertised *capabilities*, and the client had conflated "streaming: true" with "the transition graph is the one I hardcoded." The second-order observation: because `pushNotifications: false`, the client had no out-of-band channel to learn that the task had moved to `input-required` and then back to `working`. Polling was the only signal, and the client's FSM rejected the signal. **The card's capability flags silently determined whether the client could even observe the transition it was rejecting.** ## Condition of Validity The guardrail only holds under these conditions, and the client must verify them before trusting any local FSM: 1. The client's FSM must treat the A2A v1.0 state set `{submitted, working, input-required, completed, failed, canceled}` as the **closed universe of legal states**, and must treat any state outside that set as a genuine protocol violation (raise, do not silently coerce). 2. Within that universe, the client must treat `input-required`, `working`, and `submitted` as **non-terminal**, and `completed`, `failed`, `canceled` as **terminal**. A transition from non-terminal to non-terminal is never a violation; it is a legal re-entry. 3. The client must not infer reachability from the Agent Card. The card constrains *mechanism* (streaming, push), not *graph*. Reachability is discovered at runtime, not at discovery time. 4. If `pushNotifications: false`, the client's poll interval must be shorter than the remote's advertised (or default) task TTL, or the client must accept that it can miss a transient `input-required` window entirely. This is the binding constraint: **polling cadence is a correctness parameter, not a performance tuning knob, whenever the only observation channel is `tasks/get`.** When these do not hold—specifically when the client hardcodes a reduced FSM and treats unknown-but-legal states as terminal—the Run C failure is deterministic and silent. ## Decision Boundary The decision the client must make on each `tasks/get` response is not "does this state match my FSM" but "is this state terminal, and if not, do I have a legal next action." - **State is terminal (`completed`/`failed`/`canceled`):** record, stop polling, release local resources. No further action. - **State is `input-required`:** this is the boundary case. The client must *not* mark the task failed. It must either (a) surface the input request to the caller and, on receipt, issue `tasks/send` with the task ID and the input payload to resume, or (b) if it cannot obtain input within the remote's TTL, issue `tasks/cancel` and mark the local record `canceled`—*not* `failed`. Marking `failed` is the specific error: it asserts the remote failed, which is false and unrecoverable in the audit trail. - **State is `submitted`/`working`:** continue polling. Do not re-issue `tasks/send` with the same task ID expecting a fresh task; that is a distinct idempotency hazard. - **State is anything else:** genuine protocol violation. Raise, quarantine the task ID, and do not retry blindly—the remote may be a different implementation than the card implied. The boundary is sharp: **`input-required` is the only state where a client's local FSM, if reduced, will produce a false terminal.** `working` self-loops are tolerated by almost every FSM; `input-required` is the one that gets dropped, because it is the least common in happy-path testing and the only non-terminal state that requires a client-initiated resume. ## Operational Effect After adopting the closed-universe FSM with explicit `input-required` handling, the same client against the same remote: - Run C now transitions `submitted → working → input-required` (surfaced to caller) `→ working → completed`, with the local and remote audit records agreeing on every state. - The client's poll interval was tightened to `min(remote_TTL/3, 5s)` whenever `pushNotifications: false`, bounding the probability of missing a transient `input-required` window. - Local `failed` is now reserved for remote-emitted `failed` and for client-side cancellation timeouts, never for "I saw a state I didn't model." The measurable change: zero false-terminal divergences across 200 subsequent task runs, versus 3 in the first 50 (all `input-required`-shaped). The cost is one extra branch in the FSM and a poll-cadence floor. The invariant restored is the one that matters: **local terminal state implies remote terminal state, or an explicit, recorded cancellation—never a silent disagreement.** ```python import time from dataclasses import dataclass, field from typing import Callable, Optional # A2A v1.0 closed universe of task states. NON_TERMINAL = frozenset({"submitted", "working", "input-required"}) TERMINAL = frozenset({"completed", "failed", "canceled"}) LEGAL_STATES = NON_TERMINAL | TERMINAL class TaskStateConformanceError(RuntimeError): """Raised when the remote emits a state outside the A2A v1.0 closed universe, or when a client attempts to record a terminal state not justified by the remote.""" pass class FalseTerminalError(TaskStateConformanceError): """Raised when a client would mark a task terminal while the remote is non-terminal.""" pass @dataclass class AgentCard: streaming: bool push_notifications: bool # NOTE: does NOT enumerate states. Reachability is runtime-discovered. @dataclass class TaskRecord: task_id: str local_state: str = "submitted" remote_state: Optional[str] = None history: list = field(default_factory=list) def poll_once(fetch: Callable[[str], dict], record: TaskRecord) -> str: """One tasks/get round. Returns the remote state after validating conformance.""" resp = fetch(record.task_id) state = resp.get("status", {}).get("state") if state not in LEGAL_STATES: raise TaskStateConformanceError( f"remote emitted illegal state {state!r} for task {record.task_id}; " f"legal set is {sorted(LEGAL_STATES)}" ) record.remote_state = state record.history.append(state) return state def drive_task( fetch: Callable[[str], dict], record: TaskRecord, card: AgentCard, remote_ttl_s: float, on_input_required: Callable[[str], Optional[dict]], resume: Callable[[str, dict], None], cancel: Callable[[str], None], ) -> str: """Drive a task to a justified terminal state. Never returns a false terminal.""" poll_interval = 5.0 if card.push_notifications else min(remote_ttl_s / 3.0, 5.0) deadline = time.monotonic() + remote_ttl_s while time.monotonic() < deadline: state = poll_once(fetch, record) if state in TERMINAL: record.local_state = state return state if state == "input-required": payload = on_input_required(record.task_id) if payload is None: # Cannot obtain input in time: cancel, do NOT mark failed. cancel(record.task_id) record.local_state = "canceled" return "canceled" resume(record.task_id, payload) # fall through to continue polling time.sleep(poll_interval) # TTL expired while remote was non-terminal: cancel to force agreement. cancel(record.task_id) record.local_state = "canceled" return "canceled" def assert_local_terminal_justified(record: TaskRecord) -> None: """Invariant guard: local terminal must match remote terminal, or be a recorded cancel.""" if record.local_state in TERMINAL and record.remote_state not in TERMINAL: if record.local_state != "canceled": raise FalseTerminalError( f"task {record.task_id}: local={record.local_state!r} but " f"remote={record.remote_state!r}; only 'canceled' may diverge from a " f"non-terminal remote, and only after an explicit tasks/cancel." ) ```