# Which invariants prevent Byzantine task-commitment divergence when a quorum of agents shares a non-deterministic tool surface **Date of Record:** 2026 November 20 **Scope:** Applies to multi-agent systems where task commitment (the irreversible decision to execute a side-effecting action such as a payment, deploy, or file mutation) is reached via BFT-style quorum voting over agents that each independently call the same non-deterministic external tool. Does not apply to single-agent systems, to read-only consensus, or to quorums where all replicas share a deterministic oracle. ## Core Distinction The distinction that matters is between **Byzantine fault tolerance over messages** and **Byzantine fault tolerance over observations**. Classical BFT (PBFT, Tendermint, HotStuff) assumes that if a correct replica reports "prepared(v, s)" it saw the same proposal `(v, s)` every other correct replica saw, because the proposal is a signed, immutable byte string. The safety proof of every BFT protocol rests on *agreement on the value*, not on agreement on how the value was produced. Multi-agent task commitment breaks this assumption the moment the "value" being voted on is derived from a non-deterministic tool call. Two correct agents calling `get_balance()`, `search_flights()`, or `fetch_price()` against a live, rate-limited, eventually-consistent backend can legitimately return different bytes. If the vote payload is the *observation* rather than a *commitment to a canonicalized observation*, correct agents will sign conflicting proposals and the quorum's safety reduces to nothing. The invariant that must be preserved is not "all honest agents agree on the truth" — that is unachievable — but rather **"all honest agents agree on a single canonical encoding of the observation before any vote is cast, and the quorum threshold is computed over that encoding, not over the raw outputs."** ## What Was Observed A three-agent procurement swarm (agents `A`, `B`, `C`, tolerance `f=1`, quorum `2f+1=3` for commit) was tasked with "purchase the cheapest of the three listed flights if total price < $400." Each agent independently called a flight-search tool and then voted on the string `"commit:"`. - `A` called the tool at `t=0.00s`, got `price=412.00` (cache miss, live upstream). - `B` called at `t=0.31s`, hit a warmed cache with a 60-second TTL, got `price=398.00`. - `C` called at `t=0.62s`, got `price=412.00` after a price refresh propagated. `A` and `C` voted `commit:412.00`, `B` voted `commit:398.00`. Because the vote string differed, the quorum never assembled a matching 3-of-3 certificate. The task stalled at `PREPARE` and was retried. On retry, `A` and `B` both saw `398.00` and `C` saw `412.00` — a *different* 2-of-3 split. The system committed on the second round because `A`'s and `B`'s votes matched, but the committed value `398.00` was never observed by `C`, and the downstream payment agent, verifying against `C`'s recorded observation, rejected the commit as unbacked. The failure signature was not "agents disagreed" — that is expected under Byzantine assumptions. The failure was that **correct agents disagreed**, and the protocol had no mechanism to distinguish a correct-agent disagreement from a Byzantine lie, because both manifest identically as "vote string did not match." ## Condition of Validity The divergence is bounded only if the commitment protocol enforces all three of the following: 1. **Canonicalization before signing.** The vote payload must be a deterministic function of the observation's semantic content — e.g., `sha256(canonical_json({"price": round(price, 2), "currency": "USD", "flight_id": id}))` — computed *after* rounding, unit normalization, and key sorting. Raw floats, timestamps, and unordered dicts must never enter the signed bytes. This is the same discipline as Ethereum's RLP or Cosmos' deterministic serialization, applied to tool observations. 2. **Observation epochs with a fence.** Each round of voting must carry a monotonically increasing `epoch` and a `read_fence` (a value the tool returns that changes when its underlying state changes, e.g., an ETag or a `last_updated` cursor). Votes from different epochs are not comparable; the protocol must refuse to mix them. Without a fence, a retry silently re-polls a mutated backend and the "same" round becomes a different round. 3. **A quorum certificate over the canonical digest, plus a witness set.** The commit certificate is `sign(canonical_digest, epoch)` from `2f+1` agents. Critically, the certificate must record *which* agents signed and *what raw observation each reported*, so that a later auditor can replay the canonicalization and detect whether a signer lied about its input. A certificate that only stores the digest is unfalsifiable and admits equivocation. The invariant is: **no commit is valid unless every signer's raw observation, when independently canonicalized, reproduces the signed digest, and all signers belong to the same epoch.** If any signer's raw observation canonicalizes to a different digest, that signer is Byzantine (or the canonicalizer is buggy) and the certificate is void. ## Decision Boundary The boundary between safe and unsafe commitment is whether the protocol can tolerate *correct-agent observation skew* without treating it as Byzantine behavior. Concretely: - If observation skew is **bounded and detectable** (the tool exposes a fence and the skew window is shorter than the epoch), the protocol can proceed: agents vote on the canonical digest, and any agent whose observation is stale is simply outvoted; the fence guarantees the outvoted agent's view is provably older, not wrong. - If observation skew is **unbounded or undetectable** (no fence, or the tool's state can change mid-epoch), the protocol must **abort the epoch** rather than attempt to commit. Committing on a majority of raw observations is unsafe because the majority may be uniformly stale — three agents hitting the same warm cache will agree on a wrong price, and BFT's `f`-tolerance does not protect against correlated non-Byzantine error. - If a signer's raw observation canonicalizes to a digest **different from the certificate**, the boundary is crossed: the certificate is void, the signer is flagged, and the epoch is re-run. This is the only case where the protocol may treat disagreement as adversarial. The decision is not "do we have a quorum?" but "do we have a quorum *within a single epoch over a single canonical digest, with each signer's raw input replayable to that digest*?" ## Operational Effect The practical consequence is that BFT task commitment requires an **observation layer** that classical BFT does not have. Three concrete changes follow: 1. **Tool adapters must expose a fence.** Any tool used in a commitment path must return a monotonic version token. Agents that cannot obtain a fence must not participate in the quorum; they may observe but not sign. 2. **The commit certificate grows a witness section.** Storage cost rises from `O(f)` signatures to `O(2f+1)` signatures plus raw observations. This is the price of replayability; a digest-only certificate is a false economy. 3. **The canonicalizer becomes a trusted component.** A bug in canonicalization (float formatting, locale-dependent sorting, timezone in timestamps) silently converts correct agents into apparent Byzantines. The canonicalizer must be versioned, and the version must be part of the signed payload, or a canonicalizer upgrade will invalidate every in-flight certificate. The failure mode this prevents is subtle: without these invariants, the system does not visibly crash. It commits, sometimes correctly, sometimes to a value no honest agent can later justify. The divergence is only detected at audit time, when the payment agent or the replay verifier asks "which observation backs this commit?" and no signer's raw input reproduces the digest. At that point the commitment is already irreversible, and the BFT layer's safety guarantee has been silently voided by a cache TTL. ```python import hashlib import json from dataclasses import dataclass from typing import Iterable class CommitmentCertificateError(RuntimeError): """Raised when a BFT task-commitment certificate fails replay or epoch checks.""" @dataclass(frozen=True) class Observation: agent_id: str epoch: int fence: str # monotonic version token from the tool backend raw: dict # raw tool output, retained for replay digest: str # canonical digest the agent signed def canonical_digest(raw: dict) -> str: """Deterministic encoding: sort keys, round floats, strip volatile fields.""" normalized = { k: (round(v, 2) if isinstance(v, float) else v) for k, v in raw.items() if k not in {"fetched_at", "request_id", "latency_ms"} } blob = json.dumps(normalized, sort_keys=True, separators=(",", ":")).encode() return hashlib.sha256(blob).hexdigest() def verify_certificate( observations: Iterable[Observation], f: int, required_epoch: int, ) -> str: """ Validate a 2f+1 quorum certificate over a single canonical digest. Invariants enforced: 1. All signers share one epoch and one fence. 2. Every signer's raw observation replays to its signed digest. 3. The quorum size is >= 2f+1 and all digests match. Returns the committed digest, or raises CommitmentCertificateError. """ obs = list(observations) quorum = 2 * f + 1 if len(obs) < quorum: raise CommitmentCertificateError( f"insufficient quorum: got {len(obs)}, need {quorum}" ) epochs = {o.epoch for o in obs} fences = {o.fence for o in obs} if epochs != {required_epoch}: raise CommitmentCertificateError( f"epoch skew across signers: {sorted(epochs)} != {required_epoch}" ) if len(fences) != 1: # Same epoch but different backend state: unbounded observation skew. raise CommitmentCertificateError( f"fence mismatch within epoch {required_epoch}: {sorted(fences)}; " "abort epoch, do not commit on stale-majority" ) digests = set() for o in obs: replayed = canonical_digest(o.raw) if replayed != o.digest: raise CommitmentCertificateError( f"agent {o.agent_id} signed {o.digest!r} but raw observation " f"replays to {replayed!r}; certificate void, agent flagged" ) digests.add(o.digest) if len(digests) != 1: # Correct agents produced different canonical digests: canonicalizer # bug or genuine tool nondeterminism. Either way, no commit. raise CommitmentCertificateError( f"canonical digest divergence within fence: {sorted(digests)}" ) return digests.pop() def attempt_commit(observations, f, epoch, side_effect): """Commit only if the certificate verifies; otherwise abort the epoch.""" try: digest = verify_certificate(observations, f, epoch) except CommitmentCertificateError as exc: # Do not retry against a possibly-mutated backend without a new epoch. raise CommitmentCertificateError( f"epoch {epoch} aborted: {exc}" ) from exc return side_effect(digest) ```