If you run an AI agent in production, your monitoring probably tells you four things: it's up, it's fast, it isn't throwing errors, and it ran on schedule. All green.
Now ask your dashboard whether yesterday's output was correct. It can't answer. An agent can return a well-formed response, log a 200 and still be wrong every time, in the same direction, for weeks. Nothing crashes, so nothing alerts you.
You can close most of that gap with three small checks that look at what the agent produced. Together they're about 20 lines of plain Python, with no extra libraries and no new platform. You can drop them into the scheduler you already use.
1. Range alarm: catch the number that's suddenly off
Say your agent normally returns values between 200 and 240, and today it returns 3,400. The process is healthy and the output is badly wrong. So put the alarm on the number itself.
I use the median and the median absolute deviation (MAD) instead of mean and standard deviation, because one old outlier in your history shouldn't be able to hide the next one:
from statistics import median def range_alarm(history, latest, factor=3.0): m = median(history) mad = median(abs(x - m) for x in history) or 1e-9 score = abs(latest - m) / mad return score > factor * 1.4826, round(score, 1) history = [212, 198, 240, 225, 205, 231, 219, 210, 228, 201] range_alarm(history, 236) # (False, 1.8) range_alarm(history, 3400) # (True, 276.9) The 1.4826 scales MAD to match a standard deviation for normally distributed data, so factor=3.0 behaves roughly like a three-sigma rule.
2. Mix alarm: catch the classifier that quietly drifted
Classifier agents go wrong in a sneakier way. Each answer on its own looks fine. It's the overall mix that moves. If 90% of your tickets were "billing" last week and 88% are "other" this week, something upstream probably changed: a renamed field, a new web form, a model update. The agent didn't notice, and your dashboard won't either.
Total variation distance turns "how different is this week's mix?" into one number:
from collections import Counter def mix_alarm(last_period, this_period, max_shift=0.25): a, b = Counter(last_period), Counter(this_period) na, nb = sum(a.values()), sum(b.values()) tvd = 0.5 * sum(abs(a[l] / na - b[l] / nb) for l in set(a) | set(b)) return tvd > max_shift, round(tvd, 2) last = ["billing"] * 90 + ["other"] * 10 this = ["billing"] * 12 + ["other"] * 88 mix_alarm(last, this) # (True, 0.78) A score of 0 means the mix is identical and 1 means it's completely different. Start with a threshold around 0.25, then tune it after you've watched a few normal weeks.
3. Spot check: catch the agent that's consistently wrong
The first two checks catch sudden shifts. An agent that's been quietly wrong since day one passes both. To catch that, you have to compare a small sample of outputs against a source you trust that isn't the agent's own logs.
def spot_check(agent_outputs, trusted_source, keys): return [k for k in keys if agent_outputs.get(k) != trusted_source.get(k)] agent = {"INV-101": 4200, "INV-102": 1800, "INV-103": 990} erp = {"INV-101": 4200, "INV-102": 1800, "INV-103": 9900} spot_check(agent, erp, ["INV-101", "INV-102", "INV-103"]) # ['INV-103'] Five or ten records a day is plenty. If your agent summarises invoices, pull a few from the accounting system and compare. If it classifies tickets, pull ten and check them by hand. Keep the sample small, run it every day, and give one named person the job of reading the result.
Wiring it up in an afternoon
- Run all three checks in the same scheduler that runs the agent: cron, Airflow, a GitHub Action, whatever you already have.
- Send the alarms to the same channel as your crash alerts, so a wrong answer gets the same attention as a broken process.
- Log every spot-check result, passes included. A month of "checked 10, all matched" is real evidence that the agent works. A missing day in that log deserves a look too.
Questions people usually ask
What if I don't have a trusted source to compare against? Then the spot check is a person reading ten outputs and marking them right or wrong. It's slower, and it's still the most useful 15 minutes you'll spend on that agent each week.
How much history does the range alarm need? Ten to thirty recent values is enough to start. Refresh the history window regularly, so the baseline follows legitimate changes.
Won't this make noise? At first, a little. Expect to adjust the thresholds in the first two weeks. After that, an alarm that fires once a month and is right is worth far more than a dashboard that's never red.
Where this fits
These checks are what turn an AI policy into something that actually runs every day. I wrote up the longer version of that argument as governed AI vs AI governance, if you're making the case to your team.
How do you catch an agent that's healthy but wrong? I'd like to hear what works for you in the comments.
Drafted with AI and reviewed by me before publishing. The code was tested and the outputs shown are real.
