ModulesLabQuizAll courses

Monitoring, Evaluation and Continuous Improvement

Know what your automations did last night, measure whether the AI steps are right, and change a prompt without breaking what already worked. Instrument AI Caravan Ltd.'s triage flow, score it against twenty agreed answers, change one thing, score again.

Module 12 of 14 · Day 6 · Session 12 · AI Administrator: Agentic Workflows & Automation

Module 12 ~60 min read + lab No code

What you will learn

Prerequisites: Module 11: Security and governance, and the gated triage flow from Module 10.

1. Deployment is the start, not the end

A traditional automation either works or throws an error. An AI step is different: it can run perfectly and still be wrong, confidently, every time. Nobody gets an alert when a model starts labelling refund requests as sales enquiries. The only way to know is to look, on purpose, with a method.

Three boxes: logs (what happened), evaluation (was it right), improvement (change it safely), with the monitoring question underneath
The platform gives you the first layer. The other two are a sheet, twenty agreed answers and a habit.

This module gives you that method in three layers: logs (what happened), evaluation (was it right), and improvement (change it safely). The habit is borrowed from software operations, where it is called observability. You will do it in spreadsheets.

The monitoring question

For each workflow, can you answer within five minutes: how many runs yesterday, how many failed, how much did it cost, and how often was the AI step wrong? If not, this module fixes that.

2. Execution logs and what to record for AI steps

Every automation platform keeps a run history. n8n calls it Executions: one entry per run, with the input and output of every node, the time it took, and where it failed. Zapier has Zap history, Make has the scenario execution log, Power Automate has run history. Open it daily for the first two weeks of any new workflow, then weekly.

The fifteen columns of an AI log row in four groups: when and where, what it saw and said, what it cost, the person
One row per AI call, in four groups. Redact before you log; ask the prompt for a confidence; estimate tokens in the row and take the exact count from the model node.

The platform log is not enough for AI steps, because it does not summarise. Add your own AI log: one row per AI call, appended to a sheet by the workflow itself.

timestamp | workflow | run id | step name | model | input (first 200 chars, redacted) | output | confidence or category | input tokens | output tokens | cost | latency ms | human decision (if gated)

What we measured on 28 October 2026 (n8n 2.44.6, Gemini 2.5 Flash): the n8n LLM Chain node outputs only the text, so the log row estimates tokens as characters divided by four and prices them at the Gemini 2.5 Flash list price (USD 0.30 in, 2.50 out per million). Classify: estimated 187 in / 3 out, real (Executions, the Gemini sub-node) 179 / 3. Draft reply: estimated 173 / 122, real 134 / 90. Within 5% on the short call, 30% over on the long one: good for trends and alerts, not for the bill. A second finding: asked for a confidence from 1 to 5, the model answered 5 on 39 of 40 golden items, including both it got wrong. At temperature 0 the model's self-reported confidence is a weak escalation signal; the hard-case list and the gate are the real ones.

The AI log tab of the M12 Monitoring Google Sheet: fictional seed rows and, at the bottom, the two real rows of 28 October 2026 with label technical, confidence 5, 187 tokens in and 2,379 ms
The AI log tab after one real run (rows 110 and 111). The rows above are fictional seed data so the demo dashboard has a history; a participant's sheet has today's rows only.

Keep the log in the same workbook as the approval log from Module 10. One workbook per workflow, one tab per log, is a pattern you can maintain.

3. Failure handling: retries, fallbacks and the human queue

Things fail for boring reasons: a model endpoint is busy, an email server times out, a sheet is locked. Design for it once and the workflow becomes reliable.

Flow: AI step, retry on fail 3 tries 5 s, fallback path, human queue; boxes for idempotency and alerting; a red rule: never retry an action that may already have succeeded
Retry cures transient errors; a fallback keeps the flow moving; the human queue keeps the context; idempotency stops duplicates; alerting counts instead of shouting.
TechniqueWhat it doesWhere to set it
Retry with backoffTry again after a pause (5 s, then 15 s, then 45 s where the tool allows it). Cures most transient errors.Node Settings: Retry On Fail, Max Tries 3, Wait Between Tries (n8n caps it at 5,000 ms)
Fallback pathIf the primary model fails, use a second model or a simpler rule ("if subject contains invoice, category = billing").Error output of the node, routed to an alternative branch
Dead-letter / human queueAnything that still fails is written to a "needs human" sheet or channel with the full context, and a person handles it.Error workflow (n8n) or a catch branch that appends to the queue and notifies
IdempotencyRunning the same input twice does not create two tickets or two emails. Check for an existing record before creating one.A lookup step before every create step
AlertingA message when the failure rate passes a threshold, not on every failure.A scheduled workflow that counts errors in the last hour

Retries and gates

Never retry an action that may already have succeeded, such as "send email", without checking first. Retry the read, then decide again.

Trap: the five-second cap

Found 28 October 2026: n8n's Wait Between Tries accepts at most 5,000 ms, so "three tries, 10 seconds apart" ran as three tries in about ten seconds in total. Fine for a busy endpoint, useless for a ten-minute outage. For longer waits route the error output to a Wait node and loop once, or let the human queue handle it.

n8n execution view: the Classify email node with three red Gemini attempts (Bad request: the model name does not exist), then Needs human (error) and Label needs human (error) in green
The forced failure as it ran (execution 43, 28 October 2026): the model name was changed to one that does not exist. Three red attempts in about ten seconds, then the error output: a Needs human row and the needs-human label. The e-mail was not lost.

4. Evaluation: the golden set and the rubric

A golden set is a small collection of real inputs with the correct answer written by a person. Twenty examples is enough to start; fifty is comfortable. For the triage flow, that is twenty real (redacted) emails, each with the category a competent colleague would give it.

Twenty numbered squares coloured by label (billing 6, technical 6, sales 4, unsure 4), five with a red border for hard cases, and four rules for building a golden set
Our golden set: the ten Session 6 test e-mails you were told to keep, plus ten new ones. Red border: a case two labellers disagree on.

To evaluate, run every golden input through the AI step and compare. For categories the score is simply accuracy: correct divided by total. For free text such as a drafted reply, use a rubric: three or four yes/no criteria a person can judge in ten seconds.

Reply-draft rubric (score 0-4) [ ] Answers the customer's actual question [ ] Contains no invented facts (prices, dates, policies) [ ] Matches the tone guide (polite, brief, no jargon) [ ] Safe to send without legal or financial commitment

Building a good golden set

  • Sample the real mix. If 60% of emails are billing, the set should be about 60% billing. Add a few deliberately hard or ambiguous cases and label them as such.
  • Two labellers. Have two colleagues label independently and discuss the disagreements. If humans cannot agree on a case, the model cannot be marked wrong on it.
  • Keep it out of the prompt. Golden examples must not appear in the instructions, or you are testing memory, not skill.
  • Grow it from failures. Every escalation and every human correction from the approval log is a candidate golden example.

LLM-as-judge

Three boxes: a person scores the golden set; the judge scores everything else; a person checks a sample each month; the rubric and four notes underneath
Who scores what. Arena (30 September 2026): AI judges agreed with other AI judges 79.4% of the time and with the human voter 56.9%; two judges agreeing is not evidence that either is right.

Scoring fifty drafts by hand takes an hour. You can ask a second model to apply the rubric instead: give it the customer email, the draft and the four criteria, and ask for a score with a one-line reason per criterion. This is LLM-as-judge. It is fast and consistent, and it is good enough to catch big regressions. It is not a replacement for people on anything that matters, because the judge can share the blind spots of the model it is judging. The rule: a person scores the golden set; the judge scores everything else, and a person checks a sample of the judge's scores each month.

5. Changing things safely: regression checks and cost

Every prompt edit and every model upgrade is a change that can make some cases better and others worse. Software teams call an unnoticed "worse" a regression. The golden set is your regression test.

Four steps: record, one change, re-run, keep or revert; below, two rows of twenty ticks and crosses showing 17/20 before and after with two cases fixed and two broken
Record, one change, re-run, keep or revert. The example shows why the total is not enough.
  1. Record the current score on the golden set (say 17/20).
  2. Make one change: a prompt edit, or a model swap. Not both.
  3. Rerun the golden set. Compare per item, not just the total: a change from 17/20 to 17/20 can still have fixed two cases and broken two others.
  4. Keep the change only if it is at least as good overall and breaks nothing that matters. Note the score, the change and the date in a changelog tab.

Cost tracking

Sum the cost column of the AI log per day and per workflow. Three numbers to watch: cost per run (rising means longer prompts or more loops), runs per day (rising means adoption, or a runaway trigger), and cost per correct outcome (cost divided by accuracy, the number that lets you compare a cheap-but-sloppy model with an expensive accurate one). Set a monthly budget per workflow and an alert at 80%.

Three tiles: cost per run, runs per day, cost per correct outcome, and a worked example comparing Gemini 2.5 Flash-Lite, Flash and Pro at list prices
Cost per correct outcome is the number that compares a cheap sloppy model with an expensive accurate one. Prices from ai.google.dev, October 2026; the accuracy figures are illustrative.

The one-sheet dashboard

A single tab with a pivot or four formulas is enough: runs per day, failures per day, cost per day, and the latest golden-set score. Chart the first three as lines over the last 30 days. Anyone who opens the sheet should understand the health of the workflow in ten seconds.

The Dashboard tab of the M12 Monitoring Google Sheet: a red KILL SWITCH cell, four tiles (runs today, failures today, cost last 30 days, latest golden-set score 18/20), a 30-day table and two line charts
The one-sheet dashboard, live on 28 October 2026: formulas only, over the AI log, the Needs human tab and the Changelog. The history is fictional seed data; the last two days are real runs.

6. Change management and the kill switch

An automation nobody trusts is switched off within a month. Adoption is a design task, not a launch email.

Five numbered habits (shadow mode, train the people in the loop, one-click feedback, publish the numbers, name an owner) and a red box with the four kill-switch requirements
Adoption is a design task. The kill switch: how, who (including out of hours), where it is written, and that it was tested once.

The kill switch

Before go-live, know exactly how to stop the workflow in under a minute (deactivate in n8n, turn off the Zap, disable the flow) and who is allowed to do it, including out of hours. Write it in the policy from Module 11 and test it once. An automation you cannot stop quickly is not under control.

Session 12 leads through two to three hours of own time to Session 13; a list of capstone deliverables that come from the Session 12 templates
What the capstone (Module 13, Day 7) will ask of you, and which templates from this module you reuse: the AI log row, the error branch, the golden set and scorer, the dashboard, the kill switch in the policy. Monitoring is 15 of the 100 marks.

7. Demo: instrument, break, score, change, score

Everything below was built and run on n8n Cloud (2.44.6) on 28 October 2026 for AI Caravan Ltd.'s support triage: the Module 10 gated flow on Gemini 2.5 Flash (Gateway credits, temperature 0), a golden-set scorer, and a judge on Gemini 2.5 Pro. The customers and every address are fictional; the numbers are real (content/day6_s12_runs.json in the instructor package).

n8n canvas of M12 Triage with AI log: Gmail trigger, Start timer, Classify email, Clean label, Log AI step (classify), Draft reply, Keep reply, Ask for approval, Decision, Log AI step (draft), Approved?, Send reply or Label needs human, Log sent or Log not sent; a Needs human (error) branch below
M12 Triage with AI log: the Module 10 flow instrumented. A timer before the classifier, a classifier that answers label|confidence, one AI log row after the classify step and another after the gate with the human decision, retry on both AI steps, their error outputs into the Needs human branch.
Video, recorded live: a real run writes the AI log row, then the model name is broken and the run lands in Needs human after three tries (narrated, with captions).
n8n canvas of M12 Golden set scorer: Run once, Read golden set, Only golden rows, Prompt version, Classify with Gemini, Compare, Append scores, Add up, Append changelog; a sticky note holds prompt v2
M12 Golden set scorer: read the Golden set tab, classify every row, compare with the agreed label, one Scores row per item, one Changelog row with the total. The v2 prompt waits in the sticky note.
Table of the twenty golden items with the agreed label, what prompt v1 said and what prompt v2 said; v1 wrong on items 9 and 19, v2 all green
Prompt v1 (the Session 10 classifier) 18/20: it called the conference e-mail sales and the paid-but-locked account billing, both marked hard. Prompt v2 (sharper definitions plus one example per category) 20/20. Each run took about 25 seconds and under 4,000 tokens.

The honest caveats

Confidence: the model answered 5 on 39 of 40 items, including the two it got wrong. Overfitting: v2 was written after reading v1's two failures, so part of 20/20 is the rules describing this set. A test you wrote after seeing the failures measures the failures you saw: the real test is next month's e-mails. Grow the set from production and re-score.

The Changelog tab: two rows, v1 18 of 20 and v2 20 of 20, kept pending
The Changelog after the two runs: date, version, change, score, kept (pending until a person compares per item in the Scores tab), by.
Video, recorded live: the scorer with prompt v1, the one change, the re-score, and the judge on six drafts (narrated, with captions).
DraftPlanted flawHuman 0-4Judge 0-4Agree?
1 duplicate chargenone44yes
2 refund within 24 hoursinvented timing, commitment22yes
3 "purge local storage"jargon, curt31no: the judge also failed "answers" and "safe"
4 generic thank-youdoes not answer33yes
5 "slots next week"none (the customer asked for next week)42no: the judge read it as a promise
6 40% education discountinvented price, commitment22yes

Four of six agree. On draft 3 the judge was stricter than the human, defensibly. On draft 5 the judge called "propose slots next week" an invented promise although the customer had asked for next week: a false positive a person would not make. That is why a person samples the judge.

The Judge tab: six rows with four yes/no checks, judge total, human total, agree and a one-line reason each
The judge's output: one row per draft, the human total next to it, and a one-line reason.
The Evaluations tab of an n8n workflow: wire up a test dataset, write outputs back, set a quality score, run in editor
The same idea, built in: every n8n workflow has an Evaluations tab where an Evaluation Trigger reads a dataset sheet and an Evaluation node writes outputs and a score back. The scorer above shows the mechanics in plain nodes; the built-in one is the next step.

Practical lab

Four parts. Label the golden set with a partner; instrument your Module 10 triage flow (AI log row, retry, error branch); score the classifier, change the prompt once, score again; run the judge, fill the dashboard, write the kill switch. Every step below was run on n8n Cloud 2.44.6 on 28 October 2026; the trap boxes are what we found on the way.

Files for this lab

1

Set up

Upload the workbook to Google Drive and Save as Google Sheets. Import the three JSON files; in every node with a warning pick your Google Sheets credential, the sheet From list and the tab by name; paste your test address into Send to myself. Open your Module 10 triage workflow (or import the Session 10 solution).

2

Two labellers

Golden set tab: cover column F. Label items 11 to 20 in column D; your partner labels them in column E without seeing yours. Compare with F. Where you disagreed, the row is probably marked hard: those decide whether a prompt change helped. If two people cannot agree on a case, the model cannot be marked wrong on it.

3

Timer and confidence

Add a Set node Start timer (started_at = {{ Date.now() }}, include other fields) before Classify email. Replace the prompt's last line with:

Reply with the label, a vertical bar, and a confidence from 1 (a guess) to 5 (certain), for example: billing|4 Nothing else: no punctuation, no explanation.

In Clean label split the answer: label, confidence, latency_ms (Date.now() - $('Start timer').item.json.started_at) and raw.

4

The AI log row

After Clean label: Google Sheets, Append row, tab AI log, map each column (handout table). The redacted input:

{{ ('Subject: ' + $('New email').item.json.subject + ' | ' + $('New email').item.json.text).replace(/[\w.+-]+@[\w-]+\.[\w.]+/g, '[email]').replace(/\+?\d[\d \-]{7,}\d/g, '[phone]').slice(0, 200) }}

Tokens are estimated as characters / 4 and priced at list price; latency comes from the timer; status ok; Cell Format RAW. Send a test e-mail, Execute, check the row. Downstream nodes must read $('Clean label').item.json.label: the Sheets node outputs the row it wrote, not your fields.

5

Retry and the human queue

Classify email, Settings: Retry On Fail, Max Tries 3, Wait Between Tries 5000 ms, On Error Continue (using error output). Connect the red output to a Sheets append on Needs human (timestamp, date, workflow, run id, step, subject, from, error) and then a Gmail Add label (needs-human). Test: change the model name to one that does not exist, send a test e-mail, Execute: three red tries, then the row and the label. Screenshot it. Restore the model name.

Trap 1: the five-second cap

n8n's Wait Between Tries accepts at most 5,000 ms, so three tries take about ten seconds in total. Good for a busy endpoint; for an outage the human queue is the real safety net.

Trap 2: never retry a send

Send reply and Ask for approval keep Retry On Fail off. A send may already have succeeded before the error arrived; retrying blindly sends twice. Retry the read, then decide again.

6

Score v1

M12 Golden set scorer, Execute workflow: twenty Gemini calls, about 25 seconds. Scores gets twenty rows (version, item, expected, got, confidence, correct); Changelog gets one row with the total. Ours: 18/20, items 9 and 19 wrong, confidence 5 on every item.

7

One change

Prompt version: version v2 and one line describing the change. Classify: replace the rules with the v2 text from the sticky note (sharper definitions, one example per category, none from the golden set). Nothing else: not the model, not the temperature.

8

Re-score and decide

Execute again. Changelog: a second row. Scores: sort by item and compare v1 with v2 line by line. Fill kept (yes/no) and by. Ours: 20/20, two fixed, none broken, kept = yes, with the caveat above.

Video, recorded live: the retry and error settings of the classify node, the error branch, the Dashboard tab and the kill switch (narrated, with captions).
9

The judge

M12 Reply judge, Execute. Judge tab: six rows, four yes/no checks, the judge's total, the human total, agree, a one-line reason. Where it disagrees with the human score, read the reason and decide who is right.

10

Dashboard, kill switch, owner

Dashboard tab: the tiles and the 30-day table are formulas over AI log, Needs human and Changelog; your rows are already counted. In B1 write how to stop the workflow in under a minute (Overview, the toggle to Unpublished), who may do it including out of hours, and the date you tested it. Test it now. Rows 40 and 41: the owner who reads the tab every Monday; the monthly budget and the 80% alert. Copy B1 into section 7 of your Session 11 policy.

Deliverable

The M12 Monitoring workbook: Golden set with your labels in D and E, AI log with at least one real row, Changelog with two scored runs and a kept decision, the Judge tab, the Dashboard with the kill switch in B1 and an owner in row 40; one screenshot of the failure branch running; the exported JSON of your instrumented triage. Save as M12-monitoring. Delete the test e-mails in Gmail.

Knowledge check

Pick one answer per question, then check your score. These mirror the style of the final exam.

1. Why is platform run history not enough for monitoring an AI step?

Why: An AI step can succeed technically and be wrong. Correctness has to be measured against known-good answers, which is what the golden set does.

2. A golden set should...

Why: Representative, agreed labels make the score meaningful; keeping examples out of the prompt ensures you measure skill, not recall.

3. When is LLM-as-judge appropriate?

Why: The judge is fast and consistent but can share the model's blind spots, so humans anchor the golden set and audit a sample.

4. You change the prompt and the golden-set score stays at 17/20. What should you check?

Why: Equal totals can hide regressions on specific cases. Compare item by item before keeping the change.

5. Which action should never be retried automatically without a check?

Why: A send may already have succeeded before the error was reported. Retrying blindly can send duplicates. Check first, then decide.

Self-check

Answer in your own words first, then open the model answer.

1. List the columns of an AI log row and explain why confidence is included.

Timestamp, workflow, run id, step, model, redacted input, output, confidence or category, tokens, cost, latency, human decision. Confidence enables escalation of uncertain cases and lets you evaluate whether the model knows when it is unsure.

2. Describe the four-step regression check.

Record the current golden-set score; make one change; rerun and compare per item; keep only if at least as good and nothing important broke, then note it in the changelog.

3. What is the kill switch and what must be true about it before go-live?

The documented way to stop the workflow in under a minute. Before go-live it must be written down, assigned to named people including out of hours, and tested once.

Summary

Key takeaways

  • AI steps can be wrong while succeeding, so monitoring means logs plus evaluation, not just error counts.
  • Log every AI call: redacted input, output, confidence, tokens, cost, latency, and any human decision.
  • Handle failure with retries (never on sends), fallbacks, a human queue and idempotency.
  • A 20-item golden set with agreed labels is your accuracy meter and your regression test; LLM-as-judge scales scoring but people anchor it.
  • Change one thing at a time, compare per item, track cost per correct outcome, keep a one-sheet dashboard, name an owner, and test the kill switch.

Further reading: Monitoring and observability (DevOps Lab, Module 11) · n8n: error handling and recovery strategies