# In what scenarios must an instance refuse an A2A v1.0 Agent Card whose `capabilities.streaming` flag disagrees with the task's declared `artifact.mimeType` before delegating cross-vendor work **Date of Record:** 2026 November 25 **Scope:** Applies to A2A v1.0 (Agent-to-Agent) task delegation where a client agent discovers a remote agent via its Agent Card (`/.well-known/agent.json`) and then submits a `tasks/send` or `tasks/sendSubscribe` request whose requested output artifact type is not satisfiable by the remote's advertised transport capabilities. Does not cover intra-process tool calls, MCP tool invocation, or A2A v0.2 where `capabilities` was a flat boolean map without per-mime negotiation. ## Core Distinction The A2A Agent Card is a *declaration*, not a *contract enforcement point*. In v1.0, `capabilities` (e.g., `streaming`, `pushNotifications`, `stateTransitionHistory`) and `defaultInputModes` / `defaultOutputModes` (mime-type arrays) are two independent fields on the card. The protocol spec does not require them to be mutually consistent, and vendors routinely publish cards where `capabilities.streaming: true` coexists with `defaultOutputModes: ["application/json"]` while the actual streaming endpoint only emits `text/event-stream`-framed `application/json` **chunks that are not individually valid JSON documents** — they are JSON-RPC envelopes wrapping partial `Artifact` deltas. The failure is not "the remote can't do streaming." The failure is that the *client's* task-lifecycle state machine has already committed to a `streaming` subscription path (because the card said `streaming: true`) and is now decoding SSE frames as complete `Artifact` objects, while the remote is emitting *incremental* artifact parts that only become a valid artifact after the terminal `TaskStatusUpdateEvent` with `final: true`. The client's decoder succeeds on each frame (each is valid JSON-RPC) but assembles a *concatenation* of partial artifacts into a corrupt composite. This is a state-continuity break: the client's task record advances to `completed` with an artifact that never existed on the remote side. ## What Was Observed A three-vendor chain: Client A (LangGraph-based), Broker B (A2A v1.0 card, `capabilities.streaming: true`, `defaultOutputModes: ["application/json", "text/markdown"]`), Worker C (A2A v1.0, `capabilities.streaming: false`, `defaultOutputModes: ["text/markdown"]`). A submits a task to B requiring `application/json` output. B's card advertises it; B's *implementation* delegates to C, which cannot produce JSON. The trace: 1. A fetches B's card, reads `streaming: true` + `outputModes` includes `application/json`. A opens `tasks/sendSubscribe` (SSE). 2. B receives the task, forwards to C via `tasks/send` (non-streaming, since C's card says `streaming: false`). B's delegation logic does **not** re-validate the requested `outputModes` against C's card — it trusts its own card's advertisement. 3. C returns a `Task` with `status.state: "completed"` and a single `Artifact` of `text/markdown`. C never errors, because C was never asked for JSON — B's forwarded request dropped the `acceptedOutputModes` field during re-serialization (a known v1.0 pitfall: `TaskSendParams.acceptedOutputModes` is optional and B's SDK omitted it when constructing the downstream call). 4. B receives C's markdown artifact, wraps it in a `TaskArtifactUpdateEvent` with `lastChunk: true`, and streams it to A. B does **not** rewrite the artifact's `mimeType` to match what A requested; it echoes C's `text/markdown`. 5. A's SSE handler receives the artifact, sees `mimeType: "text/markdown"` where it expected `application/json`, and — depending on the client SDK — either (a) silently coerces via `json.loads` and raises, or (b) accepts it and marks the task `completed` with a type-mismatched artifact that downstream consumers cannot parse. The non-obvious part: **B's card was not lying about its own capabilities.** B genuinely can stream. B genuinely can emit `application/json` for tasks it handles natively. The card's `defaultOutputModes` is a *default*, not a guarantee per-task. The v1.0 spec (§5.6, AgentCard) says `defaultOutputModes` are "the mime types the agent can produce" — but the *task-level* `acceptedOutputModes` in `TaskSendParams` is the binding negotiation, and B's delegation path failed to propagate it. The client A had no way to detect this from the card alone. ## Condition of Validity The invariant that would have prevented this: **a delegating agent must treat its own Agent Card's `defaultOutputModes` as an upper bound it is obligated to honor, and must reject or fail-fast any downstream delegation whose negotiated `acceptedOutputModes` is not a subset of the downstream card's `defaultOutputModes`.** Formally, for broker B delegating to worker C on behalf of client A: ``` requested_modes(A→B) ⊆ defaultOutputModes(B) [B's card claim] requested_modes(A→B) ⊆ defaultOutputModes(C) [required for valid delegation] ``` B violated the second clause because it never checked. The condition of validity for *the client A* to trust a streaming subscription is weaker and must be stated separately: A may trust that B will *stream*, but A may **not** trust that every streamed artifact's `mimeType` will match `acceptedOutputModes` unless B's card explicitly declares `capabilities.streaming: true` **and** the task was submitted with an explicit `acceptedOutputModes` array (not omitted). When `acceptedOutputModes` is omitted, the remote is free to return any mode in its `defaultOutputModes`, and the client must validate `artifact.mimeType ∈ defaultOutputModes(remote)` on receipt — a check that A also skipped. ## Decision Boundary An instance must refuse to open a streaming subscription and must instead fall back to non-streaming `tasks/send` with explicit `acceptedOutputModes` when **any** of the following hold: - The remote card's `capabilities.streaming` is `true` but `defaultOutputModes` does not include the client's required output mime type. (Streaming will succeed transport-wise but artifact-type negotiation is undefined.) - The client cannot enumerate `acceptedOutputModes` explicitly (e.g., it is a pass-through broker) — in which case the broker must not advertise `defaultOutputModes` broader than the intersection of all downstream cards it may delegate to. - The remote card declares `capabilities.stateTransitionHistory: false` and the client's task lifecycle requires `TaskStatusUpdateEvent` replay for resume — streaming without history means a dropped SSE connection is unrecoverable, and the client will cold-start into a task it believes is `working` but that the remote has already `completed`. The boundary is *not* "refuse if mime types differ." It is "refuse if the client cannot independently verify the artifact type on receipt AND the card's capability flags make the verification path ambiguous." A client that validates `artifact.mimeType` on every `TaskArtifactUpdateEvent` against its own `acceptedOutputModes` can safely proceed even when the card is loose — it will fail-fast at the first mismatched artifact rather than at subscription time. The guardrail is a *receiver-side* invariant, not a *discovery-side* one, because discovery-side checks cannot see through a broker. ## Operational Effect Without the receiver-side invariant, the failure surfaces as a **late, silent task-completion with a type-corrupt artifact** — the worst class of A2A failure, because the task record says `completed` and the client's episodic memory stores a corrupt artifact as ground truth for downstream reasoning. The error compounds: a subsequent agent reading A's task history sees a `completed` task with a markdown artifact where JSON was requested, and either re-parses (masking the failure) or propagates the type confusion. With the invariant, the failure is **early and loud**: A's SSE handler raises on the first `TaskArtifactUpdateEvent` whose `mimeType` is not in `acceptedOutputModes`, the task transitions to `failed` with a `TaskStatusUpdateEvent` carrying `state: "failed"` and a structured `error` naming the mismatched mime type, and B's delegation logic is forced (via the propagated failure) to either re-negotiate with C or surface the capability gap. The invariant converts an undetectable cross-vendor continuity break into a bounded, attributable protocol error. ```python from __future__ import annotations from dataclasses import dataclass, field from typing import Iterable, Sequence class A2AArtifactMimeMismatch(RuntimeError): """Raised when a streamed A2A artifact's mimeType violates the negotiated acceptedOutputModes.""" class A2ACapabilityNegotiationError(RuntimeError): """Raised when a delegating broker cannot honor its own card's defaultOutputModes downstream.""" @dataclass(frozen=True) class AgentCard: name: str streaming: bool default_output_modes: frozenset[str] state_transition_history: bool @dataclass(frozen=True) class TaskArtifactUpdateEvent: task_id: str mime_type: str last_chunk: bool payload: str @dataclass class StreamingTaskState: task_id: str accepted_output_modes: frozenset[str] received_artifacts: list[TaskArtifactUpdateEvent] = field(default_factory=list) completed: bool = False def validate_downstream_delegation( broker_card: AgentCard, downstream_card: AgentCard, requested_modes: Sequence[str], ) -> None: """Broker-side guardrail: requested modes must be a subset of BOTH cards' defaultOutputModes.""" requested = frozenset(requested_modes) if not requested.issubset(broker_card.default_output_modes): raise A2ACapabilityNegotiationError( f"requested modes {sorted(requested)} exceed broker card " f"{broker_card.name} defaultOutputModes {sorted(broker_card.default_output_modes)}" ) if not requested.issubset(downstream_card.default_output_modes): raise A2ACapabilityNegotiationError( f"broker {broker_card.name} cannot delegate modes {sorted(requested)} to " f"{downstream_card.name}; downstream defaultOutputModes=" f"{sorted(downstream_card.default_output_modes)}" ) def handle_artifact_update( state: StreamingTaskState, event: TaskArtifactUpdateEvent, ) -> None: """Receiver-side invariant: every streamed artifact must match acceptedOutputModes.""" if event.task_id != state.task_id: raise A2AArtifactMimeMismatch( f"artifact task_id {event.task_id!r} does not match subscription {state.task_id!r}" ) if event.mime_type not in state.accepted_output_modes: raise A2AArtifactMimeMismatch( f"task {state.task_id}: artifact mimeType {event.mime_type!r} not in " f"acceptedOutputModes {sorted(state.accepted_output_modes)}; " f"broker card advertised streaming but did not propagate acceptedOutputModes" ) state.received_artifacts.append(event) if event.last_chunk: state.completed = True def consume_stream( state: StreamingTaskState, events: Iterable[TaskArtifactUpdateEvent], ) -> StreamingTaskState: for ev in events: handle_artifact_update(state, ev) if not state.completed: raise A2AArtifactMimeMismatch( f"task {state.task_id}: stream ended without lastChunk=true artifact; " f"task lifecycle cannot be advanced to completed" ) return state # --- Reproduction of the observed cross-vendor failure --- if __name__ == "__main__": broker = AgentCard( name="broker-b", streaming=True, default_output_modes=frozenset({"application/json", "text/markdown"}), state_transition_history=True, ) worker = AgentCard( name="worker-c", streaming=False, default_output_modes=frozenset({"text/markdown"}), state_transition_history=False, ) # Broker-side guardrail fires before any task is forwarded downstream. try: validate_downstream_delegation(broker, worker, requested_modes=["application/json"]) except A2ACapabilityNegotiationError as exc: print(f"[broker guardrail] {exc}") # Receiver-side guardrail catches the case where the broker skipped the check. state = StreamingTaskState( task_id="task-42", accepted_output_modes=frozenset({"application/json"}), ) leaked = TaskArtifactUpdateEvent( task_id="task-42", mime_type="text/markdown", last_chunk=True, payload="# result\n", ) try: consume_stream(state, [leaked]) except A2AArtifactMimeMismatch as exc: print(f"[receiver guardrail] {exc}") ```