An agent can book the meeting, pull the right file, draft the email and update the CRM, all in one smooth run during the demo. Then it goes live, meets a customer who changes their mind halfway through, and quietly does the wrong thing three steps later. Nobody notices until someone downstream asks why the numbers don’t add up.

The surprising part is that the model is often not the thing that failed. The team simply never agreed on what a correct outcome looks like, so nobody could tell when the agent was drifting. In this guide we explain how we think about building and evaluating AI agents, what to measure, and where the guardrails should sit, so you can tell a convincing demo from a system you can trust with real work.

What an AI agent actually is

A plain chatbot answers a question. An agent is a language model wired up to do something: it calls tools, reads results, decides on a next step, and loops until it thinks the job is finished. The tools might be a search index, a database, a ticketing system, a payment API or an internal script.

That loop is what makes agents useful and also what makes them hard to test. A single wrong answer from a chatbot is one bad sentence. A wrong decision early in an agent’s run can ripple through every step after it, and each step can look reasonable on its own.

Because of this, the question is no longer “is the model smart enough?” It becomes “given this set of tools, this data and these permissions, does the whole run end in the right place, at a sensible cost, and does it stop when it should?”

Why demos flatter agents

Demos are built on the easiest path through the problem. The person running the demo chooses the input, knows which tools work, and quietly steers around the awkward cases. Production is the opposite. Inputs are typos, half-finished requests, contradictory instructions and documents that are three versions out of date.

We see the same pattern in most stalled projects. The demo team and the team that has to run the system are often different people with different goals. The demo team is rewarded for an impressive run. The operations team inherits the edge cases and the cost. Somewhere in that handoff, the project loses its footing.

Clean inputs versus messy inputs

A demo usually works with a tidy prompt and a handful of documents. Real use means thousands of requests, some of which the agent has never seen in any form. Testing has to deliberately include those odd cases, including the ones you hope never happen.

One success versus a pattern of success

An agent that succeeds once has shown you very little. What matters is the rate at which it succeeds across a representative spread of tasks, and whether the failures are the kind you can live with. An agent that fails safely by asking a person for help is often more valuable than one that succeeds ninety-nine times and does something damaging the hundredth time.

What to measure

Vague goals produce vague evaluations. “The agent seems good” is not a test result. Before you judge an agent, write down what done looks like for each task type, then measure against that. We usually recommend tracking a small set of numbers together:

The last two are the ones teams most often skip. An agent that quietly takes forty steps to do a five-step job will look fine in a demo and become expensive and slow in production. We explore the wider measurement question in our guide to AI model performance metrics that matter to your business.

Building an evaluation harness

An evaluation harness is the set of test cases, scoring rules and replay tooling that lets you run the same checks every time something changes. Without one, every update to a prompt, model or tool is a gamble.

A practical harness usually has four parts.

1. A test set drawn from real work

Start with real requests, anonymised where necessary. Pull them from support logs, ticket queues, or the people who currently do the job by hand. Include the boring cases, the ambiguous ones and the ones that have caused trouble before. A test set built only from ideal examples measures how well the agent handles ideal examples, which is not very useful.

2. Known-good answers and clear pass rules

For each case, define what a correct outcome looks like. Sometimes that is an exact value. Often it is a set of conditions: the right record was updated, no personal data appeared in the output, and the summary mentioned the open item. Write these rules down before you run the agent, not after you have seen what it did.

3. Adversarial and failure-mode cases

Deliberately try to break the agent. Give it conflicting instructions, incomplete data, requests for things it should refuse, and inputs designed to push it past its permissions. This is where you find out whether it fails gracefully. Our piece on LLM hallucinations, detection and prevention covers the kinds of wrong answers that look convincing and are hardest to catch.

4. Regression runs on every change

Every time you change the prompt, swap a model, add a tool or update a document source, rerun the full set. Compare the results against the last known state. A change that improves one case and quietly breaks five others is common, and you only see it if the whole suite runs each time.

Alongside automated scoring, keep a human review sample. Automated checks catch what you thought to check. Reviewers catch what you didn’t.

Guardrails, permissions and the audit trail

An agent should never have more access than the task needs. This principle of least privilege sounds obvious, but agents often arrive with broad credentials because it was easier to set up that way during the pilot. Strip those back before production.

A few guardrails we would expect to see in any serious deployment:

That last point matters more than people expect. When something goes wrong, the first question from the business is usually “what exactly did it do?” If you cannot answer that from the logs, the incident becomes a debate instead of a fix. Our article on building audit trails your board will actually sign off on goes deeper on what those records should contain.

For the access side of the picture, see our guide to AI access control and governance beyond authentication.

The honest pros and cons of agents

Agents are not the right tool for every job, and it is worth being clear about the trade-offs before you commit.

On the plus side, agents can handle multi-step work that used to need a person to shuttle information between systems. They can cope with variation in inputs better than rigid scripts, and they can often be extended by adding a tool rather than rebuilding a process.

On the downside, they are harder to test than deterministic software, their costs can be less predictable, and their failures can be subtle. An agent can be right ninety percent of the time and still be the wrong choice if the remaining ten percent is expensive or hard to spot.

This is why we often suggest asking whether a fixed workflow would do the job more reliably. Our guide on agentic automation versus rule-based systems, and when to switch walks through that decision.

What the wider field is telling us

The direction of recent work points the same way. MIT Technology Review’s newsletter The Download has been returning to the idea of an agentic web, where software agents act on behalf of people across many services. That framing raises the stakes for testing, because an agent’s mistakes stop being contained inside one app.

On the research side, OpenAI has published work measuring how AI agents handle everyday wet-lab science, which is a useful reminder that evaluating agents on realistic, domain-specific tasks is becoming the norm rather than the exception. Hugging Face has also described ToyBlocks, a controlled environment built for robot learning and evaluation, showing how researchers are building contained test worlds so behaviour can be measured repeatedly.

We take a practical lesson from all of this. Whatever the research setting, the principle carries over to business systems: define the task, build a controlled way to test it, measure the outcome, and rerun the checks whenever something changes. You can read the original pieces here: The Download from MIT Technology Review, OpenAI on measuring AI agents in wet-lab science, and Hugging Face on ToyBlocks.

Where to start if you are already partway there

Most teams we talk to are not starting from zero. They have a pilot that works in the demo, a few users who like it, and a growing worry about what happens at scale. The first step is usually a clear picture of where things stand.

Our Diagnostic Sprint is built for that moment. Over two weeks, we audit what you have, identify the gaps in your evaluation, permissions and monitoring, and put together a cost and risk exposure report. You finish with a prioritised build plan, so you can decide what to fix first and what the business case looks like before you commit further. You can read more about the approach on our services page.

If you are weighing up whether to build the agent layer yourself or buy it in, our article on build versus buy for AI infrastructure covers the reasoning that usually decides it.

Frequently asked questions

How is evaluating an agent different from evaluating a chatbot?

A chatbot is usually judged on the quality of a single reply. An agent is judged on the whole run: the sequence of decisions, the tools it called, the final state it left behind, and whether it stopped at the right moment. That means your tests need to check outcomes and actions, not just text.

How many test cases do we need before going live?

There is no universal number. What matters is coverage: the common task types, the awkward edge cases and the known failure modes should all be represented. A smaller set built from real work is worth more than a large set of invented examples.

Should a person review everything an agent does?

Not necessarily. A better approach is to put approval steps around irreversible or high-impact actions, sample a portion of routine runs for human review, and watch escalation rates over time. The right balance depends on what the agent is allowed to change.

What is the first thing to fix if our agent is unreliable?

In our experience it is rarely the prompt alone. Start by checking the data the agent retrieves, the tools it has access to and the clarity of the success criteria. Those three areas cause more trouble than wording changes do.

Talk to us about your agent

If you have an agent in a demo, a pilot that is struggling to leave the lab, or a production system that nobody fully trusts, we are glad to help you work out what to do next. You can get in touch through our contact page and we will respond to your enquiry, and we can talk through whether a Diagnostic Sprint makes sense for where you are right now.