# Why does an instance accept a delegated A2A task before its capability card's declared schema has been reconciled with the caller's expected artifact contract? **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 task delegation between independently deployed agents where the callee advertises a capability card and the caller binds an artifact schema at task creation. Does not apply to intra-process tool calls or to A2A streaming-only partial-result flows without artifact binding. ## Core Distinction There is a difference between *transport-level acceptance* of a task and *semantic-contract acceptance*. A2A v1.0 separates the two: the `tasks/send` (or `message/send`) RPC returns a `Task` object with a state of `submitted` or `working` as soon as the callee's runtime admits the message, but the capability card's `defaultInputModes`/`defaultOutputModes` and any declared `skills[].inputSchema`/`outputSchema` are advisory metadata, not enforced preconditions on admission. The failure mode is that a callee will transition to `working` and consume real compute/tokens against an input artifact whose shape it cannot actually honor, because the schema reconciliation happens *lazily inside the skill handler* rather than at the delegation boundary. The invariant that is violated: **a task must not leave `submitted` until the callee has proven that the input artifact validates against the skill's input schema AND that the skill's output schema is a structural subtype of the caller's requested output contract.** A2A does not mandate this gate; most v1.0 implementations omit it. ## What Was Observed A cross-vendor delegation: caller agent (vendor A, orchestrator) delegated a document-extraction task to callee agent (vendor B, extractor). The callee's capability card declared: ``` skills: [{ id: "extract-invoice", inputModes: ["application/json"], outputModes: ["application/json"], inputSchema: { "$ref": "#/definitions/InvoiceDoc" }, outputSchema: { "$ref": "#/definitions/InvoiceFields" } }] ``` The caller bound an output artifact contract requiring fields `{invoice_id, total, currency, line_items[]}` with `total` as a decimal string. Vendor B's `InvoiceFields` used `total` as a JSON number and omitted `line_items` entirely (it returned a flattened `items` array). Neither card was wrong in isolation. The mismatch was invisible at the RPC layer because: 1. `message/send` validated only that the payload was valid JSON matching `application/json` — the MIME-level check passed. 2. The callee's handler ran schema validation *after* the LLM extraction step, so tokens were already spent. 3. On validation failure the callee returned a `Task` in state `failed` with a `status.message` of `"output schema validation failed"` — but the caller's delegation loop had already fanned out 40 sibling tasks and was awaiting artifact merge, so it treated the single `failed` as a partial and continued. 4. The caller's merge step coerced `total` (number) into its decimal-string slot via string interpolation, silently producing `"19.99"` vs `"19.990000000000002"` float artifacts downstream, and dropped `line_items` because it was absent under the name it expected. Net effect: 39 of 40 tasks "succeeded" at the transport level, the merge produced a syntactically valid but semantically corrupted aggregate, and the failure surfaced three hops later in a downstream reconciliation agent that had no lineage back to the schema mismatch. Detection latency: 11 minutes of wall clock and ~$0.40 of inference across 40 tasks, all avoidable. The non-obvious part: the callee *did* validate output schema. The bug was that output-schema conformance is necessary but not sufficient — the caller's *artifact contract* (a caller-side type the card never saw) is a separate constraint. A2A v1.0 has no field for the caller to transmit its expected output contract, and no field for the callee to echo back the schema it will actually emit, so the two sides can both be internally consistent and mutually incompatible. ## Condition of Validity The boundary gate described here is required when **all** of the following hold: - The caller binds an artifact schema that is stricter than or divergent from the callee's `outputSchema` (different field names, types, or required-set). - The callee's skill handler performs validation only after invoking a probabilistic or costly step (LLM call, tool call, external fetch). - The caller fans out concurrent sibling tasks and treats per-task `failed` states as non-fatal partials. It is **not** required when the caller and callee share a schema registry by reference (same `$id`), or when the callee's card `outputSchema` is byte-identical to the caller's contract (verifiable by hash), or when the caller uses `tasks/get` polling with a strict all-or-nothing merge. ## Decision Boundary The architectural fix is a **pre-admission schema handshake** inserted before the callee transitions `submitted → working`: 1. Caller includes an `expectedOutputContract` extension field (A2A allows extension params on `message/send`) carrying the JSON Schema `$id` and a structural hash. 2. Callee, on receipt, performs a *subtype check*: is its declared `outputSchema` a structural subtype of the caller's contract? If the callee cannot prove subtyping (e.g., because it emits `items` not `line_items`), it must reject at `submitted` with a structured `SchemaMismatch` status — **before** any LLM invocation. 3. If the callee cannot decide subtyping statically (open-ended `additionalProperties`), it must emit a `capability.probe` response advertising the concrete schema it will emit, and the caller decides whether to proceed. 4. The caller's fan-out loop must treat `SchemaMismatch` at admission as a *hard* error that aborts the batch, distinct from a mid-execution `failed`. The decision boundary is: **a task may only enter `working` if the callee has positively confirmed output-contract compatibility or the caller has explicitly opted into best-effort coercion.** Absent that, the task stays `submitted` and the caller is notified synchronously. ## Operational Effect With the handshake in place, the 40-task fan-out above fails fast: the first `message/send` returns `SchemaMismatch` in ~40ms (no inference), the caller aborts the batch, and the operator sees the exact field divergence (`line_items` vs `items`, `total` string vs number) in the rejection payload. Cost drops from $0.40 to ~$0.00; detection latency drops from 11 minutes to sub-second; and the corrupted-aggregate class of bug is eliminated structurally rather than by downstream reconciliation. The tradeoff: the callee must expose enough of its schema to permit a subtype check, which some vendors treat as IP. In practice this is resolved by exchanging schema *hashes* plus a `capability.probe` round-trip only on hash mismatch — one extra RPC per novel caller-callee pair, amortized to zero on repeat delegations. The invariant to encode in every A2A client: **never let a delegated task reach `working` on an unverified output contract; treat admission as the last cheap moment to fail.** ```python import hashlib import json from typing import Any class SchemaMismatchError(RuntimeError): """Raised when a callee's declared output schema is not a structural subtype of the caller's bound artifact contract, at A2A admission time. Must fire BEFORE the callee transitions submitted -> working.""" def __init__(self, caller_contract_id: str, callee_schema_id: str, divergences: list[str]): self.caller_contract_id = caller_contract_id self.callee_schema_id = callee_schema_id self.divergences = divergences super().__init__( f"output contract {caller_contract_id} incompatible with " f"callee schema {callee_schema_id}: {divergences}" ) def _schema_hash(schema: dict[str, Any]) -> str: canonical = json.dumps(schema, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode()).hexdigest() def _structural_divergences( caller_contract: dict[str, Any], callee_schema: dict[str, Any] ) -> list[str]: """Minimal subtype check: every required field in the caller's contract must exist in the callee's schema with a compatible type.""" out: list[str] = [] caller_props = caller_contract.get("properties", {}) callee_props = callee_schema.get("properties", {}) for field, spec in caller_props.items(): if field not in callee_props: out.append(f"missing field: {field}") continue if spec.get("type") != callee_props[field].get("type"): out.append( f"type mismatch on {field}: " f"caller={spec.get('type')} callee={callee_props[field].get('type')}" ) return out def admit_delegated_task( caller_contract: dict[str, Any], callee_capability_card: dict[str, Any], skill_id: str, ) -> str: """Gate called on the callee side before transitioning submitted -> working. Returns the task state to set ('working') or raises SchemaMismatchError.""" skill = next( (s for s in callee_capability_card.get("skills", []) if s["id"] == skill_id), None, ) if skill is None: raise SchemaMismatchError( caller_contract.get("$id", ""), "", [f"unknown skill {skill_id}"] ) callee_schema = skill.get("outputSchema", {}) if _schema_hash(caller_contract) == _schema_hash(callee_schema): return "working" divergences = _structural_divergences(caller_contract, callee_schema) if divergences: raise SchemaMismatchError( caller_contract.get("$id", ""), callee_schema.get("$id", ""), divergences, ) return "working" ```