INSTRUMENT | Propagation & containment
Retry, Verification, and Fallback Reliability Optimizer for LLM Agents
5 cited sources
How many times should you retry a failed agent step? Compare retry, majority vote, verifier gate, fallback, and escalation on delivered correctness and expected cost per task, from your own rates.
How many times should you retry a failed API or tool call? At a 0.80 per-attempt success rate with half of its failures detectable, three attempts lift correct delivery from 80% to 88.8%. This page prices six policies against a retry budget, the attempt cap per task. It extends the lever table in reliable AI agents in production; carry your chosen policy into the chain math for a multi-step agent.
Showing your last valid result. Update the inputs above to recompute.
Expected total cost per task in your cost unit, recommended policy
2.129
Verifier-gated retry (up to 3 attempts): 96.1% correct, 2.0% wrong delivered, 1.9% no answer; run cost 1.636 per task.
Six delivery policies on the same inputs: how each task ends, the expected run cost, and the total with wrong-answer and no-answer prices added
| Strategy | Correct | Wrong delivered | No answer | Run cost | Total cost |
|---|---|---|---|---|---|
| Single run | 80.0% | 10.0% | 10.0% | 1 | 3.5 |
| Retry on detected failure (up to 3 attempts) | 88.8% | 11.1% | 0.1% | 1.11 | 3.335 |
| Fallback path on detected failure | 89.0% | 10.5% | 0.5% | 1.4 | 3.525 |
| Majority vote of 3 | 89.6% | 2.8% | 7.6% | 3 | 3.94 |
| Verifier-gated retry (up to 3 attempts) | 96.1% | 2.0% | 1.9% | 1.636 | 2.129 |
| Verifier-gated retry, then escalate | 98.0% | 2.0% | 0.0% | 1.915 | 2.315 |
Recommended policy if the wrong-answer cost is misjudged, no-answer cost held at 5
| Wrong-answer cost | Recommended | Correct | Total cost |
|---|---|---|---|
| 0.25x: 5 | Retry | 88.8% | 1.67 |
| 0.5x: 10 | Verifier-gated retry | 96.1% | 1.929 |
| 1x (entered): 20 | Verifier-gated retry | 96.1% | 2.129 |
| 2x: 40 | Verifier-gated retry | 96.1% | 2.53 |
| 4x: 80 | Verifier-gated retry | 96.1% | 3.331 |
expected total cost = run cost + P(wrong) · wrong-answer cost + P(no answer) · no-answer costHow?
How this is calculated
Every attempt on the primary path ends one of three ways: correct with probability p, a detected failure (an error, a timeout, an invalid output) with probability q = (1 - p) · d, or a silent wrong answer with probability s = (1 - p) · (1 - d), where d is the share of failures that surface on their own. That split is what separates the policies. A retry or a fallback can only act on a detected failure; a silent wrong answer never triggers one. A verifier turns silent failures into detected ones, catching a wrong answer with probability cr and wrongly rejecting a correct one with probability fr. A vote acts on silent failures by redundancy. Attempts are treated as independent and identically distributed throughout. Most agent faults are semantic rather than transient, which is what loads the silent branch; that finding, and the lever table this tool puts a price on, come from the levers that hold up in production agent systems.
The six policies. Single run ships whatever one attempt produced. Retry re-runs the primary on a detected failure, up to n attempts, and ships the first answer produced: with G = (1 - q^n) / (1 - q) the expected attempts, it ends correct with probability p · G, wrong with s · G, and unanswered with q^n. Fallback runs the primary once and, on a detected failure, a different path once at its own rate pf: correct p + q · pf. Majority vote runs k attempts and ships the answer held by more than k/2 of them: correct with the binomial tail P(Bin(k, p) > k/2), wrong with P(Bin(k, s) > k/2) if wrong answers coincide (the worst case, so an upper bound), otherwise no answer. Verifier-gated retry checks each produced answer and re-runs on a reject: per attempt it accepts a correct answer with probability p(1 - fr), accepts a wrong one with s(1 - cr), and re-rolls with r = q + p · fr + s · cr, the chance an attempt ends in a detected failure, a false reject, or a caught wrong answer; over the loop it ends correct with p(1 - fr) · G(r), wrong with s(1 - cr) · G(r), and unanswered with r^n. Escalation runs the same loop and hands the r^n that remains to a resolver assumed to answer correctly.
Costs. Run cost is an expected value: primary attempts times the attempt cost, verifier checks (only produced answers are checked) times the check cost, plus the fallback or escalation charge times the probability it fires. Expected total cost adds the wrong-answer cost times the probability a wrong answer ships and the no-answer cost times the probability nothing ships. The recommendation is the policy with the lowest expected total; ties break toward the higher delivered-correct rate. Only ratios between the costs move the recommendation, so any unit works as long as every cost uses it. The sensitivity table re-derives the recommendation at 0.25x, 0.5x, 2x, and 4x of the entered wrong-answer cost, the softest input.
Worked example, the preloaded inputs. A primary path at 0.80 with half of its failures detected gives q = 0.10 and s = 0.10 per attempt. Retry with up to three attempts lifts correct delivery from 80% to 88.8% (0.8 × 1.11 expected attempts) but also lifts wrong delivery from 10% to 11.1%, because retries convert detected failures into more answers of the same mix. A fallback at 0.90 buys 89.0% correct at 1.4 per task. Majority vote of three reaches 89.6% correct with 2.8% wrong at a flat cost of 3. The verifier (85% catch, 10% false reject, 0.25 per check) rejects 16.5% of attempts and never sees the 10% that already failed loudly, so 26.5% of attempts end in a re-roll; over up to three attempts the loop ends 96.1% of tasks correct and 2.0% wrong at 1.636 per task, and with a wrong answer priced at 20 and no answer at 5 its expected total, 2.129, is the lowest of the six. Escalating the 1.9% left over at 15 each raises correct delivery to 98.0% at a total of 2.315.
How this differs from pass@k and the chain calculator. pass@k and reliability@k describe repeated runs of the same task with no decision rule and no cost: at least one of k passes, or all k pass. This tool prices a policy that decides which answer ships, at what cost, and how the task ends when nothing acceptable is produced. It works on one task or one step. The lever rows in the multi-step agent reliability calculator are these same retry and fallback levers at d = 1, where every failure announces itself; the detected share, the verifier, the vote, and the cost axis are what this tool adds. To see what a lever buys across a multi-step chain, carry the policy's delivered-correct rate into that calculator as the effective per-step rate.
Honest limits. Independence is the assumption everything rests on. A task the primary path gets wrong every time, or an outage that fails every attempt at once, makes retry and voting buy less than these figures say. How much a retry can still buy when a share of failures traces to one cause shared across steps is what the shared-failure simulator puts numbers on. The fallback's real advantage is the one thing the model cannot see, a second path that does not share the primary's failure causes, so read the fallback row as a floor. Verifier errors compound with the attempt cap: false rejects can turn correct answers into no answer, which is why the verifier loop can deliver fewer correct answers than a plain retry at low n. The vote's wrong-answer figure assumes wrong answers agree; scattered wrong answers push those cases toward no answer instead, which makes the vote's total cost optimistic whenever a missing answer costs more than a wrong one. Costs are expected values per task, not bounds on any single task. Where retry helps and where it re-runs a semantic fault is worked through in cascading failures in agent systems.
Formula: expected total cost = run cost + P(wrong) · wrong-answer cost + P(no answer) · no-answer cost
Questions
How many times should you retry a failed API call?
Three numbers decide it, and the table above works the answer out from them: the per-attempt success rate, the share of failures that surface as errors (a retry can only act on those), and the ratio between what one attempt costs and what the outcome you are avoiding costs. On the preloaded example, a primary path at 0.80 with half of its failures visible, going from one attempt to three lifts correct delivery from 80% to 88.8% and the expected run cost from 1 to 1.11 per task, while the wrong-answer rate rises from 10% to 11.1% because a retry produces more answers of the same mix. After three attempts 0.1% of tasks are still unanswered (0.10 cubed), so a fourth attempt is worth about 0.08 percentage points of correct delivery.
When should you stop retrying?
When the next attempt is worth less than what it costs, and immediately on a failure the retry cannot fix. A retry budget, the cap on attempts one task may spend before it escalates or gives up, is the operational form of that rule, and it also keeps a partial outage from becoming a retry storm, where every caller retries at once and the retries themselves become the load. The worked example above leaves 0.1% of tasks with no answer after three attempts; whether those go to a person or ship nothing is a pricing question, and where to put that escalation threshold is its own calculation.
How is this different from pass@k and reliability@k?
pass@k asks whether at least one of k independent runs passes; reliability@k and pass^k ask whether all of them do. Both are properties of repeated runs with no policy attached: nothing chooses an answer, nothing costs anything, and a task never ends with no answer. This tool takes the same per-attempt rate and asks what a specific delivery policy does with it: which answer ships, how often a wrong one ships, how often nothing ships, and what each outcome costs. Estimate the per-attempt rate and its interval with the reliability@k estimator, then bring it here.
Why can a verifier lower the delivered-correct rate?
A verifier with a false-reject rate throws away some correct answers. With a low attempt cap, those rejects can exhaust the loop, so a task that would have shipped a correct answer ends with no answer instead. At n = 1 the verifier loop's correct-delivery rate is p(1 - fr), below a single run's p whenever the verifier rejects any correct answers. What the verifier buys is a lower wrong-answer rate, and whether that trade pays depends on what a wrong answer costs against what a missing one costs. The tool flags the case in its notes and prices the trade in the total-cost column.
Should I retry the same model or fall back to a different one?
Both act on the same trigger, a detected failure. Under independent attempts a retry re-runs the primary at its own rate and cost, and a fallback runs a different path once at its rate and cost, so the comparison is arithmetic on those four numbers. The case for a fallback that the arithmetic cannot show is a failure that would repeat: a task the primary path gets wrong every time is one a retry re-runs and a different path may not. If a large share of your detected failures are of that kind, weight the fallback row up. Neither lever touches a silent wrong answer.
Is exponential backoff always the right retry strategy?
Backoff answers when to retry; this page answers whether to retry and what the retry delivers. Exponential backoff with jitter spaces attempts out so a wave of callers does not synchronize, and it is the right default for a fault that clears on its own, a rate limit or a timeout; the mechanics are set out in exponential backoff and jitter. It does nothing for a semantic fault, where the same prompt returns the same plausible wrong answer on the next attempt, and those are the failures that load the silent branch in the table above. This tool computes no delays and no jitter, so read it beside a backoff policy rather than in place of one.
How do I estimate the detected-failure share and the verifier rates?
From a labeled eval run. Split the failed attempts into those that surfaced on their own (exceptions, timeouts, schema or parse failures, refusals) and those that returned a plausible answer that was wrong; the first group's share of all failures is the detected share. For the verifier, run it over the same labeled outputs: its catch rate is the share of wrong outputs it rejected, and its false-reject rate is the share of correct outputs it rejected. Those two are the sensitivity and specificity that the judge bias correction calculator uses, measured the same way. The full pre-flight set these inputs come from, per-attempt pass rates and judge calibration included, is listed in the agent reliability testing checklist.
Can I combine these policies, and how do I carry the result into a chain?
Yes. Production ladders usually stack them: retry detected failures, verify what is produced, fall back to a second path, escalate what is left. Each row here isolates one lever on the same inputs so the marginal value of each is visible; the two verifier rows already show one composition, the same loop ending in abstention or in escalation. Once a policy is chosen, its delivered-correct rate is the effective per-step reliability to raise to the N in the chain calculator for independent steps, and its wrong-delivered rate is the per-step probability of a silent fault entering the next step.
Sources
- Parallel or redundant model (the reliability of independent tries, 1 minus the product of the per-try failure probabilities)
- R out of N model (k-of-n redundancy as a binomial tail, the form majority voting takes)
- Standby model (a second unit switched in when the first fails, the shape of a fallback path)
- Self-Consistency Improves Chain of Thought Reasoning in Language Models (majority voting over sampled answers)
- Training Verifiers to Solve Math Word Problems (a learned verifier selecting among sampled candidates)