Why does an instance accept a Task in a foreign Agent Card's `acceptedInputModes` but silently drop binary payloads at the first `message/send`?

**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 (Agent-to-Agent) task negotiation where a client agent discovers a remote Agent Card, matches its declared `capabilities`/`defaultInputModes`/`defaultOutputModes` against locally available content, and initiates `tasks/send` with a `Part` union (text, file, data). Does not cover intra-process tool calls, MCP-only transports, or streaming `tasks/sendSubscribe` resumption semantics beyond the initial handshake.

Core Distinction

There are two distinct notions of "capability match" in A2A v1.0, and conflating them is the failure. The first is **declared capability**, expressed in the Agent Card's `capabilities` object (e.g., `streaming: true`, `pushNotifications: false`) and its `defaultInputModes`/`defaultOutputModes` arrays (MIME strings like `text/plain`, `application/json`, `image/png`). The second is **per-task accepted modality**, which is negotiated implicitly by what the remote agent actually does when it receives a `Part` it cannot process. A2A does not mandate that the server reject unprocessable parts at the transport layer; the spec permits a server to accept the task envelope (`TaskState: submitted`) and then transition to `input-required` or `failed` *after* the client has already committed resources, streamed a large file part, or discarded the local copy. The boundary failure is that the client treats the Agent Card's `defaultInputModes` as a hard contract, while the server treats it as a *hint* about default routing. The invariant that must hold for safe cross-vendor delegation is: **the client must not consider a modality "accepted" until it has observed a task-level acknowledgment that echoes the modality back, not merely a 200 on the RPC envelope.**

What Was Observed

A client agent (vendor A) discovers a research-synthesis agent (vendor B) via `GET /.well-known/agent.json`. B's card declares:

"defaultInputModes": ["text/plain", "application/json", "application/pdf"],
"capabilities": {"streaming": true, "pushNotifications": true}

A's planner has a 40-page PDF in a file `Part` (`mimeType: "application/pdf"`, `file.bytes` base64). A matches `application/pdf` against `defaultInputModes`, marks the delegation as modality-compatible, and issues `tasks/send` with `message.parts = [file part, text instruction]`. B returns `200 OK` with a `Task` object in state `submitted`, `id: t-8841`.

Three seconds later A receives a `TaskStatusUpdateEvent` with `state: input-required` and a message: `"I can read PDFs but only when they are also accompanied by `application/json` metadata indicating page range; otherwise I extract text only from page 1."` B's implementation had a per-vendor guard: its PDF extractor required a structured `data` part to bound the extraction, and without it B fell back to a lossy single-page path rather than failing. The Agent Card's `defaultInputModes` was accurate about *what MIME types the parser accepts*, but silent about *the compound-part precondition*. A had already deleted its local PDF staging buffer after the `200 OK` (a resource optimization), so the `input-required` round-trip forced a re-fetch from cold storage — a 40-second regression on a task A's planner had budgeted at 6 seconds.

A second instance of the same class: an image-captioning agent (vendor C) declared `image/png` in `defaultInputModes` but its card omitted `capabilities.streaming` handling for file parts. A sent a 12 MB PNG as a non-streaming `Part`; C's gateway had a 4 MB body limit that returned `413` *inside* the JSON-RPC error object rather than as an HTTP status, so A's transport layer saw `200` and only parsed the failure when it inspected `result.error`. A's retry loop, keyed on HTTP status, did not fire.

Condition of Validity

The failure is bounded and reproducible under these conditions, and does **not** occur outside them:

  1. The remote Agent Card lists a MIME type in `defaultInputModes` that the server *can* parse only under a compound-part or size precondition not expressible in the card schema. A2A v1.0's `AgentCapabilities` has no field for "requires companion part" or "max part size," so this is structurally unrepresentable — the card is under-specified by design.
  2. The client optimizes for early resource release (deletes local buffers on `200 OK` envelope, not on `TaskState: working`).
  3. The server's failure mode is a *state transition* (`input-required`, `failed`) rather than a transport rejection. If the server returns a JSON-RPC error with a non-2xx HTTP status, the client's HTTP-keyed retry catches it and the failure does not manifest.

If any of the three is absent — e.g., the client retains buffers until `working`, or the server rejects at the envelope — the invariant holds and the failure is masked. This is why it is non-obvious: in a homogeneous test suite where client and server are co-designed, condition 1 rarely holds because the card author knows to document preconditions out-of-band.

Decision Boundary

The client must draw the line between **envelope acceptance** and **modality acceptance** at the first `TaskStatusUpdateEvent`, not at the RPC response. Concretely:

Operational Effect

Downstream, the misclassification propagates. A's planner recorded B as "PDF-capable" in its capability cache (a distilled episodic memory of successful delegations). The next PDF task routed to B without the `application/json` companion, hit the same `input-required`, and — because A's cache said "compatible" — A's verifier flagged the `input-required` as a *B-side fault* rather than a *negotiation mismatch*, escalating to a human. The human, seeing "vendor B failed twice," downranked B in the routing table. B was never at fault; the card was under-specified and the client's acceptance criterion was too early. This is the classic episodic-to-semantic distillation loss: the memory "B accepted a PDF" was true at the envelope layer and false at the modality layer, and the distillation dropped the distinction.

The architectural fix is a two-phase acceptance handshake the client enforces locally: (1) envelope ack, (2) modality ack at first non-`input-required` status event, with the source payload held across the gap. The server-side fix is envelope-level rejection for unrepresentable preconditions. Neither is in the A2A v1.0 schema; both are client and server discipline layered on top.

import time
from dataclasses import dataclass, field
from typing import Optional


class ModalityAcceptanceError(RuntimeError):
    """Raised when a task envelope is accepted but the modality is not
    confirmed before the client releases its source payload."""
    pass


@dataclass
class TaskHandle:
    task_id: str
    card_input_modes: list[str]
    source_parts: list[dict] = field(default_factory=list)
    payload_released: bool = False
    modality_confirmed: bool = False


def send_task(client, remote_card: dict, parts: list[dict],
              deadline_s: float = 30.0) -> TaskHandle:
    declared = set(remote_card.get("defaultInputModes", []))
    for p in parts:
        mt = p.get("mimeType")
        if mt and mt not in declared:
            # Pre-flight: card does not even advertise it. Reject locally.
            raise ModalityAcceptanceError(
                f"mime {mt!r} not in card defaultInputModes {sorted(declared)}"
            )

    resp = client.rpc("tasks/send", {"message": {"parts": parts}})
    if "error" in resp.get("result", {}):
        # JSON-RPC error embedded in 200 body — the silent-413 case.
        raise ModalityAcceptanceError(
            f"envelope-level error: {resp['result']['error']}"
        )

    handle = TaskHandle(
        task_id=resp["result"]["id"],
        card_input_modes=sorted(declared),
        source_parts=parts,
    )

    # CRITICAL: do NOT release payload on envelope ack. Hold until we see
    # a status event that is not input-required naming a modality defect.
    t0 = time.monotonic()
    while time.monotonic() - t0 < deadline_s:
        ev = client.poll_status(handle.task_id)
        state = ev.get("state")
        if state == "working" or state == "completed":
            handle.modality_confirmed = True
            handle.payload_released = True  # safe now
            return handle
        if state == "input-required":
            msg = ev.get("message", "")
            if "mimeType" in msg or "part" in msg.lower():
                # Modality falsified post-envelope; card match was provisional.
                raise ModalityAcceptanceError(
                    f"task {handle.task_id} entered input-required for modality "
                    f"defect: {msg!r}; card advertised {handle.card_input_modes} "
                    f"but compound-part precondition unmet"
                )
            # Otherwise it's genuine user input; keep payload, escalate.
            return handle
        if state == "failed":
            raise ModalityAcceptanceError(
                f"task {handle.task_id} failed before modality confirmation"
            )
        time.sleep(0.5)

    if not handle.modality_confirmed and not handle.payload_released:
        raise ModalityAcceptanceError(
            f"task {handle.task_id} never confirmed modality within {deadline_s}s; "
            f"source payload still held — do not cache as compatible"
        )
    return handle