Why a good demo proves little
An agent that handled five questions well in a meeting can still fail on the sixth, and fail differently tomorrow. Model outputs vary between runs, real inputs are messier than demo inputs, and small changes have wide effects: a reworded instruction, a new document in the index or a provider's model update can fix one behaviour and break three others. Without a fixed test set, nobody can tell whether a change made things better or worse, and the argument is settled by whoever tried it last.
Evaluation turns 'it seems fine' into numbers per task, per risk and per release. It does not make an agent correct. It tells you how often it is wrong, in which ways, and whether that is acceptable.
Building the test set from real cases
The most useful test cases come from the work itself: past tickets, emails, documents and decisions, anonymised before they leave the system they live in. Invented examples miss the odd phrasing, missing fields and contradictory requests that real cases contain. Aim for coverage before volume:
- Common cases in the proportions they really occur, so the overall score means something.
- Edge cases: missing information, two requests in one message, conflicting records, Arabic and English mixed.
- Cases where the right answer is not to act: out-of-scope requests, a missing approval, a customer who should be passed to a person.
- Known failures from earlier versions, so they never return unnoticed.
Each case records more than a question and an answer:
| Field | What it holds |
|---|---|
| Input | The customer message, document or event that starts the run |
| Context | The records and documents the agent should see, frozen at a known state |
| Expected outcome | The correct decision, answer or end state, written by someone who knows the work |
| Must not happen | Actions that fail the case outright, such as a refund without approval |
| Risk tag and owner | How much a mistake would cost, and who decides when a label is disputed |
Testing what the agent does, not only what it says
An agent that takes actions needs its actions tested. We run it in a sandbox with fake versions of the CRM, help desk or ledger it works with, then check the end state as well as the text: was the right record changed, with the right values, and nothing else?
- Tool calls. The right tool, valid arguments and no calls outside the agent's permissions.
- Path and cost. How many steps and model calls a run took, so a correct answer that needed twenty tool calls is visible.
- Multi-turn behaviour. A simulated customer who changes their mind, gives partial details or pushes back.
- Repeat runs. Each case runs several times and the report shows how often it passes, because an agent that succeeds four times in five fails every fifth customer.
Three kinds of grader
Every result needs a score, and no single grader suits every check.
| Grader | Good for | Watch out for |
|---|---|---|
| Rules in code | Exact values, valid formats, required fields, forbidden actions, amounts within a tolerance | Only checks what can be stated precisely |
| A grading model | Tone, completeness, whether an answer is supported by its sources, comparing two versions | Known tendencies, such as favouring longer answers or the first option shown, so it must be checked against people |
| People who know the work | Judgement calls, domain correctness, Arabic register, and the labels the other graders are measured against | Slow and costly, and two reviewers can disagree, so use a written rubric and double-check a sample |
Use rules wherever you can, a grading model for what rules cannot express, and people for the labels and the high-risk cases. A grading model earns trust only once its scores agree closely enough with expert labels on the same cases; we measure that agreement and recheck it whenever the grader or the rubric changes. The LLM evaluation glossary entry defines the terms.
Red-team cases belong in the same suite
Adversarial cases belong in the regression suite, not in a one-off exercise. They include direct attempts to override instructions, instructions hidden in a document or email the agent reads, requests for another customer's data, attempts to push an action past its limits, and abusive or manipulative users. Each case states what a safe response looks like. AI red teaming finds new cases; the suite makes sure fixed weaknesses stay fixed. The attacks themselves are covered on our AI security page.
Thresholds the business signs off
Before launch, the people who own the workflow agree what good enough means for each category of case, not as one average. A typical shape:
| Category | Example | Shape of the threshold |
|---|---|---|
| Forbidden actions | Paying, deleting or disclosing without approval | Zero, across every repeat run |
| High-risk decisions | Refund eligibility, credit holds | Agreed with the business against how people perform on the same cases |
| Routine answers | Order status, policy questions | A minimum pass rate, with every failure reviewed |
| Hand-off | Cases the agent should pass to a person | It must recognise them: too many hand-offs cost time, too few create risk |
| Cost and latency | Model spend and response time per case | A budget per case and a limit on slow runs |
Where you can, measure your current process on the same cases, so the agent is compared with reality rather than with perfection. The go or no-go meeting itself is described in our article on testing AI agents before launch.
Regression runs on every change
Anything that can change behaviour triggers a run: edits to prompts and instructions, a new model or model version, changes to tools and schemas, new or updated documents in the index, and settings such as temperature. Providers update models too, so pin a dated model version where the provider offers one, and rerun the suite before you move to another.
- A fast subset runs on every pull request; the full suite runs before each release.
- Results are compared case by case with the previous run, so a fall in one category is not hidden by gains elsewhere.
- The test set is versioned like code, and every production failure becomes a new case, fed from AI monitoring.
What you receive
The evaluation harness lives in your repository and runs in your pipeline, so it keeps working after our part ends. You get the labelled test set with an owner for each area, the grader configurations and rubrics, a report per release with scores by category and every failed case, and a short guide to adding cases. The work is part of our AI agents and automation service and follows its rhythm: a threat review at the start, weekly demos and a plain-language plan. For the wider picture, read deploying AI agents safely.