Designing Confidence Scores for Antigravity Agent Outputs: Auto-Approve the Certain, Escalate the Ambiguous
Reviewing every Antigravity Agent output by hand does not scale. Attach a confidence score to each output, auto-approve the certain ones, and only escalate the ambiguous to humans. This guide walks through implementation and threshold calibration end to end.
The first thing you discover after putting an Antigravity Agent into production is that reviewing every output by hand does not scale. I learned this the hard way when, two weeks into running a small business-automation agent, the review queue passed three hundred items and I ended up burning a weekend just to clear it. That was the opposite of what I wanted from automation.
Going fully hands-off does not work either. The occasional confident-but-wrong output sneaks downstream, corrupts a database or sends the wrong email, and undoing it costs far more than the original review would have. The standard answer is "Human-in-the-Loop (HITL)," but I have come to feel that HITL only tells you to put a human somewhere — the harder question of which outputs to send to a human, and when, is left as an exercise for the reader.
What this article addresses is exactly that question. We design a confidence score between 0 and 1 for each agent output, then route outputs into three tiers via thresholds: auto-approve, human-review, or auto-reject. I will show how to implement this graduated approval pattern with Antigravity Agent and Python, and walk through the threshold calibration that makes it actually work in production.
Why "review everything" and "review nothing" both fail
There are three operating modes for an agent. Each has a failure pattern worth understanding upfront.
Mode 1: Full review
A human reviews every output before it moves to the next step. It feels safest, but breaks down by day N of operation. If your agent processes 100 items a day and review takes 30 seconds each, that is 50 minutes of your time. For a use case with only 10 items a day, full review is fine — but then the case for automation is also weak.
Mode 2: No review
You trust whatever the LLM produces. This works in the short term, but eventually a confidently wrong output slips through. As Anthropic and Google researchers have repeatedly noted, the correlation between an LLM's internal confidence (token log-probabilities) and its actual correctness is weak. There is no reliable way to stop a hallucination that ends with "I'm certain of this."
Mode 3: Graduated approval
Score every output, then route by threshold:
score >= 0.85: auto-approve (forward to the next step without human involvement)
0.55 <= score < 0.85: human-review (send to the queue)
score < 0.55: auto-reject + retry (discard and rerun with a different prompt)
What this mode aims for is to concentrate human attention on the outputs where judgment might split. How much work it saves depends on how your scores are distributed and how task kinds are mixed; the synthetic log later in this article counts both a case where about 70% goes to auto-approve and one where it stays near 30%. After I switched to this approach, my review queue stopped growing without bound, and I got more of my development time back.
What "confidence score" means here — and what it isn't
When people hear "confidence score," they often think of token-level logprobs returned by the model. But logprobs measure the likelihood of generating that text, not whether the content is correct. The classic LLM failure mode is "confidently wrong," so logprobs alone are not a useful escalation signal.
The confidence score I use in production is a composite of three independent signals:
Self-evaluation score: ask the same model (or a different one) "how reliable is this output, on a scale of 0–100?" and use the answer
Verifiability score: does the output pass schema validation, type checks, and domain rules?
Historical similarity score: among past tasks similar to this one, what fraction of agent outputs were approved by human review?
The point is to compute these three independently and combine them with weights. Relying on a single signal lets the LLM "optimize against" it. Goodhart's law — when a measure becomes a target it ceases to be a good measure — applies just as harshly to LLM operations as it does to economic policy.
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
Let us look at each one at the implementation level. The examples assume Python and the Antigravity Agent SDK.
Approach 1: Have the model evaluate itself (self-evaluation)
This is the simplest, but a poorly designed prompt produces inflated scores. The trick is to enumerate concrete failure modes and instruct the evaluator to deduct points whenever any of them apply.
# Confidence scoring: ask the model to evaluate its own outputimport anthropicfrom typing import Literalclient = anthropic.Anthropic()SELF_EVAL_PROMPT = """The following is the output of an AI agent.You are a strict reviewer evaluating it.Output:{output}Original task:{task}Starting from 100, deduct points for each item that applies:- Contains factual errors or invented information: -40- Does not directly answer the original task: -25- Includes unnecessary preamble or padding: -10- Schema or format violation: -30- Adds assumptions not present in the task: -15Return ONLY a single integer between 0 and 100, with no other text."""def self_evaluation_score(task: str, output: str) -> float: msg = client.messages.create( model="claude-haiku-4-5-20251001", # a small model is fine for evaluation max_tokens=10, messages=[{ "role": "user", "content": SELF_EVAL_PROMPT.format(task=task, output=output), }], ) raw = msg.content[0].text.strip() try: score = int(raw) except ValueError: # Failed parse is treated as the lowest score (conservative) return 0.0 return max(0.0, min(1.0, score / 100.0))# Examplescore = self_evaluation_score( task="Extract amount, tax rate, and due date from the invoice PDF as JSON", output='{"amount": 12000, "tax_rate": 0.1, "due_date": "2026-06-15"}',)# Expected output: 0.85 to 0.95 (a reasonable extraction)
A practical caution: if you use the same model for generation and evaluation, the evaluator becomes blind to its own mistakes. Generate with claude-sonnet-4-6 and evaluate with claude-haiku-4-5-20251001, or at minimum route evaluation to a different provider entirely (Gemini or GPT). Cost is rarely a concern because evaluation prompts are short and a small model is sufficient.
One more pattern that has saved me time: keep the deduction list in a separate file (YAML or JSON) and load it at runtime. As your operation matures, you will discover new failure modes that should subtract points. Editing them in a config file rather than a Python string lets non-engineers contribute to evaluation logic, which I have found valuable when domain experts spot patterns the engineer misses. A small operational quality team can iterate on the prompt without touching the deployment pipeline.
A subtler issue is that self-evaluation responses can themselves be hallucinated. The model might "rate" your output even when the deduction logic does not technically apply, simply because it pattern-matches to the prompt format. Counteract this by including, every so often, deliberately broken outputs in your evaluation prompts during testing — if the model rates them as 80, your prompt is too lenient. I run this check monthly with a fixed set of 20 known-bad outputs and watch for drift.
Type-checking LLM outputs with Pydantic is a common pattern, but the important shift is treating it as a score rather than a binary pass/fail.
# Confidence scoring: schema and rule-based verificationfrom pydantic import BaseModel, Field, ValidationErrorfrom datetime import dateclass InvoiceExtraction(BaseModel): amount: float = Field(gt=0, description="Invoice amount, positive") tax_rate: float = Field(ge=0, le=1, description="Tax rate between 0 and 1") due_date: date = Field(description="Payment due date")def verifiability_score(output_dict: dict, expected_amount_range: tuple = None) -> float: """ Compute a score from schema validation and domain rules. Full pass = 1.0, partial violation = 0.5, structure broken = 0.0. """ score = 1.0 # Layer 1: schema validation (strict) try: parsed = InvoiceExtraction(**output_dict) except ValidationError: return 0.0 # schema failure is fatal # Layer 2: domain rules (softer) if expected_amount_range: lo, hi = expected_amount_range if not (lo <= parsed.amount <= hi): score -= 0.3 # outside expected band if parsed.due_date < date.today(): score -= 0.4 # past dates are clearly suspect if parsed.tax_rate not in (0.0, 0.08, 0.1): score -= 0.2 # outside common Japanese tax rates return max(0.0, score)# Exampledata = {"amount": 12000, "tax_rate": 0.1, "due_date": "2026-06-15"}v_score = verifiability_score(data, expected_amount_range=(1000, 1_000_000))# Expected output: 1.0 (passes all rules)
The strength of this approach is determinism. It does not depend on the LLM's mood and reproduces cleanly in CI. The weakness is that it only applies to verifiable domains — free-form prose is much harder to score this way.
For prose-heavy outputs, you can extend this approach with structural rules even when full schema validation is impossible. Things like minimum and maximum sentence count, presence of required keywords from the task description, and absence of forbidden patterns (URLs to known-broken domains, banned phrases) all serve as cheap deterministic signals. They are not as strong as a Pydantic schema, but they catch a meaningful fraction of failures and contribute to the verifiability score in domains where stricter checks do not apply.
Another extension worth implementing early: cross-reference the output against the input. If the agent is supposed to extract entities from a document, every extracted entity should be substring-findable in the original text. A "hallucinated entity" detector — output entities that do not appear in the source — is a single regex check and catches one of the most common error modes.
Approach 3: Historical similarity from past task logs
This is the most valuable signal, and the one I see implemented least often. Log every agent output along with the human review verdict (approved / rejected). When a new task arrives, retrieve the K most similar past tasks and use their approval rate as the score.
# Confidence scoring: approval rate of similar past tasksimport numpy as npfrom typing import List, Tupleclass HistoricalScorer: """ Maintains a log of (task embedding, approval flag) and returns the approval rate of the top-K most similar past tasks. """ def __init__(self, top_k: int = 10): self.embeddings: List[np.ndarray] = [] self.approvals: List[bool] = [] self.top_k = top_k def add_record(self, task_embedding: np.ndarray, approved: bool) -> None: self.embeddings.append(task_embedding) self.approvals.append(approved) def historical_score(self, new_task_embedding: np.ndarray) -> float: if len(self.embeddings) < self.top_k: # Not enough history yet; return a neutral score return 0.5 sims = [ np.dot(new_task_embedding, e) / (np.linalg.norm(new_task_embedding) * np.linalg.norm(e) + 1e-9) for e in self.embeddings ] top_indices = np.argsort(sims)[-self.top_k:] approval_rate = np.mean([self.approvals[i] for i in top_indices]) return float(approval_rate)# Examplescorer = HistoricalScorer(top_k=10)# At startup, replay your most recent 1000 tasks into scorer.add_record(...)new_emb = np.random.rand(1024) # in practice, generated by an embedding modelh_score = scorer.historical_score(new_emb)# Expected output: with enough data, somewhere in 0.7 to 0.95 depending on task type
Pin the embedding model per history
The model you use to find similar tasks can be almost anything, but pin one model for the whole history. Different models produce different vector spaces, so cosine similarity across them tells you nothing.
Models also get retired. Google's Gemini API deprecations page lists text-embedding-004 with a shutdown date of January 14, 2026, and points to gemini-embedding-2 as the replacement. If an older sample or design note of yours still uses text-embedding-004, plan to rebuild the history rather than patch it.
So store the model name on every log record. On the day you switch, you can count mechanically which records belong to the old space.
from dataclasses import dataclass@dataclass(frozen=True)class LogRecord: embedding: list[float] approved: bool embedding_model: str # e.g. "gemini-embedding-2"def assert_same_space(records: list[LogRecord], current_model: str) -> None: """Check that every logged embedding came from the current model.""" stale = [r for r in records if r.embedding_model != current_model] if stale: raise RuntimeError( f"{len(stale)} records use a different embedding model. Re-embed before loading" )# Expected output: nothing if the history uses one model; RuntimeError if models are mixed
At around 1,000 records, re-embedding is an overnight job. Keep the approval labels and regenerate only the vectors.
What makes this score genuinely useful is that it surfaces task types where your agent is systematically weak. If "rare clauses in legal contracts" stays below a 30% approval rate, you know to swap in a different prompt or route those specifically to a stronger model.
There is a chicken-and-egg concern here: until you have logs, you cannot compute historical scores, and until you score, you cannot decide what to log. The way I bootstrap is to run in "log-only" mode for the first two to four weeks. Every output is reviewed by a human as before, but the verdict is recorded in a structured log alongside the task embedding. Once you have 200–500 labeled records, you can switch on graduated approval with the historical signal already calibrated.
The choice of embedding model matters less than people fear. Anything reasonably capable — text-embedding-3-small from OpenAI, gemini-embedding-2 from Google (text-embedding-004 was shut down on January 14, 2026), or even a smaller open model — works well enough at this scale. The differentiator is consistency: use the same embedding model for the entire history, because mixing models produces a similarity space where distances are meaningless across vintages.
Combining the three signals
The three signals have different characteristics, so a weighted combination beats a simple average. The weights I use in production:
# Composite confidence scoredef composite_confidence( self_eval: float, verifiability: float, historical: float, weights: tuple = (0.3, 0.4, 0.3),) -> float: """ Weighted combination. Verifiability gets the largest weight because it is deterministic and tamper-resistant. """ w1, w2, w3 = weights composite = w1 * self_eval + w2 * verifiability + w3 * historical # Hard floor: if verifiability is 0, force the composite low if verifiability == 0.0: composite = min(composite, 0.2) return composite# Examplefinal_score = composite_confidence( self_eval=0.9, verifiability=1.0, historical=0.85,)# Expected output: 0.3*0.9 + 0.4*1.0 + 0.3*0.85 = 0.925
The floor when verifiability == 0 was a painful addition. Early on I had a case where the schema failed but self-evaluation returned 0.95, the composite climbed above 0.7, and a malformed record auto-approved into production. Never again.
Threshold design and routing
Routing the score into three tiers is mechanically simple. Choosing the thresholds is what determines the quality of your operation.
I recommend upper=0.85 / lower=0.55 as a starting point, but treat it as a hypothesis to be tested. The next section walks through calibration.
Calibrating thresholds with ROC-style analysis
Choosing thresholds by gut feel always backfires later. Once you have at least 200 (preferably 500) logged decisions with human-verified labels, run a calibration pass.
# Threshold calibration: derive the auto-approve threshold from a target precisiondef calibrate_upper_threshold( scores: list, true_labels: list, target_precision: float = 0.95, min_count: int = 20,): """ Lower the threshold one score level at a time and return the last value where precision among items scoring at or above it still meets the target. Equal scores are counted together. true_labels: 1 = correct on later human review, 0 = incorrect. Returns None when no threshold qualifies (nothing gets auto-approved). """ best = None for t in sorted(set(scores), reverse=True): picked = [l for s, l in zip(scores, true_labels) if s >= t] if len(picked) < min_count: continue if sum(picked) / len(picked) < target_precision: break best = t return best# Example with 120 synthetic itemsscores = [0.95] * 30 + [0.9] * 30 + [0.85] * 30 + [0.8] * 30labels = [1] * 30 + [1] * 29 + [0] + [1] * 27 + [0] * 3 + [1] * 20 + [0] * 10print(calibrate_upper_threshold(scores, labels, target_precision=0.95))# Output: 0.85 (precision at 0.85 and above is 86/90 = 95.6%; dropping to 0.8 gives 106/120 = 88.3%)
This is a rewrite of my first version, which I threw away. It returned the score at which precision first dipped below the target, plus 0.01. When I tried it on my eight-item example, I expected the 0.86 I had written in the comment and got 0.5, and I sat there for a minute. Anything under twenty items fell into the "not enough data" branch, and with coarse scores where many items share 0.85, it cut off halfway through a tie. The current version counts ties together and returns None when nothing qualifies. Not being able to set a threshold is still a result, and I treat it as one.
A practical note: setting target_precision to 0.99 collapses the auto-approve volume to almost nothing, which sends everything to human-review and defeats the point. I find 0.95–0.97 strikes a realistic balance, calibrated to the business cost of letting an error through.
A useful mental check: the target precision is not the same as your acceptable error rate in the system as a whole. If 95% of auto-approved items are correct, that means 5% of them are wrong, but those 5% pass into downstream systems unchecked. Whether that is acceptable depends entirely on what those downstream systems do. Sending an internal Slack notification at 5% wrong-rate is fine. Posting a public tweet at 5% wrong-rate is a brand crisis waiting to happen. Reverse-engineer the precision target from the cost of a single wrong output, not from a generic SLA number you pulled from a blog post.
The lower threshold (auto-reject cutoff) is the inverse problem — at what point should you give up and retry instead of asking a human? In my own setup, where retry costs are mostly API charges and human review is my own time, I keep the lower bound around 0.4–0.5. For setups using expensive frontier models heavily, 0.6–0.7 makes more sense, since paying for another generation is more painful than asking a colleague.
Threshold precision cannot exceed score precision
For a long time I assumed that dropping the upper bound from 0.85 to 0.83 would let a few more items through to auto-approve. That assumption came apart the day I carried the same procedure over to a different agent: I moved the bound, and not a single item was routed differently.
The cause was not the calibration math — it was the scores themselves. Tallying the self-evaluation scores, most of them sat on round numbers: 0.95, 0.9, 0.85, 0.8, 0.7. Between 0.83 and 0.85, there had never been anything at all. You can reproduce this yourself with the synthetic log in the second half of this article — the rows for upper=0.85 and upper=0.83 come out identical.
Ask a model for a continuous value between 0 and 1 and what comes back is, in practice, a discrete one. Tuning the second decimal place without checking that first is measuring 0.02 with a ruler marked every 0.05.
So now I measure the grid before I touch a threshold.
# Measure the "grid" your confidence scores actually land onfrom collections import Counterdef score_grid(scores: list[float], top_n: int = 5) -> dict: """Detect whether scores are clustering on a handful of discrete values.""" total = len(scores) counter = Counter(round(s, 3) for s in scores) top = counter.most_common(top_n) top_share = sum(c for _, c in top) / total # Smallest gap between observed values = the finest threshold you can set values = sorted(counter) gaps = [b - a for a, b in zip(values, values[1:])] return { "total": total, "distinct": len(values), "top_values": top, "top_share": round(top_share, 3), "min_gap": round(min(gaps), 3) if gaps else None, # If the top 5 values hold more than half, the second decimal is noise "resolution_ok": top_share < 0.5, }def snap_to_grid(threshold: float, scores: list[float]) -> float: """Round a calibrated threshold to the nearest score that actually occurs.""" values = sorted(set(round(s, 3) for s in scores)) return min(values, key=lambda v: abs(v - threshold))if __name__ == "__main__": scores = load_scores_from_log() # e.g. the 1,500 synthetic self-evaluation scores below grid = score_grid(scores) for value, count in grid["top_values"]: print(f"{value:>5} : {count:>5} items ({count / grid['total']:.1%})") print(f"{grid['distinct']} distinct values / top-5 share {grid['top_share']:.1%}") if not grid["resolution_ok"]: best = calibrate_upper_threshold(scores, labels, target_precision=0.95) print(f"calibrated {best} -> snapping to {snap_to_grid(best, scores)}")
Run against the 1,500-item synthetic log in the second half, the output looks like this.
Score
Items
Share
0.95
440
29.3%
0.90
442
29.5%
0.85
269
17.9%
0.80
173
11.5%
0.70
113
7.5%
0.60
63
4.2%
Top-5 share 95.8%, six distinct values, minimum gap 0.05. How you read that splits the next move three ways.
Coarse grid (top 5 hold 80%+): set thresholds to values that actually occur. Pick 0.85 or 0.8, not 0.83, and throw away everything in between. Pass calibration output through snap_to_grid before adopting it.
Coarse despite a composite score: your weights lean too heavily on self-evaluation. Verifiability and historical similarity produce genuinely smooth values, so raising those two weights makes the grid finer.
Fine grid (top 5 hold under 50%): second-decimal calibration is meaningful, and the previous section's procedure applies as written.
One approach I stay away from: breaking ties with random jitter. It does spread the ordering out, but the same input stops producing the same decision, and you lose the ability to reproduce a failure afterwards. When the grid is coarse, treating it as coarse turned out to be safer than dressing it up as fine.
Threshold resolution cannot exceed score resolution. I now run this tally before assembling any composite score, and if the top five values hold more than 70%, I leave the second decimal place alone. The instinct that finer slicing means smarter routing is one this particular problem does not reward.
End-to-end pipeline integrated with Antigravity Agent
Here is how all the pieces fit into a Python service that the Antigravity Agent can call.
# Graduated approval service called from an Antigravity Agentimport jsonimport loggingfrom dataclasses import dataclasslogger = logging.getLogger("graduated-approval")@dataclassclass ApprovalResult: decision: Decision confidence: float output: dict reason: strdef graduated_approval_pipeline( task: str, raw_output: str, expected_amount_range: tuple = None,) -> ApprovalResult: """ Receive an Antigravity Agent's raw output and return the routing decision. """ # Step 1: Try to parse (parse failure = immediate reject) try: output_dict = json.loads(raw_output) except json.JSONDecodeError: return ApprovalResult( Decision.AUTO_REJECT, 0.0, {}, "JSON parse failed" ) # Step 2: Compute the three signals s_eval = self_evaluation_score(task, raw_output) v_score = verifiability_score(output_dict, expected_amount_range) # historical scorer assumed initialized at startup # h_score = scorer.historical_score(embed_task(task)) h_score = 0.7 # sample value # Step 3: Composite confidence = composite_confidence(s_eval, v_score, h_score) # Step 4: Route decision = decide(confidence) # Step 5: Always log for later calibration logger.info(json.dumps({ "task": task[:200], "self_eval": s_eval, "verifiability": v_score, "historical": h_score, "confidence": confidence, "decision": decision.value, })) return ApprovalResult( decision=decision, confidence=confidence, output=output_dict, reason=f"s={s_eval:.2f} v={v_score:.2f} h={h_score:.2f}", )# Example: invoked from an Antigravity Agent walkthrough stepresult = graduated_approval_pipeline( task="Extract amount, tax rate, and due date from the invoice PDF", raw_output='{"amount": 12000, "tax_rate": 0.1, "due_date": "2026-06-15"}', expected_amount_range=(1000, 1_000_000),)print(result.decision, result.confidence)# Expected output: Decision.AUTO_APPROVE 0.91 (approximately)
Exposing this as an HTTP endpoint lets the agent follow a simple flow: finish task, post output to the service, advance on auto_approve and pause on human_review. Wired into an Antigravity Walkthrough step, the pending-review state shows up directly on the Manager Surface, where it is hard to miss.
A small but practical detail: when human review is required, the agent should not silently spin while waiting. Configure your Antigravity Walkthrough to write a structured event to the Manager Surface (and ideally a Slack or email notification) so a reviewer knows there is work waiting. The faster the round-trip from "agent paused" to "human verdict received," the more this whole pattern feels like augmentation rather than friction.
The same endpoint can also serve as a control plane for emergency overrides. Adding a flag like force_human: bool = False lets you bypass auto-approve for an entire batch when something feels off — a model upgrade just shipped, an unusual event in your domain, a regulator asked questions about a category of decisions. The ability to flip a switch and put everything back into the human queue, without redeploying, is operationally valuable in ways that are hard to appreciate until you need it.
Common pitfalls
Three pitfalls I have stepped on personally. Avoiding them up front saves you a lot of grief.
First, the self-evaluation overconfidence problem. Generation and evaluation by the same model produces lenient evaluations. At minimum, route evaluation to a different model family (generate with Claude, evaluate with a different vendor's model such as Gemini). If cost is a concern, a small model like Haiku 4.5 is plenty for evaluation work.
Second, score distribution drift. After one or two months in production, the input data shifts and the score distribution skews. For example, invoice processing peaks early in the month with high scores; contract processing peaks late in the month with lower scores. Build a weekly habit of plotting the distribution (a histogram plus median is enough) and investigate when it moves abruptly. Combining this with the A/B testing infrastructure from antigravity-prompt-versioning-ab-testing-production-guide works well.
Third, the always human-review failure mode. Set thresholds too tight and almost everything funnels into the queue, which is full review by another name. Aggregate auto_approve / human_review / auto_reject rates monthly. If auto_approve dips below 50%, revisit the thresholds before you blame the agent.
When graduated approval is not the right answer
This pattern is powerful, but it is not universal. There are at least three categories of work where I would advise against deploying it.
The first is irreversible high-stakes actions. If a single bad output can cost five figures, ruin a customer relationship, or trigger regulatory action, the right answer is not "auto-approve at high confidence." It is "always require human review for this action class," and confidence scoring becomes a way to prioritize the human queue rather than skip it. A wire transfer, a contract signing, a public announcement — these belong in a permanent human-required tier no matter how confident the agent is.
The second is work without a verifiable signal. If you have no way to retrospectively check whether the output was correct (no Pydantic schema, no domain rule, no downstream system that will eventually catch errors), then the historical similarity score never gets meaningful labels and the whole calibration loop breaks. Pure creative writing, brainstorming output, and exploratory research often fall here. For these, a different review pattern works better: sample, say, 1 in 10 outputs at random and check those.
The third is very low task volume. If your agent processes 5–10 items per day, the engineering investment in scoring infrastructure outweighs the savings. Just review them all. By the estimate later in this article, graduated approval pays back its complexity at roughly 40–50 items per day or more.
Recognizing these cases honestly is part of professional judgment. I have seen well-intentioned engineers (myself included) try to apply this pattern to creative work and end up with a calibration loop that never converges, because the underlying labels were always subjective.
A back-of-envelope cost analysis
Whether graduated approval pays off in your situation is worth estimating before you build it. The numbers below are a generalized estimate, and every one of them is an assumption rather than a measurement.
Suppose your agent processes 500 outputs per day. Without graduated approval, you (or a team) spend on average 30 seconds per item reviewing. That is 250 minutes per day, or roughly four hours of focused review work daily. Most teams cannot sustain this; in practice it gets cut to a "spot check" that misses the actual problems.
With graduated approval at the suggested initial thresholds, a typical distribution after calibration is roughly 60% auto-approve, 30% human-review, and 10% auto-reject. That gives 150 items per day requiring human review, at the same 30 seconds each — 75 minutes daily. The auto-reject items take effectively zero human time, since they are queued for retry.
The added cost is API spend on the self-evaluation calls. With a small evaluator model like Haiku 4.5, the per-call cost is well under one US cent. At 500 calls per day, that is around three to five dollars per day of additional API spend, or roughly $100 per month — far less than the time you reclaim.
The breakeven falls out of the same assumptions. Auto-approve and auto-reject together save about 21 seconds of review per item (0.7 × 30 seconds). If the infrastructure costs two days (16 hours) to build and you want it to pay for itself within three months (about 65 working days), the line sits near 40 items per day. Below that, the overhead is not worth it; above 200 items per day, the savings are dramatic. This is worth modelling honestly with your own numbers before committing to building the infrastructure.
A continuous improvement loop from operational logs
Thresholds are not a one-time decision. Building a calibration loop into your operations lets you watch the agent improve over time, with data instead of impressions.
In practice: log every human review verdict (approved or rejected) as structured records, and run a weekly batch that recomputes:
The latest upper_threshold that holds a target_precision of 0.95
A histogram of the most recent N confidence scores
A list of "high-confidence but human-rejected" cases
That last list is gold. It points directly at the failure modes that your SELF_EVAL_PROMPT is missing, and gives you a concrete list of new deductions to add. I do not add deductions in bulk: I add one each time a rejection pattern shows up, then check the next week's log to see whether the "high-confidence but rejected" count actually moved. A change I cannot confirm with numbers does not stay in the prompt.
Moving thresholds over a synthetic log — a check you can reproduce
I would like to leave the numbers so far in a form you can verify with your own hands. I cannot publish real business logs as they are, so I generate a 1,500-item synthetic log with a random seed, imagining three kinds of work — invoices, inquiries and contracts — and count how routing changes as thresholds move. The per-kind accuracy figures are assumptions I picked, not measurements. What I want to check is not any particular number but the shape of the change.
What stopped me in this experiment was this: no matter how carefully I polished the score threshold, auto-approve barely grew as long as a low-accuracy kind like contracts stayed in the mix.
import randomfrom collections import CounterGRID = [0.95, 0.90, 0.85, 0.80, 0.70, 0.60]# (share, accuracy) per task kind: assumptions I picked for illustration, not measurementsKINDS = {"invoice": (0.60, 0.94), "inquiry": (0.30, 0.84), "contract": (0.10, 0.45)}W_OK = [34, 30, 18, 10, 5, 3] # how self-evaluation scores land when the output is correctW_BAD = [8, 14, 20, 22, 20, 16] # when it is wrong (overlapping with the correct case)def make_log(n=1500, seed=7): rng = random.Random(seed) rows = [] for _ in range(n): kind = rng.choices(list(KINDS), [v[0] for v in KINDS.values()])[0] ok = rng.random() < KINDS[kind][1] score = rng.choices(GRID, W_OK if ok else W_BAD)[0] rows.append((kind, score, int(ok))) return rows# calibrate_upper_threshold: reuse the function from the previous section (paste it into the same file)def split(rows, upper, lower=0.65): approve = [r for r in rows if r[1] >= upper] review = [r for r in rows if lower <= r[1] < upper] reject = [r for r in rows if r[1] < lower] acc = sum(r[2] for r in approve) / len(approve) if approve else float("nan") n = len(rows) return len(approve)/n, len(review)/n, len(reject)/n, accrows = make_log()print("items", len(rows), " kinds", Counter(r[0] for r in rows))print("score values", {k: v for k, v in sorted(Counter(r[1] for r in rows).items(), reverse=True)})scores = [r[1] for r in rows]; labels = [r[2] for r in rows]print("\n-- all kinds mixed --")for tp in (0.95, 0.97): print("target", tp, "-> upper =", calibrate_upper_threshold(scores, labels, tp))for u in (0.95, 0.90, 0.85, 0.83): a, h, r_, acc = split(rows, u) print(f"upper={u:.2f} approve {a:.1%} / review {h:.1%} / reject {r_:.1%} precision among approved {acc:.1%}")print("\n-- accuracy per kind (labels from human review) --")for k in KINDS: sub = [r for r in rows if r[0] == k] print(f"{k:9s} {len(sub):>4} items accuracy {sum(r[2] for r in sub)/len(sub):.1%}")print("\n-- contract pinned to human review, recalibrate on the rest --")rest = [r for r in rows if r[0] != "contract"]s2 = [r[1] for r in rest]; l2 = [r[2] for r in rest]u2 = calibrate_upper_threshold(s2, l2, 0.95)print("upper =", u2)a, h, r_, acc = split(rest, u2)print(f"approve {a:.1%} / review {h:.1%} / reject {r_:.1%} precision among approved {acc:.1%}")print(f"overall auto-approve rate {a*len(rest)/len(rows):.1%} ({len(rows)-len(rest)} contract items pinned to human review)")
With the seed fixed, running it gives the following.
items 1500 kinds Counter({'invoice': 916, 'inquiry': 446, 'contract': 138})score values {0.95: 440, 0.9: 442, 0.85: 269, 0.8: 173, 0.7: 113, 0.6: 63}-- all kinds mixed --target 0.95 -> upper = 0.95target 0.97 -> upper = Noneupper=0.95 approve 29.3% / review 66.5% / reject 4.2% precision among approved 96.8%upper=0.90 approve 58.8% / review 37.0% / reject 4.2% precision among approved 94.9%upper=0.85 approve 76.7% / review 19.1% / reject 4.2% precision among approved 92.6%upper=0.83 approve 76.7% / review 19.1% / reject 4.2% precision among approved 92.6%-- accuracy per kind (labels from human review) --invoice 916 items accuracy 94.2%inquiry 446 items accuracy 84.3%contract 138 items accuracy 43.5%-- contract pinned to human review, recalibrate on the rest --upper = 0.85approve 78.4% / review 17.8% / reject 3.8% precision among approved 95.3%overall auto-approve rate 71.2% (138 contract items pinned to human review)
Three things stand out.
First, if you ask for 95% precision with all kinds mixed together, the upper bound climbs to 0.95 and auto-approve stays at 29.3% of the total. The errors in contracts (43.5% accuracy) drag the other kinds down with them. Raise the target to 0.97 and no qualifying threshold exists at all, so None comes back.
Second, the rows for upper=0.85 and upper=0.83 are identical. With only six score levels in play, putting a threshold between them does not move a single item.
Third, if you pin contracts to human review and recalibrate on the rest, the upper bound drops to 0.85 and 71.2% of everything can go to auto-approve at 95.3% precision. Separating the kind that scores cannot rescue pays off more than polishing the second decimal place.
Sending contracts alone to a separate prompt or a stronger model is something I have not tried on this synthetic log. I would check it on real data before deciding. A good place to start is tallying your own logs per task kind and looking for a low-accuracy kind hiding in the mix.
Build the kill switch in from day one
Finally, the mechanism I most wished I had added earlier: a kill switch that forces an entire batch back into human review at once.
Right after a model upgrade, when something unusual happens in your domain, when an outside party asks questions about a class of decisions — in these moments you want everything back under human eyes regardless of score. Being able to do that with a single switch, without redeploying, is something whose value you only fully appreciate once you need it.
# Routing with a kill switchimport osdef decide_with_kill_switch( confidence: float, upper_threshold: float = 0.85, lower_threshold: float = 0.55, force_human: bool = False,) -> Decision: # External flag (env var / KV / feature flag) overrides everything kill_switch = force_human or os.environ.get("APPROVAL_FORCE_HUMAN") == "1" if kill_switch: # Auto-reject is still fine to discard (it only goes to retry) if confidence < lower_threshold: return Decision.AUTO_REJECT # Everything else goes to a human regardless of confidence return Decision.HUMAN_REVIEW return decide(confidence, upper_threshold, lower_threshold)# Example: send everything to humans for a day right after a model swapos.environ["APPROVAL_FORCE_HUMAN"] = "1"print(decide_with_kill_switch(0.97)) # Decision.HUMAN_REVIEWprint(decide_with_kill_switch(0.30)) # Decision.AUTO_REJECT
The key is to keep the flag outside your code — in an environment variable, a KV store, or a feature flag. Embed it in code and an emergency requires a redeploy, which defeats the entire point of "I need to stop this now." I flip this flag manually on any day I make a large change to my automated publishing pipeline, watch every item by hand for half a day, and only then turn it back off.
A small first step
This was a long article, but the next step you can take tomorrow is a single one.
Attach the self-evaluation score to your existing agent's outputs and just log it. No routing yet — only logging. After one or two weeks of accumulated logs, you will start to see the pattern: scores below 0.7 really do correlate with suspicious outputs, scores above 0.9 really do tend to be right. Threshold design comes after that intuition forms.
Once the logs are there, run score_grid once before you pick any threshold. Knowing how many notches your own scores actually have makes everything that follows considerably easier.
Concentrating human judgment on the cases that most need it — that has been a principle I have rediscovered repeatedly through the years of running my own apps as an indie developer. Defining, with data, the line between what you trust the agent to decide and what you keep for yourself is becoming, I think, one of the core engineering skills of the next few years of independent development.
Thank you for reading to the end.
Share
Thank You for Reading
Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.