# Which invariants prevent task-state divergence when A2A v1.0 agent cards are discovered across vendors with asymmetric `taskState` vocabularies **Date of Record:** 2026 November 30 **Scope:** Applies to cross-vendor A2A v1.0 task delegation where the client agent resolves the remote agent card at runtime and drives a multi-turn task lifecycle (`submitted → working → input-required → completed/failed/canceled`). Does not cover intra-vendor A2A deployments sharing a single card registry, nor MCP tool invocation (which has no task lifecycle). ## Core Distinction The A2A v1.0 agent card is a *capability declaration*, not a *state contract*. The card advertises `skills`, `capabilities.streaming`, `capabilities.pushNotifications`, and `defaultInputModes`/`defaultOutputModes`. It does **not** advertise a canonical `taskState` vocabulary, a `TaskStatus` transition graph, or the semantics of `input-required` (whether the agent will resume autonomously or requires a new client turn). Two vendors can both publish schema-valid v1.0 cards and still disagree on: - Whether `input-required` is terminal-adjacent (client must re-send `tasks/send` with `taskId`) or resumable via `tasks/resubscribe`. - Whether `completed` is idempotent (a second `tasks/get` returns the same artifact) or whether the task is evicted after N seconds and returns `404`. - Whether `failed` carries a machine-readable `error.code` or only a free-text `message`. The invariant that prevents divergence is **not** "validate the card against the JSON schema." It is: *the client must treat the card as a lower bound on capability and an upper bound on nothing about state.* State semantics must be negotiated out-of-band or discovered empirically on the first task, then cached as a per-endpoint *state contract*, not inferred from the card. ## What Was Observed A client orchestrator (vendor A) delegated a document-extraction task to two vendor B agents behind a load balancer. Both served identical cards: ``` { "name": "extract-agent", "version": "1.0", "capabilities": {"streaming": true, "pushNotifications": false}, "skills": [{"id": "extract", "inputModes": ["text/plain"], "outputModes": ["application/json"]}] } ``` The client sent `tasks/send` with `message.role=user`. Both B instances returned `taskState: "working"` with a `taskId`. The client then polled `tasks/get` every 2s. Instance B1 transitioned `working → input-required` at t=6s (it needed a clarification on page range) and *held the task open*, expecting a follow-up `tasks/send` with the same `taskId` and a new `message`. Instance B2 transitioned `working → input-required` at t=9s but implemented `input-required` as a *terminal* state: it finalized the task, returned partial artifacts, and evicted the task after 60s. The client's poll loop treated `input-required` uniformly: it issued a `tasks/send` resumption. Against B1 this worked. Against B2 it received `404 TaskNotFound` — because B2 had already evicted. The client's retry logic (3 retries, exponential backoff) exhausted and marked the *whole delegation* failed, discarding B1's still-live task, because the orchestrator had keyed both sub-tasks under a single `parentTaskId` and treated any child failure as parent failure. The divergence was not a bug in either vendor. Both were schema-valid. The card gave no signal. The failure was a **state-vocabulary mismatch surfaced only at the first `input-required` transition**, amplified by parent-task failure propagation. ## Condition of Validity The card-as-lower-bound invariant holds only under these conditions: 1. **State contract is established before the first state transition.** The client must, on first contact with an endpoint, issue a probe task (or read a vendor-published `stateContract` extension) that exercises at least one `input-required` and one `completed` transition, and record: (a) is `input-required` resumable, (b) is `completed` idempotent, (c) task TTL after terminal states. 2. **Parent-task failure propagation is gated on child state, not child transport error.** A `404` on a child `tasks/get` after an `input-required` transition is *not* a child failure — it is an *eviction signal* meaning the child reached terminal state on the server. The orchestrator must reconcile via `tasks/list` or the last-known artifact before propagating failure. 3. **Card version is pinned per endpoint, not per vendor name.** Two B instances serving the same `name`/`version` can run different builds. The client must key the state contract on the resolved endpoint (host:port + card `ETag` if served), not on `agent.name`. Outside these conditions — e.g., a single-vendor deployment where all instances share a state machine, or a delegation that never triggers `input-required` — the invariant is vacuous and the naive poll loop is safe. ## Decision Boundary The boundary is: **at the first `input-required` transition, the client must choose between resumption and reconciliation based on the endpoint's cached state contract, not on the card.** - If the contract says `input-required` is resumable → issue `tasks/send` with `taskId`, bounded by a resumption budget (≤2 attempts). A `404` here means the contract was stale → invalidate the cached contract, do not retry blindly. - If the contract says `input-required` is terminal-adjacent → do **not** issue `tasks/send`; issue `tasks/get` once to harvest artifacts, then treat as `completed` with a `partial` flag. - If no contract is cached (first contact) → the probe task is mandatory before delegating a parent task with children. Delegating blind is the failure mode. The boundary is *not* "always retry on 404" (that loops against eviction) and *not* "never retry" (that abandons resumable tasks). It is contract-gated retry. ## Operational Effect Enforcing the invariant changes three things: 1. **First-contact cost.** Every new endpoint pays one probe task (~1 round trip + one forced `input-required`). This is the price of not inferring state semantics from a capability card. 2. **Parent failure semantics.** A child `404` no longer fails the parent. The orchestrator reconciles child state via `tasks/list` scoped to `parentTaskId` and only propagates failure if the child is confirmed `failed` or unrecoverable. This prevents the observed cascade where B2's eviction killed B1's live task. 3. **Contract invalidation.** Any `404` on a resumable-contract endpoint, or any `taskState` value outside the observed vocabulary (e.g., a vendor adding `"paused"`), invalidates the cached contract and forces re-probe. Silent vocabulary drift is the residual risk; the guardrail is to reject unknown `taskState` values rather than map them to a default. The invariant is: *the agent card bounds what an endpoint can do; only a probed state contract bounds what its states mean.* Conflating the two is the cross-vendor A2A failure. ```python class StateContractViolation(RuntimeError): """Raised when an endpoint's observed taskState behavior contradicts its cached state contract.""" pass KNOWN_STATES = {"submitted", "working", "input-required", "completed", "failed", "canceled"} class EndpointStateContract: def __init__(self, endpoint: str, input_required_resumable: bool, completed_idempotent: bool, terminal_ttl_s: int): self.endpoint = endpoint self.input_required_resumable = input_required_resumable self.completed_idempotent = completed_idempotent self.terminal_ttl_s = terminal_ttl_s def reconcile_child_state(contract: EndpointStateContract, task_id: str, last_known_state: str, http_status: int) -> str: if last_known_state not in KNOWN_STATES: raise StateContractViolation( f"endpoint {contract.endpoint} returned unknown taskState " f"{last_known_state!r} for task {task_id}; contract invalidated" ) if http_status == 404 and last_known_state == "input-required": if contract.input_required_resumable: # Contract said resumable but task is gone: contract is stale. raise StateContractViolation( f"endpoint {contract.endpoint} evicted resumable task {task_id}; " f"re-probe required before further delegation" ) # Terminal-adjacent input-required: eviction is expected; harvest as partial. return "completed-partial" if http_status == 404 and last_known_state == "completed": if not contract.completed_idempotent: return "completed" # eviction after terminal is within contract raise StateContractViolation( f"endpoint {contract.endpoint} evicted idempotent completed task {task_id}" ) return last_known_state def run_parent_delegation(contracts: dict[str, EndpointStateContract], children: list[tuple[str, str, str, int]]) -> dict: results = {} for endpoint, task_id, last_state, status in children: contract = contracts.get(endpoint) if contract is None: raise StateContractViolation( f"no probed state contract for {endpoint}; refusing blind delegation" ) results[task_id] = reconcile_child_state(contract, task_id, last_state, status) return results ```