AI agents

Sizing a Review Sample: Confidence, Error Rate and Volume

Antonio Evans8 min read

A desk with a laptop showing a spreadsheet of weekly agent outputs, a printed table of confidence levels and error rates, and a hand-drawn line splitting 1,000 outputs into three tiers with counts Binet each.
Key points

Key points

  1. 1A weekly review sample is a statistical estimate, so the failure rate you want to catch and the confidence you need decide the number of looks, not a fixed percentage of volume.
  2. 2For a 5 percent failure rate, 95 percent confidence and a 3 percentage point margin of error, the required sample is about 203 outputs.
  3. 3Split the sample across agent tiers in proportion to risk and volume, and always review 100 percent of the highest-risk tier.
  4. 4When volume makes full sampling impossible, use triggered review (every flagged, every high-value, every irreversible action) plus a random audit sample to catch what the triggers miss.

Turning a review rule into a number

A 10 percent review rule is a starting habit, not a control. It tells you a reviewer sees one output in ten, but it says nothing about whether that is enough to notice the failure you actually care about. The question to answer instead is: what is the smallest number of looks that gives me a defensible chance of catching a bad agent?

That question has a standard statistical answer. You are estimating a proportion (the share of outputs that are wrong, unsafe or otherwise unacceptable) from a sample, so you use the sample size formula for a proportion: n equals Z squared times p times (1 minus p), divided by the square of the margin of error. The sample size calculators used across survey research implement exactly this, and the worked examples in open statistics texts show the same arithmetic step by step.

You need three inputs:

  1. p, the failure rate you want to be able to detect. This is the rate you consider unacceptable, not the rate you hope for. If 5 percent of outputs being wrong would trigger a remediation project, use 0.05.
  2. The confidence level. 95 percent is the usual working default, which gives a Z of 1.96. A 99 percent level gives 2.58 and costs you more samples, so reserve it for regulated or safety-critical work.
  3. The margin of error. This is how precisely you want to locate the true rate. Three percentage points is tight enough to distinguish 5 percent from 8 percent; five points is cheaper but blurs the picture.

The table below shows what those choices cost, using the proportion formula and rounding up to the next whole output as the statistics course material recommends.

Failure rate you want to detectConfidenceMargin of errorSample needed
5%90%5 points52
5%95%5 points73
5%95%3 points203
5%95%2 points457
5%99%3 points351
10%95%3 points385

Note the last row: assuming a higher failure rate makes you review more, not fewer, outputs, because p times (1 minus p) is largest at 0.5. If you genuinely have no idea of your rate, planning at 50 percent is the conservative choice and gives a much larger sample, which is why a short pilot period matters before you commit.

The three inputs, chosen deliberately

The formula is easy. Choosing p, the confidence level and the margin is where teams argue, so here is a decision rule for each.

Pick p from the consequence, not the average. If a wrong answer in a customer email is embarrassing but correctable, a 5 percent detectable rate is reasonable. If a wrong answer touches payments, access provisioning or anything irreversible, the rate you care about may be 1 percent or lower. A 1 percent detectable rate at 95 percent confidence and a 1 point margin needs around 38,000 samples if you review at random, which tells you immediately that random sampling cannot be your only control for that tier. That is a finding, not a failure: it tells you to gate the action instead of reviewing after the fact.

Use 95 percent unless someone is paying for 99. The jump from 95 to 99 percent confidence increases the required sample by about 73 percent (1.96 squared versus 2.58 squared). Reserve the higher level for the tier where a miss becomes a regulatory or safety event, and be explicit that this is why the number is larger.

Set the margin by the decision you need to make. If your remediation trigger is "the true rate is above 5 percent," a 3 point margin lets you see a sample result of 7 percent and know the true rate is plausibly 4 to 10 percent, which is enough to act. A 1 point margin is what you need to argue that quality improved from 5 to 4 percent.

One practical caveat: these formulas assume the sample is random and that outputs are independent. Agents running the same workflow in a loop produce correlated outputs, so the effective sample is smaller than the count suggests. This is a strong argument for spreading the sample across sessions, tenants and task types rather than taking 203 consecutive runs.

Worked example: 2,000 outputs a week

Say a support triage agent produces 2,000 outputs a week across three categories. The team currently reviews 10 percent, which is 200 outputs, split evenly by whoever is free. That looks roughly right by luck, but the split is wrong.

Start with the target: catch a 5 percent failure rate at 95 percent confidence with a 3 point margin. That requires 203 outputs. Because 2,000 is far larger than 203, you can treat the weekly volume as effectively unlimited and skip the finite population correction; the calculators note that the adjustment barely changes results for populations above roughly 100,000, and here the ratio of sample to volume is about one in ten, so the correction would shave only a few outputs. Round to 210 for scheduling convenience.

Now allocate across tiers. Use risk and volume together, not volume alone:

TierWeekly volumeRisk if wrongSample this weekWhy
Tier 1: auto-send replies to customers400High, external100 (25%)Customer-facing, hard to retract
Tier 2: internal ticket classification and routing1,400Medium, correctable70 (5%)Cheap to fix, high volume
Tier 3: draft knowledge article updates200Low, gated by editor40 (20%)Low sample because the editor is already a control

That is 210 reviews and it changes what the team learns. Under the old even split, Tier 1 got about 67 reviews and was undersampled relative to its risk, while Tier 3 was over-sampled for a tier that already has a human gate. The tier allocation is a judgment call, and you should write down the reasoning because auditors and incident reviews will ask why each number is what it is. Human-in-the-loop design guidance makes the same point about approval routing: match oversight to blast radius and reversibility, not to a uniform percentage.

If the week's Tier 1 reviews find 5 failures out of 100, your observed rate is 5 percent with a 95 percent interval of roughly 1.6 to 11.3 percent. You cannot conclude the process is fine, and you should not conclude it is broken either; you should increase the Tier 1 sample next week and, in parallel, add a pre-send check on that path. That is the value of doing the arithmetic: it stops a single bad week from triggering either panic or complacency.

When volume is too high to sample fully

At very high volume, even a correctly sized random sample becomes expensive, and some tiers produce more output than any team can review. Three tactics keep the control honest.

Triggered review plus a random audit. Send every output that trips a runtime flag (guardrail block, low confidence, unusual tool call, policy near-miss) to a human, and add a random sample of the rest. The guardrails literature describes runtime checks that block or escalate when an agent drifts, and operational guidance stresses that access and action decisions should be logged as they happen. Triggered review is fast and targeted; the random audit is what tells you whether the triggers are missing failures. Without the random leg, you only ever see what the flags already caught.

Gate the action instead of reviewing it. If an agent can do something irreversible, review belongs before execution, not after. Approval gates on irreversible or regulated actions are the recommended pattern in Dataiku's design patterns for governed agents, and the matching approval record (who approved, when, against which request) belongs in the audit trail, as Permit's audit trail guidance sets out. For that tier, the sample size is 100 percent of the action, by design.

Use double sampling to save reviewer time. When a first small sample is inconclusive, take a second rather than starting large. The NIST handbook's treatment of double sampling shows how a first sample with accept and reject thresholds avoids a second sample in most cases, and how the average number inspected drops as a result. Applied here: review 120 Tier 1 outputs first; if failures are at or below 3, stop; if at or above 8, stop and escalate; if in between, review another 120. In a stable week you inspect less than the full 210 and learn the same thing.

A small script makes the weekly number reproducible, which matters when someone asks why the sample changed:

import math

def weekly_sample(p, z, margin):
    n = (z**2 * p * (1 - p)) / (margin**2)
    return math.ceil(n)

print(weekly_sample(p=0.05, z=1.96, margin=0.03))  # 203
print(weekly_sample(p=0.05, z=2.58, margin=0.03))  # 351

Run it whenever the failure rate you care about, the confidence level or the margin changes, and record the output in the review policy so the number is traceable.

Sanity-checking a week's result

A sample size is only half the control. The other half is interpreting what the sample found without overreacting or underreacting. Two rules cover most weeks.

Report the interval, not the percentage. A week with 5 failures in 100 looks alarming next to a target of 2 percent, but the interval is wide. A week with 18 failures in 210 is a different situation: the point estimate is 8.6 percent and even the optimistic end of the interval sits above your 5 percent threshold. Reviewers should write down "failures, sample, interval" every week, not just a pass or fail, because human evaluation guidance is clear that no single signal, whether an automated eval or a small human sample, is sufficient on its own; you combine human sampling with traces and production signals.

Re-size when the process changes, not on a calendar. A prompt change, a new model behind the agent, a new tool permission or a new customer segment all invalidate your estimate of p. Re-run the formula with the new assumption and adjust the sample for a few weeks after the change. This is the same logic agent evaluation frameworks apply to autonomy levels: the oversight needed depends on the agent's behaviour and risk, not a fixed schedule.

If the team finds itself doing this sizing by hand for several agents and several tiers each week, and pulling traces from more than one provider to do it, the arithmetic is the easy part and the plumbing is the hard part. Quanta Inference puts text, image, video, audio and embedding models behind one OpenAI-compatible API key, which at least keeps the trace source consistent while you sample.

FAQ

FAQ

Why not just review 10 percent of everything?

Because 10 percent of a large number and 10 percent of a small number give you completely different confidence. Ten percent of 2,000 is 200, which happens to be about right for a 5 percent failure rate at 95 percent confidence and a 3 point margin. Ten percent of 20,000 is 2,000, far more than needed, while 10 percent of 500 is 50, too few to distinguish a 5 percent rate from a 10 percent one. Size from the failure rate you care about, then express the result as a percentage only if you want to.

What failure rate should I use if I have never measured mine?

Plan conservatively at 50 percent for the first cycle, which produces the largest sample, or run a two-week pilot with a generous sample and use the observed rate as your estimate for planning. The population proportion guidance recommends 50 percent when you are unsure, and notes that a previous survey or small pilot is the better input once you have one.

Does the sample have to be perfectly random?

It should be selected without the reviewer choosing, and it should be spread across sessions, tenants, task types and times of day, because agents often fail in clusters. If you must stratify, sample within each stratum and state the allocation. Correlated outputs from the same loop count for less than independent ones, so treat the nominal count as an upper bound on what you actually learned.

How do I split the sample across agents and tiers?

Allocate in proportion to risk and volume together, with a floor that guarantees full coverage of the highest-risk tier. A workable default is 100 percent review for irreversible or regulated actions, roughly 25 percent for customer-facing output that is hard to retract, and 5 percent for internal, correctable actions. Write the reasoning down for each tier.

What do I do when the math says the sample is bigger than the volume?

That is the signal to stop using review as the primary control for that tier. If detecting a 1 percent failure rate requires tens of thousands of samples but the tier only produces hundreds of outputs a week, gate the action with a pre-execution approval and log the decision, and rely on runtime checks to escalate exceptions. Review then becomes an audit of the gates, not the only line of defence.

Sources

Sources

  1. Sample Size Calculator
  2. 7.5 Calculating the Sample Size for a Confidence Interval
  3. Determining a Sample Size for a Confidence Interval ...
  4. Human-in-the-Loop AI Agents: How to Design Approval ...
  5. Guardrails for AI Agents: Types, Benefits & How to Implement
  6. Agentic AI Guardrails: What They Are and How to Implement Them - Aembit
  7. Human-in-the-loop AI agents: design patterns for governance
  8. AI Agent Audit Trail: Proving What an Agent Did and Why
  9. 6.2.4. What is Double Sampling?
  10. AI Agent Evaluation: Metrics, Traces, Human Review, and ...
  11. AI Agent Evaluation: Frameworks, Strategies, and Best ...
  12. Sample Size - Population Proportion
About the author

About the author

Antonio Evans
Antonio Evans

Antonio Evans is the founder of Quanta Intelligence and a fractional CTO who builds HIPAA-ready AI systems for health and life-science companies. Before that he was technical co-founder of FriendsEAT for twenty years, CEO of Socialdraft, and a data engineer at IBM. Antonio lives with his dog Santino in Lisbon, Portugal.

All articles