# When must an instance reject a delegated task because the remote agent card's declared `inputModes` are a superset of what the caller can actually serialize **Date of Record:** 2026 December 3 **Scope:** Applies to A2A v1.0 cross-vendor task delegation where the calling agent discovers a remote `AgentCard` via `/.well-known/agent.json` (or registry lookup) and dispatches a `tasks/send` using a declared `inputMode`. Does not cover intra-tenant A2A where both peers share a schema registry, nor streaming-only `tasks/sendSubscribe` flows where the first SSE frame carries the negotiated content type. ## Core Distinction The failure is not "the remote agent rejected our payload." That is a clean, observable 4xx. The failure is that the remote agent *accepted* the task, echoed a `Task` object with `state: "submitted"`, and then silently degraded — because the caller satisfied the *declared* `inputModes` list while violating the *effective* one. An `AgentCard` advertises `inputModes: ["text/plain", "application/json", "multipart/form-data"]`. The caller has a structured object with a binary attachment and no multipart serializer, so it picks `application/json` — which is in the list. The remote vendor's JSON path, however, only handles a flat `{"text": ...}` envelope; the multipart path is the only one that carries `file` parts. The card's `inputModes` is a union of *transport-level* content types, not a matrix of *which content types can carry which part kinds*. The caller cannot distinguish these from the card alone, and the remote does not fail fast because validating part-kind/mode compatibility is deferred to the handler, which is lenient by default. The invariant that must hold is: **an instance may only delegate when it can prove, from the card plus its own serializer capabilities, that every part in the outgoing `Message` is expressible in the selected mode AND that the selected mode is the one the remote's part-handling path expects for that part kind.** The card alone is insufficient evidence for the second conjunct, so the caller must either probe or pin. ## What Was Observed A planner agent (vendor A) discovered a document-extraction agent (vendor B) via a public A2A registry. B's card declared: ``` "capabilities": {"streaming": false, "pushNotifications": true}, "defaultInputModes": ["text/plain", "application/json"], "defaultOutputModes": ["application/json"], "skills": [{"id": "extract", "inputModes": ["text/plain", "application/json", "multipart/form-data"]}] ``` A's planner constructed a `Message` with two parts: a `TextPart` (the instruction) and a `FilePart` (a 40-page PDF as base64). A's serializer had no multipart encoder, so it selected `application/json` — a member of the skill's `inputModes`. B returned `{"id": "task-9f2", "status": {"state": "submitted"}}`. B's JSON handler deserialized the message, found the `FilePart`, and — because its JSON path was written before `FilePart` support landed — dropped unrecognized parts with a `logger.warn` and proceeded on the `TextPart` alone. The extraction ran against an empty document. B returned `state: "completed"` with `{"extracted": [], "pages": 0}`. A's downstream validator saw a well-formed, schema-valid, empty result and marked the subtask complete. The failure surfaced three hops later as a missing-clause hallucination in a synthesized contract summary. The tell was in B's `TaskStatus.message`: absent. B never populated a status message because it never considered the task degraded. The card was accurate about *accepted content types* and silent about *part-kind support per content type* — a gap the A2A v1.0 spec permits, since `inputModes` is defined over MIME types, not over the `Part` union. ## Condition of Validity The rejection rule applies precisely when all of the following hold: 1. The outgoing `Message` contains at least one part whose kind is not `TextPart` (i.e., `FilePart` or `DataPart`). 2. The caller's selected `inputMode` is `application/json` (or any mode the caller reached by *elimination* rather than by *capability match* — i.e., it fell back to JSON because it lacked a multipart encoder). 3. The remote card lists more than one `inputMode` for the target skill, and the non-JSON modes are plausibly the "rich part" carriers (multipart, or a vendor-specific `application/vnd.*+json` with an explicit part schema). 4. The card does not include a `partKindSupport` extension or per-mode part schema — A2A v1.0 does not mandate one. When any of these fails, the rule does not apply: a text-only message is safe in any declared mode; a caller with a real multipart encoder can select the rich mode directly; a single-mode card forces the question into the open at discovery time. ## Decision Boundary The boundary is between *mode satisfaction* and *part expressibility*. Mode satisfaction is a set-membership test the caller can run locally: `selected_mode ∈ card.skills[id].inputModes`. Part expressibility requires knowing the remote's per-mode part map, which the card does not carry. The decision procedure the caller must adopt: - If the message is text-only → dispatch on any declared mode. No probe needed. - If the message carries non-text parts AND the caller can serialize the richest declared mode (multipart) → select that mode explicitly and set `Content-Type` on the request; do not let the transport default to JSON. - If the message carries non-text parts AND the caller cannot serialize the richest mode → **do not delegate**. Either downgrade the task (extract text locally, send `TextPart` only, and accept the fidelity loss explicitly) or refuse. Silently selecting JSON is the forbidden move. - If the card is ambiguous and the caller cannot downgrade → issue a capability probe: send a minimal `tasks/send` with a synthetic `FilePart` of known content and a `TextPart` asking the remote to echo the byte length of the file part. If the echo is absent or zero, the remote's JSON path drops file parts; cache that as a negative capability for the card's `etag`/version and refuse subsequent rich delegations. The probe is cheap and bounded: one round trip, a 16-byte file, a text instruction the remote can answer without invoking its real skill. It converts an unobservable card gap into an observable fact, and the fact is cacheable against the card version so it is paid once per card revision. ## Operational Effect Adopting the rule converts a silent-degradation class into a fail-fast class. The planner that refuses to delegate a `FilePart` over `application/json` either produces a local text extraction (lossy but *known* lossy, and flagged) or surfaces a `CapabilityMismatch` to its orchestrator, which can route to a different vendor or request a multipart-capable caller. The three-hop-latent hallucination becomes a one-hop explicit refusal. The cost is a small amount of over-refusal: some remotes do handle `FilePart` over JSON correctly, and the rule refuses them until probed. That cost is bounded by the probe cache and is strictly preferable to the alternative, because the failure mode it prevents is *undetectable from the response* — a `completed` task with a valid-but-empty result. In agent systems, an undetectable wrong answer is worse than a detectable refusal, and the card's `inputModes` union is precisely the kind of accurate-but-insufficient declaration that manufactures undetectable wrong answers. ``` ```python class CapabilityMismatch(RuntimeError): """Raised when the local serializer cannot express every part in the selected inputMode, and the remote card does not prove per-mode part support.""" pass RICH_MODES = ("multipart/form-data",) def select_input_mode(card: dict, skill_id: str, message_parts: list[str], local_serializers: set[str]) -> str: """Return the inputMode to use, or raise CapabilityMismatch. message_parts: part kinds present, e.g. ["text", "file"]. local_serializers: MIME types this caller can actually encode. """ skill = next((s for s in card["skills"] if s["id"] == skill_id), None) if skill is None: raise CapabilityMismatch(f"skill {skill_id!r} absent from card") declared = skill.get("inputModes") or card.get("defaultInputModes", []) has_rich_part = any(k != "text" for k in message_parts) if not has_rich_part: # Text-only is safe on any declared mode. return "text/plain" if "text/plain" in declared else declared[0] # Rich parts present: we must select a mode we can serialize AND that # is plausibly the remote's rich-part carrier. expressible_rich = [m for m in declared if m in RICH_MODES and m in local_serializers] if expressible_rich: return expressible_rich[0] # We cannot serialize any rich mode. JSON fallback is only legal if the # card proves per-mode part support for JSON. json_ok = ( "application/json" in declared and "application/json" in local_serializers and _card_proves_json_file_support(card, skill_id) ) if json_ok: return "application/json" raise CapabilityMismatch( f"skill {skill_id!r}: message has parts {message_parts} but caller " f"cannot serialize a rich mode {RICH_MODES} and card does not prove " f"JSON FilePart support; refusing to delegate (would silently degrade)." ) def _card_proves_json_file_support(card: dict, skill_id: str) -> bool: """A2A v1.0 has no standard field for this; only a vendor extension or a cached successful probe counts as proof.""" ext = card.get("extensions", {}).get("x-part-kind-support", {}) return ext.get(skill_id, {}).get("application/json", {}).get("file", False) ```