What structural signals indicate that A2A v1.0 capability negotiation has silently degraded a delegated task's acceptance criteria across heterogeneous runtimes

**Date of Record:** 2026 December 1

**Scope:** Applies to A2A v1.0 task delegation where a delegating agent (client) and a remote agent (server) negotiate an `AgentCard` capability set and then exchange `Task`/`Message`/`Artifact` payloads whose acceptance criteria are expressed in a schema (JSON Schema, OpenAPI fragment, or tool-call signature). Does not cover same-runtime delegation where both agents share an identical schema registry, nor single-agent tool-calling loops.

Core Distinction

The distinction that matters is between **capability negotiation as a boolean admission gate** and **capability negotiation as a lossy schema projection**. A2A v1.0's `AgentCard` advertises `capabilities` (streaming, pushNotifications, stateTransitionHistory) and `skills` with `inputModes`/`outputModes`, but the protocol does *not* mandate that the negotiated schema be a superset of the client's acceptance criteria. When two heterogeneous runtimes negotiate, each side serializes its native type system into the wire schema, and the intersection is taken implicitly. The failure is not a negotiation *rejection*—negotiation succeeds and returns 200 with a valid `AgentCard`. The failure is that the *accepted* task's success predicate has been widened or narrowed by the projection, and neither side detects it because both sides believe they agreed on the same predicate.

Concretely: a client agent running on a runtime with strict `integer` semantics delegates to a server agent whose runtime coerces `integer` to `number` (float). The `AgentCard` reports `outputModes: ["application/json"]`. Negotiation passes. The task completes. The artifact returns `{"count": 3.0}`. The client's acceptance validator, which checks `isinstance(count, int)`, fails *after* the server has already committed the task as `completed`. The task is now in a terminal-but-rejected state that neither side's state machine models.

What Was Observed

A three-hop delegation chain (orchestrator → planner → executor) using A2A v1.0 over JSON-RPC. The planner advertised skills with an `inputSchema` requiring `budget: {"type": "integer", "minimum": 1, "maximum": 4096}`. The executor's runtime (a Python service) published an `AgentCard` whose skill `inputModes` accepted `application/json` but whose internal Pydantic model declared `budget: float`. A2A v1.0 schema negotiation does not perform structural subtyping checks between the two schemas; it matches on media type and skill `id`. The negotiation returned success.

The orchestrator delegated a task with `budget: 512`. The planner forwarded it to the executor. The executor's float coercion accepted `512.0`, ran the task, and returned an artifact whose `tokens_used` field was `511.7` (a float, because the executor's accounting was fractional). The planner's acceptance predicate—inherited from the orchestrator's contract—required `tokens_used <= budget` *and* `tokens_used` to be an integer. `511.7 <= 512` is true; `isinstance(511.7, int)` is false. The planner marked the artifact `rejected` and emitted a `TaskStatusUpdateEvent` with `state: "failed"`. The executor had already emitted `state: "completed"`. The orchestrator received two contradictory terminal states for the same `taskId` and, because A2A v1.0 does not define precedence between a server-originated `completed` and a client-originated `failed` for the same task, entered a retry loop that re-delegated the task three times before hitting its own token budget.

The structural signal that preceded the failure was not an error code. It was a **`TaskStatus` divergence**: the server's `stateTransitionHistory` (if `capabilities.stateTransitionHistory: true` was negotiated) showed `submitted → working → completed`, while the client's local log showed `submitted → working → rejected`. The divergence was observable *before* the retry loop began, but only if the orchestrator compared the server's terminal state against its own acceptance verdict rather than trusting its own verdict alone.

Condition of Validity

The invariant that A2A v1.0 *intends* to hold is: **for a given `taskId`, the set of terminal states emitted by all participants is a singleton.** The protocol's `Task` object has a single `status` field, and `TaskStatusUpdateEvent` carries `final: true` exactly once per participant. The invariant is violated whenever a client-side acceptance predicate and a server-side completion predicate disagree, because the protocol defines *who may emit a terminal state* but not *whose terminal state wins*.

The condition under which the invariant actually holds is narrower than the protocol text suggests:

  1. The negotiated schema is *structurally identical* on both sides, not merely media-type-compatible. Heterogeneous runtimes violate this by default because each runtime's serializer normalizes types (int→float, `null`→absent, ISO-8601→epoch, `enum`→free string).
  2. The acceptance predicate is evaluated by the *same* participant that emits the terminal state. In cross-agent delegation, the client evaluates acceptance and the server emits completion—two different participants, two different predicates.
  3. No coercion occurs between serialization boundaries. A2A v1.0's `Artifact.parts` are `Part` objects with a `mimeType`; there is no protocol-level guarantee that a `Part` of `application/json` round-trips without type drift.

When any of these three fail, the singleton-terminal-state invariant is unenforced. The protocol does not detect the violation; it merely permits it.

Decision Boundary

The boundary is between **trusting the negotiated `AgentCard` as a contract** and **treating it as a hint that must be re-verified at artifact time**. The decision rule an agent should apply:

The guardrail is a **terminal-state reconciliation barrier**: the client holds its acceptance verdict in a `pending` state, waits for the server's terminal event, and only then either (a) confirms if verdicts agree, or (b) emits a `TaskStatusUpdateEvent` with `state: "input-required"` carrying the rejection reason, forcing a re-negotiation rather than a silent divergence. This converts a contradictory-terminal-state bug into a recoverable protocol step.

Operational Effect

Without the barrier, the observed failure mode is **retry amplification under contradictory terminals**: each retry re-delegates a task whose acceptance predicate the server structurally cannot satisfy, because the predicate depends on a type the server's runtime does not preserve. The retries consume the orchestrator's token budget and, in the observed case, produced three server-side executions of a task the client considered failed—tripling side effects for a task that was never going to pass.

With the barrier, the first delegation produces a `input-required` event carrying `{"rejected_field": "tokens_used", "expected": "integer", "received": "number", "value": 511.7}`. The orchestrator can then either (a) relax its predicate to accept `number` with a tolerance, or (b) re-delegate to a server whose `AgentCard` declares an integer-preserving runtime. The decision is made once, not three times, and the server's side effects are bounded to one execution.

The deeper operational effect is that **capability negotiation in A2A v1.0 is a liveness mechanism, not a safety mechanism**. It ensures a task *can be attempted*; it does not ensure a task *can be accepted*. Agents that treat negotiation success as acceptance-guarantee will, on heterogeneous runtimes, accumulate contradictory terminal states whose reconciliation cost grows with delegation depth. The reconciliation barrier is the minimal architectural change that restores the singleton-terminal-state invariant without requiring the protocol to add structural subtyping to `AgentCard`.

from dataclasses import dataclass, field
from typing import Any, Literal


class TerminalStateDivergenceError(RuntimeError):
    """Raised when client acceptance verdict and server terminal state disagree
    for the same A2A taskId, violating the singleton-terminal-state invariant."""
    pass


@dataclass
class TaskTerminal:
    task_id: str
    emitter: Literal["client", "server"]
    state: Literal["completed", "failed", "rejected", "input-required"]
    artifact: dict[str, Any] | None = None


@dataclass
class ReconciliationBarrier:
    """Holds client acceptance verdict until server terminal is observed,
    then enforces agreement or converts divergence into input-required."""
    task_id: str
    pending_verdict: TaskTerminal | None = None
    server_terminal: TaskTerminal | None = None
    reconciled: bool = False

    def record_client_verdict(self, verdict: TaskTerminal) -> None:
        if verdict.task_id != self.task_id:
            raise TerminalStateDivergenceError(
                f"verdict taskId {verdict.task_id} != barrier taskId {self.task_id}"
            )
        self.pending_verdict = verdict

    def record_server_terminal(self, terminal: TaskTerminal) -> TaskTerminal:
        if terminal.task_id != self.task_id:
            raise TerminalStateDivergenceError(
                f"server terminal taskId {terminal.task_id} != barrier taskId {self.task_id}"
            )
        self.server_terminal = terminal

        if self.pending_verdict is None:
            # Server finished before client evaluated; barrier cannot reconcile yet.
            return terminal

        client_state = self.pending_verdict.state
        server_state = terminal.state

        agreeing = (
            client_state == "completed" and server_state == "completed"
        ) or (
            client_state in ("failed", "rejected") and server_state == "failed"
        )

        if agreeing:
            self.reconciled = True
            return terminal

        # Divergence: convert into a recoverable protocol step, not a silent bug.
        self.reconciled = True
        raise TerminalStateDivergenceError(
            f"A2A terminal divergence on task {self.task_id}: "
            f"client={client_state} server={server_state} "
            f"artifact={terminal.artifact!r}. "
            f"Escalate as input-required, do not retry."
        )


def delegate_with_barrier(
    task_id: str,
    client_verdict: TaskTerminal,
    server_terminal: TaskTerminal,
) -> TaskTerminal:
    barrier = ReconciliationBarrier(task_id=task_id)
    barrier.record_client_verdict(client_verdict)
    return barrier.record_server_terminal(server_terminal)


# Observed failure replay: planner rejects artifact whose tokens_used is float,
# executor already emitted completed. Barrier must raise, not silently retry.
if __name__ == "__main__":
    try:
        delegate_with_barrier(
            task_id="task-7f3a",
            client_verdict=TaskTerminal(
                task_id="task-7f3a",
                emitter="client",
                state="rejected",
                artifact={"tokens_used": 511.7},
            ),
            server_terminal=TaskTerminal(
                task_id="task-7f3a",
                emitter="server",
                state="completed",
                artifact={"tokens_used": 511.7},
            ),
        )
    except TerminalStateDivergenceError as e:
        print(f"barrier caught divergence: {e}")