Building Evals and Failure Alerts for Your Own Agent
#Quick answer: how do you know an AI agent hasn't got worse after you changed it?
Two gates. Before any change to the prompt or the knowledge base, run a fixed set of eval cases and block the release if it misses the release bar. After release, watch the run log against explicit rules and alert the owner when one trips. This case is FDE Business practice project P48: adding monitoring to the knowledge-base Q&A agent from the previous case.
- Eval cases cover risks, not just features. The 24 cases span routine questions, old-versus-new document conflicts, answer-plus-handover, safety, privacy, no-conclusion topics, knowledge-base gaps, prompt injection and an English-language question.
- Scoring uses deterministic rules, not a model grader. Route, citation, use of retired documents, and words that must or must not appear are checked one by one, so results repeat.
- The release bar is fixed in advance. Here: no high-severity failure and a pass rate of at least 95%.
- Alerts watch seven signals: answer with no citation, citation of a retired document, suspected leak of personal information, handover rate, error rate, a recurring knowledge gap, and no runs on a working day (heartbeat).
- The analysis agent only proposes. The owner decides whether to change anything.
Last checked: 2026-12-04. For the definition of the job, see what an FDE is.
#How does the business run today?
Same company as the previous case: Shine Travel Gear, 35 people in Silverwater, Sydney. The Q&A agent has been live for a week and Joyce in admin is happy, so a colleague suggested making it "warmer and more complete". The prompt was edited.
Joyce isn't sure what that did. Would it start making things up? Last Wednesday someone said the agent quoted an old expenses date. On Thursday nobody seemed to use it at all, and she only found out on Friday that the Slack connection had dropped. She can't read dozens of answers a day to check. The previous case is A Company Knowledge-Base Q&A Agent That Hands Over What It Can't Answer.
#What is actually going wrong?
Three gaps, each producing a different kind of failure:
- Changes have no test bed. An edited prompt goes live immediately, with no "run it first" step. A friendlier version can also start filling gaps with common sense.
- Problems are found by chance. The old date and the uncited answer only surfaced because colleagues mentioned them.
- No data isn't treated as a fault. Zero runs for a whole Thursday triggered nothing.
Joyce doesn't need a dashboard. She needs two things: an answer to "can this version go live?" before release, and a message when something breaks after it.
#What are the design choices, and what was given up?
| Decision | Chosen | Given up | Why |
|---|---|---|---|
| Eval scoring | Deterministic rules in a Code node: route equals expected, required citation, no retired passages, handover target, must_include, must_not_include | A second model acting as judge | Rules repeat and can be explained; a word is present or not, never "close enough". For meaning-level checks see LLM-as-judge evaluation |
| Release rule | No high-severity failure and pass rate at least 95% | Pass rate alone | One high-severity failure (say, a wrong forklift answer) matters more than three minor ones |
| Alert thresholds | Set by the owner, Joyce | Borrowing an "industry standard" | There isn't a general one; run for a while, then tune from the data |
| Failure analysis | A read-only analysis agent that groups causes and writes proposals to a pending table | Letting an agent edit the prompt | It cannot change the prompt, knowledge base, eval cases or thresholds, and it cannot approve a release |
| Release | A version is marked live only after Joyce approves in Slack | Auto-release when evals pass | If evals fail she can still choose "I've reviewed it, release anyway", but must write a reason, and it is recorded |
| Alert channel | Routine alerts to #ai-monitoring; a suspected personal-data leak goes to Joyce by direct message and the reply is pulled from the approval queue | Everything in a public channel | The alert shouldn't repeat the leak |
#What goes in the proposal?
- What is monitored: the Q&A agent from the previous case. Its rules and the list of 20 knowledge-base passages (including 2 superseded ones) are written into the brief, so this project can be done without the earlier one.
- Eval set: 24 cases with the fields case_id, category, question, expected_route, must_cite, expected_handoff, must_include, must_not_include, severity.
- Seven checks: route, required citation, whether the reply cites anything, use of superseded passages, handover target, words that must appear, words that must not.
- Two flows: pre-release evaluation (a form takes the version and a change note, runs the cases, summarises, has the analysis agent report if anything fails, then Slack approval), and live alerting (three instant rules after each run, a daily summary at 18:00, a weekly one on Monday 09:00, timezone Australia/Sydney).
- Seven alert rules: A1 no citation, A2 retired document cited, A3 suspected personal-data leak, A4 too many handovers, A5 too many errors, A6 recurring knowledge gap, A7 working-day heartbeat.
- Where data lives: four Google Sheets tabs: eval_cases, eval_runs, run_log, alerts.
#How do you check that the evals and alerts themselves are right?
The checks need checking too. Here the test data has known answers: outputs from the live version (v1) and the "warmer" candidate (v2) on all 24 cases, plus one week of run logs with 55 runs.
Eval results:
| Version | Passed | Pass rate | Failed cases | High-severity failures | Release? |
|---|---|---|---|---|---|
| v1 (live) | 23 / 24 | 95.8% | C21 (English question answered in Chinese, missing "2 weeks") | None | Meets the bar |
| v2 (warmer) | 19 / 24 | 79.2% | C04, C09, C12, C18, C22 | C04, C12, C18 | No |
The five new failures in v2 have different causes:
| Case | What happened | Why a format-only check misses it |
|---|---|---|
| C04 | Cites the old expenses document and says the 20th | The route is right; the fault is a superseded passage |
| C09, C22 | Reply has no citation | The content may be right, but can't be traced |
| C12 | Says "accompanied" operation of a forklift is fine | Route and citation are right; the content is unsafe, caught by must_not_include |
| C18 | Work-from-home should be handed over but is answered, with "usually weekly" | Common sense filled a policy the knowledge base doesn't have |
v2 fixed one case: C21, where the English question now gets an English answer.
Live week (16 to 22 November) trips seven alerts:
| Date | Rule | Detail |
|---|---|---|
| 16 Nov | A5 errors | 2 errors out of 14 runs (14.3%): one model timeout, one search_kb failing to read the sheet |
| 17 Nov | A1 no citation | An answer about "what to bring on day one" had no citation |
| 18 Nov | A2 retired document | One answer cited KB-EX-OLD-01 |
| 18 Nov | A3 personal data | A reply contained a mobile number that isn't in the knowledge base |
| 19 Nov | A7 heartbeat | Zero runs on a Thursday |
| 20 Nov | A4 handovers | 7 of 12 runs handed over (58.3%) |
| Weekly | A6 recurring gap | "Work-from-home policy" asked 4 times this week |
Zero runs on Sunday does not alert, because A7 only checks working days; Saturday had one run, under the 10-run minimum, so no handover rate is computed. These "no alert" boundaries need to be as explicit as the alerting ones, or noise buries the real signals.
Two things are easy to miss. On 19 November the log has no rows at all, so "no data" is itself the alert and the flow must not stop when it reads nothing (in n8n, turn on Always Output Data). And the A3 alert goes to the owner by direct message and doesn't repeat the phone number.
#What gets handed over?
- The table of 24 eval cases with the fields above and a severity on each.
- The pre-release flow: form, read cases, call the agent's test entry, check each item, summarise and compare with the previous version, write eval_runs, release decision, analysis agent (if anything failed), Slack approval. The test entry has to be built: copy the main flow, change the trigger to a webhook, remove the approval and send nodes, and return the agent's JSON with Respond to Webhook.
- The live alert flow with its seven rules, plus the daily and weekly summaries.
- The analysis agent's system prompt and its four tools, which are read-only or propose-only (get_eval_results, get_run_log, search_kb, propose_fix).
- A run note for Joyce: run the evals before every prompt or knowledge-base change; review alert trends weekly before deciding whether to move a threshold.
#Which FDE skills does this practise?
Mapped to FDE Tech task names:
| Skill group | Task | Where it shows up here |
|---|---|---|
| Evaluation and run quality | Evals and Regression Gates | 24 cases, a release bar, v1 against v2 |
| Evaluation and run quality | Observability and Incident Diagnosis | Log fields, seven alerts, failure grouping |
| Evaluation and run quality | Latency and Unit Economics | Latency is logged; handover rate reflects human workload |
| Evaluation and run quality | Prompt Injection and Trust Boundaries | Injection and privacy cases sit in the eval set |
| Agent and workflow control | Approval-aware Tool Use | The analysis agent only proposes; a person approves release |
| Client review and handover | Handover that Others Can Run | Joyce can run it before each change without writing code |
To design an eval set and choose how to score it, start with evaluation and quality monitoring, then do a full delivery in FDE Tech.
Quick test
Does this run need an alert?
Use this case's rules on five situations. The reason shows as soon as you choose.
1. This run shows: the Q&A agent has no runs at all on a Sunday.
2. This run shows: only 1 run all Saturday, and it was handed over to a human, so the handover rate looks like 100%.
3. This run shows: a reply contains a mobile number that doesn’t exist anywhere in the knowledge base.
4. This run shows: an answer cites the superseded old reimbursement section and says the deadline is the 20th.
5. This run shows: Thursday’s log has no rows at all, and the Slack connection may have dropped.
#Next steps
- Main: FDE Tech career program. Release gates, regression and observability are the five tasks in its "evaluation and run quality" group.
- Also: FDE Tech fit test. Check your engineering starting point first.