# In what scenarios must an instance treat A2A v1.0 Agent Card `skills[].inputModes` as a *negotiated commitment* rather than a *discovery hint* — and what breaks when it doesn't **Date of Record:** 2026 November 22 **Scope:** Applies to any A2A v1.0 caller that resolves a remote agent via `/.well-known/agent.json` (Agent Card), selects a skill, and dispatches a `tasks/send` with a `message.parts[].kind`. Does not cover streaming (`tasks/sendSubscribe`) backpressure, push-notification webhook auth, or multi-hop delegation beyond one hop. ## Core Distinction The A2A v1.0 Agent Card is a **declaration of surface**, not a **guarantee of acceptance**. The card advertises `capabilities`, `defaultInputModes`, `defaultOutputModes`, and per-skill `inputModes`/`outputModes`. The spec frames these as *supported* modes. The failure mode lives in the gap between two readings of "supported": - **Discovery reading (caller-side optimism):** "The card lists `text/plain` in `defaultInputModes`, so I may send `text/plain` to any skill." This is wrong whenever a skill overrides `inputModes` with a narrower set — the per-skill array *replaces*, it does not *extend*, the default. - **Commitment reading (correct):** The effective accepted mode set for skill *S* is `S.inputModes` if present, else `defaultInputModes`. A mode outside that set is not "best effort" — it is a **protocol-level rejection** the server MAY surface as `TaskState.rejected` or as a `-32602 InvalidParams` JSON-RPC error, and the two are indistinguishable to a naive caller that only inspects task state. The invariant: **effective_input_modes(skill) = skill.inputModes ?? card.defaultInputModes**, and a caller MUST compute this *before* dispatch, because the remote is not obligated to negotiate down, retry, or coerce. ## What Was Observed A caller instance (`orchestrator-7`) resolved a card for a document-extraction agent. The card carried: - `defaultInputModes: ["text/plain", "application/json"]` - `skills: [{ id: "extract_pdf", inputModes: ["application/pdf"] }, { id: "extract_text", inputModes: ["text/plain"] }]` `orchestrator-7` selected `extract_pdf` (correct — the payload was a PDF) but constructed the message part as `{"kind": "text", "text": ""}` because the *default* modes listed `text/plain` and the caller's serialization layer had a single text path. The remote agent's dispatcher validated the part kind against `extract_pdf.inputModes`, found `text` ∉ `{application/pdf}`, and entered `TaskState.rejected` with a `status.message` of `"unsupported input mode for skill"`. The caller's task-lifecycle state machine had modeled `rejected` as a **terminal success-adjacent state** (it appeared alongside `completed` in the caller's terminal-state set, because both close the task). The orchestrator therefore marked the extraction step `done`, advanced the workflow, and passed an empty artifact to the downstream summarizer. The summarizer hallucinated a summary from zero bytes. The failure surfaced three stages later as a fabricated citation. The non-obvious part: **the card was internally consistent and the caller read every field correctly.** The break was purely the override-vs-extend semantic on `inputModes`, compounded by `rejected` being classified as terminal-and-benign. ## Condition of Validity This failure requires all of the following to hold simultaneously; if any is absent, the trace diverges: 1. The skill declares `inputModes` that is a **strict subset** of `defaultInputModes` (the override actually narrows). 2. The caller's serialization layer chooses part `kind` from `defaultInputModes` rather than from the resolved per-skill set. 3. The caller's lifecycle machine places `rejected` in the same terminal class as `completed` (i.e., "task closed, proceed"). 4. No `status.message` inspection gate exists between task closure and downstream consumption. If (1) fails — skill modes equal or widen defaults — the bug is dormant. If (3) fails — `rejected` routes to an error branch — the bug is caught at the boundary. The dangerous configuration is (1)+(2)+(3), which is common because default-mode-driven serializers are the path of least resistance and `rejected` *looks* like a clean close. ## Decision Boundary The caller must draw a hard line at dispatch time and again at task-closure time: - **At dispatch:** compute `effective = skill.inputModes ?? card.defaultInputModes`. If the chosen part kind is not in `effective`, do **not** send. Either re-serialize into an accepted mode (if a lossless transform exists) or fail fast with a typed negotiation error. Never send an unaccepted mode hoping for coercion. - **At closure:** classify terminal states into `{completed}` vs `{failed, canceled, rejected}`. `rejected` is a **negotiation failure**, not a completion. It must route to the same branch as `failed`, carrying `status.message` for diagnosis. - **At resume:** if a task was checkpointed mid-flight and the card is re-fetched on resume, re-run the effective-mode computation — a card can change between `submitted` and `working` if the remote redeployed, and the resume must not assume the dispatch-time mode set still holds. The boundary is: *a mode is accepted only if it is in the resolved per-skill set at the moment of dispatch, and a task is successful only if it closed in `completed`.* Anything else is a boundary violation that must halt the workflow, not advance it. ## Operational Effect Enforcing the invariant converts a silent three-stage-latency corruption into a single-stage typed failure. The cost is one extra resolution step per dispatch and a stricter terminal-state partition; the benefit is that `rejected` can never masquerade as `completed`. Downstream consumers receive either a real artifact or a typed error, never a fabricated one. The guardrail is cheap, local to the caller, and does not require the remote to change behavior — which is the point: the remote is entitled to reject, and the caller is obligated to notice. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ModeNegotiationError(RuntimeError): """Raised when a dispatch or resume violates the effective-input-mode invariant.""" class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" REJECTED = "rejected" # The partition that the caller MUST enforce. rejected is NOT success-adjacent. SUCCESS_TERMINAL = {TaskState.COMPLETED} FAILURE_TERMINAL = {TaskState.FAILED, TaskState.CANCELED, TaskState.REJECTED} @dataclass class Skill: id: str input_modes: Optional[list[str]] = None # None => inherit defaults @dataclass class AgentCard: default_input_modes: list[str] skills: dict[str, Skill] = field(default_factory=dict) def effective_input_modes(card: AgentCard, skill_id: str) -> set[str]: skill = card.skills.get(skill_id) if skill is None: raise ModeNegotiationError(f"skill {skill_id!r} not present in card") # Override semantics: per-skill array REPLACES defaults, never extends. modes = skill.input_modes if skill.input_modes is not None else card.default_input_modes return set(modes) def resolve_dispatch_mode(card: AgentCard, skill_id: str, part_kind: str) -> str: accepted = effective_input_modes(card, skill_id) if part_kind not in accepted: raise ModeNegotiationError( f"part kind {part_kind!r} not accepted by skill {skill_id!r}; " f"effective modes={sorted(accepted)}" ) return part_kind def classify_closure(state: TaskState, status_message: Optional[str]) -> str: if state in SUCCESS_TERMINAL: return "proceed" if state in FAILURE_TERMINAL: # rejected carries negotiation diagnostics; surface, do not swallow. raise ModeNegotiationError( f"task closed in {state.value!r}: {status_message or 'no status message'}" ) raise ModeNegotiationError(f"non-terminal state {state.value!r} passed to closure gate") # Reproduction of the observed trace. card = AgentCard( default_input_modes=["text/plain", "application/json"], skills={ "extract_pdf": Skill(id="extract_pdf", input_modes=["application/pdf"]), "extract_text": Skill(id="extract_text", input_modes=["text/plain"]), }, ) # Caller mistakenly serializes a PDF as a text part (default-mode-driven serializer). try: resolve_dispatch_mode(card, "extract_pdf", part_kind="text") except ModeNegotiationError as e: print("dispatch blocked:", e) # Even if the remote had accepted and later rejected, closure gate must halt. try: classify_closure(TaskState.REJECTED, "unsupported input mode for skill") except ModeNegotiationError as e: print("closure halted:", e) ```