How to Test an AI Agent Before It Goes Live

An agent that works in the demo has shown it can work. Being ready is something else: it means getting real cases right, against a criterion written down beforehand, well enough for the process owner to sign off on the error that remains.

Carlos Andrés Ramírez ·

An agent that works in the demo has shown it can work. Being ready is something else: it means getting real cases right, against a criterion written down beforehand, well enough for the process owner to sign off on the error that remains.

Picture an agent that classifies supplier invoices and proposes which cost centre each one is charged to. In the presentation it does well with ten invoices chosen by the team that built it. Two weeks into production it meets an invoice in two currencies, another with a credit note attached and a third from a supplier that changed its format in October. None of those were in the demo, and they are exactly the ones that matter at a month-end close.

The idea behind this article is simple: an agent is tested against the operation, not against the prototype, and the call that it is ready belongs to whoever answers for the process, not to whoever built it. Getting there takes three separate tests, each with an owner and a result you can read.

The short answer

How do you test an AI agent before putting it into production?

You test it in three steps, in this order: first against a set of real cases whose correct answer is already known, then in parallel with the people who do the work today, and finally against an exit threshold the process owner signed before testing began. If any of the three is missing, what you have is an impression, not a test. The impression tends to be favourable, because the agent almost always gets the ordinary cases right, which is why the mistakes show up with the first real customer.

First test

An agent is tested on the cases the operation already solved, the ugly ones included

The starting point is a reference set: real cases from recent months, each with the solution a person gave and someone with judgement confirmed. In the invoice example, that would be a few hundred invoices already coded and reviewed by accounting. You run the whole set through the agent and compare its proposal with the known answer.

What matters here is how the set is made up. If the technical team builds it, it will tend to be a set the agent passes. It has to be built with whoever runs the process, and it has to include the exceptions: the ambiguous cases, the ones that change format, the ones settled with a call to another department. A set on which the agent scores high without effort is a sign that hard cases are missing, not that the agent is excellent.

Second test

An agent is tested alongside the person, before it acts in their place

The reference set looks backwards. Production brings cases that have not happened yet, and the way to see them without risk is shadow mode: for a period the agent receives every new case and proposes its resolution, but the person is still the one who decides. At the end of each week the two answers are compared and, where they differ, someone reviews which one was right.

This test finds two things the first cannot. One is drift: the supplier that changes format, the policy that gets updated, the field that starts arriving empty. The other is the difference between errors. If the agent and the person disagree on a low-value invoice, the cost is small; if they disagree on a credit note with tax impact, it is large. An overall accuracy figure hides that difference, and shadow mode is where you see it.

An accuracy rate without the cost of each error describes the agent, but it does not say whether it can be put to work.

BECOME

Third test

An agent is ready when the process owner signs a threshold that was written before anything was measured

This is the one that usually goes missing, and it is what turns the other two into a decision. Before the first run, the person responsible for the process writes down what result they accept: which kinds of case the agent may resolve alone, which it only proposes and a person confirms, and which it stays out of. For each kind they set a tolerable level of error, based on what a mistake costs and not on what the agent happens to achieve.

Writing it down first changes the conversation. With the threshold fixed in advance, 94 per cent accuracy stops being a number everyone reads their own way and becomes a yes or a no. Without it, the criterion bends to the results: if the agent does well, it is celebrated, and if it does so-so, it turns out that "what matters is that it saves time". A test whose criterion moves after the score is seen proves nothing, and the only person who can set it is the one who will carry the error when it happens.

The framework

The three tests share the risk between them, and none replaces another

1. Reference set
It answers whether the agent can solve what the operation already solved. It is built by whoever runs the process, exceptions included. On its own it overrates the agent, because it only looks at known cases.
2. Shadow mode
It answers whether the agent keeps getting new cases right and how it differs from the people. The process owner reads it every week. On its own it is not enough, because it does not say how much error is acceptable.
3. Signed threshold
It answers when work can be handed to the agent and within what limit per kind of case. The process owner writes and signs it before measuring. Without the other two it is a number with no evidence behind it.

Take the agent that will soon go into production and ask the process owner to write, in half a page, which kinds of case it could resolve without review and how much error they would tolerate in each. If they cannot write it, that is the work still missing before any technical test.

Frequently asked questions

How do you test an AI agent before production?

With three tests in order: a set of real cases with known answers, exceptions included; a period in shadow mode, where the agent proposes and the person decides; and an exit threshold the process owner signs before measuring. Each covers a different risk, and none replaces the others.

What is shadow mode for an AI agent?

It is a period in which the agent receives real cases and proposes a resolution but does not act: the decision stays with the person. Both answers are compared and the differences are reviewed. It shows how the agent behaves with new cases without letting an error reach a customer.

What accuracy does an AI agent need before going to production?

There is no single figure that fits every case. It depends on what a mistake costs in each kind of decision: an error in an internal classification tolerates far more than one in a payment or a message to a customer. That is why the threshold is set per kind of case, by the person responsible for the process.

Who should approve an AI agent going into production?

Whoever answers for the process the agent will run, not the team that built it. The technical team reports how the agent behaves, but accepting a level of error is a business decision. It helps to write it down before testing starts, so the criterion does not bend to the results.

Let's define the exit threshold for your first agent

From the idea to the operation

An agent reaches operation once someone defines its limits, its exceptions and who owns the outcome. That gets designed and built.

About the author

Carlos Andrés Ramírez — Transformation Director

Specialist in business transformation and reinvention. Director of Specialised Programmes and lecturer in Artificial Intelligence at UPC's Graduate School.

LinkedIn