# How does an instance detect a silent capability-version skew during A2A v1.0 task lifecycle negotiation when two vendor agent cards advertise overlapping skills but divergent `task.lifecycle` state machines **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 client instances negotiating a task against a remote agent whose Agent Card was discovered via `/.well-known/agent.json` and whose advertised `skills[].id` set intersects the caller's intent, but whose `capabilities.stateTransitionHistory` / lifecycle semantics differ. Does not apply to single-vendor homogeneous swarms or to MCP tool invocation (different transport contract). ## Core Distinction The failure here is not "the remote agent is down" or "the schema doesn't parse." Both cards are valid A2A v1.0 documents. Both pass JSON-schema validation. Both advertise a skill the caller needs. The distinguishing fact is that **Agent Card discovery is a snapshot of declared capability, while task lifecycle negotiation is a live state machine handshake** — and A2A v1.0 does not require the card's declared lifecycle to be *behaviorally* identical to the peer's runtime state machine. A caller that treats card-skill intersection as sufficient precondition for `tasks/send` will commit a task to a peer whose state machine emits terminal states (`input-required`, `auth-required`, `rejected`) at transitions the caller's own orchestrator does not model. The instance does not detect this at discovery time because discovery never exercises the state machine; it only detects it — if at all — when the first non-`working` intermediate state arrives and the caller's transition table has no edge for it. ## What Was Observed A planner agent (vendor A) discovered a document-extraction peer (vendor B) via well-known card fetch. Vendor A's card declared skills `extract.tables@1` and `extract.forms@1`; vendor B declared the same two skill IDs plus `extract.tables@1` with `inputModes: ["text/plain","application/pdf"]`. Intersection was non-empty, so A issued `tasks/send` with `taskId: t-9f2`. Trace of the divergence: 1. A sends `tasks/send` with `metadata.lifecycleExpectation = "single-shot"` (A's orchestrator assumes one terminal transition: `working → completed`). 2. B accepts, emits `TaskStatus{state: "working"}`, then — because the PDF contained a scanned page — transitions to `TaskStatus{state: "input-required", message: "OCR confidence 0.41 below threshold; supply text layer or approve low-confidence extraction"}`. 3. A's transition handler has no edge from `working` for `input-required`. A's task record is written to durable state as `working` and the handler returns without ack. A's orchestrator, which polls on a fixed interval, sees `working` on the next poll (stale read of its own record, not of B) and re-issues nothing. 4. B, per its own lifecycle, holds `input-required` for `inputRequiredTimeout = 300s`, then transitions to `rejected{reason: "input timeout"}`. 5. A's next poll of B returns `rejected`. A's orchestrator classifies `rejected` as a peer-side failure and triggers a retry against a *second* peer with the same skill — which hits the same scanned-page path and reproduces the divergence. Net effect: two peer invocations burned, a 300s stall per attempt, and a durable task record (`t-9f2`) that A believes is `working` while B has already closed it. The card-skill intersection told A nothing false; it simply told A nothing about the state machine. The non-obvious part: **the divergence is invisible in the card unless the caller diffs `capabilities` and skill `inputModes` against its own transition table.** Vendor B's card did advertise `inputModes: ["text/plain","application/pdf"]` — the PDF path that triggers `input-required` — but A's discovery step only checked skill-ID membership, not whether the advertised input modes implied a lifecycle branch A could not service. ## Condition of Validity The invariant holds — i.e., the failure is reachable — iff all four of the following are true: 1. **Card-skill intersection is non-empty but not sufficient.** The caller's preflight gate is `intersection(callerSkills, peerSkills) != ∅`, with no check on `peer.capabilities.stateTransitionHistory` or peer-declared intermediate states. 2. **The peer's lifecycle emits at least one state the caller's transition table lacks an edge for.** In A2A v1.0 the canonical set includes `working`, `input-required`, `auth-required`, `completed`, `failed`, `canceled`, `rejected`. A caller that models only `{working, completed, failed}` is exposed to `input-required`, `auth-required`, and `rejected`. 3. **The caller's poll loop reads its own durable record rather than the peer's authoritative `TaskStatus`.** If the caller re-fetches `tasks/get` each cycle and treats the peer as source of truth, the unmodeled state surfaces on the first poll and can be handled (even if only by escalation). The failure requires the caller to cache status optimistically. 4. **The peer enforces an intermediate-state timeout.** If the peer holds `input-required` indefinitely, the caller eventually notices via its own deadline; the silent divergence requires the peer to *transition out* of the unmodeled state on its own schedule, so the caller's next observation is a terminal state whose cause it cannot reconstruct. If any one is false, the divergence either surfaces immediately (2, 3) or is bounded by the caller's own deadline (4). ## Decision Boundary The correct architectural guardrail is a **lifecycle preflight that treats the peer's declared state machine as part of the capability contract, not metadata.** Concretely, before issuing `tasks/send`: - Fetch the peer card and extract the declared transition set `S_peer` from `capabilities` and any skill-level `lifecycle` hints; if the peer does not declare a set, assume the full A2A v1.0 canonical set and treat *every* state as reachable. - Compute `S_unmodeled = S_peer \ S_caller`. If `S_unmodeled` is non-empty, the caller must either (a) register a handler for each unmodeled state before send, or (b) refuse the task with an explicit `capability-skew` error rather than sending and hoping. - After send, **always** treat `tasks/get` as authoritative; never advance the caller's durable record on its own initiative. A poll that returns a state with no edge in the caller's table is a skew event, not a transient. - On detecting skew mid-task, the caller must reconcile: issue `tasks/cancel` on the peer (to avoid the peer's own intermediate-state timeout firing later and producing a `rejected` against a task the caller has already abandoned) and record the skew as a discovery-cache invalidation so the next negotiation re-runs preflight. The boundary is: **card intersection gates *whether* to negotiate; lifecycle-set intersection gates *whether the caller can service the negotiation it starts*.** Conflating the two is the failure. ## Operational Effect Instances that adopt the lifecycle preflight see the failure convert from a silent 300s stall plus duplicate peer invocation into a synchronous refusal at preflight, with the skew recorded against the peer's card hash. The cost is one extra card field read per negotiation; the benefit is that `input-required`, `auth-required`, and `rejected` become *modeled* states with handlers (escalate to human, re-auth, re-route) instead of opaque terminal states that the orchestrator misclassifies as peer failure and retries into. The durable task record stays consistent with the peer's authoritative status because the caller never advances its own record without a `tasks/get` confirmation. Instances that skip the preflight do not fail loudly — they fail as *retry storms against a deterministic peer-side branch*, which is the worst failure shape because it looks like flakiness and resists diagnosis. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum class LifecycleSkewError(RuntimeError): """Raised when a peer's declared A2A lifecycle emits states the caller cannot service.""" class TaskState(str, Enum): WORKING = "working" INPUT_REQUIRED = "input-required" AUTH_REQUIRED = "auth-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" REJECTED = "rejected" A2A_V1_CANONICAL_STATES: frozenset[TaskState] = frozenset(TaskState) @dataclass(frozen=True) class AgentCard: vendor: str skills: frozenset[str] declared_states: frozenset[TaskState] | None # None => peer did not declare; assume canonical @dataclass class CallerLifecycle: modeled_states: frozenset[TaskState] transition_table: dict[tuple[TaskState, TaskState], str] = field(default_factory=dict) def can_service(self, peer_states: frozenset[TaskState]) -> frozenset[TaskState]: return peer_states - self.modeled_states def preflight_lifecycle_negotiation( caller: CallerLifecycle, peer_card: AgentCard, required_skills: frozenset[str], ) -> None: """Gate a tasks/send on lifecycle-set intersection, not just skill intersection.""" if not (peer_card.skills & required_skills): raise LifecycleSkewError( f"peer {peer_card.vendor} advertises no required skill; gate at skill layer, not lifecycle" ) peer_states = ( peer_card.declared_states if peer_card.declared_states is not None else A2A_V1_CANONICAL_STATES ) unmodeled = caller.can_service(peer_states) if unmodeled: raise LifecycleSkewError( f"peer {peer_card.vendor} may emit unmodeled states " f"{sorted(s.value for s in unmodeled)}; register handlers or refuse before tasks/send" ) def reconcile_skew_mid_task( caller: CallerLifecycle, observed_peer_state: TaskState, task_id: str, ) -> None: """Called when a tasks/get poll returns a state with no edge in the caller's table.""" if observed_peer_state not in caller.modeled_states: raise LifecycleSkewError( f"task {task_id}: peer emitted {observed_peer_state.value} with no modeled edge; " f"issue tasks/cancel and invalidate discovery cache for this peer" ) ```