# Under what conditions must an instance reject a delegated task whose A2A Agent Card advertises a capability that the remote agent's JSON-RPC `tasks/send` handler cannot actually honor at the declared schema version **Date of Record:** 2026 November 19 **Scope:** Applies to cross-vendor A2A v1.0 task delegation where a client agent discovers a remote agent via its Agent Card and dispatches work over JSON-RPC `tasks/send`. Does not apply to same-vendor, same-binary delegations where the card and handler are generated from a single source of truth, nor to streaming-only `tasks/sendSubscribe` flows where the initial response is a task envelope rather than a terminal artifact. ## Core Distinction The A2A Agent Card is a *declarative* advertisement: a static JSON document served at `/.well-known/agent.json` describing `skills`, `capabilities`, `defaultInputModes`, `defaultOutputModes`, and a `protocolVersion`. The `tasks/send` handler is an *imperative* runtime. The failure this record isolates is **card–handler drift**: the card advertises a skill whose declared `inputModes`/`outputModes` (e.g., `application/vnd.mycorp.invoice+json` at schema v3) is not the schema the handler actually validates against at dispatch time. This is distinct from ordinary capability mismatch (skill present in card, absent in handler) — that fails loudly at the first request. Card–handler drift fails *silently and partially*: the handler accepts the payload, performs side effects, and returns a task in `completed` state whose artifact is schema v2 or a free-text `TextPart` masquerading as the structured type. The client's downstream parser then either coerces or throws, and the delegation is recorded as successful while the business outcome is corrupt. The invariant at stake: **a `completed` task state must imply that at least one artifact in `task.artifacts` validates against the `outputModes` the card advertised for the invoked skill at the `protocolVersion` the card declared.** When this invariant is unenforced, the card becomes a source of false trust rather than a contract. ## What Was Observed A client orchestrator discovers three vendor agents for a `invoice.extract` skill. All three cards declare `protocolVersion: "1.0"`, `defaultOutputModes: ["application/vnd.acme.invoice+json"]`, and a skill entry with `id: "invoice.extract"`, `inputModes: ["application/pdf"]`, `outputModes: ["application/vnd.acme.invoice+json"]`. Delegation to Vendor A returns a `Task` with `status.state: "completed"` and one artifact whose `parts[0]` is `{"type": "data", "data": {...}}` conforming to the declared schema. Fine. Delegation to Vendor B returns `status.state: "completed"` with `parts[0]` as `{"type": "text", "text": "Extracted: invoice #4471, total $1,204.00, due 2025-07-01"}`. The card said the output mode was structured JSON. The handler emitted prose. The client's `jsonschema.validate` on the artifact throws `ValidationError`, but the orchestrator had already committed the task as `completed` in its own state store because it trusted `status.state` before validating artifacts. Delegation to Vendor C returns `status.state: "completed"` with a `data` part that validates against the *v2* schema: `total` is a string `"1204.00"` rather than a number, and `currency` is absent (v3 requires it). The client's v3 parser coerces `total` to `1204.0` and defaults `currency` to `"USD"`. No exception is raised. A EUR invoice is booked as USD. The trace for Vendor B, at the wire level: ``` → {"jsonrpc":"2.0","id":"7","method":"tasks/send", "params":{"id":"t-9f2","message":{"role":"user", "parts":[{"type":"file","file":{"mimeType":"application/pdf","bytes":"..."}}], "metadata":{"skill":"invoice.extract"}}}} ← {"jsonrpc":"2.0","id":"7","result":{"id":"t-9f2", "status":{"state":"completed"}, "artifacts":[{"parts":[{"type":"text","text":"Extracted: ..."}]}]}} ``` No `error` object. No `status.message` explaining the downgrade. The handler had a fallback path: when its internal OCR confidence fell below a threshold, it emitted a human-readable summary instead of the structured artifact, and reused the same `completed` state rather than a distinct `failed` or a `completed` with a `metadata.degraded: true` marker. The card had no way to express "structured output is best-effort under low confidence." ## Condition of Validity The card-as-contract holds only under a conjunction of three conditions, any one of which, when false, voids the delegation: 1. **Version pinning is exact, not range-based.** The card's `protocolVersion` must match the client's A2A implementation exactly. A card declaring `"1.0"` while the handler validates against a v0.9 schema is drift; the client cannot detect it from the card alone. 2. **Output mode is a hard postcondition, not a hint.** The A2A spec treats `outputModes` as a *preference negotiation* input; a server may legitimately respond with a different mode if it cannot satisfy the request. The client must therefore treat `outputModes` as advisory and enforce validation on the returned artifact — but must also *fail the task* when the returned mode is not in the requested set, rather than accepting the downgrade silently. 3. **`completed` is not terminal until artifacts validate.** The orchestrator must not transition its own task record to a terminal state on receipt of `status.state: "completed"`. It must hold the task in a `validating` state, run schema validation against the declared output mode, and only then commit. This is the guardrail that bounds the failure. When any of these is false, the delegation is *unwarranted* and must be rejected at the client boundary, not repaired downstream. ## Decision Boundary The precise boundary: **reject when the returned artifact's `type` or `mimeType` is outside the `outputModes` the client requested in `message.metadata.acceptedOutputModes`, OR when the artifact fails schema validation against the declared mode, OR when `status.state == "completed"` but `artifacts` is empty or contains only `text` parts for a skill whose card declared a non-text `outputModes`.** Accept-with-warning is not a valid third option for structured-output skills, because downstream consumers cannot distinguish a coerced artifact from a native one. The boundary does *not* trigger on: a `failed` state with a `status.message` (that is a clean, honest failure the client can route); a `completed` state with an artifact in a *declared* alternate mode the client explicitly listed in `acceptedOutputModes`; or a `completed` state where the artifact validates but carries a `metadata.confidence` field the client's policy permits. The subtle case: Vendor C's v2 artifact *validates* against the v2 schema and *coerces* against v3. The client cannot detect this from the artifact alone if it is lenient. The defense is strict `additionalProperties: false` and required-field enforcement in the v3 schema, plus a post-parse check that no default-substitution occurred. This is the boundary where lenient parsing converts a detectable drift into an undetectable corruption. ## Operational Effect Enforcing the boundary changes the delegation lifecycle from a two-state (`pending` → `completed`) to a three-state (`pending` → `validating` → `committed | rejected`) model, with the `validating` state owned by the client. The cost is one schema-validation pass per artifact and a small latency increase; the benefit is that card–handler drift surfaces as a `TaskValidationError` at the client, attributable to the specific vendor and skill, rather than as a silent data corruption in the business layer. Operationally, the client should also emit a per-vendor *drift signal*: when a vendor's handler returns an artifact outside its card's declared `outputModes` more than a threshold fraction of the time, the client should demote that vendor's card to *untrusted* and require explicit re-negotiation (a fresh card fetch plus a probe task) before further delegation. This converts a per-task rejection into a per-vendor circuit breaker, which is the only way the drift is bounded across a long-running swarm. The invariant to encode in the client's task state machine: **no artifact enters the business layer without passing the schema validator bound to the `outputModes` the card advertised at discovery time, and no task is committed as `completed` until every artifact has passed.** The card is a promise; the validator is the only thing that makes the promise enforceable. ```python import json from typing import Any import jsonschema class AgentCardDriftError(RuntimeError): """Raised when a remote A2A agent's completed task violates the output-mode contract advertised in its Agent Card.""" def commit_delegated_task( card: dict[str, Any], task_response: dict[str, Any], accepted_output_modes: list[str], schemas_by_mode: dict[str, dict[str, Any]], ) -> dict[str, Any]: state = task_response.get("status", {}).get("state") if state != "completed": return task_response # failed / working / input-required: not our boundary artifacts = task_response.get("artifacts") or [] if not artifacts: raise AgentCardDriftError( f"task {task_response.get('id')} completed with no artifacts " f"despite card declaring outputModes {card.get('defaultOutputModes')}" ) validated: list[dict[str, Any]] = [] for art in artifacts: for part in art.get("parts", []): ptype = part.get("type") if ptype == "text" and any( m != "text/plain" for m in accepted_output_modes ): raise AgentCardDriftError( f"skill {card.get('name')} returned TextPart but client " f"accepted {accepted_output_modes}; card-handler drift" ) if ptype != "data": continue mode = art.get("mimeType") or card.get("defaultOutputModes", [None])[0] if mode not in accepted_output_modes: raise AgentCardDriftError( f"artifact mode {mode!r} not in accepted {accepted_output_modes}" ) schema = schemas_by_mode.get(mode) if schema is None: raise AgentCardDriftError( f"no validator bound for declared mode {mode!r}; " f"cannot certify card contract" ) try: jsonschema.validate(part["data"], schema) except jsonschema.ValidationError as exc: raise AgentCardDriftError( f"artifact for mode {mode!r} failed schema at {exc.json_path}: " f"{exc.message}" ) from exc validated.append(part["data"]) if not validated: raise AgentCardDriftError( f"task {task_response.get('id')} completed with zero schema-validated " f"data artifacts; refusing to commit" ) task_response["_validated_artifacts"] = validated task_response["_committed"] = True return task_response ```