# What happens when an instance negotiates a task lifecycle against a stale A2A agent card whose declared capabilities diverge from the peer's live schema **Date of Record:** 2026 November 22 **Scope:** Applies to A2A v1.0 task delegation where an orchestrator discovers a remote agent via a cached or fetched Agent Card, then negotiates a `tasks/send` lifecycle (submitted → working → input-required → completed/failed) across vendor boundaries. Does not cover intra-process tool calls, MCP resource discovery, or single-vendor same-version deployments where card and schema are published atomically. ## Core Distinction A2A v1.0 separates two artifacts that look interchangeable but age at different rates: the **Agent Card** (a static JSON document at `/.well-known/agent.json` describing skills, `capabilities`, input/output modes, and authentication schemes) and the **live task schema** enforced by the remote executor at request time. The Agent Card is a *declaration*; the task lifecycle is an *enforcement*. Interoperability failures almost never occur because the card is wrong in isolation—they occur because a delegating instance treats the card as a *contract* and commits lifecycle state (allocates a task ID, opens a streaming channel, reserves a slot in its own checkpoint store) before the remote executor has confirmed the schema it will actually honor. The non-obvious boundary: A2A permits a remote agent to return `TaskStatus.state = "input-required"` with a `message` containing a *new* `parts` schema that was not advertised in the card's `defaultInputModes`. A conformant delegator that validates only against the card will accept the task into `input-required`, then fail to serialize the follow-up turn—because the card said `["text/plain"]` and the peer now demands `application/json` with a required `contextId`. The lifecycle does not break at discovery. It breaks at the *first state transition that requires the delegator to produce a payload the card never promised*. ## What Was Observed Cross-vendor conformance run: Vendor A orchestrator (card-driven, caches cards for 300s TTL) delegating to Vendor B executor (rolling deploy, card regenerated per build, task schema versioned independently in the executor binary). During a B-side canary rollout, the card at `/.well-known/agent.json` was updated to advertise `capabilities.streaming = true` and `defaultInputModes = ["text/plain", "application/json"]`, but the executor fleet was mid-rollout: 40% of instances still ran the prior binary whose `input-required` follow-up path accepted only `text/plain`. Trace of a single failing task: 1. A fetches B's card at T+0, caches it. Card declares `streaming: true`, `inputModes: [text, json]`. 2. A issues `tasks/send` with `message.parts = [{type: "text", text: "..."}]`. Routed by B's load balancer to a *new* binary instance. Task created, `state = "working"`. 3. New-binary instance determines it needs clarification and returns `state = "input-required"` with `message.parts = [{type: "data", data: {...}, metadata: {schema: "clarification/v2"}}]` — a `data` part, permitted by the new schema but **not** in the cached card's input modes. 4. A's follow-up turn constructs `tasks/send` with a `data` part. Load balancer routes to an *old-binary* instance (sticky routing keyed on task ID hash, not on binary version). 5. Old binary rejects: `-32602 Invalid params: unsupported part type "data"`. Task transitions to `failed` on B, but A has already written `input-required → working` to its own checkpoint store. 6. A's reconciler sees B reports `failed`, A's local state says `working`. Divergence. A retries `tasks/send` on the same task ID; old binary returns `-32001 Task not found` (task store is per-instance, not shared). A now holds an orphaned task ID with no peer-side record. The failure is not "the card was stale." The failure is that **the card and the executor were versioned independently, and A2A v1.0 provides no mechanism to bind a task's lifecycle to the schema version in force at task creation.** The task ID survived a binary boundary; the schema it was created under did not. ## Condition of Validity The invariant that would have prevented this: *a task's negotiated schema must be pinned at `submitted` and immutable for the task's lifetime, and any peer that cannot honor the pinned schema must reject at `submitted`—not at `input-required`.* A2A v1.0 does not mandate this. The card's `capabilities` field is advisory; the spec's conformance section requires executors to *support* advertised modes, not to *reject tasks whose follow-up turns use modes the card advertised but the instance cannot serve*. The validity condition for card-driven delegation is therefore narrower than most orchestrators assume: - **Valid** when card TTL < executor rollout window, AND the delegator re-validates the card on every `input-required` transition, AND the peer's task store is shared across instances (so a task ID is resolvable regardless of routing). - **Invalid** when any of: card cached across a rollout; load balancer routes by task ID to heterogeneous binaries; task store is per-instance; follow-up payloads are constructed from the cached card rather than from the peer's `input-required` message. The last condition is the sharp one. A conformant delegator must treat the `input-required` message's `parts` as the *authoritative* schema for the follow-up turn, not the card. The card describes what the peer *can* accept at task creation; the `input-required` message describes what it *will* accept at continuation. These are different contracts, and the spec does not say so explicitly. ## Decision Boundary The delegator must choose, at the `input-required` transition, between two strategies: - **Card-authoritative**: build the follow-up from the cached card's `defaultInputModes`. Cheap, no re-fetch, but fails whenever the peer's live schema has advanced past the card (the observed case) or the peer's `input-required` message demands a mode the card omitted. - **Message-authoritative**: build the follow-up from the `input-required` message's `parts` and `metadata.schema`, re-fetch the card if the message's schema is unknown, and abort with a typed error if the peer's declared modes and message schema disagree. Costlier (one extra fetch per continuation), but bounds the failure to a clean rejection rather than an orphaned task. The boundary is crossed when `input-required.message.parts` contains a part type or `metadata.schema` value not present in the cached card's `defaultInputModes`/`defaultOutputModes`. At that instant the delegator must *not* proceed on the card. It must either re-fetch (and if the re-fetched card still disagrees with the message, treat the peer as non-conformant and fail the task with a protocol error) or abandon the task with a typed exception that preserves the task ID for reconciliation. A second boundary: when the peer returns `-32001 Task not found` on a continuation, the delegator must not retry `tasks/send` with the same ID. A2A task IDs are peer-scoped; a `not found` means the peer's task store lost the record (instance boundary, TTL eviction, or crash). Retrying with the same ID either duplicates work (if the peer re-creates) or fails permanently (if the peer rejects reused IDs). The correct action is to abandon the task ID, mark the delegation `failed` locally, and re-issue under a fresh ID *only* if the operation is idempotent at the business layer. ## Operational Effect The observable cost of ignoring this boundary is not a single failed task—it is **task-ID orphan accumulation** on the delegator side. Each orphan is a checkpoint entry with a peer-side record that no longer exists, a streaming channel that will never close, and a slot in the delegator's concurrency budget that is never released until a reconciler sweeps it. In the observed run, a 90-second canary window produced 340 orphans against a 200-slot budget; the orchestrator hit its concurrency ceiling and began rejecting *new* delegations unrelated to Vendor B. The blast radius of a stale card is the entire delegation pool, not the single peer. The guardrail that bounds it: pin the schema at `submitted`, treat `input-required` as authoritative for continuation, treat `-32001` as terminal for the task ID, and run a reconciler that compares local task state against peer `tasks/get` on a bounded interval with a hard TTL (orphans older than N seconds are force-failed and their slots released). The reconciler must itself be card-aware: if `tasks/get` returns a schema the local store cannot parse, that is an orphan, not a transient error. ```python import time from dataclasses import dataclass, field from typing import Any class A2ALifecycleDivergence(RuntimeError): """Raised when a task's negotiated schema diverges from the peer's live schema or when the peer's task store loses a task ID mid-lifecycle.""" @dataclass class PinnedTask: task_id: str peer: str schema_at_submit: dict[str, Any] state: str = "submitted" created_at: float = field(default_factory=time.time) last_continuation_schema: dict[str, Any] | None = None def build_continuation( task: PinnedTask, input_required_message: dict[str, Any], cached_card: dict[str, Any], refetch_card, ) -> dict[str, Any]: """Construct the follow-up turn. The input-required message is authoritative; the cached card is advisory. Divergence is a protocol error, not a retry.""" msg_parts = input_required_message.get("parts", []) msg_schema = input_required_message.get("metadata", {}).get("schema") card_modes = set(cached_card.get("defaultInputModes", [])) msg_modes = {p.get("type") for p in msg_parts if "type" in p} if not msg_modes.issubset(card_modes): # Card and live message disagree. Re-fetch once; if still disagreeing, fail. fresh = refetch_card(task.peer) fresh_modes = set(fresh.get("defaultInputModes", [])) if not msg_modes.issubset(fresh_modes): raise A2ALifecycleDivergence( f"peer {task.peer} task {task.task_id}: input-required message " f"demands modes {msg_modes} not in card (cached={card_modes}, " f"fresh={fresh_modes}); schema={msg_schema}" ) cached_card = fresh # adopt fresh card for this continuation only task.last_continuation_schema = {"modes": msg_modes, "schema": msg_schema} task.state = "working" return {"taskId": task.task_id, "message": {"parts": msg_parts}} def handle_continuation_response(task: PinnedTask, response: dict[str, Any]) -> None: """A -32001 on continuation means the peer lost the task ID. Terminal.""" error = response.get("error") if error and error.get("code") == -32001: task.state = "failed" raise A2ALifecycleDivergence( f"peer {task.peer} lost task {task.task_id} (code -32001); " f"task ID is peer-scoped and must not be reused" ) if "result" in response: task.state = response["result"].get("status", {}).get("state", task.state) def reconcile_orphans(tasks: list[PinnedTask], peer_probe, ttl_s: float = 300.0) -> list[str]: """Sweep tasks whose peer-side record is gone or whose age exceeds TTL.""" orphans = [] now = time.time() for t in tasks: if t.state in ("completed", "failed"): continue if now - t.created_at > ttl_s: t.state = "failed" orphans.append(t.task_id) continue probe = peer_probe(t.peer, t.task_id) if probe.get("error", {}).get("code") == -32001: t.state = "failed" orphans.append(t.task_id) return orphans ```