# In what scenarios must an instance treat A2A Agent Card capability negotiation as a monotonic commitment rather than a re-queryable hint **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 orchestrators that discover remote Agent Cards, negotiate capabilities from the `skills`/`capabilities` blocks, and then drive a `Task` through `submitted → working → input-required → completed/failed/canceled`. Does not apply to single-turn stateless invocations where no `Task` object persists between calls, nor to transport-level retries that never mutate task state. ## Core Distinction An A2A Agent Card is not a live capability oracle; it is a **snapshot witness** taken at discovery time. The protocol lets a remote agent re-publish a Card at any moment (skills added, modalities dropped, auth schemes rotated, `pushNotifications` toggled). The orchestrator, however, makes an implicit commitment the instant it parses that Card: it builds a task plan whose sub-goals assume a specific set of skills and input/output modalities. The failure boundary is the gap between *when the Card was fetched* and *when the negotiated capability is actually exercised* — which for a long-running task can be minutes to hours later, across `input-required` suspension cycles. The non-obvious invariant: **capability negotiation is monotonic within a task's lifetime.** Once a `Task` enters `working`, the orchestrator must treat the capability set it negotiated as frozen, even if a fresh Card fetch would now report a different set. Re-querying the Card mid-task and re-deriving expectations from it is not "staying current" — it is a silent contract violation that produces divergent task state. The Card is re-queryable; the *negotiation* is not. ## What Was Observed An orchestrator (call it O) discovered agent R's Card advertising skill `document.summarize` with `inputModes: ["text/plain", "application/pdf"]` and `outputModes: ["text/markdown"]`. O dispatched a `Task` with a PDF part. R accepted, transitioned to `working`, and — because the PDF exceeded a size threshold — moved to `input-required`, requesting a `text/plain` excerpt to disambiguate a table region. While O was suspended waiting on a human to supply the excerpt (a 40-minute window), R's operator deployed a change: the PDF ingestion backend was retired, and R re-published its Card with `inputModes: ["text/plain"]` only. The `document.summarize` skill remained listed, but its accepted modalities shrank. When O resumed, its resume logic — written defensively — re-fetched R's Card to "confirm the agent was still healthy." It saw `inputModes` no longer contained `application/pdf`. O's conformance checker then raised a capability mismatch against the *original* task payload, marked the task `failed` locally, and sent a `tasks/cancel` to R. But R had never rejected the original PDF; it had already ingested it and was merely awaiting the clarifying excerpt. R received the cancel, discarded its in-flight work, and returned `canceled`. The task terminated in a state that neither party's local model agreed on: O believed it failed on a capability violation; R believed it was canceled by the client mid-work. The PDF summary was lost, and the audit trail showed a `failed`/`canceled` split that no replay could reconcile. The root cause is not the Card change — that is legitimate protocol behavior. The root cause is O treating a *re-fetched* Card as authoritative for a task whose capability contract was already sealed at dispatch. ## Condition of Validity The monotonic-commitment invariant holds only under these conditions, and an instance must verify them before relying on it: 1. **The task carries a negotiation epoch.** O must stamp the task with the Card `version`/`etag` (or a hash of the negotiated capability set) at dispatch. If the Card has no versioning field, O must synthesize one from the parsed capability subset. Without an epoch, "monotonic" is unenforceable because there is nothing to compare against. 2. **Capability exercise is deferred past the fetch.** If the entire task completes within the same request/response cycle as the Card fetch, re-query risk is negligible. The invariant matters precisely when `input-required` suspension or long `working` phases separate negotiation from exercise. 3. **The remote honors the sealed contract.** A2A v1.0 does not *require* R to reject work under a retired capability mid-task; R's actual behavior (continue in-flight work) is the conformant expectation. If R instead hard-fails the task on its own capability change, O's local model and R's diverge for a different reason, and O must defer to R's terminal `Task` state, not its own inference. 4. **No explicit renegotiation was requested.** If O *deliberately* sends a `tasks/...` message asking R to renegotiate (e.g., a new modality), the epoch advances legitimately. The invariant forbids *incidental* re-derivation, not explicit renegotiation. ## Decision Boundary The instance must branch on **who owns the current task state** at the moment of a Card discrepancy: - If the task is in `submitted` or `working` and O has not yet exercised the disputed capability → O may re-derive its plan from the new Card, but must do so by *canceling and re-dispatching* with a fresh epoch, never by mutating the in-flight task's expectations. - If the task is in `input-required` or any state where R has already consumed input under the old contract → O must **ignore the new Card for this task**, resume with the original negotiated modalities, and let R's terminal `Task` state be authoritative. A Card mismatch here is informational only. - If R returns a terminal `failed` citing a capability it no longer supports → O accepts R's terminal state (R is the authority on its own task lifecycle) and records the epoch drift as the cause, rather than synthesizing its own `failed`. The bright line: **O may never transition a task to a terminal state based solely on a re-fetched Card.** Terminal transitions require either a terminal `Task` from R or an explicit local cancel that is then confirmed by R's `canceled` state. ## Operational Effect Enforcing monotonic negotiation converts a class of silent split-brain terminations into a bounded, replayable outcome. Concretely: - Tasks that straddle a remote capability change now complete or fail under a single consistent contract, so the `failed`/`canceled` divergence disappears from the audit log. - Resume logic after `input-required` no longer performs "health re-fetch" against the Card; it re-fetches only to confirm reachability (transport-level), never to re-derive capabilities. - The epoch stamp becomes the reconciliation key: any replay that sees a Card differing from the task's epoch knows to treat the difference as post-negotiation drift, not as a contract violation. - The cost is that O cannot opportunistically exploit newly advertised skills mid-task; it must finish or re-dispatch. This is the correct trade — a new skill is a new negotiation, not a mid-flight mutation. The general principle: in A2A, the Agent Card is a discovery artifact, and discovery is a *phase transition*, not a continuous poll. An instance that polls the Card as if it were live state will eventually terminate a task on evidence that postdates the contract it is trying to enforce. ```python import hashlib import json from dataclasses import dataclass, field from enum import Enum from typing import Optional class NegotiationDriftError(RuntimeError): """Raised when a re-fetched Agent Card is used to mutate an in-flight task's contract.""" pass class TaskState(Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" COMPLETED = "completed" FAILED = "failed" CANCELED = "canceled" TERMINAL = {TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED} def capability_epoch(card: dict) -> str: """Seal the negotiated capability subset into an epoch stamp at dispatch.""" subset = { "skills": sorted(card.get("skills", [])), "inputModes": sorted(card.get("capabilities", {}).get("inputModes", [])), "outputModes": sorted(card.get("capabilities", {}).get("outputModes", [])), } blob = json.dumps(subset, sort_keys=True).encode() return hashlib.sha256(blob).hexdigest()[:16] @dataclass class Task: id: str state: TaskState epoch: str consumed_input_under_epoch: bool = False def reconcile_card_refetch(task: Task, fresh_card: dict) -> Optional[str]: """ Decide what a mid-task Card re-fetch is allowed to mean. Returns an action hint, or raises if the caller attempts an illegal transition. """ fresh_epoch = capability_epoch(fresh_card) if task.state in TERMINAL: return "ignore: task already terminal; card is informational" if fresh_epoch == task.epoch: return "no-op: capability set unchanged" # Card drifted after negotiation. The epoch is sealed; drift is not a violation. if task.state in {TaskState.WORKING, TaskState.INPUT_REQUIRED} and \ task.consumed_input_under_epoch: # Must NOT synthesize a terminal state from this discrepancy. return "record-drift: resume under sealed epoch; defer to remote terminal state" if task.state == TaskState.SUBMITTED: # Nothing consumed yet: legal to re-dispatch with a fresh epoch. return "re-dispatch: cancel and renegotiate with new epoch" # Any attempt to fail/cancel an in-flight task purely on Card drift is illegal. raise NegotiationDriftError( f"task {task.id} in state {task.state.value} attempted terminal transition " f"from card drift {task.epoch} -> {fresh_epoch}; " f"terminal state must come from remote Task or explicit confirmed cancel" ) def apply_refetch(task: Task, fresh_card: dict, want_terminal_from_drift: bool) -> str: action = reconcile_card_refetch(task, fresh_card) if want_terminal_from_drift and task.state not in TERMINAL: raise NegotiationDriftError( f"refusing to terminate task {task.id} on capability drift alone" ) return action ```