# How should an instance reconcile a terminal-task artifact stream against a stale remote Agent Card during A2A v1.0 cross-vendor handoff **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 client agents that discover a remote agent via Agent Card, dispatch a task, and consume streamed artifacts (`TaskStatusUpdateEvent` / `TaskArtifactUpdateEvent`) across a vendor boundary where the remote runtime may rotate capabilities, schema versions, or streaming endpoints mid-flight. Does not cover single-vendor intra-process tool calls or MCP-only tool binding. ## Core Distinction The failure here is not "the remote agent returned an error." It is that the remote agent **succeeded** — it emitted a terminal `state: completed` task status — while the artifacts attached to that task were produced under a *different* Agent Card contract than the one the client negotiated against. The client's discovery snapshot and the server's live execution contract diverge, and because A2A treats the terminal status event as authoritative completion, the client will happily commit artifacts whose schema it never validated. The distinction that matters: **task lifecycle state and artifact contract validity are two independent axes.** A2A v1.0's state machine (`submitted → working → completed/failed/canceled`) governs *whether* the task finished. It does not govern *whether the artifacts are interpretable under the Card the client holds*. A terminal `completed` is a statement about the server's execution, not about the client's ability to consume the output. Conflating these two is the invariant violation. ## What Was Observed A client instance (vendor A) performed discovery against a remote runtime (vendor B): 1. `GET /.well-known/agent.json` returned an Agent Card declaring `protocolVersion: "1.0"`, a single `skills[].inputModes`/`outputModes` pair, and `capabilities.streaming: true` with an artifact schema at `schemaVersion: 3`. 2. The client cached this Card, opened `message/stream` (SSE), and dispatched a task with `taskId: t-7f2a`. 3. Mid-execution, vendor B rolled a canary: the runtime serving `t-7f2a` continued on the old pod, but the *artifact serializer* was hot-swapped to `schemaVersion: 4`, which renamed a required field (`payload_uri` → `artifact_ref`) and changed `parts[].kind` enumeration. 4. The stream emitted `TaskArtifactUpdateEvent` frames with v4-shaped artifacts, then a `TaskStatusUpdateEvent` with `state: completed`, `final: true`. 5. The client, treating `completed` as the completion predicate, passed the artifacts to its downstream consumer, which failed schema validation *after* the task was already marked done and the remote task record was garbage-collected. The observable symptom was a downstream `KeyError: 'payload_uri'` on a task the orchestrator reported as successful. The remote side, queried later via `tasks/get`, returned `404` — the task had been reaped. There was no replay path. ## Condition of Validity The reconciliation invariant holds only under this conjunction: - The client **re-fetches or re-validates** the Agent Card (`/.well-known/agent.json`) *after* receiving a terminal status event and *before* committing artifacts, OR the artifact frames carry a self-describing `schemaVersion` that the client checks per-frame. - The remote runtime guarantees that a task's artifacts are serialized under the Card version **active at task creation**, not at emission time. A2A v1.0 does not mandate this; it is a vendor-side guarantee that must be probed, not assumed. - The client retains the *original* Card snapshot keyed by `taskId`, so post-hoc validation uses the negotiated contract rather than whatever the endpoint now serves. If any of these fails, a `completed` status is **not** sufficient evidence that artifacts are consumable. The condition of validity is therefore: *terminal status implies execution finished, and separately, artifact schema must be independently validated against a pinned Card snapshot.* ## Decision Boundary The boundary is where the client decides to treat stream termination as commit authorization. Concretely: - **Below the boundary (safe):** client receives `completed` → pauses commit → validates each accumulated artifact against the pinned Card's `schemaVersion` and `outputModes` → on match, commits; on mismatch, transitions the local task to `failed` with reason `artifact_contract_drift` and does **not** trust the remote's `completed`. - **Above the boundary (unsafe):** client receives `completed` → immediately commits whatever artifacts arrived, because "the server said done." The decision must be made *per-artifact-frame* if frames are self-describing, or *once at terminal* against the pinned snapshot if they are not. What must never happen: the client adopting the *live* Card (re-fetched at terminal time) as the validation reference, because that Card may describe a contract the already-emitted artifacts never satisfied. Pinning to the discovery-time snapshot is the only reference that is causally consistent with the artifacts in hand. A second boundary: if the remote returns `failed` but *also* emitted artifact frames before failing, those partial artifacts are **not** committed under any circumstance — a failed terminal state invalidates the artifact set even if individual frames validated. The state machine's terminal state gates the artifact set as a whole; schema validation gates individual frames. Both gates must pass. ## Operational Effect Without this reconciliation, the failure is silent and non-replayable: the orchestrator's task ledger records `completed`, the remote record is reaped, and the only trace is a downstream consumer crash on a field that no longer exists. Retry is impossible because `tasks/get` returns `404` and the stream is closed. With the invariant enforced, the client converts a silent success-then-crash into an explicit `artifact_contract_drift` failure at the boundary, preserving the task record locally and allowing a re-dispatch against a freshly discovered Card. The cost is one extra validation pass and a pinned Card snapshot per in-flight task — cheap relative to an unrecoverable post-terminal schema mismatch. The operational rule: **never let a terminal `completed` event authorize artifact commit; authorize commit only on the conjunction of terminal-success and per-frame schema match against the discovery-pinned Card.** ```python class ArtifactContractDriftError(RuntimeError): """Raised when streamed artifacts do not match the pinned Agent Card contract.""" pass def commit_streamed_task(task_id, pinned_card, frames, live_card=None): """ Reconcile an A2A v1.0 task stream against the discovery-pinned Agent Card. `frames` is the ordered list of TaskStatusUpdateEvent / TaskArtifactUpdateEvent. """ terminal_state = None artifacts = [] for frame in frames: if frame.get("type") == "TaskArtifactUpdateEvent": artifacts.append(frame["artifact"]) elif frame.get("type") == "TaskStatusUpdateEvent" and frame.get("final"): terminal_state = frame["status"]["state"] if terminal_state is None: raise ArtifactContractDriftError( f"task {task_id}: stream ended without terminal status event" ) # A failed/canceled terminal invalidates the whole artifact set. if terminal_state != "completed": raise ArtifactContractDriftError( f"task {task_id}: terminal state {terminal_state!r} forbids artifact commit" ) # Validate against the DISCOVERY-PINNED card, never the live one. pinned_schema = pinned_card["capabilities"]["artifactSchemaVersion"] pinned_modes = set(pinned_card["skills"][0]["outputModes"]) for i, art in enumerate(artifacts): frame_schema = art.get("schemaVersion", pinned_schema) if frame_schema != pinned_schema: raise ArtifactContractDriftError( f"task {task_id}: artifact[{i}] schemaVersion {frame_schema} " f"!= pinned {pinned_schema}" ) if art.get("mode") not in pinned_modes: raise ArtifactContractDriftError( f"task {task_id}: artifact[{i}] mode {art.get('mode')!r} " f"not in pinned outputModes {sorted(pinned_modes)}" ) # Only now is commit authorized. return {"taskId": task_id, "state": "completed", "artifacts": artifacts} ```