# Why does an instance accept an A2A Agent Card whose declared `defaultInputModes` are satisfied by a `text/plain` fallback while the task artifact schema silently requires `application/vnd.acme.invoice+json`? **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 task delegation where capability discovery is performed against an Agent Card (`/.well-known/agent.json`) and artifacts are exchanged via `artifacts[].parts[]` with declared MIME types. Does not cover streaming-only `message/stream` partial-artifact flows or non-v1.0 draft cards lacking `capabilities` blocks. ## Core Distinction The failure is not "the remote agent lied about its capabilities." The Agent Card is *truthful* about what input modes it accepts. The boundary is that **input-mode negotiation (a coarse, card-level, MIME-family declaration) and artifact-schema conformance (a fine-grained, task-level, structural contract) are resolved at two different points in the lifecycle, by two different components, with no shared validator.** The card advertises `defaultInputModes: ["text/plain", "application/json"]`. The delegating agent picks `text/plain` because it's the lowest-friction serialization it can produce. Discovery succeeds. Task submission succeeds. The task enters `working`. Then the remote agent's artifact assembler attempts to construct an invoice artifact whose `parts[]` must carry `application/vnd.acme.invoice+json`, and the structured fields it needs (line items, tax jurisdiction, currency code) were never present in the `text/plain` payload because the delegating agent flattened them into a human-readable string. The card was satisfied; the artifact contract was not. ## What Was Observed Trace from a delegating orchestrator (`caller`) to a vendor B2B agent (`billing-agent`): 1. **Discovery.** `caller` fetches the card. `capabilities.streaming: true`, `defaultInputModes: ["text/plain","application/json"]`, `defaultOutputModes: ["application/json"]`, `skills: [{id: "invoice.generate", inputModes: ["text/plain","application/json"], outputModes: ["application/json"]}]`. Every declared mode intersects with what `caller` can emit. Discovery passes. 2. **Submission.** `caller`'s planner chooses `text/plain` (its JSON serializer is gated behind a schema it doesn't have, so it falls back to a templated natural-language brief). It sends `tasks/send` with `message.parts: [{kind: "text", text: "Generate invoice for order 4471, 3 units of SKU-99 at 12.50 EUR each, VAT DE-19."}]`. The remote accepts — `text/plain` is a declared input mode. 3. **State transition.** Task moves `submitted → working`. The remote's artifact assembler runs. It needs `application/vnd.acme.invoice+json` for the artifact because its downstream ERP connector only ingests that vendor media type. It has no parser that can recover structured line items from the free-text brief with sufficient fidelity (the SKU/quantity/price triple is recoverable, but the VAT jurisdiction token `DE-19` is ambiguous between two internal tax tables). 4. **Failure surface.** The remote does *not* fail the task. It emits an artifact with `parts: [{kind: "text", text: "Invoice generation requires structured input."}]` and transitions the task to `input-required`, carrying an artifact whose media type (`text/plain`) is *not* in the skill's declared `outputModes` (`application/json`). The caller's artifact validator, keyed on `outputModes`, rejects the artifact as non-conformant and — depending on implementation — either drops the task into a retry loop or marks it `failed` without ever reading the `input-required` state. The task is now live on the remote (awaiting input) and dead on the caller (rejected artifact). This is the orphaned-task boundary. The non-obvious part: the *card was accurate at every declared granularity*, and the *artifact was rejected for a reason the card never promised*. The mismatch lives in the gap between `defaultInputModes` (what serialization envelopes are accepted) and the artifact's internal schema (what semantic structure the skill actually requires to produce a conformant output). ## Condition of Validity This failure mode is bounded and reproducible only when all of the following hold: - The skill declares **more than one** input mode, at least one of which is lossy relative to the artifact schema (i.e., `text/plain` cannot carry the fields the output artifact mandates). If the skill declares only `application/json`, the caller cannot select the lossy path and the failure does not arise. - The remote's artifact assembler performs **deferred validation** — it accepts the message, transitions to `working`, and only discovers the structural shortfall when constructing the artifact. If it validated the message body against the artifact schema *before* the `submitted → working` transition, it would reject with a task error and the caller would see a clean failure. - The caller's artifact validator is keyed on **`outputModes`** rather than on the artifact's own `parts[].metadata` schema URI. If the caller validated against the artifact's declared schema rather than the card's coarse output modes, it would surface the `input-required` state correctly. When any one of these three conditions is absent, the system degrades gracefully. The invariant is therefore conditional, not universal. ## Decision Boundary The architectural guardrail is a **pre-transition schema gate plus an artifact-schema negotiation step that the card cannot satisfy on its own.** Concretely: - **Card discovery must be treated as advisory, not authoritative, for artifact conformance.** The card's `inputModes`/`outputModes` answer "what envelopes will you parse." They do not answer "what fields must the payload contain." The latter must be negotiated explicitly — either via an `extensions` block on the card that names the artifact schema URI, or via a pre-flight `tasks/send` with a probe payload that the remote validates against the artifact schema *before* accepting. - **The remote must gate `submitted → working` on artifact-schema validity, not on input-mode membership.** If the chosen input mode cannot carry the artifact's required fields, the task must fail synchronously with a structured error naming the required schema — before the caller loses the ability to correlate. - **The caller must never select a lossy input mode when the artifact schema is known to require structure.** The safe rule: if the skill's `extensions` names an artifact schema, the caller must emit `application/json` (or the exact schema media type) and refuse the `text/plain` path even though the card permits it. The boundary, stated as an invariant: *a task may not transition from `submitted` to `working` unless the submitted payload is structurally sufficient, under the chosen input mode, to construct an artifact conformant to the skill's declared output schema.* Input-mode membership is necessary but not sufficient. ## Operational Effect Downstream, the orphaned-task boundary produces three distinct operational signatures: 1. **Split-brain task state.** The remote holds the task in `input-required` (a live, resumable state); the caller has marked it `failed` (a terminal state). Any retry from the caller spawns a *second* task on the remote, and the original lingers until its TTL expires — consuming the remote's task slots and, if the skill is metered, billing twice. 2. **Artifact-type drift in audit logs.** Because the remote emitted a `text/plain` artifact against an `application/json` output mode, any auditor replaying the task history sees an artifact that violates the card's own declaration. The audit trail now contains a contradiction that is not a bug in either agent but a consequence of the deferred-validation gap. 3. **Silent capability inflation.** The caller's discovery cache records the skill as `text/plain`-compatible (it was), so future delegations to the same skill keep selecting the lossy mode, and the failure rate compounds across the fleet. The card never changes; the misselection is self-reinforcing. The remediation is to make the pre-transition gate mandatory and to treat `input-required` as a *caller-visible* state that must be reconciled before the caller marks a task terminal. The code below encodes the gate and the reconciliation. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Optional class ArtifactSchemaMismatch(RuntimeError): """Raised when the submitted payload cannot yield a conformant artifact.""" class TaskState(Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" @dataclass class AgentSkill: skill_id: str input_modes: list[str] output_modes: list[str] artifact_schema_uri: Optional[str] = None # from card `extensions` required_artifact_fields: frozenset[str] = frozenset() @dataclass class Submission: mime_type: str payload: dict @dataclass class Task: task_id: str state: TaskState = TaskState.SUBMITTED artifacts: list[dict] = field(default_factory=list) LOSSY_MODES = frozenset({"text/plain"}) def gate_submission(skill: AgentSkill, sub: Submission) -> None: """Enforce: no submitted->working transition unless payload can build a conformant artifact under the chosen input mode.""" if sub.mime_type not in skill.input_modes: raise ArtifactSchemaMismatch( f"mode {sub.mime_type!r} not in declared input modes {skill.input_modes}" ) # The boundary: input-mode membership is necessary but not sufficient. if skill.artifact_schema_uri and sub.mime_type in LOSSY_MODES: missing = skill.required_artifact_fields - set(sub.payload.keys()) if missing: raise ArtifactSchemaMismatch( f"lossy mode {sub.mime_type!r} cannot satisfy artifact schema " f"{skill.artifact_schema_uri!r}; missing fields {sorted(missing)}" ) def submit_task(skill: AgentSkill, sub: Submission, task_id: str) -> Task: gate_submission(skill, sub) # raises before any state transition task = Task(task_id=task_id) task.state = TaskState.WORKING return task def reconcile_caller_view(task: Task, caller_state: TaskState) -> TaskState: """Never let caller mark terminal while remote holds a live state.""" if caller_state in (TaskState.FAILED, TaskState.COMPLETED) and task.state in ( TaskState.INPUT_REQUIRED, TaskState.WORKING, ): raise ArtifactSchemaMismatch( f"caller marked {caller_state.value} but remote holds live state " f"{task.state.value}; task {task.task_id} would be orphaned" ) return caller_state ```