# What happens when an instance renegotiates its A2A artifact schema mid-task and the delegating agent has already committed a typed dependency **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 task delegation where a delegator agent has bound a typed artifact contract (`artifact.mimeType` + `schema` reference) into its own downstream reasoning chain, and the delegatee agent emits a revised artifact schema in a subsequent `TaskStatusUpdateEvent`. Does not cover initial capability negotiation, transport-level retries, or stateless one-shot `message/send` calls that never carry artifacts. ## Core Distinction The failure is not "schema mismatch." A2A v1.0 makes schema mismatch at *first* artifact delivery loud and cheap: the delegator validates `artifact.parts[].metadata.schema` against its expected contract and rejects with `InvalidParams`. The dangerous case is **schema drift on a re-emitted artifact within a still-open task**. The protocol permits an agent to emit multiple `TaskArtifactUpdateEvent`s for the same `artifactId` (streaming, partial, or corrected artifacts), and it permits `append`/`replace` semantics on parts. Nothing in the spec forces the delegatee to keep the *schema* of a given `artifactId` stable across emissions, only that each emission be internally well-formed. So the delegator can hold a valid, already-validated artifact `X@schema-v1`, have consumed it into its own reasoning state (e.g., distilled it into a plan, a query, or a downstream tool argument), and then receive `X@schema-v2` under the same `artifactId` with `replace` semantics. The delegator's validation passes (v2 is well-formed) but its *committed dependency* on v1's shape is now silently invalid. This is a continuity invariant violation, not a validation failure: the artifact identity survived, the schema contract did not, and the delegator never re-ran the binding step. ## What Was Observed Trace from a two-agent pipeline (delegator `D`, delegatee `E`) doing structured extraction: 1. `D` sends `tasks/send` with `acceptedOutputModes: ["application/json"]` and a `task.metadata.expectedSchema: "extraction/v1"` (fields: `entities: [{name, type}]`, `confidence: float`). 2. `E` emits `TaskArtifactUpdateEvent` `artifactId="a1"`, `append=false`, part `application/json` conforming to `extraction/v1`. `D` validates, binds `a1 → extraction/v1`, and **distills** the entities into a retrieval query it fires immediately (streaming consumption — `D` does not wait for `TaskStatusUpdateEvent: completed`). 3. `E`'s internal model re-plans, decides the extraction was low-confidence, and re-emits `a1` with `append=false` (replace) but as `extraction/v2`: `entities` becomes `[{label, category, score}]`, `confidence` is dropped in favor of per-entity `score`. 4. `D` receives the replace event. `D`'s artifact validator checks "is this valid JSON matching *some* declared output mode" → yes. It does **not** check "is this the same schema revision I bound at step 2," because the binding was keyed on `artifactId`, and `artifactId` is unchanged. 5. `D`'s distillation layer, which still holds v1-shaped state, merges the v2 payload under v1 keys. Result: `name`/`type` fields are absent, `label`/`category` are ignored, `confidence` reads as `None`. The retrieval query fires with empty entity types and a null confidence gate → it passes the confidence threshold check by treating `None < threshold` as false in that language's comparison, and emits an over-broad query. The observed signature: **validation green, downstream semantics wrong, no error raised anywhere.** The failure is only detectable by comparing the schema revision bound to `artifactId` at consumption time against the revision present at re-emission time — a comparison the protocol does not mandate and most delegator implementations do not perform. ## Condition of Validity The invariant that must hold for safe streaming consumption is: > For any `artifactId` that a delegator has consumed into its reasoning state, every subsequent artifact event for that `artifactId` must carry a schema revision identical to the one bound at first consumption, **or** the delegator must invalidate and re-derive all state distilled from that artifact before the next reasoning step. This invariant is violated whenever all of the following hold: - the delegatee re-emits an existing `artifactId` with `replace`/`append` semantics (allowed by spec), - the re-emission carries a different `schema` reference (allowed by spec — only per-event well-formedness is required), - the delegator consumed the earlier emission **before** the task reached a terminal state (streaming, the common low-latency pattern), - the delegator keyed its schema binding on `artifactId` rather than on `(artifactId, schema-revision)`. It does **not** apply to batched consumption (delegator waits for `completed` then takes the last artifact), because there is no committed intermediate state to invalidate. It also does not apply when the delegatee is contractually pinned to a single schema revision for the task lifetime — but A2A v1.0 provides no such pin; `acceptedOutputModes` constrains MIME type, not schema revision. ## Decision Boundary The delegator must choose, per artifact, between two disciplines: - **Bind-and-freeze:** on first consumption of `artifactId`, record `(artifactId, schemaRef, contentHash)` in a binding ledger. On any later event for that `artifactId`, if `schemaRef` differs → do not merge; raise and either re-derive from the new artifact from scratch or fail the delegation. This is correct but forces re-derivation cost on every legitimate correction. - **Bind-and-version:** treat `(artifactId, schemaRef)` as the true identity. A v2 emission is a *new* artifact for reasoning purposes; the v1-derived state is quarantined and only the v2-derived state is used going forward. This is cheaper but requires the delegator's distillation layer to be keyed on the composite identity, not the bare `artifactId`. The boundary is: **you may stream-consume an artifact before task completion only if your distilled state is keyed on `(artifactId, schemaRef)` and you are prepared to discard it.** If your distilled state is keyed on `artifactId` alone, you must wait for terminal state before consuming. There is no third option that is safe under A2A v1.0's re-emission semantics. ## Operational Effect Without the composite-key discipline, the failure mode is a *silent semantic corruption* that survives all schema validators, all MIME checks, and all per-event well-formedness checks. It surfaces only as degraded downstream output (over-broad queries, dropped entities, null confidence gates) that is indistinguishable from ordinary model error — which is exactly why it is expensive to diagnose: teams attribute it to "the extractor got worse" rather than to a schema-revision continuity break. The guardrail is a binding ledger with composite keys and a hard invalidation path; the cost is re-derivation on legitimate corrections, which is the price of not silently merging incompatible revisions under a stable identifier. ```python from dataclasses import dataclass, field from typing import Any class ArtifactSchemaDriftError(RuntimeError): """Raised when a re-emitted artifact under a bound artifactId carries a different schema revision than the one the delegator committed to.""" @dataclass class Binding: artifact_id: str schema_ref: str content_hash: str @dataclass class DelegatorState: # Distilled reasoning state, keyed on COMPOSITE identity, never bare artifactId. distilled: dict[tuple[str, str], Any] = field(default_factory=dict) ledger: dict[str, Binding] = field(default_factory=dict) def consume(self, event: dict) -> None: artifact_id = event["artifactId"] schema_ref = event["part"]["metadata"]["schema"] content_hash = event["part"].get("contentHash", "") prior = self.ledger.get(artifact_id) if prior is not None and prior.schema_ref != schema_ref: # Re-emission under a new schema revision: the v1-derived state is # now unsound. Refuse to merge; force re-derivation. self.distilled.pop((artifact_id, prior.schema_ref), None) raise ArtifactSchemaDriftError( f"artifactId={artifact_id!r} re-emitted with schema " f"{schema_ref!r} but was bound to {prior.schema_ref!r}; " f"distilled state invalidated, re-derive required" ) self.ledger[artifact_id] = Binding(artifact_id, schema_ref, content_hash) self.distilled[(artifact_id, schema_ref)] = self._distill(event, schema_ref) def _distill(self, event: dict, schema_ref: str) -> Any: # Schema-revision-aware distillation; never assumes v1 field names. payload = event["part"]["payload"] if schema_ref == "extraction/v1": return {"entities": payload["entities"], "confidence": payload["confidence"]} if schema_ref == "extraction/v2": return { "entities": [ {"name": e["label"], "type": e["category"]} for e in payload["entities"] ], "confidence": min((e["score"] for e in payload["entities"]), default=0.0), } raise ArtifactSchemaDriftError(f"unhandled schema revision {schema_ref!r}") def run_trace() -> None: d = DelegatorState() d.consume({"artifactId": "a1", "part": { "metadata": {"schema": "extraction/v1"}, "payload": {"entities": [{"name": "x", "type": "org"}], "confidence": 0.9}, }}) # Delegatee re-plans and replaces a1 with a v2 payload. d.consume({"artifactId": "a1", "part": { "metadata": {"schema": "extraction/v2"}, "payload": {"entities": [{"label": "x", "category": "org", "score": 0.4}]}, }}) if __name__ == "__main__": run_trace() ```