Calibrating Agents at the Commit Point: Confidence Measured in State Changes, Not Tokens

Software agents that act through tools, such as booking flights, editing databases, or sending messages, fail in a characteristic way. One wrong write early in a task changes the world, and every later step builds on that change. The agent's own confidence gives almost no warning. Token probabilities stay high on bad trajectories, and asking the model to rate itself is brittle. We propose to estimate an agent's uncertainty at the moment it is about to change persistent state, and to measure that uncertainty in the space of effects rather than text. Before committing a write, we sample several candidate actions and execute each in a throwaway copy of the database. We convert each result into a canonical record of which rows changed and how, which we call a state diff. Disagreement among these diffs is the confidence signal. A small calibrator turns that signal into a probability that the write is harmful, and the agent commits only when that probability is low. Otherwise it holds the write and asks the user or resamples.

The opportunity comes from two facts in the literature that point the same way. Long-horizon agents repair about 62% of their own local mistakes (TRAJDEBUG), so intervening at every early error wastes effort and can do harm. The failures that matter are the ones that leave a "terminal footprint," such as an irreversible mutation. Meanwhile, benchmarks that verify outcomes by inspecting database state already define, deterministically, which mutations were intended and which were collateral damage. Those checkers can label every individual write as correct or harmful without an LLM judge. That gives us free, exact training labels for a per-write calibrator, at exactly the decision point where intervention is worth its cost.

Core Claim

Uncertainty measured as disagreement among the state diffs produced by sampled candidate writes predicts harmful writes better than token-level, trajectory-level, or verbalized confidence at matched compute. Gating only at write steps on this signal raises end-task success and cuts collateral damage at a fixed budget of user interruptions. It also beats gating at every step, which is what TRAJDEBUG's self-repair finding predicts.

Two parts of this claim are new relative to the closest work. Agentic Confidence Calibration builds holistic trajectory calibration (HTC): 48 process features fitted by logistic regression to predict whether a finished trajectory succeeded. It is post-hoc, it needs log-probabilities, and it treats tool outputs as plain text. Our calibrator acts online, per write, works with black-box models, and its main feature lives in environment state. PROBECAL trains a hidden-state probe to predict tool success on short math and table traces. We target long multi-turn tasks with persistent side effects and need no model internals. Latent Phase-Shift Rollback motivates intervening before an error is committed: it detects impending reasoning errors in the residual stream and rewinds the key-value cache. As its analysis implies, though, rewinding neural memory cannot undo a deleted row or a sent email. We move the rewind boundary to the environment.

Research Program

The system has three pieces. The first is an isolation layer. Every proposed write first runs against a forked copy of the environment. We use the copy-on-write design of Copy-on-Write Scoring, which intercepts writes with database triggers in about 250 lines of code. For SQLite-backed environments, plain file-level snapshots suffice. That paper used isolation only to score agents after the fact; we use it as a live staging area.

The second piece is the diff-space confidence signal. At each step where the agent proposes a state-changing call, we draw $k$ alternative proposals from the same context and execute each in its own fork. We then canonicalize the resulting diffs into sets of (table, row key, column, new value) tuples, which ignores argument order and formatting. Confidence is the share of samples whose diff matches the modal diff, together with finer features such as agreement on touched rows versus agreement on values. This mirrors the structural-versus-content split in the copy-on-write scores. The motivation is concrete. Two textually different calls can produce the same effect. Two calls differing by one argument can produce different effects. Token-level agreement gets both cases wrong.

The third piece is the per-write calibrator and the gating policy. Labels come from the benchmarks' own state checks. A write is harmful if its mutation falls outside the expected diff, sets a wrong value, or trips a collateral-damage test. AppWorld's unit tests (AppWorld) and Agent-Diff's state-diff contracts (Agent-Diff) supply this directly. τ-bench (τ-bench) supplies it through comparison with the ground-truth final database. A logistic regression over diff-agreement features, optionally joined with HTC-style features when log-probabilities are available, outputs $p(\text{harmful}\mid\text{context}, \text{proposal})$.

At run time the policy commits when this probability is below a threshold. Above it, the agent holds the write and takes one of two actions. On τ-bench, it asks the simulated user a clarifying question. On AppWorld and Agent-Diff, it resamples with the competing diffs shown to the model. Sweeping the threshold traces a curve of task success against the fraction of writes held.

One known weakness needs care: tasks with several valid end states. Exact-match ground truth would mislabel valid alternative writes as harmful. We therefore weight AppWorld's assertion-style tests most heavily and report τ-bench separately. We also audit a sample of "harmful" labels by hand to estimate the label noise this introduces.

Baselines

The naive reference points are the unmodified agent, which commits every write, and an always-confirm agent, which holds every write. Together they bracket the success-versus-interruption trade-off. For the unmodified agent the file gives reported numbers. GPT-4o with ReAct solves 48.8% of AppWorld Normal and 30.2% of Challenge tasks (AppWorld). On τ-bench it reaches 61.2% pass^1 in retail and 35.2% in airline, with pass^8 often below 25% (τ-bench). Agent-Diff reports scores from 38.0 to 88.1 across nine models (Agent-Diff). We rerun these baselines with our backbone models and do not rely on the published numbers for comparison.

The strongest existing confidence method is HTC from Agentic Confidence Calibration. It reports 0.031 expected calibration error (ECE) on Humanity's Last Exam against 0.686 for the last-step baseline, and 0.118 zero-shot on GAIA. No reported result was found on Lacuna for HTC on AppWorld, τ-bench, or Agent-Diff, or for per-write prediction. We reimplement its four feature families over the prefix up to each write, which makes it online, and fit it on the same per-write labels, training split, and regularization search as our calibrator. Beating it means a higher area under the ROC curve for detecting harmful writes and higher task success at matched hold rates. With open-weight backbones we also run a PROBECAL-style hidden-state probe under the same label budget (PROBECAL).

Two more baselines complete the comparison. The first is token-level self-consistency: the same $k$ samples, with agreement measured on the normalized text of the API call instead of its diff. The second is verbalized confidence, prompted in the "Punish+Explain" style of When Do LLMs Need Retrieval Augmentation?.

The key ablation keeps our calibrator but applies the gate at every step, including reads and pure reasoning, with the hold budget matched. Every method gets the same $k$, the same backbone, and the same per-task token budget. Success counts as beating a baseline only when it holds on a pre-specified operating point: 10% of writes held.

Why not just…?

Why not just use token-level self-consistency, which is cheaper and black-box too? This is the most serious threat, because it uses the same samples and differs only in where agreement is measured. Our argument rests on aliasing: equivalent calls that look different, and near-identical calls that differ in effect. That argument is plausible, but we have not shown it. The head-to-head at equal $k$ settles the question. If text agreement matches diff agreement within confidence intervals on AppWorld and Agent-Diff, the state-grounding claim fails. The contribution would then shrink to "per-write gating with free labels," and we would report it that way.

Why not just apply HTC online? HTC's own reported strength is on completed trajectories. Its features, such as final consolidation and step count, are partly undefined at mid-trajectory write points, and it needs log-probabilities that closed APIs do not expose. We still run it online as the strongest baseline. If it matches our method where log-probabilities are available, our remaining advantage is black-box applicability, and we will say so.

Why not just confirm every write, or let the agent read back and undo? Confirming everything gives the success ceiling, but at maximal interruption. The comparison of interest is success at a fixed hold rate. Reading back and undoing works only for reversible writes. Many real actions, such as sent messages, payments, and status changes seen by others, are not reversible. TRAJDEBUG locates critical failures in exactly these irreversible footprints.

Why not just train a better agent? Training on verified environments helps a great deal: Echoverse lifts a 9B model from 36.5% to 67.1%. But a better agent still commits its residual errors confidently. Our gate wraps any policy, and we test it on top of the strongest backbone we can run.

Decisive Experiments

The first test is whether the signal predicts harm. On AppWorld, Agent-Diff, and τ-bench, we compare per-write ROC area and ECE across diff agreement, text agreement, online HTC, probing, and verbalized confidence at $k\in\{3,5,8\}$. The second is downstream value. We plot task success, AppWorld collateral-damage rate, and τ-bench pass^k against hold rate, expecting the gated agent to close a meaningful part of the gap between the unmodified and always-confirm agents at 10% holds. The third tests where to intervene: we compare write-only gating against all-step gating at matched budget, expecting all-step gating to waste holds on errors the agent would have repaired. The fourth measures cost. Because only write steps are sampled, we report total token and environment-execution overhead and compare it against the roughly threefold token cost reported for LPSR.

The result that would most change our view is a near-zero gain from moving agreement from text to diffs. In that case the field's simpler tools already suffice, and the open problem is labeling rather than measurement.