Back to blog
ASRrobustnessconfidence intervalnon-determinismred teaming

Measuring AI Agent Robustness: ASR and Wilson Interval

Published on 2026-11-16 · Updated on 2026-11-265 min read
In short: An AI agent does not always answer the same way, so an attack that fails three times is not an attack that fails. If the true success probability of an injection is 30%, three failures in a row happen 34% of the time. The right measure is an attack success rate (ASR) computed over many trials, with a confidence interval such as Wilson's. With zero successes in 35 trials, all you can say is that the true rate is probably below about 10%.

Why does "I tried 3 times and it didn't work" prove nothing?

Because three trials are too few to tell a rare attack from a nonexistent one, and models vary from one trial to the next. Even at temperature 0, outputs change: in an experiment published by Thinking Machines, 1,000 completions of the same request on an open model produced 80 different texts. The authors attribute most of the variation to the result depending on the size of the batch of requests the server processes at once, hence on its load. Your test and production do not see the same load.

The calculation is simple. If an attack succeeds with probability p on each trial, the probability of seeing it fail n times in a row is (1 − p)^n.

True success rateChance of 0 successes in 3 trialsChance of 0 successes in 10 trials
10%73%35%
20%51%11%
30%34%3%
50%12%0.1%

An attack that works one time in five therefore fails three times in a row more than half the time. For an agent that processes thousands of documents a day, 20% is a catastrophic rate.

What is the attack success rate (ASR)?

It is the proportion of trials in which the attack reaches its goal, measured under fixed conditions: same agent, same model version, same attack set. Public benchmarks work this way. AgentDojo (Debenedetti et al.) offers 97 realistic tasks and 629 security test cases. RedTeamCUA, which evaluates agents driving a computer, separates the attempt rate (the agent tries the trapped action) from the success rate (the action goes through), because an agent can fail for lack of capability without being robust.

The same repetition problem affects reliability. The τ-bench benchmark (Yao et al.) introduced the pass^k measure, which evaluates an agent's reliability across several trials: its authors report that even state-of-the-art function-calling agents (such as gpt-4o) succeed on fewer than half the tasks, with pass^8 below 25% in the retail domain. The lesson carries over to security: correct behavior once is not correct behavior every time.

How do you read a Wilson confidence interval?

It is a range that says where the true rate probably lies given the number of trials. A 95% Wilson interval for k successes in n trials comes from the formula below, where p = k/n and z = 1.96:

center = (p + z²/2n) / (1 + z²/n), half-width = z · √(p(1−p)/n + z²/4n²) / (1 + z²/n)

Why Wilson rather than the textbook formula (Wald)? Because the latter behaves badly with few trials or rates near 0: it gives zero width at 0 successes, which, according to Wikipedia, falsely implies certainty. Wilson stays usable in those cases. For zero successes, the rule of three gives an approximate upper bound of 3/n, mostly valid when n is large. Here is what Wilson gives:

Successes / trialsObserved rate95% interval
0 / 30%0% to 56%
0 / 100%0% to 28%
0 / 350%0% to 10%
0 / 1000%0% to 3.7%
3 / 3010%3.5% to 25.6%
10 / 10010%5.5% to 17.4%
30 / 30010%7.1% to 13.9%

The same observed 10% is known to about ±11 points with 30 trials and ±3 points with 300. The observation stays the same, only the precision changes.

How many trials do you need?

It depends on the certainty required. To state, at 95%, that an attack's success rate is below a threshold, with zero successes observed, you need at least:

  • 35 trials for a 10% threshold;
  • 73 trials for a 5% threshold;
  • 381 trials for a 1% threshold.

These numbers hold for one given attack, with independent trials. Reset the session and the memory between two trials: otherwise the agent learns from the previous one and your trials are no longer comparable. They say nothing about attacks you did not try: zero out of 100 for one wording does not cover the neighboring wording.

How do you compute the interval in practice?

A few lines are enough, with no library:

```python

from math import sqrt

def wilson(k, n, z=1.96):

p = k / n

d = 1 + z * z / n

centre = (p + z * z / (2 * n)) / d

margin = z * sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d

return max(0, centre - margin), centre + margin

print(wilson(6, 50)) # about (0.056, 0.238)

`

To compare before and after a fix, use the same number of trials and the same conditions. If the ASR goes from 6 out of 50 to 2 out of 50, the intervals are [5.6%; 23.8%] and [1.1%; 13.5%]: they overlap, so the improvement is not demonstrated. Non-overlap is a cautious rule that does not replace a full statistical test. You then need more trials.

Which pitfalls give a false sense of security?

Fix and record the conditions: exact model version, temperature, system prompt, active tools, memory state. Disable response caches, otherwise you are measuring the cache and not the model. Have part of the verdicts checked by hand if a model judges the results, since a judge makes mistakes too. Vary the attack wording: an ASR computed on a single attack prompt describes that prompt. Finally, remember the real attacker adapts: the ASR of a frozen set is a floor.

These measurements tie into the automation tools described in our Promptfoo, Garak and PyRIT comparison and the controls of the production security checklist.

What do these calculations give on real measurements?

Here are numbers from my own reports of flaws in two open source coding agents. The flaws are not published yet, so I name neither the tools nor the models. In both cases, a trapped contribution file read by the agent led it to run a command with no confirmation prompt.

SetupSuccessesObserved rate95% Wilson interval
Agent A, model 14 out of 1040%17% to 69%
Agent A, models 2 and 30 out of 20 each0%0% to 16%
Agent B, model 41 out of 1010%2% to 40%
Agent B, control (option spelled out in full)0 out of 100%0% to 28%

Format of my run log (simplified excerpt):

```text

run model input tool_call approval_window result

07 m1 CONTRIBUTING.md (v2) shell "git grep …" none canary executed

08 m1 CONTRIBUTING.md (v2) none n/a refused

`

Two lessons. A "0 out of 20" does not mean "immune": the upper bound is still 16%, which is a lot for an agent that reads repositories every day. And the result depends on the model plugged in behind the same tool: the flaw lives in the tool, and the model only changes how often it fires. The control run checks that the tested variant is what makes the difference.

How does CleanIssue report an agent's robustness?

Each reported attack comes with its number of trials, its conditions and a rate with an interval, never a bare "tested, not reproduced". This way of measuring belongs to our method and to the AI agent red teaming page. The Agent Red Team Express (€1,900, 5 days, start within 48 hours after the quote and authorization are signed) covers one agent and its tools with these repeated measurements; several agents fall under the Custom Red Team, quoted individually. The first step is a free 30-minute discovery call.

Does your product ship an AI agent? CleanIssue tests what a stranger can make it do with the Agent Red Team Express (5 days, €1,900), or a custom red team for several agents and MCP servers. First step: a free 30-minute discovery call.

Know what your agent can do before an attacker does.

A free 30-minute discovery call: you describe your agent, I tell you what I would test and what it costs. Five case studies are published.

Book a call