How to test an AI agent before it touches real work
Why testing an agent is not like testing ordinary software
Ordinary software gives the same output for the same input, so a test can check for one correct answer. An agent is different. It reads free text, chooses its own steps and may phrase the same result in many ways. A passing test therefore means the output meets a standard, not that it matches one exact string.
Treat testing as a way to find where the agent fails before a customer or colleague does. The goal is not a perfect score. The goal is a clear list of the cases it handles well, the cases it gets wrong and the cases where it must hand over to a person.
Build the test set from real cases, including the awkward ones
Start with the work people actually do. Export a sample of past tasks from your inbox, helpdesk, CRM or spreadsheets, and remove personal data before the sample is used anywhere outside your own systems. Keep the mix realistic, so common tasks are covered well and rare ones are not forgotten.
Write the expected result for each case, or the expected action when there is no single correct text. Keep the set in a shared file with a short note on why each case is there, so a future tester understands its purpose. Include these groups:
- Typical cases: the everyday requests the agent should handle without help.
- Awkward cases: incomplete records, two customers with the same name, a price that changed mid-quote, or an enquiry that mixes Traditional Chinese and English.
- Cases that must go to a person: complaints, legal wording, refunds and anything involving money.
- Known failures: every case where a person previously had to fix the work by hand.
Score each output against a written standard
Decide before you run the tests what a good output looks like. Write the standard as a short checklist a reviewer can apply to every case, such as: uses only facts in the supplied records, follows the required format, names the correct customer and asks a person before anything is sent. Use the same reviewer or the same rubric, so scores mean the same thing from one run to the next.
Score the actions as well as the words. An agent that writes a good draft but then updates the wrong record has failed, even though the text looks fine. Record three things for each case:
- Correct: the answer or draft meets the standard.
- Right actions: the agent used the intended tools and no others.
- Right stop: the agent escalated the cases it should not decide on its own.
Run regression tests whenever something changes
An agent can get worse without anyone touching its code. A model provider may release a new version, a prompt may be edited to fix one case, or a connected system may rename a field. Each of these can break cases that used to pass. Run the full test set after every change, and compare the new scores with the last accepted run.
Keep a record of every run: the date, the prompt version, the model name, the tool versions and the scores. When a score drops, you can see which change caused it. Check each provider's release notes and deprecation notices on its official documentation site, since those notices are where behaviour changes are announced.
Test the guardrails as hard as the answers
Guardrails are the limits on what the agent may do: which systems it can write to, how many steps it may take and when it must stop. Test them directly rather than assuming they work. Write cases that push the agent past its limits, such as a request to email a whole client list or to change a price it is not allowed to change. Include hostile input too, such as text inside a document that tells the agent to ignore its instructions. Expect the agent to refuse and to escalate.
A guardrail that has never been tested is a hope, not a control. Check that a loop stops at the step limit, that a missing record produces a question rather than a guess, and that an action needing approval really waits for one.
Who signs off before launch
Name one person who owns the business result, usually the manager of the process the agent will support, and make that person sign off. Engineers can confirm the system runs as designed. Only the owner can confirm the answers are good enough for customers and staff. Write the sign-off rule down: the scores that must be reached, the cases that must pass in full, and any known failures accepted with a plan to fix them.
Launch in stages. Let the agent draft while a person approves every output, then widen its permissions only after the logs show the behaviour you expect. Keep the test set running after launch, because real use reveals cases nobody thought of, and each new failure should be added to the set.
How Hundred Seas helps
Hundred Seas is a product studio in Taipei. We build AI agents and AI CRM systems on Claude and on OpenAI models, and we choose the model for each task on cost, speed, quality and where the client's data has to stay. We are a registered partner in Anthropic's Claude Partner Network and an OpenAI partner.
Work starts with a scope step of about one week at a fixed price, ending in a written plan, a clickable prototype and a firm quote. The build follows in weekly releases of working software, and a monthly run plan keeps the agent running and up to date.
Questions
- How many test cases do I need before launch?
- There is no universal number. Start with enough real cases to cover your common tasks, your awkward cases and every known failure from the old process. A small, well-chosen set that the business owner trusts is more useful than a large set nobody reviewed. Add a case each time live use reveals a new failure.
- Can I test an agent with made-up examples?
- You can start with made-up examples to check the basics, but they rarely show the messy input real customers send. Use real past cases wherever you can, with personal data removed first. Invented cases are most useful for guardrail tests, such as a request the agent must refuse.
- Who should score the outputs?
- Someone who knows the work well and was not involved in building the agent, so they judge the output rather than the intention behind it. Give them a written standard and a short rubric. Where two reviewers disagree, discuss the case and refine the standard so future scores stay consistent.
- How often should I rerun the tests?
- Rerun the full set after every change to the prompt, the model, a connected tool or the data the agent reads. Also rerun it on a regular schedule, because a provider can change how a model behaves when it updates that model. Compare each result with the last accepted run before you release anything.
- Is a passing test set enough to launch?
- It is necessary but not sufficient. A passing set shows the agent meets the standard on the cases you chose, but it does not prove it will handle every case. Launch with human approval on each outbound action, keep the logs, and treat the first weeks of live use as a continuation of testing.