# Where must an instance reject a capability claim: the A2A v1.0 Agent Card `skills[].inputModes` / `outputModes` intersection gap during cross-vendor task delegation **Date of Record:** 2026 December 3 **Scope:** Applies to A2A v1.0 task delegation where a delegating agent (the *client*) selects a remote agent (the *server*) by reading its Agent Card and then submits a `message/send` or `tasks/send` with a concrete `Message.parts` payload. Does not apply to same-vendor intra-process tool calls, nor to the initial capability-discovery GET itself (which is a plain HTTP fetch). ## Core Distinction The Agent Card is a *declaration*, not a *contract*. A2A v1.0 lets a server advertise, per skill, an `inputModes` and `outputModes` array drawn from the MIME-type registry (`text/plain`, `application/json`, `image/png`, `audio/wav`, `video/mp4`, and vendor extensions). The non-obvious invariant is this: **the intersection of the client's outbound part MIME types with the chosen skill's `inputModes` must be non-empty *and* the intersection of the client's declared acceptable response types with the skill's `outputModes` must be non-empty, and both must hold against the *same* skill entry.** Most implementations check only the input side, or check the union of all skills' modes rather than the modes of the single skill the client actually routes to. The failure is not "the server rejects the request." The failure is that the server *accepts* it, because the transport layer (JSON-RPC over HTTP) has no schema-level enforcement of `inputModes`—it is advisory metadata. The server's handler then receives a `parts` array containing, say, `application/json` when the routed skill only declared `text/plain`, and either (a) silently coerces with lossy `json.dumps` into a text field, (b) raises an internal 500 that the client interprets as retryable, or (c) routes to a *different* skill internally whose modes do match, producing a response shaped for a task the client never asked for. ## What Was Observed A client agent (vendor A) delegated a structured extraction task to a server agent (vendor B). The client read B's Agent Card: ``` skills: [ { id: "summarize", inputModes: ["text/plain"], outputModes: ["text/plain"] }, { id: "extract", inputModes: ["application/json"], outputModes: ["application/json"] } ] ``` The client's router matched on the skill *description* embedding, not on the `id`, and selected `summarize` (the description mentioned "extract key points"). It then sent a `Message` whose `parts[0]` was `{"kind":"data","data":{...}}` (i.e., `application/json`). B's dispatcher, keyed by `id`, saw the payload was JSON and internally re-dispatched to the `extract` skill—which returned a JSON object. The client's response parser, expecting `text/plain` because it had recorded the *selected skill's* `outputModes`, attempted `str(part.text)` on a `data` part, got `None`, and wrote an empty extraction to its episodic log. The task was marked `completed` on both sides. No error surfaced at any hop. The trace of the divergence: 1. Client selects skill by semantic match → `summarize`. 2. Client records expected output mode = `text/plain` (from `summarize.outputModes`). 3. Client sends `application/json` part, never validated against `summarize.inputModes`. 4. Server receives; its transport accepts any part kind. 5. Server's skill dispatcher keys on payload kind, not on the client's selected `id` (the `id` is not carried in the `Message` in A2A v1.0—it lives only in the card). 6. Server executes `extract`, returns `application/json`. 7. Client parses against `text/plain`, silently yields empty. 8. Both sides report `completed`. The root cause is structural: **the skill `id` the client used to negotiate is not transmitted in the task payload.** A2A v1.0 carries `metadata` on `Message` and `Task`, but the skill selection is implicit in the card. So the server cannot know which skill's mode contract the client believes it is operating under, and the client cannot know which skill actually executed. The negotiation is one-sided and unverified. ## Condition of Validity The gap is bounded (i.e., safe) only when all of the following hold: - The client validates the outbound `parts` MIME types against the `inputModes` of the *single* skill it selected, and refuses to send on empty intersection. - The client records the selected `skill.id` and the expected `outputModes` in `Message.metadata` under a namespaced key (e.g., `x-client.skillId`, `x-client.expectOutputModes`), and the server echoes the executed `skill.id` in the `Task` artifact metadata. - The server's dispatcher keys on the declared `skill.id` from metadata when present, and rejects (with a typed A2A error, not a 500) when the actual `parts` kinds fall outside that skill's `inputModes`. - The client treats a response whose `parts` kinds fall outside its recorded `outputModes` as a `failed` task, not a `completed` one. Absent any one of these, the handshake is unsound and the failure is silent. The condition is *not* satisfied by trusting the card alone, because the card is a snapshot that may be stale relative to the server's deployed dispatcher (card served from cache, dispatcher hot-reloaded) — a second, independent drift vector. ## Decision Boundary The precise boundary where an instance must refuse rather than proceed: - **Empty input intersection:** `set(part.kind for part in parts) ∩ set(skill.inputModes) == ∅` → do not send. This is the obvious case and most clients catch it. - **Non-empty input but empty output intersection:** the client can produce a payload the skill accepts, but the skill cannot produce anything the client can consume. This is the *non-obvious* case: the request will succeed at the transport layer and the client will receive a response it cannot parse. Must refuse at negotiation time, before `message/send`. - **Skill-id / payload-kind divergence:** the client selected skill `S` by semantic match but the payload kind matches a *different* skill `S'`. The server will likely route to `S'`. The client must detect this pre-send (payload kind ∉ `S.inputModes`) and either re-select or abort. It cannot rely on the server to catch it, because the server has no record of `S`. - **Post-response mode violation:** response `parts` kinds ∉ recorded `outputModes` → the task must be transitioned to `failed` with reason `output_mode_violation`, and the partial result must *not* be written to episodic memory (writing it is how the empty-extraction corruption in the observed trace entered the client's long-term store). The boundary is *not* "the server returned an error." Errors are the safe path. The boundary is "the server returned a well-formed response that the client's parser silently degrades." ## Operational Effect Without the guardrail, the corruption is durable: the client writes a `completed` task with an empty or malformed artifact into episodic memory, and subsequent retrieval over that memory surfaces the empty artifact as a successful precedent, biasing future skill selection toward the same mis-routing. The failure compounds across tasks — a classic stale-memory-drift amplification seeded by a single negotiation gap. With the guardrail, the mis-routed delegation fails *fast and loud* at the client's pre-send check, produces a typed error that the orchestrator can route to a re-selection loop, and never touches episodic memory. The cost is one extra validation pass over the card's `skills` array per delegation; the benefit is that the only path to a `completed` task is one where both the input and output mode contracts were satisfied against the same skill entry and confirmed by the server's echoed `skill.id`. The invariant to enforce, stated once: **a task may be marked `completed` only if the executed `skill.id` echoed by the server equals the `skill.id` the client negotiated, and the response `parts` kinds intersect that skill's declared `outputModes`.** Everything else is `failed`. ```python from dataclasses import dataclass, field from typing import Any class CapabilityNegotiationError(RuntimeError): """Raised when an A2A delegation violates the input/output mode contract of the single skill the client negotiated against.""" pass @dataclass class Skill: id: str input_modes: list[str] output_modes: list[str] @dataclass class AgentCard: skills: list[Skill] def skill(self, skill_id: str) -> Skill: for s in self.skills: if s.id == skill_id: return s raise CapabilityNegotiationError(f"skill {skill_id!r} not present in card") def negotiate_and_send( card: AgentCard, selected_skill_id: str, outbound_part_kinds: list[str], acceptable_response_kinds: list[str], ) -> dict[str, Any]: """Pre-send negotiation. Refuses to construct a Message when the input or output mode intersection against the *selected* skill is empty, or when the payload kind diverges from the selected skill's input modes. """ skill = card.skill(selected_skill_id) in_intersection = set(outbound_part_kinds) & set(skill.input_modes) if not in_intersection: raise CapabilityNegotiationError( f"outbound kinds {outbound_part_kinds} do not intersect " f"skill {skill.id!r} inputModes {skill.input_modes}" ) out_intersection = set(acceptable_response_kinds) & set(skill.output_modes) if not out_intersection: raise CapabilityNegotiationError( f"acceptable response kinds {acceptable_response_kinds} do not " f"intersect skill {skill.id!r} outputModes {skill.output_modes}" ) # Guard against semantic-match routing to a skill whose modes the payload # does not actually satisfy for *this* request. mismatched = set(outbound_part_kinds) - set(skill.input_modes) if mismatched: raise CapabilityNegotiationError( f"payload kinds {sorted(mismatched)} fall outside skill " f"{skill.id!r} inputModes; server may re-dispatch to a different skill" ) return { "metadata": { "x-client.skillId": skill.id, "x-client.expectOutputModes": sorted(out_intersection), }, "parts": [{"kind": k} for k in outbound_part_kinds], } def verify_response( negotiated: dict[str, Any], server_echoed_skill_id: str, response_part_kinds: list[str], ) -> None: """Post-response invariant. A task may only be marked completed if the server echoed the negotiated skill id and the response kinds intersect the negotiated output modes. Otherwise raise; do not write to memory.""" expected_skill = negotiated["metadata"]["x-client.skillId"] if server_echoed_skill_id != expected_skill: raise CapabilityNegotiationError( f"server executed skill {server_echoed_skill_id!r} but client " f"negotiated {expected_skill!r}; response shape is unverified" ) expected_out = set(negotiated["metadata"]["x-client.expectOutputModes"]) actual_out = set(response_part_kinds) if not (actual_out & expected_out): raise CapabilityNegotiationError( f"response kinds {sorted(actual_out)} do not intersect negotiated " f"output modes {sorted(expected_out)}; refusing to mark completed" ) ```