Mean time to detect is one of the oldest numbers in an SRE’s toolkit, and for most services it’s dominated by one question: how fast does the alert fire after things start failing? For an agent, the more important question comes first: does any alert fire at all?
Agents fail in more ways than services do. Some of those ways look exactly like service failures and trip the alerts you already have. Others look exactly like success. An MTTD averaged across all of them is mostly a measurement of the easy ones.
Four fault classes
For detection purposes I group agent faults by what they look like from the outside:
| Fault class | What it looks like | Example |
|---|---|---|
| Crash | An error is raised | Tool throws, model API returns 5xx |
| Timeout | The task is slow | Agent loops on a tool, context grows until the call times out |
| Malformed | The output is the wrong shape | Missing field, invalid JSON, out-of-range value |
| Wrong-but-valid | Nothing; it looks like success | Correct format, plausible content, wrong answer or wrong action |
The first two are what request-level monitoring is built for. The third needs a validator. The fourth needs someone, or something, to check the answer against reality.
The simulation
I built a seeded simulation to measure MTTD for each class under four monitoring stacks, each adding one layer to the last. Fault classes, rates and monitors are illustrative. The numbers describe how the monitors behave, not any real agent. The script is at the end.
- 20 tasks a minute, with a healthy background of 1% errors and 2% slow tasks.
- Faults: a crash affecting 30% of tasks, a timeout affecting 20%, a malformed-output fault affecting 15%, and a wrong-but-valid fault affecting 5%.
- Monitors:
- Errors + latency. Alert when the 5-minute failure rate exceeds 8% or the slow share exceeds 10%.
- + Output schema. Malformed outputs count as failures in the error-rate alert.
- + 1% audit. One task in a hundred is audited by a human or a judge model, which catches a wrong answer 70% of the time. Audits are reviewed in a batch every 4 hours.
- + Reconciliation. For 30% of task types, compare what the agent did with the state of the world an hour later.
- 400 injected faults per cell, with a one-week cutoff.
Results
Mean time to detect:
| Fault | Errors + latency | + Output schema | + 1% audit | + Reconciliation |
|---|---|---|---|---|
| Crash | 4 min | 4 min | 4 min | 4 min |
| Timeout | 4 min | 4 min | 4 min | 4 min |
| Malformed | not within a week | 4 min | 4 min | 4 min |
| Wrong-but-valid | not within a week | not within a week | 5.0 h | 65 min |
(Four minutes is the alert window filling up: the first evaluation of a 5-minute window.)
The loud faults are solved problems. Any team with basic alerting detects a crash or a timeout in one window, and nothing you add later changes that.
Malformed output is invisible until something checks the shape. Without a schema check, a 200 with a broken payload is a success as far as your alerts know, which is the same blind spot as a status-code circuit breaker. Add the check and it becomes as loud as a crash.
Wrong-but-valid output is invisible to everything that looks at requests. Error rate, latency and schema all pass. The only monitors that see it are the ones that look at the answer: an audit, or a comparison with the world.
The audit is a sampling problem
A 1% audit found the wrong-answer fault in about five hours, and most of that is arithmetic. With 1 bad task a minute, a 1% sample and a 70% catch rate, the first catch takes a couple of hours on average, and then waits for the next 4-hour batch review. The audit’s MTTD scales with how many tasks the fault touches:
| Wrong-but-valid fault touches | 1% audit | Reconciliation |
|---|---|---|
| 5.0% of tasks | 5.1 h | 63 min |
| 1.0% of tasks | 15.6 h | 76 min |
| 0.2% of tasks | 50.8 h, and 12 of 200 not caught within a week | 2.4 h |
(The audit means exclude the runs that weren’t caught at all, so they flatter the audit.)
A subtle fault that affects one task in five hundred is exactly the kind a model update or a prompt edit introduces. With a 1% audit, it runs for two days on average, and sometimes for more than a week. That’s not a monitoring failure you’ll notice. It’s a quiet one that shows up later as a pattern in customer complaints.
Reconciliation is the cheap one
Reconciliation was the fastest monitor for wrong answers, and it doesn’t need a judge model or a person. It needs the agent to say what it intended, and a later check of whether the world agrees:
- The agent said it closed the ticket. Is the ticket closed, and is it the ticket the user asked about?
- The agent said it scaled the deployment to 6 replicas. Are there 6 replicas, an hour later?
- The agent said it issued a refund of $40. Did $40 post to the right account?
The intent is already in the agent’s decision record, or should be. The check is usually an API read. In the simulation, covering only 30% of task types with a 60-minute delay was enough to bring wrong-answer detection down to about an hour, because a fault that touches many tasks hits a covered type almost immediately. The delay sets the floor; the coverage sets how quickly you hit it.
The limit is the task types you can’t reconcile: answers to questions, summaries, recommendations, anything where the “world state” is a person’s understanding. Those are what the audit, and evals, are for.
Report MTTD per class
If you take one thing from this: stop reporting a single MTTD for an agent.
- Measure each fault class separately, by injecting or replaying faults of that class. A fleet-wide average is set by crashes, which are frequent and easy.
- Report “not detected” as its own outcome. A class your monitors never catch has no MTTD. It has a coverage gap, and the gap is the finding.
- Add layers in order of cost. Schema checks are nearly free. Reconciliation is an API read per covered task. Audits cost human or model time per sample. All three are cheaper than discovering a wrong-answer fault from a customer.
- Re-measure after every behavior change. A new model can move faults from one class to another: fewer crashes, more confident wrong answers. Your MTTD for the class that grew is the one that matters.
The script
Standard library only. Seeded, so you get exactly the numbers above. It takes about 45 seconds. Save as agent_mttd.py and run it with python3.
"""Mean time to detect, by fault class and by monitor, for an AI agent in production.
Synthetic, seeded, stdlib only. Fault classes, rates and monitors are illustrative.
"""
import random
SEED = 21
TASKS_PER_MIN = 20
TRIALS = 400
MAX_MIN = 7 * 24 * 60 # give up after a week
# Fault classes: what share of tasks the fault affects, and what it looks like.
FAULTS = {
# affected raises_error slow output_invalid wrong_but_valid
"crash": (0.30, True, False, False, False),
"timeout": (0.20, False, True, False, False),
"malformed": (0.15, False, False, True, False),
"wrong-valid": (0.05, False, False, False, True),
}
# Monitors
ERR_WINDOW, ERR_THRESH = 5, 0.08 # 5-min failure rate above 8%
LAT_WINDOW, LAT_THRESH = 5, 0.10 # 5-min share of slow tasks above 10%
BASE_ERR, BASE_SLOW = 0.01, 0.02 # healthy background rates
AUDIT_SHARE = 0.01 # 1% of tasks get a human/LLM-judge audit
AUDIT_CATCH = 0.70 # audit spots a wrong answer 70% of the time
AUDIT_DELAY = 240 # audits are read in a batch every 4 h
RECON_DELAY = 60 # outcome reconciliation: compare intent vs
RECON_COVER = 0.30 # world state an hour later, for 30% of task types
def detect(fault, monitors, rng):
share, err, slow, invalid, wrong = FAULTS[fault]
errs, slows = [], []
audit_hit_at = None
for minute in range(MAX_MIN):
e = s = 0
for _ in range(TASKS_PER_MIN):
hit = rng.random() < share
# an invalid output only counts as a failure if something validates it
seen_invalid = invalid and "schema" in monitors
e += (hit and (err or seen_invalid)) or (rng.random() < BASE_ERR)
s += (hit and slow) or (rng.random() < BASE_SLOW)
if hit and wrong:
if "audit" in monitors and audit_hit_at is None:
if rng.random() < AUDIT_SHARE and rng.random() < AUDIT_CATCH:
audit_hit_at = minute
if "recon" in monitors and rng.random() < RECON_COVER:
return minute + RECON_DELAY
errs.append(e); slows.append(s)
if "errors" in monitors and len(errs) >= ERR_WINDOW:
if sum(errs[-ERR_WINDOW:]) / (ERR_WINDOW * TASKS_PER_MIN) > ERR_THRESH:
return minute
if "latency" in monitors and len(slows) >= LAT_WINDOW:
if sum(slows[-LAT_WINDOW:]) / (LAT_WINDOW * TASKS_PER_MIN) > LAT_THRESH:
return minute
if audit_hit_at is not None:
# surfaced at the next batch review
return (audit_hit_at // AUDIT_DELAY + 1) * AUDIT_DELAY
return None
def fmt(m):
if m is None:
return " never"
return f"{m:5.0f} m" if m < 120 else f"{m/60:5.1f} h"
if __name__ == "__main__":
stacks = {
"errors+latency": ("errors", "latency"),
"+ output schema": ("errors", "latency", "schema"),
"+ 1% audit": ("errors", "latency", "schema", "audit"),
"+ reconciliation": ("errors", "latency", "schema", "audit", "recon"),
}
rng = random.Random(SEED)
print(f"{'fault':12s}" + "".join(f"{k:>18s}" for k in stacks))
for f in FAULTS:
row = f"{f:12s}"
for name, mons in stacks.items():
ts = [detect(f, mons, rng) for _ in range(TRIALS)]
got = [t for t in ts if t is not None]
mean = sum(got) / len(got) if len(got) == len(ts) else None
row += f"{fmt(mean):>18s}"
print(row)
print("\nwrong-valid fault, MTTD vs how many tasks it touches")
for share in (0.05, 0.01, 0.002):
FAULTS["wrong-valid"] = (share, False, False, False, True)
a = [detect("wrong-valid", ("audit",), rng) for _ in range(200)]
r = [detect("wrong-valid", ("recon",), rng) for _ in range(200)]
a_ok = [x for x in a if x is not None]
print(f" affects {share:5.1%} of tasks: 1% audit {fmt(sum(a_ok)/len(a_ok))} "
f"(undetected in a week: {len(a)-len(a_ok)}/200), reconciliation {fmt(sum(r)/len(r))}")
Full output:
fault errors+latency + output schema + 1% audit + reconciliation
crash 4 m 4 m 4 m 4 m
timeout 4 m 4 m 4 m 4 m
malformed never 4 m 4 m 4 m
wrong-valid never never 5.0 h 65 m
wrong-valid fault, MTTD vs how many tasks it touches
affects 5.0% of tasks: 1% audit 5.1 h (undetected in a week: 0/200), reconciliation 63 m
affects 1.0% of tasks: 1% audit 15.6 h (undetected in a week: 0/200), reconciliation 76 m
affects 0.2% of tasks: 1% audit 50.8 h (undetected in a week: 12/200), reconciliation 2.4 h
Limits
- Faults are constant from the start. Real faults ramp up, come and go, or cluster on one tenant. A ramp delays the error-rate alert; intermittency makes the audit slower still.
- Monitors are idealized. The audit’s 70% catch rate and reconciliation’s perfect accuracy are assumptions. A reconciliation check can be wrong too, and a noisy one becomes a source of false alarms.
- Detection isn’t diagnosis. An audit that catches one wrong answer tells you something is wrong, not what. Time to understand the fault is a separate number, and for wrong-answer faults it’s usually the larger one.
- The four classes are a simplification. They group faults by what a monitor can see, not by root cause. A crash and a wrong answer can come from the same bug.
The faults your alerts already catch were never the problem. Measure the ones they don’t.
Comments