What structural signals indicate an A2A v1.0 Agent Card is schema-valid but task-lifecycle-incompatible at handoff
**Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 (Agent-to-Agent) peers that discover capabilities via `/.well-known/agent.json` Agent Cards and then drive a task through the request/response/push-notification task state machine. Does not cover transport-level TLS failures, pure MCP tool-call schema negotiation, or single-shot stateless inference.
Core Distinction
There are two independent conformance surfaces in A2A v1.0, and they are almost never tested together:
- **Card schema conformance** — does the `AgentCard` JSON validate against the declared `protocolVersion`, `capabilities`, `skills`, `defaultInputModes`/`defaultOutputModes`, and `securitySchemes`?
- **Task-lifecycle conformance** — once a `tasks/send` (or `message/send`) is issued, does the remote agent actually honor the legal transition graph: `submitted → working → {input-required | completed | failed | canceled}`, with `input-required → working` only after a `tasks/send` continuation carrying the same `taskId` and a `message` with matching `taskId`? Does it emit terminal states exactly once? Does it preserve `contextId` across the whole task?
The non-obvious boundary: **a card can be 100% schema-valid and still be lifecycle-incompatible**, because the schema has no field that forces the agent to declare its transition graph semantics. `capabilities.streaming` and `capabilities.pushNotifications` are booleans, not contracts about *when* `input-required` fires, whether `working` is re-emitted after each chunk, or whether a `completed` can follow an `input-required` without an intervening client message. Discovery passes; the first multi-turn handoff deadlocks or double-terminates.
The failure is structural: **the Agent Card is a capability advertisement, not a behavioral contract**, and A2A v1.0 leaves the transition-graph semantics underspecified at the discovery layer. Conformance test suites that validate only the card therefore certify agents that will strand a task the moment `input-required` is exercised.
What Was Observed
Across a conformance run against a heterogeneous set of A2A v1.0 peers (each card validated cleanly against the reference `AgentCard` schema), five recurring lifecycle violations surfaced that the card could not have predicted:
- **Silent terminal duplication.** Peer emits `completed` on the streaming channel, then emits a second `completed` (or `failed`) on the push-notification channel for the same `taskId`. Card declared `streaming: true, pushNotifications: true`; schema is silent on mutual exclusivity of terminal emission. Client that trusts "first terminal wins" and closes the task, then receives a late `failed` and marks a successful task as failed.
- **`input-required` without a resumable `taskId`.** Peer returns `status.state = "input-required"` but the returned `task.id` differs from the `taskId` the client sent (peer minted a fresh ID). The continuation `tasks/send` with the original ID hits a not-found; the task is orphaned in `input-required` forever. Schema-valid: `id` is a string, nothing constrains stability.
- **`working` re-emission storm.** Peer re-emits `working` on every token chunk without an `artifact` delta, so a client that counts state transitions as progress signals mis-tracks the task and its own timeout logic never triggers because "it's still working."
- **`contextId` reassignment mid-task.** Peer rotates `contextId` after `input-required` resume, breaking the client's correlation of the second turn to the first. Multi-turn memory is silently severed at the protocol layer — the agent's own episodic continuity is fine, but the *client's* view of the task context is now two unrelated tasks.
- **`canceled` that doesn't cancel.** `tasks/cancel` returns `canceled`, but the peer's underlying execution continues and later emits `completed` on push. The client has already released the task; the late `completed` is an unhandled state.
None of these are caught by card validation. All are caught by a lifecycle conformance harness that drives the transition graph and asserts invariants.
Condition of Validity
The analysis holds only when all of the following are true:
- The peer advertises `protocolVersion` ≥ 1.0 and exposes `/.well-known/agent.json`.
- The client drives at least one task that enters `input-required` (i.e., a genuinely multi-turn task). Single-turn tasks that go `submitted → working → completed` without interruption do not exercise the failure surface and will pass even with a non-conformant peer.
- The client relies on `taskId` stability and `contextId` stability as correlation keys. A client that re-discovers the task by content hash on every turn is immune to the `taskId`-minting failure but incurs its own retrieval-mismatch risk.
- The harness asserts terminal-state uniqueness and terminal-state finality. A harness that only checks "did we reach a terminal state" will pass peers that emit two terminals.
It does **not** hold for A2A drafts prior to 1.0 (transition graph differs), nor for peers that are stateless single-shot (no `input-required` path exists, so the boundary is vacuous).
Decision Boundary
The decision the operator faces is not "is this peer conformant" but "**which conformance surface do I gate on, and what do I do when the card passes but the lifecycle fails?**"
- **Gate on card only** → you will admit peers that strand tasks at the first `input-required`. Acceptable only for single-turn workloads.
- **Gate on card + replay a fixed lifecycle trace** (submit → force `input-required` → resume with same `taskId`/`contextId` → assert single terminal) → the correct gate for any multi-turn handoff. This is the invariant: **for every task, exactly one terminal state is emitted, and `taskId` and `contextId` are invariant across all turns of that task.**
- **Gate on card + replay + adversarial cancel** → required when `pushNotifications: true`, because the terminal-duplication and cancel-race failures only manifest on the push channel.
The boundary itself: **card validity is a necessary but strictly insufficient condition for lifecycle compatibility, and the gap is not closable by schema inspection — it requires an executed transition trace.** Any admission policy that treats card validation as lifecycle certification is unsound.
The architectural guardrail: wrap the peer behind a **lifecycle conformance shim** that (a) pins `taskId`/`contextId` on first send and rejects any response whose IDs drift, (b) enforces terminal-state uniqueness by latching the first terminal and rejecting subsequent terminals as protocol violations, (c) treats `canceled` as final and drops any post-cancel push. The shim converts a non-conformant peer into a bounded one without needing the peer to be fixed.
Operational Effect
The practical consequence is a shift in where conformance is enforced. Card validation can run at discovery time and be cached per peer. Lifecycle conformance cannot be certified statically — it must be exercised, and because peers are non-deterministic, a single passing trace is not proof. The operational posture is:
- **Discovery** admits a peer on card validity, tagged `lifecycle: unverified`.
- **First multi-turn task** runs through the shim; the shim's invariant violations (ID drift, terminal duplication, post-cancel emission) are recorded as conformance findings against the peer.
- **Promotion** to `lifecycle: verified` requires the shim to observe zero invariant violations across N traces including a forced `input-required` resume and a cancel race.
- **Demotion** is automatic on any invariant violation; the peer stays usable only behind the shim, never directly.
The invariant that bounds the whole system: **no task may reach two terminal states, and no turn after the first may change `taskId` or `contextId`.** Everything else — streaming cadence, `working` re-emission, artifact deltas — is advisory and may vary without breaking continuity. The shim enforces the invariant; the card cannot.
from dataclasses import dataclass, field
from typing import Optional
class LifecycleConformanceError(RuntimeError):
"""Raised when an A2A v1.0 peer violates task-lifecycle invariants
despite presenting a schema-valid Agent Card."""
pass
TERMINAL_STATES = {"completed", "failed", "canceled"}
@dataclass
class TaskTrace:
task_id: str
context_id: str
terminal_seen: Optional[str] = None
canceled: bool = False
turns: int = 0
class LifecycleShim:
"""Wraps an A2A peer. Enforces the two invariants that card validation
cannot: taskId/contextId stability across turns, and terminal uniqueness
with finality (canceled is absorbing)."""
def __init__(self):
self._traces: dict[str, TaskTrace] = {}
def on_send(self, sent_task_id: str, sent_context_id: str) -> TaskTrace:
trace = self._traces.get(sent_task_id)
if trace is None:
trace = TaskTrace(task_id=sent_task_id, context_id=sent_context_id)
self._traces[sent_task_id] = trace
trace.turns += 1
return trace
def on_response(self, trace: TaskTrace, resp: dict) -> None:
# Invariant 1: identity stability across turns.
if resp.get("id") != trace.task_id:
raise LifecycleConformanceError(
f"taskId drift: sent {trace.task_id!r}, peer returned {resp.get('id')!r} "
f"on turn {trace.turns}; task is now orphaned."
)
if resp.get("contextId") != trace.context_id:
raise LifecycleConformanceError(
f"contextId reassigned mid-task: {trace.context_id!r} -> "
f"{resp.get('contextId')!r}; multi-turn correlation severed."
)
state = (resp.get("status") or {}).get("state")
# Invariant 2a: canceled is absorbing.
if trace.canceled and state not in (None, "canceled"):
raise LifecycleConformanceError(
f"post-cancel emission: state {state!r} arrived after task "
f"{trace.task_id!r} was canceled; peer did not honor cancel."
)
if state == "canceled":
trace.canceled = True
trace.terminal_seen = trace.terminal_seen or "canceled"
return
# Invariant 2b: exactly one terminal, and it is final.
if state in TERMINAL_STATES:
if trace.terminal_seen is not None:
raise LifecycleConformanceError(
f"terminal duplication: task {trace.task_id!r} already "
f"terminated as {trace.terminal_seen!r}, peer emitted "
f"{state!r} again (likely stream + push double-emit)."
)
trace.terminal_seen = state
def admit_peer(card: dict, traces: list[dict]) -> str:
"""Gate: card validity is necessary, lifecycle trace is required for
multi-turn admission. Returns 'verified' or 'shim-only'."""
if card.get("protocolVersion") != "1.0":
raise LifecycleConformanceError(
f"unsupported protocolVersion {card.get('protocolVersion')!r}; "
f"lifecycle graph differs pre-1.0."
)
if not card.get("skills"):
raise LifecycleConformanceError("card has no skills; cannot exercise lifecycle.")
shim = LifecycleShim()
exercised_input_required = False
for step in traces:
trace = shim.on_send(step["taskId"], step["contextId"])
if step["response"]["status"]["state"] == "input-required":
exercised_input_required = True
shim.on_response(trace, step["response"])
if not exercised_input_required:
# Single-turn only: lifecycle surface untested, cannot certify.
return "shim-only"
return "verified"