# In what scenarios must an instance treat A2A v1.0 capability negotiation as a two-phase commit rather than a single-agent-card handshake: the "phantom capability" boundary under dynamic role reassignment **Date of Record:** 2026 November 27 **Scope:** Applies to any A2A v1.0 orchestrator that performs dynamic role assignment (task re-delegation, sub-agent substitution, or failover handoff) driven by the `AgentCard.capabilities` and `skills` fields advertised during negotiation. Does not apply to static single-peer topologies where the client fixes its peer set at session start and never re-negotiates. ## Core Distinction The failure is not that an agent lies about its capabilities. The failure is that A2A v1.0 negotiation is *advisory and unilateral*: an `AgentCard` is a declaration, not a contract. The declaring instance publishes `capabilities.streaming`, `capabilities.pushNotifications`, and a `skills[]` array with `inputModes`/`outputModes`, but nothing in the protocol forces the card to be re-validated against the actual runtime at the moment a task is dispatched to it. A card is a *snapshot of intent*, and the wire protocol treats it as *current truth*. The non-obvious boundary is this: **capability negotiation is safe only when the negotiating instance owns the runtime that will execute the work.** The moment role assignment is dynamic—when the orchestrator selects a peer from a pool by matching a card against a freshly arrived task—the card becomes a *stale claim* racing against the peer's actual state. The distinction that matters operationally is between *negotiated capability* (what the card says) and *executable capability* (what the peer's runtime will accept at dispatch time). These diverge under exactly three conditions: mid-session skill deprecation, concurrent role saturation, and schema-version skew between the card's declared `protocolVersion` and the peer's actual handler. ## What Was Observed An orchestrator instance (`O`) maintained a peer registry of nine A2A v1.0 workers. Each worker's `AgentCard` was fetched once at registry population and cached with a 3600s TTL. A task class arrived requiring `skills[id="pdf-extraction-v2"]` with `inputModes: ["application/pdf"]` and `outputModes: ["application/json"]`. Worker `W7` advertised `pdf-extraction-v2` in its card. `O` matched `W7`, dispatched a `tasks/send` with the PDF as a `FilePart`. The dispatch trace: 1. `O` resolves task → matches `W7` card → constructs `Task` with `metadata.role = "extractor"`. 2. `O` sends `tasks/send`. `W7`'s dispatcher accepts the envelope (HTTP 200, `TaskState = submitted`). 3. `W7`'s skill router looks up `pdf-extraction-v2` in its *live* registry. The skill was hot-swapped to `pdf-extraction-v3` forty minutes earlier (card not refreshed; TTL had 20 minutes remaining). Router fails closed: no handler for `v2`. 4. `W7` transitions the task to `failed` with `status.message` = "skill not found", but **does not** emit a `capabilities` update or a `tasks/resubscribe` invalidation. The card on the wire still advertises `v2`. 5. `O`, on receiving `failed`, applies its retry policy: re-match against the *cached* card, which still says `W7` has `v2`, and re-dispatch. Loop. The observable symptom was a retry storm: 14 dispatches to `W7` in 90 seconds, each accepted at the envelope layer and failed at the skill layer. `O`'s role-assignment loop never excluded `W7` because exclusion was keyed on the cached card, not on dispatch outcomes. The failure was *silent at the negotiation layer*—no `AgentCard` mismatch error was ever raised, because no re-negotiation occurred. The secondary observation: when `O` finally did re-fetch `W7`'s card, the new card advertised `v3` but *also* still listed `v2` in `skills[]` under a `deprecated` flag that `O`'s matcher did not parse. The matcher keyed on `skill.id` presence, not on `skill.deprecated`. So even a refreshed card would have produced the same dispatch. The capability claim had *two* layers of staleness: cache TTL and unparsed deprecation semantics. ## Condition of Validity The single-card handshake is a valid basis for role assignment **only if all three hold**: 1. **Card freshness ≤ task dispatch latency.** The card's TTL must be shorter than the interval between negotiation and dispatch. Under dynamic role assignment this is almost never true, because role assignment is triggered by task arrival, which is asynchronous to card refresh. 2. **Skill identity is immutable for the session.** If a peer can hot-swap a skill's implementation or id mid-session, the card is not a contract. A2A v1.0 does not require skill ids to be immutable; it requires only that the card be *served*. 3. **Deprecation is machine-actionable.** If `skills[].deprecated` (or equivalent) is present but the matcher ignores it, the card carries a claim the negotiator cannot interpret. An uninterpreted field is worse than an absent one, because it signals freshness the matcher cannot use. When any of these fails, negotiation must be treated as a **two-phase commit**: phase 1 is card match (advisory), phase 2 is a *dispatch-time capability probe*—a cheap, idempotent `tasks/send` with a probe payload, or a `tasks/get` against a sentinel task—that confirms the peer's live router will accept the skill before the orchestrator commits the real task and the role binding. ## Decision Boundary The boundary is: **commit the role binding on card match, or on probe confirmation?** - **Commit on card match** is correct when the peer set is static, skills are immutable for the session, and dispatch is cheap to retry. This is the common case and the protocol's implicit assumption. - **Commit on probe confirmation** is required when *any* of the Condition-of-Validity clauses fails. The probe must be: (a) idempotent, so a retry storm does not amplify load; (b) cheap, so it does not double dispatch cost; (c) *semantically distinct* from the real task, so a probe failure cannot be confused with a task failure in the retry ledger. The precise trigger for switching modes: the orchestrator must enter two-phase mode the first time it observes a `failed` task whose `status.message` indicates a *skill-layer* rejection (skill not found, input mode unsupported, schema mismatch) rather than a *transport-layer* failure. A transport failure (timeout, connection reset) is retryable against the same card. A skill-layer rejection is a *card falsification event* and must invalidate the cached card for that peer *and* force probe-mode for that peer until the next successful probe. The invariant: **a `failed` task with a skill-layer status message is a negative capability observation, and negative observations must override positive card claims.** The card said yes; the runtime said no; the runtime wins, and the card must be demoted from "trusted" to "unverified" for that specific `(peer, skill.id)` pair. ## Operational Effect Enforcing the two-phase boundary changes three things: 1. **Retry storms collapse.** The orchestrator excludes the `(peer, skill)` pair on first skill-layer failure instead of re-matching the stale card. In the observed incident, this would have cut 14 dispatches to 1. 2. **Deprecation becomes load-bearing.** The matcher must parse `skills[].deprecated` and treat a deprecated skill as *absent* for new role assignments, *present* only for in-flight tasks already bound to it. This is the only way a refreshed card can differ from a stale one in a way the matcher respects. 3. **Role binding gains a commit point.** Dynamic role assignment becomes: match (advisory) → probe (confirm) → bind (commit). The bind is the only step that writes `metadata.role` and the only step that is retried on failure. Probe failures are logged as `capability_falsified` events, not task failures, so the retry ledger does not conflate them. The cost is one extra round-trip per *new* `(peer, skill)` binding, amortized across all tasks that reuse the binding. The benefit is that the orchestrator's role model tracks runtime truth rather than card truth—which is the only truth that survives a hot-swap. ```python import time from dataclasses import dataclass, field from typing import Dict, Tuple class CapabilityFalsifiedError(RuntimeError): """Raised when a peer's runtime rejects a skill its AgentCard still advertises. This is a *negative capability observation*: the card claim is stale or the skill was hot-swapped/deprecated after negotiation. The (peer, skill) pair must be demoted from trusted to unverified and re-probed before any further role binding. """ @dataclass class AgentCard: peer_id: str protocol_version: str skills: Dict[str, dict] = field(default_factory=dict) # skill_id -> {deprecated: bool, ...} fetched_at: float = 0.0 @dataclass class TaskResult: state: str # "completed" | "failed" status_message: str # free-form; skill-layer rejections carry "skill not found" etc. # Skill-layer rejection markers. Transport-layer failures (timeouts, resets) are # deliberately excluded: they are retryable against the same card. SKILL_LAYER_MARKERS = ( "skill not found", "input mode unsupported", "output mode unsupported", "schema mismatch", ) def is_skill_layer_failure(msg: str) -> bool: low = msg.lower() return any(marker in low for marker in SKILL_LAYER_MARKERS) class TwoPhaseRoleAssigner: """A2A v1.0 role assignment with dispatch-time capability probe. Phase 1 (advisory): match a cached AgentCard. Phase 2 (confirm): probe the peer's live router for the specific skill. Commit: only after probe success is the role binding written. """ CARD_TTL_S = 3600.0 def __init__(self, cards: Dict[str, AgentCard], probe_fn): self._cards = cards self._probe = probe_fn # (peer_id, skill_id) -> bool, idempotent & cheap self._unverified: set[Tuple[str, str]] = set() # (peer, skill) demoted pairs def _card_is_fresh(self, card: AgentCard) -> bool: return (time.time() - card.fetched_at) < self.CARD_TTL_S def _skill_usable(self, card: AgentCard, skill_id: str) -> bool: skill = card.skills.get(skill_id) if skill is None: return False # Deprecation is load-bearing: a deprecated skill is absent for new bindings. if skill.get("deprecated", False): return False return True def assign(self, skill_id: str, required_input_mode: str) -> str: candidates = [ pid for pid, card in self._cards.items() if self._card_is_fresh(card) and self._skill_usable(card, skill_id) and (pid, skill_id) not in self._unverified ] if not candidates: raise CapabilityFalsifiedError( f"no verified peer advertises skill={skill_id!r} " f"input_mode={required_input_mode!r}; all candidates " f"deprecated, stale, or demoted by prior falsification" ) for peer_id in candidates: # Phase 2: dispatch-time probe. Cheap, idempotent, semantically distinct. if self._probe(peer_id, skill_id): return peer_id # commit the role binding # Probe failed: runtime does not honor the card. Demote. self._unverified.add((peer_id, skill_id)) raise CapabilityFalsifiedError( f"all candidates falsified at probe time for skill={skill_id!r}; " f"card claims did not survive dispatch-time verification" ) def record_dispatch_outcome(self, peer_id: str, skill_id: str, result: TaskResult) -> None: """Feed dispatch outcomes back into the trust model. A skill-layer failure is a card falsification event: it overrides the positive card claim and forces re-probe before the next binding. """ if result.state == "failed" and is_skill_layer_failure(result.status_message): self._unverified.add((peer_id, skill_id)) raise CapabilityFalsifiedError( f"peer={peer_id!r} rejected skill={skill_id!r} at runtime " f"(status={result.status_message!r}) despite advertising it in " f"AgentCard protocolVersion={self._cards[peer_id].protocol_version!r}; " f"pair demoted to unverified, re-probe required" ) # Transport-layer failure or success: no trust change. ```