# Under what conditions must an instance reject a peer's Agent Card before task acceptance, rather than after **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 (Agent-to-Agent) client instances that discover peer Agent Cards via well-known URI resolution and negotiate a `tasks/send` lifecycle across organizational boundaries. Does not apply to intra-process tool calls, MCP server bindings, or same-vendor deployments where capability schemas are pinned by a shared build. ## Core Distinction The distinction that matters is between **card-time validation** and **task-time validation**. An Agent Card is a *declaration* — a JSON document advertising `capabilities`, `skills`, `defaultInputModes`/`defaultOutputModes`, authentication schemes, and a `protocolVersion`. The task lifecycle is an *execution contract* — a state machine that moves `submitted → working → input-required → completed | failed | canceled`. The failure mode is not that a peer lies in its card. It is that a client accepts a card whose *advertised* capability set is a superset of what the peer can actually execute for the *specific skill* being invoked, then discovers the gap only after the task has been `submitted` and the peer has already persisted partial state. At that point the client is committed to a lifecycle it cannot cleanly abort: `tasks/cancel` is itself a negotiated capability, and a peer that lacks `cancelation` support leaves the task orphaned in `working` on the remote side. The invariant: **the set of skills a client will invoke against a peer must be a subset of the intersection of (peer-advertised skills) ∩ (peer-advertised input modes) ∩ (peer-advertised auth schemes the client can satisfy) ∩ (peer-advertised protocolVersion the client speaks), and this intersection must be computed and frozen before the first `tasks/send`.** Anything discovered after `submitted` is a boundary escape, not a negotiation. ## What Was Observed A client instance resolved a peer card at `https://peer.example/.well-known/agent.json`. The card declared: ``` protocolVersion: "1.0" capabilities: { streaming: true, pushNotifications: false, stateTransitionHistory: true } defaultInputModes: ["text/plain", "application/json"] skills: [ { id: "summarize", inputModes: ["text/plain"] }, { id: "extract", inputModes: ["application/json"] } ] ``` The client intended to invoke `extract` with a JSON payload. It validated the card against its own transport (protocolVersion match, streaming preference) and dispatched `tasks/send` with `skillId: "extract"`, `parts: [{ type: "data", data: {...} }]`. The peer accepted the task and returned `status: "working"`. Forty seconds later it transitioned to `failed` with `error: "unsupported input mode for skill extract"`. The peer's *card* said `extract` accepts `application/json`; the peer's *runtime* rejected the `data` part. The mismatch: the card's `inputModes` are declared per-skill, but the A2A part type `data` maps to `application/json` only if the peer's skill handler registers a data-part deserializer. The peer had registered `text/plain` for `extract` and advertised `application/json` in `defaultInputModes` — a card-level field that does *not* override per-skill `inputModes` when the skill omits them, because the spec treats omission as "inherit default" in some implementations and "no constraint" in others. Cross-vendor ambiguity in the inheritance rule produced a card that was truthful at the field level and false at the skill level. The client had no way to distinguish this at card time because it validated `defaultInputModes` against its payload type, not `skills[extract].inputModes`. It had also not checked `capabilities.cancelation` (absent → default false), so when the task failed it could not issue `tasks/cancel` to reclaim the peer-side state record, which remained in `failed` with a retained `contextId` — a stale reference the client's episodic store later retrieved and replayed against a *different* peer instance that had recycled the `contextId`. ## Condition of Validity The card-time freeze is valid only under three conjunctive conditions: 1. **Per-skill field resolution is explicit.** The client resolves `inputModes`/`outputModes` at the *skill* level, not the card level. If a skill omits `inputModes`, the client must treat it as *unknown*, not as inherited from `defaultInputModes`. Unknown → refuse to invoke that skill until the peer card is re-fetched with the field populated, or the client falls back to a capability probe (`tasks/send` with a minimal `text/plain` payload) whose failure is classified as *probe*, not *task*. 2. **Protocol version is exact-matched, not range-matched.** A2A v1.0 cards declare `protocolVersion` as a string. A client that speaks `1.0` must reject `1.1` and `0.9` rather than attempting downgrade negotiation, because the task state machine's `input-required` semantics changed between minor versions (v1.0 allows resumption via `tasks/send` with the same `taskId`; v0.9 required a new task). Accepting a mismatched version means the client's resume path silently forks a second task. 3. **Cancellation capability is a precondition for any task with side effects.** If `capabilities.cancelation` is false or absent, the client must either (a) refuse tasks whose skills have observable external effects, or (b) accept that the task is non-abortable and budget its timeout accordingly. The card does not tell you *why* cancellation is unsupported; it only tells you it is. Treat absence as a hard constraint on the task's blast radius. ## Decision Boundary The boundary is between *rejecting the card* and *accepting the card but constraining the task*: - **Reject the card** (do not cache, do not dispatch) when: `protocolVersion` is not exact-match; the requested skill is absent from `skills[]`; the requested skill's `inputModes` is present and does not contain the client's payload mode; or the card's `security`/`securitySchemes` cannot be satisfied by any credential the client holds. - **Accept the card but constrain the task** when: `cancelation` is false (proceed only with idempotent or read-only skills); `streaming` is false (poll `tasks/get` instead of `tasks/resubscribe`); `stateTransitionHistory` is false (do not attempt replay-based verification, since the peer will not serve the transition log). - **Probe before commit** when: a skill omits `inputModes` entirely and the client cannot determine the mode from the card. The probe is a `tasks/send` with a `text/plain` sentinel payload and an explicit `metadata: { probe: true }`; a peer that rejects the probe with `unsupported input mode` is telling you the skill exists but the mode is wrong — a different signal from `skill not found`. The critical anti-pattern: treating `tasks/send` acceptance (`status: "submitted"`) as validation. Acceptance proves the peer's *transport* accepted the envelope, not that its *skill handler* can execute the payload. The two are separated by the peer's internal dispatch, which is opaque to the client. ## Operational Effect Freezing the capability intersection at card time converts a class of post-commitment failures into pre-dispatch rejections. The measurable effect: tasks that fail at `working → failed` due to input-mode mismatch drop to zero for skills whose `inputModes` are explicitly declared; the residual failures are confined to skills with omitted `inputModes`, which the probe path classifies before any stateful task is created. The `contextId` recycling hazard disappears because the client never creates a task against a peer it cannot later cancel or whose version it cannot resume correctly. The cost is latency: card-time validation plus optional probing adds one round-trip per new peer per skill. This is amortized across the peer's card TTL. The invariant to hold: **no `tasks/send` may be issued against a peer whose card has not been frozen into the client's peer registry with an explicit per-skill capability record, and no task may be resumed after a `contextId` TTL expiry without re-validating the peer card** (peers recycle `contextId` namespaces across restarts, and a stale `contextId` resolved against a fresh peer instance silently attaches to an unrelated task). ```python import hashlib from dataclasses import dataclass, field from typing import Optional class AgentCardBoundaryError(RuntimeError): """Raised when a peer Agent Card cannot be safely frozen into the registry.""" @dataclass(frozen=True) class SkillCapability: skill_id: str input_modes: frozenset # empty frozenset == explicitly unknown, not "inherit" output_modes: frozenset @dataclass(frozen=True) class FrozenPeer: peer_id: str protocol_version: str cancelation_supported: bool streaming_supported: bool skills: dict card_digest: str def freeze_peer_card( peer_id: str, card: dict, client_protocol_version: str, client_payload_mode: str, requested_skill: str, ) -> FrozenPeer: if card.get("protocolVersion") != client_protocol_version: raise AgentCardBoundaryError( f"protocolVersion mismatch for {peer_id}: " f"peer={card.get('protocolVersion')!r} client={client_protocol_version!r}; " f"refusing downgrade negotiation" ) skills_raw = {s["id"]: s for s in card.get("skills", [])} if requested_skill not in skills_raw: raise AgentCardBoundaryError( f"skill {requested_skill!r} absent from {peer_id} card; " f"available={sorted(skills_raw)}" ) skill = skills_raw[requested_skill] # Per-skill inputModes ONLY. Do not fall back to defaultInputModes: # cross-vendor inheritance semantics are ambiguous in A2A v1.0. declared_modes = skill.get("inputModes") if declared_modes is None: raise AgentCardBoundaryError( f"skill {requested_skill!r} on {peer_id} omits inputModes; " f"mode is unknown, not inherited — probe required before tasks/send" ) if client_payload_mode not in declared_modes: raise AgentCardBoundaryError( f"skill {requested_skill!r} on {peer_id} does not accept " f"{client_payload_mode!r}; declared={declared_modes}" ) caps = card.get("capabilities", {}) frozen_skills = { sid: SkillCapability( skill_id=sid, input_modes=frozenset(s.get("inputModes", [])), output_modes=frozenset(s.get("outputModes", [])), ) for sid, s in skills_raw.items() } digest = hashlib.sha256( repr(sorted((k, v) for k, v in card.items())).encode() ).hexdigest() return FrozenPeer( peer_id=peer_id, protocol_version=card["protocolVersion"], cancelation_supported=bool(caps.get("cancelation", False)), streaming_supported=bool(caps.get("streaming", False)), skills=frozen_skills, card_digest=digest, ) def dispatch_task( frozen: FrozenPeer, skill_id: str, payload_mode: str, has_external_side_effects: bool, ) -> dict: if skill_id not in frozen.skills: raise AgentCardBoundaryError( f"skill {skill_id!r} not in frozen peer {frozen.peer_id}" ) cap = frozen.skills[skill_id] if payload_mode not in cap.input_modes: raise AgentCardBoundaryError( f"payload mode {payload_mode!r} outside frozen input_modes " f"{sorted(cap.input_modes)} for {skill_id!r}" ) if has_external_side_effects and not frozen.cancelation_supported: raise AgentCardBoundaryError( f"peer {frozen.peer_id} lacks cancelation; refusing side-effecting " f"task {skill_id!r} — task would be non-abortable" ) return { "taskId": None, # assigned by peer "skillId": skill_id, "mode": payload_mode, "cardDigest": frozen.card_digest, } ```