Prohelp AI
All insights

How we test an AI agent before customers see it

Checking an agent's final answers is not enough. What we measure instead, how often the tests run, and where a person still reviews the results.

"Did it answer correctly?" is only half of what you need to know about an agent. An agent can reach the right answer by a broken route: a lucky search result, the wrong tool, or flawed reasoning that happened to land on the right number. Routes like that break as soon as the questions change, so we test the route as well as the answer.

In short

Before an agent talks to your customers, we write test cases with you: real examples of what customers ask, what the agent should do and what it must never do. We score the agent against them all through the build, on five separate measures. A short set of tests runs on every change and the full set runs every night. Each week a person reviews a sample of the automatic scores, because the automatic scoring makes mistakes too.

Why answer checks are not enough

Most teams start with a fixed list: around 30 questions and 30 expected answers, scored by exact match or by an AI model judging how similar the answers are. That works for a simple FAQ chatbot. An agent needs more, for three reasons.

  1. The route matters. Agents reach answers by using tools, such as looking up an order. The same correct answer can come from the right sequence of steps or from a wrong sequence that got lucky, and only the first one keeps working as volume grows.
  2. Conversations drift. Single-question tests miss the case where the agent's third reply contradicts its first.
  3. Correct answers are worded differently. "The order ships tomorrow" and "Your order is booked for next-day delivery" are both right. An exact-match check fails the second one, and a similarity score gives it a middling mark. Neither result tells you much.

A test that only checks for exact wording mostly tells you whether the agent repeats itself, not whether it helped the customer.

The five things we score

We score these five separately on every agent build. Rolling them into one quality score hides the failures you most need to see.

  1. Outcome. Did the agent get the customer what they wanted? Scored pass or fail by an AI judge working from written rules, with spot checks by a person.
  2. Path. Did it use the right tools in the right order? Compared with a reference for each test case.
  3. Refusals. When it should have refused or asked a clarifying question, did it? This catches agents that act too eagerly.
  4. Made-up facts. How often does it state something that its tools or documents do not support? Scored by a separate check built to catch unsupported claims.
  5. Cost and speed. What each conversation costs and how long customers wait for a reply. If two answers are both correct, we prefer the one that costs less and returns faster.

Writing the test cases

Every agent needs its own test cases. We write them with the client before the build starts, and the set grows as the build goes on. Each case says what the customer wants, which steps the agent must take, which it must never take, and when it should ask a question instead of acting. There is an example in the section for your IT team at the end.

Most production agents end up with somewhere between 50 and 200 cases. Covering every possible message is a waste of effort. The cases should represent the failures you care about most.

How often the tests run

If the tests only run when someone remembers, people stop trusting them. We set them up in three layers:

  • A short set on every change. 10 to 20 quick cases that finish in under 90 seconds. If any score drops below its threshold, the change does not go out.
  • The full set every night. Every case runs once a day, and a short report of what changed goes to the team.
  • A sample of live conversations. 1 to 5% of real conversations are scored the same way, which shows when live behaviour starts to drift.

A test suite that passes when it should fail is dangerous, because the team stops checking by hand.

Where people still check

For two of the five measures, outcome and made-up facts, an AI judge is good enough most of the time. When it is wrong, though, the mistakes are worth studying. Each week a person reviews 5 to 10% of the judge's decisions, and we use the disagreements to improve the judge's rules.

The other three measures (path, refusals, and cost and speed) are mechanical and do not need a person. That leaves people to do what they are better at than the model, which is judging meaning in unclear cases.

Common mistakes

  • Writing for the test set. The team learns to pass the same 30 cases. Add new cases every few weeks.
  • One overall quality score. It hides failures. Report the five measures separately.
  • No sampling of live conversations. Offline tests drift away from real traffic within weeks.
  • AI judges that nobody checks. Judges tend to reward longer answers and can be fooled by confident wrong ones, so compare them with human reviewers every week.
  • Speed limits set on the average. Customers notice the slowest replies, so set the limit on those (the 95th percentile).

Prompts and models will change every few months. The test cases you write with us will still apply, so that is where we put the effort.

For your IT team

One test case for a support agent, and how it is scored:

# Test case: "I want to change my shipping address"
goal:        update_shipping_address(order_id, new_address)
must_call:   [lookup_order, verify_identity, update_address]
must_not:    [cancel_order, refund]
clarify_if:  no order_id in conversation
refuse_if:   identity verification fails twice
expected:    confirmation with new address + ETA

# Scoring (per test case)
outcome:       1.0 if address actually changed in system
path:          1.0 if must_call sequence present, must_not absent
refusal:       1.0 if clarify/refuse rules followed
hallucination: 1.0 if no facts asserted outside tool output
latency:       p95 ≤ 4.0 s

The short set runs in CI on every pull request and blocks the merge if a threshold drops. The full set runs nightly against the main branch. Outcome and hallucination use an LLM judge with a written rubric. Path, refusals and latency are checked in code. We report p50 and p95 latency, tokens and tool calls per conversation.

Have a process like this in your business?

Tell us how it works today and where it slows down. We'll say plainly whether automation is worth it, and what we would build first.

Book a meeting
Prohelp team
Prohelp AI

Prohelp AI builds automation for UAE businesses from Dubai. These notes come from our client projects.

Next step

A question about this article?

Email us, or book a meeting and we can go through it with your own process in mind.