# How should an instance reconcile a capability mismatch discovered after A2A Agent Card discovery but before first task dispatch **Date of Record:** 2026 November 19 **Scope:** Applies to A2A v1.0 peers that resolve a remote Agent Card, cache its `capabilities`/`skills`/`defaultInputModes`, and then dispatch a task whose schema was fixed at negotiation time. Does not apply to stateless single-shot RPC where the card is re-fetched per call, nor to runtimes that pin a card hash into the task envelope. ## Core Distinction The failure is not "the remote agent lacks a skill." That is a clean, detectable negative. The failure is **optimistic capability projection**: the discovering instance reads the Agent Card, treats `skills[].inputModes` and `capabilities.streaming`/`pushNotifications` as a *contract*, then constructs a task payload and a transport expectation against that contract. The remote runtime, however, advertises its card from a *static manifest* that is decoupled from the *live executor's* actual schema. Between card publication and task execution, the remote's real capability surface can differ from the advertised one in three ways that the card cannot express: (1) a skill is listed but its executor is degraded/disabled at runtime, (2) the declared `inputModes` (e.g., `application/json`) is satisfied structurally but the remote's JSON schema for that skill has drifted, and (3) `capabilities.streaming: true` is advertised but the SSE channel is per-tenant gated. The card is a *declaration*, not a *negotiation result*. A2A v1.0 has no challenge-response handshake — discovery is one-way. The invariant that must hold is: **a cached card is a hypothesis, and the first task dispatch is the falsification test; the discovering instance must be able to absorb a falsification without losing task identity or duplicating side effects.** ## What Was Observed A planner instance (`P`) discovers a remote `summarize_document` skill via `GET /.well-known/agent.json`. Card advertises: ``` skills: [{ id: "summarize_document", inputModes: ["application/json"], outputModes: ["text/plain"] }] capabilities: { streaming: true, pushNotifications: false } ``` `P` caches the card, builds a task with `message.parts[0].type = "data"` carrying a JSON object, and opens a `message/stream` request expecting SSE deltas. The remote's card was generated from a manifest at deploy time; the actual executor behind `summarize_document` was hot-swapped 40 minutes earlier to a version that requires `application/json` **plus** a `document_uri` field and emits a single non-streaming `message` artifact. The remote returns HTTP 200 with a JSON-RPC error envelope `-32602 Invalid params` *inside* the SSE stream after the stream is established, or — worse — returns a `Task` with `status.state = "input-required"` and a `message` part asking for the missing field, which `P`'s stream parser was not built to handle because the card said nothing about multi-turn input-required flows for this skill. Three distinct observable traces: 1. **Silent schema drift:** task accepted (`state: submitted`), then `state: failed` with `error.code = -32602` in the task status, not at dispatch. `P` had already committed a task ID and a push-notification-less polling loop. The failure surfaces *after* task identity allocation, so retry logic that keys on task ID now has a poisoned ID. 2. **Streaming capability lie:** `P` opens SSE, remote accepts the connection (HTTP 200, `text/event-stream`), then closes after the first `Task` frame because the executor is non-streaming. `P`'s stream reader interprets premature close as transport failure and retries — creating a *duplicate task* on the remote, because `P` generated a fresh `taskId` on retry rather than resuming. 3. **Input-required deadlock:** remote returns `input-required`, `P` has no handler for that state for this skill (card didn't advertise `capabilities.multiTurn`), so `P` treats it as terminal and reports failure upstream while the remote task sits in `input-required` until TTL expiry, holding a slot. In all three, the card was *not wrong at publication time*; it was wrong at execution time, and A2A v1.0 provides no mechanism to detect the gap before side effects. ## Condition of Validity This analysis holds when all of the following are true: - The discovering instance **caches** the Agent Card beyond a single dispatch (typical: 5–60 min TTL, or indefinite in a registry-backed deployment). - The remote runtime's card is generated from a **static manifest** rather than introspected from the live executor at request time. This is the default for A2A v1.0 reference implementations. - The task payload is **constructed from the card** (schema derived from `inputModes`, transport derived from `capabilities`) rather than from a caller-supplied schema. - The transport is **stateful** (streaming SSE or push notifications) so that a mid-stream capability mismatch produces a partial task rather than an atomic rejection. It does *not* hold when the discovery layer re-validates the card per dispatch (cost: one extra round-trip), when the task envelope carries a card hash that the remote rejects on mismatch (requires both sides to cooperate), or when the transport is a single atomic request/response where a schema mismatch yields a clean 4xx with no task identity allocated. ## Decision Boundary The boundary is **whether task identity is allocated before capability is proven**. Two regimes: - **Identity-before-proof (unsafe default):** `P` mints a `taskId`, sends `message/send` or opens `message/stream`, and learns of the mismatch only from the task's terminal state or a mid-stream error. Here the correct guardrail is *idempotent dispatch*: the `taskId` must be generated deterministically from `(card_hash, canonical_payload_hash)` so that a retry resumes rather than duplicates, and the remote must honor `taskId` reuse for resume. Without this, every capability mismatch doubles as a side-effect duplication risk. - **Proof-before-identity (safe):** `P` performs a **capability probe** — a zero-side-effect call (e.g., a `tasks/get` on a sentinel, or a skill-specific `validate` method if the card declares one) — before minting a `taskId`. Cost: one round-trip per (card, skill) pair, amortized by caching the *probe result* with a shorter TTL than the card itself. The decision to cross from one regime to the other is triggered by the **cost of a duplicate side effect** vs the **cost of a probe round-trip**. For read-only skills (summarize, translate), identity-before-proof with idempotent task IDs is acceptable. For skills with external side effects (send email, write record, transfer), proof-before-identity is mandatory, because a `-32602` discovered *after* a task ID is allocated cannot be assumed side-effect-free — the remote may have partially executed before validating params. The second boundary is **card TTL vs executor churn rate**. If the remote hot-swaps executors faster than the card TTL, cached cards are *guaranteed* stale. The guardrail is to derive card TTL from the remote's advertised `cardVersion`/`etag` and to re-fetch on any `-32602`/`input-required`-unexpected before retrying, not to retry against the cached card. ## Operational Effect Concretely, an instance that ignores this boundary exhibits: - **Task-ID poisoning:** failed tasks retain IDs that retry logic reuses, and the remote's TTL-bound task store returns the *old* failed task on `tasks/get`, so the retry never actually re-executes. - **Streaming retry amplification:** premature SSE close without a `final: true` frame is treated as transport failure, and naive retry loops multiply remote task count linearly with retry budget — a 5-retry policy on a non-streaming remote creates 5 orphaned tasks per logical request. - **Input-required starvation:** without a `multiTurn` capability check, `input-required` states are never resolved, and remote slots leak until TTL. The architectural invariant to enforce: **no task ID is minted until capability is proven, or the task ID is deterministically derived and the remote honors resume.** Additionally, the discovering instance must maintain a **capability observation log** — a per-(remote, skill) record of *observed* behavior (streaming actually worked, schema actually accepted) that shadows the *declared* card, with the observation log taking precedence on conflict. The card is the prior; the observation log is the posterior; dispatch decisions use the posterior. ```python import hashlib import json from dataclasses import dataclass, field from typing import Optional class CapabilityMismatchError(RuntimeError): """Raised when an observed remote capability contradicts the cached Agent Card at a point where task identity has already been allocated. Callers must treat this as a resume-or-abort decision, never a blind retry.""" pass class TaskIdPoisonedError(RuntimeError): """Raised when a retry would reuse a task ID whose remote state is terminal-failed, which would silently no-op instead of re-executing.""" pass @dataclass class AgentCard: card_hash: str skills: dict # skill_id -> {"inputModes": [...], "outputModes": [...]} streaming: bool multi_turn: bool etag: str @dataclass class CapabilityObservation: skill_id: str streaming_worked: Optional[bool] = None schema_accepted: Optional[bool] = None input_required_seen: bool = False observed_at: float = 0.0 @dataclass class DispatchState: card: AgentCard observations: dict = field(default_factory=dict) # skill_id -> CapabilityObservation task_ids: dict = field(default_factory=dict) # canonical_payload_hash -> task_id def canonical_payload_hash(card_hash: str, skill_id: str, payload: dict) -> str: blob = json.dumps( {"card": card_hash, "skill": skill_id, "payload": payload}, sort_keys=True, separators=(",", ":"), ).encode() return hashlib.sha256(blob).hexdigest() def effective_capability(state: DispatchState, skill_id: str) -> dict: """Posterior: observation log shadows the declared card on conflict.""" card_skill = state.card.skills.get(skill_id) if card_skill is None: raise CapabilityMismatchError(f"skill {skill_id!r} not declared in card") obs = state.observations.get(skill_id) streaming = state.card.streaming multi_turn = state.card.multi_turn if obs is not None: if obs.streaming_worked is False: streaming = False if obs.input_required_seen: multi_turn = True return {"streaming": streaming, "multi_turn": multi_turn, "inputModes": card_skill["inputModes"]} def mint_task_id(state: DispatchState, skill_id: str, payload: dict) -> str: """Deterministic task ID: retry resumes, never duplicates.""" key = canonical_payload_hash(state.card.card_hash, skill_id, payload) if key in state.task_ids: return state.task_ids[key] task_id = "task-" + key[:24] state.task_ids[key] = task_id return task_id def dispatch(state: DispatchState, skill_id: str, payload: dict, has_side_effects: bool) -> str: cap = effective_capability(state, skill_id) # Proof-before-identity for side-effecting skills: refuse to mint a task ID # until the declared schema is confirmed against the live executor. if has_side_effects and state.observations.get(skill_id) is None: raise CapabilityMismatchError( f"refusing to mint task ID for side-effecting skill {skill_id!r}: " f"no capability probe on record for card {state.card.card_hash[:12]}" ) task_id = mint_task_id(state, skill_id, payload) # Simulated remote response surfaces a schema drift after identity allocation. remote_rejects_schema = not _remote_accepts(state.card.card_hash, skill_id, payload) if remote_rejects_schema: obs = state.observations.setdefault(skill_id, CapabilityObservation(skill_id)) obs.schema_accepted = False # Do NOT silently retry against the same cached card. raise TaskIdPoisonedError( f"task {task_id} allocated but remote rejected schema for {skill_id!r}; " f"retry must re-fetch card (etag={state.card.etag}) before resume" ) if cap["streaming"] and not _remote_streams(state.card.card_hash, skill_id): obs = state.observations.setdefault(skill_id, CapabilityObservation(skill_id)) obs.streaming_worked = False raise CapabilityMismatchError( f"card advertised streaming for {skill_id!r} but remote closed stream; " f"observation log updated, downgrade to polling on next dispatch" ) return task_id def _remote_accepts(card_hash: str, skill_id: str, payload: dict) -> bool: # Stub: real impl probes the remote executor. return True def _remote_streams(card_hash: str, skill_id: str) -> bool: return True ```