# When must an instance reject a negotiated A2A capability set because the Agent Card's declared `inputModes`/`outputModes` are satisfiable in isolation but form an empty intersection across the negotiation chain **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 orchestrators that resolve a remote Agent Card, select a skill, and then chain that skill's declared `inputModes`/`outputModes` against the caller's own media-type state and any intermediate relay agent. Does not apply to single-hop invocations where the caller's output mode is the terminal sink, nor to non-A2A (plain HTTP/MCP) tool calls where media types are not part of the contract. ## Core Distinction The failure is not "the remote agent does not support my media type." That is a clean, detectable capability miss and A2A v1.0 gives you the `UnsupportedModesError`-equivalent signal for it. The non-obvious failure is **pairwise-compatible, globally-incompatible mode chains**: every adjacent pair `(producer.outputModes ∩ consumer.inputModes)` is non-empty, so each individual hop negotiates successfully, yet the composed chain from the origin's produced mode to the terminal sink's accepted mode has an **empty intersection**. Agent Card discovery validates each hop locally and correctly; the invariant that breaks is global, not local. Concretely: origin agent O produces `application/json`. Relay agent R declares `inputModes: ["application/json", "text/plain"]` and `outputModes: ["text/plain", "text/markdown"]`. Terminal agent T declares `inputModes: ["text/markdown", "text/html"]`. O→R negotiates on `application/json` (fine). R→T negotiates on `text/markdown` (fine). But if the orchestrator pinned R's output to `text/plain` at hop 1 — a legal choice given R's card — then R→T has no intersection and the chain dies at hop 2, *after* R has already executed and produced a `text/plain` artifact that T cannot accept. The card data was never wrong. The negotiation *order* and the *absence of a chain-level feasibility check* are what fail. ## What Was Observed A three-hop fan-out (origin → two relays → aggregator) was dispatched from a freshly discovered Agent Card set. Discovery succeeded for all four cards; each card was schema-valid against A2A v1.0 and each declared at least one `inputMode` matching its upstream's `outputModes`. The orchestrator invoked hop 1, which returned `202`-style accepted-then-streaming semantics and began emitting `text/plain` chunks. At hop 2 the relay rejected the payload with a mode-mismatch error because its card listed `text/plain` under `inputModes` but its *selected skill* (not the agent-level card) declared only `application/json` and `text/markdown` for `inputModes`. The agent-level card and the skill-level card disagreed — a legal A2A v1.0 arrangement, since skills may narrow modes. The observable trace: hop 1 completed and was billed; hop 2 failed at input validation; hop 3 was never invoked. The orchestrator's retry logic re-selected hop 1's output mode to `application/json`, which hop 2's skill accepted, but hop 2's skill then emitted `text/markdown` which hop 3's skill did not accept (hop 3's skill declared `inputModes: ["text/plain"]` only, while the hop 3 *agent* card advertised `text/markdown`). Two retries, two different empty intersections, both invisible to per-hop card validation because the orchestrator was intersecting **agent-level** modes while the runtime enforced **skill-level** modes. The invariant that was violated: *a mode chain is feasible iff there exists an assignment of one mode per hop such that every adjacent pair intersects, computed over the skill-level mode sets that will actually be enforced — not the agent-level sets that were advertised at discovery.* ## Condition of Validity The chain-feasibility check is required (and the pairwise check is insufficient) precisely when all of the following hold: 1. The negotiation chain has length ≥ 2 hops (a single hop cannot exhibit the failure). 2. At least one hop's agent-level `inputModes`/`outputModes` is a strict superset of its skill-level modes for the skill that will be selected — i.e., the card is a lossy projection of the enforced contract. 3. The orchestrator selects the concrete mode per hop lazily (at invocation time) rather than solving the whole chain up front. When any of these is false, pairwise validation is sound. When all three hold, pairwise validation is *unsound but appears to work* on most inputs, which is what makes it a boundary condition rather than a bug: it passes the test suite because the test fixtures use single-mode agents. ## Decision Boundary The decision the orchestrator must make at discovery time, before any hop is invoked: **does a global mode assignment exist?** This is a constraint-satisfaction problem over the chain, not a sequence of local intersections. The correct procedure: - Resolve each hop's *skill-level* mode sets (not agent-level) for the skill the planner intends to call. If the skill is not yet selected, treat the hop's mode set as the *union* over candidate skills and re-check after selection — but do not invoke before re-checking. - Compute reachable output-mode sets forward from the origin: `S_0 = {origin_produced_mode}`; `S_{i+1} = { m' ∈ consumer_i.outputModes : ∃ m ∈ S_i, m ∈ consumer_i.inputModes and m' is a legal transform of m }`. If any `S_i` is empty, the chain is infeasible and must be rejected *before hop 1 executes*. - If a mode transform is legal but lossy (e.g. `application/json` → `text/plain` via stringification), record it as a transform edge with a fidelity tag; a chain that is only feasible through lossy transforms is feasible-but-degraded and must be surfaced to the caller, not silently taken. The boundary: reject at discovery if forward reachability is empty; accept-with-warning if reachable only through lossy transforms; accept silently only if reachable through identity or lossless transforms. ## Operational Effect Without the chain-level check, the operational signature is: **partial execution with billing and side effects, followed by a mode-mismatch error at a downstream hop, followed by retries that each fail at a different hop.** Because each retry re-pins an upstream mode, the failure appears non-deterministic across runs — the same logical task fails at hop 2 on one attempt and hop 3 on the next. This defeats naive retry-with-backoff and can exhaust the token/step budget on a chain that was infeasible from the start. The remediation is to hoist feasibility to discovery: solve the mode CSP over skill-level sets, persist the chosen assignment in the invocation plan, and treat any skill whose enforced modes drift from its advertised modes as a contract violation to be quarantined rather than retried. ```python from dataclasses import dataclass, field from typing import Iterable class ModeChainInfeasibleError(RuntimeError): """Raised when a multi-hop A2A chain has no global mode assignment, even though every adjacent pair intersects locally.""" pass class SkillCardDriftError(RuntimeError): """Raised when a hop's enforced (skill-level) modes are not a subset of the advertised (agent-level) modes used during discovery.""" pass @dataclass class Hop: name: str agent_input_modes: frozenset[str] agent_output_modes: frozenset[str] skill_input_modes: frozenset[str] skill_output_modes: frozenset[str] lossy_transforms: dict[str, frozenset[str]] = field(default_factory=dict) def enforced_in(self) -> frozenset[str]: # Runtime enforces skill-level modes, not the agent-level card. if not self.skill_input_modes <= self.agent_input_modes: raise SkillCardDriftError( f"{self.name}: skill inputModes {sorted(self.skill_input_modes)} " f"not subset of advertised {sorted(self.agent_input_modes)}" ) return self.skill_input_modes def enforced_out(self) -> frozenset[str]: if not self.skill_output_modes <= self.agent_output_modes: raise SkillCardDriftError( f"{self.name}: skill outputModes {sorted(self.skill_output_modes)} " f"not subset of advertised {sorted(self.agent_output_modes)}" ) return self.skill_output_modes def plan_mode_chain( origin_mode: str, hops: Iterable[Hop], sink_input_modes: frozenset[str], ) -> list[str]: """Forward-reachability over skill-level mode sets. Returns the chosen mode per hop boundary. Raises if empty at any step.""" reachable: set[str] = {origin_mode} chosen: list[str] = [] for hop in hops: ins = hop.enforced_in() outs = hop.enforced_out() # Modes the hop can accept from what we currently carry. acceptable = reachable & ins if not acceptable: raise ModeChainInfeasibleError( f"empty intersection entering {hop.name}: " f"carry={sorted(reachable)} enforced_in={sorted(ins)}" ) # Prefer identity pass-through, then declared lossless, then lossy. next_reachable: set[str] = set() for m in acceptable: if m in outs: next_reachable.add(m) for target in hop.lossy_transforms.get(m, frozenset()): if target in outs: next_reachable.add(target) if not next_reachable: raise ModeChainInfeasibleError( f"{hop.name} accepts {sorted(acceptable)} but cannot emit any " f"of them (enforced_out={sorted(outs)})" ) chosen.append(sorted(next_reachable)[0]) reachable = next_reachable if not (reachable & sink_input_modes): raise ModeChainInfeasibleError( f"terminal sink rejects all reachable modes: " f"reachable={sorted(reachable)} sink={sorted(sink_input_modes)}" ) return chosen ```