# Why does an instance accept a peer's Agent Card at discovery but then fail the task lifecycle handshake mid-execution? **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 (Agent-to-Agent) task delegation where the calling agent (client) discovers a remote agent via its published Agent Card and drives a task through the lifecycle states (`submitted → working → input-required → completed/failed/canceled`). Does not apply to single-shot request/response tool calls, MCP resource fetches, or same-vendor agents sharing a compiled schema. ## Core Distinction The Agent Card is a *discovery-time* document. The task lifecycle is a *runtime* state machine. A2A v1.0 does not require that the two be validated against the same schema version, nor that the card's declared `capabilities` and `skills[].inputModes/outputModes` be re-checked when a task actually transitions. Discovery succeeds on the card alone; the handshake that matters happens later, on `tasks/send`, and it can fail on a state the card never described. The non-obvious part: an Agent Card can be *fully conformant* to the v1.0 JSON schema, pass every discovery-time validator, and still describe a lifecycle the remote agent does not actually implement. The card is a claim; the lifecycle is the behavior. The gap between them is the failure surface. ## What Was Observed A client orchestrator (vendor A) discovered a remote agent (vendor B) via `/.well-known/agent.json`. The card validated cleanly: - `protocolVersion: "1.0"` - `capabilities.streaming: true`, `capabilities.pushNotifications: false`, `capabilities.stateTransitionHistory: true` - `skills[0].inputModes: ["text/plain"]`, `outputModes: ["text/plain"]` - `defaultInputModes`/`defaultOutputModes` present at top level The client sent a `tasks/send` with `message.role: "user"`, `parts: [{kind: "text", text: "..."}]`. The remote accepted it and returned a `Task` in state `submitted` with a valid `id` and `contextId`. So far, conformant. Then the client did what the card licensed: it opened a `tasks/resubscribe` SSE stream because `capabilities.streaming: true` was declared. The remote returned HTTP 200 and an event stream. The first event was a `TaskStatusUpdateEvent` with `state: "working"`. The second event was — critically — a `TaskStatusUpdateEvent` with `state: "input-required"` and a `message` whose `parts` contained a `kind: "data"` part (a structured clarification payload). The client's parser rejected the event: its lifecycle handler had been compiled against the card's `outputModes: ["text/plain"]` and `inputModes: ["text/plain"]`, so it had no deserializer registered for `kind: "data"` in an inbound `input-required` message. The task stalled in `input-required` on the remote side while the client threw a deserialization error. The remote's task eventually timed out to `failed` after its own `input-required` deadline; the client never sent the clarifying message because it never parsed the request for one. Two independent conformance facts collided: 1. The card's `skills[].inputModes` describes what the agent accepts *as task input*, not what it may *emit* in an `input-required` clarification. The spec's `input-required` state carries a `Message` whose parts are governed by the message schema, not by the skill's `inputModes`. A conformant client that keys its inbound part deserializer off `inputModes` is wrong — but a conformant *card* gives it no other hook. 2. `capabilities.stateTransitionHistory: true` was declared, but the remote's `tasks/get` for the same task returned a `history` array that omitted the `input-required` event, containing only `submitted` and `working`. The history was lossy relative to the live stream. A client that resumed from `tasks/get` (after a reconnect) would reconstruct a lifecycle that never entered `input-required` and would wait forever for a `completed` that the remote was blocked on producing. ## Condition of Validity The invariant that must hold for cross-vendor A2A task execution to be safe: > For any task accepted under a discovered Agent Card, every state the remote can emit on the live stream must be reconstructible from `tasks/get` history, and every part `kind` the remote can emit in any lifecycle message must be in the union of the card's declared modes *and* the message-schema part kinds the client's parser accepts. Both halves failed here. The card's `outputModes` was treated by the client as the complete set of inbound part kinds — an over-read of the spec, but an over-read the card invites because it publishes no separate "emittable part kinds" field. And `stateTransitionHistory: true` was treated as a durability guarantee for the full event log, when in practice it only guarantees *some* history, with vendor-specific truncation. The condition of validity is therefore narrower than "the card validates." It is: *the card's declared capabilities are a superset the remote actually honors on the wire, and the client's parser is a superset of the remote's emittable part kinds.* Neither side can establish this from the card alone. ## Decision Boundary The boundary is between **trusting the card as a contract** and **treating the card as a hint that must be confirmed by the first task's wire behavior**. - Trusting the card: the client configures its lifecycle deserializer from `inputModes`/`outputModes`, assumes `stateTransitionHistory: true` means full replay, and assumes `streaming: true` means the stream and `tasks/get` agree. This is the default behavior of most v1.0 client SDKs and it is where the failure lives. - Confirming on the wire: the client accepts any `kind` in an inbound `Message` (the message schema is closed and small — `text`, `file`, `data`), and reconciles the stream against `tasks/get` history at every resume, treating any divergence as a protocol fault rather than a transient. The decision point is at `input-required`: when the remote transitions a task to `input-required`, the client must either (a) have a deserializer for every part kind in the inbound message, or (b) fail the task explicitly with a protocol error rather than stalling. Stalling is the failure mode — the client holds the task open, the remote holds its `input-required` deadline, and both wait on the other. ## Operational Effect The concrete operational consequence: a task that is *conformant on both sides* deadlocks for the duration of the remote's `input-required` timeout, then fails, and the client's `tasks/get` history shows no record of why. The failure is invisible in the history (lossy) and invisible in the card (conformant). The only trace is the live stream event the client rejected. The guardrail is a **card-to-wire conformance probe** run before the first real task: send a minimal task, force an `input-required` transition if the card declares any skill that can request input, and assert that (1) the inbound message parses against the full closed message-part schema, and (2) `tasks/get` history contains the same state sequence as the stream. If either assertion fails, downgrade the card's declared capabilities in the client's registry and refuse to route tasks that depend on them. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class A2AProtocolFault(RuntimeError): """Raised when a remote agent's wire behavior contradicts its Agent Card.""" class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" # The A2A v1.0 message-part schema is closed. A conformant client must # accept every kind here, regardless of what the card's inputModes says. CLOSED_PART_KINDS = frozenset({"text", "file", "data"}) @dataclass class AgentCard: protocol_version: str streaming: bool state_transition_history: bool input_modes: list[str] output_modes: list[str] @dataclass class StatusEvent: state: TaskState part_kinds: frozenset[str] = field(default_factory=frozenset) def reconcile_stream_against_history( card: AgentCard, stream_events: list[StatusEvent], history_states: list[TaskState], ) -> None: """Enforce the card-to-wire invariant before trusting a remote task. Two independent checks, both required: 1. Every inbound part kind is in the closed message schema. The card's outputModes do NOT bound emittable kinds; keying a deserializer off it is the classic cross-vendor stall. 2. If state_transition_history is declared true, the tasks/get history must contain every state the live stream emitted, in order. A lossy history makes resume-after-reconnect reconstruct a false lifecycle. """ for event in stream_events: unknown = event.part_kinds - CLOSED_PART_KINDS if unknown: raise A2AProtocolFault( f"remote emitted part kinds {sorted(unknown)} not in closed " f"message schema; client parser would stall the task" ) if card.state_transition_history: stream_seq = [e.state for e in stream_events] if history_states != stream_seq: raise A2AProtocolFault( f"declared stateTransitionHistory=true but tasks/get history " f"{[s.value for s in history_states]} diverges from live " f"stream {[s.value for s in stream_seq]}; resume would " f"reconstruct a false lifecycle" ) def drive_task(card: AgentCard, stream_events: list[StatusEvent], history_states: list[TaskState]) -> Optional[TaskState]: reconcile_stream_against_history(card, stream_events, history_states) # Only after the invariant holds may the client trust the card's # declared capabilities for routing subsequent tasks. return stream_events[-1].state if stream_events else None ```