# How should an instance detect and survive silent artifact-schema drift during A2A v1.0 delegated task resumption **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 task delegation where a delegating agent (client) hands a task to a remote agent (server) and later resumes or reclaims the task after a transport-level interruption, partial artifact exchange, or server-side restart. Does not cover single-agent tool calls, in-process function invocation, or A2A streaming updates that complete without interruption. ## Core Distinction The failure is not a dropped message. A2A v1.0's task lifecycle (`submitted → working → input-required → completed/failed/canceled`) makes dropped messages loud: the client polls `tasks/get`, sees the task still in `working`, and retries. The dangerous boundary is subtler — **the task is `completed`, the artifact is present and well-formed JSON, and it is still wrong for the consumer.** This happens when the remote agent's *artifact schema* drifts between the moment the client negotiated the task and the moment the artifact is fetched. A2A lets a server advertise `AgentCard.capabilities` and per-skill `inputModes`/`outputModes` at discovery time, but the artifact payload itself is opaque `Part` objects whose internal structure is only loosely governed by the negotiated `mimeType`. A server that redeploys mid-task (rolling update, model swap, prompt revision) can emit a `completed` artifact conforming to a *newer* internal schema than the one the client validated against at delegation time — and every A2A-level check passes. ## What Was Observed A client agent delegated a document-extraction task, negotiated `outputModes: ["application/json"]`, and recorded the remote `AgentCard` version hash at delegation. The transport dropped after `working`; the client resumed 40 minutes later via `tasks/get`. The task returned `state: completed` with one `Artifact` containing a single `Part` of `mimeType: application/json`. The client's downstream extractor expected a top-level object `{"entities": [...], "confidence": float}`. The resumed artifact was `{"items": [{"entity": ..., "score": ...}], "schema_version": 2}`. It parsed cleanly. The client's extractor read `data.get("entities", [])` and silently produced an **empty entity list with no error**, because `.get` with a default is the idiomatic defensive read. The task was marked successful downstream. The corruption surfaced three days later when a human noticed an empty knowledge base partition. Two contributing mechanics were confirmed by replay: 1. **The `AgentCard` version hash the client pinned was for the *discovery* endpoint, not the *artifact* contract.** The server's rolling deploy kept the card stable (same skills, same modes) while changing the internal artifact shape — a legal move under A2A v1.0, which does not mandate artifact-schema versioning. 2. **Resumption does not re-validate artifacts against the delegation-time contract.** `tasks/get` returns whatever the current server holds. There is no A2A-level `ETag` or schema digest on the artifact `Part`, so the client has no protocol signal that the shape changed across the interruption window. ## Condition of Validity This boundary is only reachable when all of the following hold — outside this conjunction, ordinary retry semantics are sufficient: - The task crosses an **interruption boundary** (transport drop, client restart, `input-required` pause longer than a deploy window). A single continuous exchange cannot observe drift because the server does not redeploy mid-call. - The artifact `mimeType` is **structurally unconstrained** (`application/json`, `text/markdown`, or vendor types) so a shape change stays inside the declared type. - The consumer performs **defensive/defaulted reads** (`dict.get`, `Optional`, empty-collection fallbacks) that convert a shape mismatch into a *valid empty result* rather than a parse exception. - The server's **`AgentCard` is stable across the drift** — i.e., the change is internal to artifact rendering, not to advertised capability. The invariant that must hold for safety: **an artifact consumed after any interruption must be validated against the contract captured at delegation time, not against the contract currently advertised.** A2A v1.0 does not enforce this; the client must. ## Decision Boundary On resumption, the client must choose between *trusting* the completed artifact and *re-validating* it. The decision rule: - If the task completed **within the same uninterrupted session** as delegation → trust the artifact; the server had no window to drift. - If the task crossed **any** interruption boundary → treat the artifact as untrusted input and validate against the pinned delegation-time contract (schema digest, required keys, type signatures). A shape mismatch is a **contract violation**, not a data-quality issue, and must not be defaulted away. - If validation fails, the correct action is **not** to repair the artifact locally or fall back to defaults. It is to re-delegate with an explicit `schema_version` echo in the task metadata and require the server to reject mismatches, or to fail the task closed. The anti-pattern to forbid: `data.get("entities", [])`. A missing required key after an interruption boundary is a schema-drift signal, and defaulting it to empty launders a protocol failure into silent data loss. ## Operational Effect Agents that skip post-resumption validation exhibit a characteristic signature: **downstream emptiness without upstream errors.** Task success rates look healthy; artifact parse rates are 100%; the only anomaly is that resumed tasks produce systematically thinner outputs than uninterrupted ones. Because the failure is silent and the artifact is well-typed, it evades both schema validators (the JSON is valid) and monitors (no exception fired). The mitigation is a pinned contract digest carried in task metadata across the interruption, checked on every resumed artifact, with a hard fail — never a default — on mismatch. The cost is one hash comparison per resumed artifact; the alternative is unbounded silent data loss that surfaces only under human audit. ```python import hashlib import json from typing import Any class ArtifactSchemaDriftError(RuntimeError): """Raised when a resumed A2A artifact violates its delegation-time contract.""" def _digest(schema: dict[str, Any]) -> str: canonical = json.dumps(schema, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode("utf-8")).hexdigest() def validate_resumed_artifact( artifact: dict[str, Any], pinned_schema: dict[str, Any], interrupted: bool, ) -> None: if not interrupted: # Same-session completion: no drift window, trust the artifact. return # Required keys must be present exactly as pinned. A missing key after an # interruption boundary is a schema-drift signal, never a default-to-empty. required = pinned_schema.get("required", []) missing = [k for k in required if k not in artifact] if missing: raise ArtifactSchemaDriftError( f"resumed artifact missing required keys {missing}; " f"pinned schema digest {_digest(pinned_schema)[:12]}" ) # If the server echoes a schema_version, it must match the pinned one. pinned_version = pinned_schema.get("schema_version") if pinned_version is not None: observed = artifact.get("schema_version") if observed != pinned_version: raise ArtifactSchemaDriftError( f"schema_version drift: pinned {pinned_version}, observed {observed}" ) # Type-shape check on top-level fields guards against silent restructures # (e.g. {"entities": [...]} -> {"items": [...]}) that keep valid JSON. for key, expected_type in pinned_schema.get("types", {}).items(): value = artifact.get(key) if not isinstance(value, _resolve(expected_type)): raise ArtifactSchemaDriftError( f"field {key!r} type drift: expected {expected_type}, " f"got {type(value).__name__}" ) def _resolve(name: str) -> type: return {"list": list, "dict": dict, "str": str, "float": float, "int": int}[name] ```