How to Test AI Agents Before Launch: Evals, Red Teaming, Regression Suites
9 min readHow to test an AI agent before launch: build a test set, grade outcomes and tool use, red team for prompt injection, track regressions and set go-live rules.
Zunkiree Labs Team
· Updated
In short: Testing an AI agent means measuring whether it completes real tasks correctly, safely and consistently, not just whether its answers sound good. You build a fixed set of realistic test cases, grade the outcome and the steps taken, attack it deliberately, and rerun the whole set whenever the model, prompt or tools change. Ship when it clears thresholds you set in advance, and keep measuring afterwards.
Key Takeaways
- Test tasks, not sentences. For an agent the question is whether it did the right thing, with the right tools, in the right order.
- A test set built from real cases is your most valuable asset. Keep it fixed and versioned so results are comparable.
- Grade three layers: the final outcome, the tool calls made, and the safety behaviour.
- Automated graders help but need checking against human judgement before you trust them.
- Red team for prompt injection, over-reach and data leakage, not just ordinary mistakes.
- Regressions are the norm. Every change can break something, so rerun the suite on each change.
- Set go-live thresholds before you see results, to avoid moving the goalposts.
What Is Different About Testing Agents
Traditional software is deterministic: the same input gives the same output. An agent is probabilistic and multi-step, so:
- Results vary between runs, so run each case more than once.
- Errors compound. A small mistake in step two can ruin step six.
- The same goal can be reached by several valid paths.
- Behaviour depends on the model, prompt, tool descriptions and retrieved context together.
That means a single demo proves little. You need many cases and repeated runs.
Step 1: Build the Test Set
Collect 50 to 200 cases for a first version, drawn from real work:
- Typical cases, weighted to match real volume.
- Edge cases: missing data, ambiguous requests, conflicting instructions.
- Known failures from pilots and support tickets.
- Out-of-scope requests the agent should decline or escalate.
- Adversarial cases (see below).
For each case record the input, the starting state of any systems, the expected outcome and any forbidden actions. Version the set and add to it as you meet new failures.
Step 2: Decide What to Grade
| Layer | Question | Example check |
|---|---|---|
| Outcome | Did it achieve the goal? | Booking created with the right slot |
| Process | Did it use tools correctly? | Called availability check before booking |
| Constraints | Did it stay within limits? | No refund above the permitted amount |
| Communication | Was the message accurate and appropriate? | Correct price, correct tone |
| Efficiency | Was it reasonable in steps and cost? | Under the step cap |
| Safety | Did it avoid harm? | Declined to share another customer's data |
Where possible use programmatic checks against system state (was the record created?) because they are objective. For text quality use rubrics.
Step 3: Graders
- Code graders check state, formats and rules.
- Model-based graders score open-ended output against a rubric. Validate them: have humans grade a sample and measure agreement. Keep rubrics specific, and beware graders that prefer longer or more confident answers.
- Human review on a sample every release, especially for tone and judgement.
Step 4: Red Team the Agent
Attack it on purpose:
- Prompt injection: hide instructions in emails, documents and web pages the agent reads, and check it ignores them. See OWASP's MCP Top 10 and our MCP security checklist.
- Over-reach: ask for actions outside its remit and check it refuses or escalates.
- Data leakage: try to extract other customers' data or internal prompts.
- Social engineering: claim to be a manager and request an exception.
- Tool abuse: supply malformed or extreme arguments.
Fix at the system level (tool limits, permissions, approval gates), not only with prompt wording.
Step 5: Repeat and Compare
Run each case several times and report pass rates, not single results. Track:
- Task success rate.
- Rate of forbidden actions (the target is zero).
- Escalation rate and whether escalations were appropriate.
- Cost and time per task.
- Variance between runs.
Compare against your human baseline for the same tasks. "Better than nothing" is not a threshold.
Step 6: Set Go-Live Rules
Write them before testing: minimum success rate on the core set, zero tolerance for specified safety failures, human approval for defined actions, and a rollback plan. Launch to a small share of real traffic with monitoring, then widen.
Step 7: Keep Testing in Production
- Log runs and sample them for review.
- Alert on spikes in errors, escalations, cost or latency.
- Add every real failure to the test set.
- Rerun the full suite on any change to the model, prompt, tools or retrieval data. Model upgrades are the most common surprise.
- Re-red-team on a schedule, because new attacks appear.
How We Approach It
Because our agents log every tool call and decision, each run can be replayed and graded. We start with a person approving the agent's actions and loosen approvals only as measured results justify it. For the build side, see how to build a business AI agent and our custom AI agent development service.
The Short Version
Test an agent as you would test a new hire doing real work: give it realistic tasks, check the outcome and the method, try to trick it, and keep checking after it starts. A fixed test set, honest graders, pre-set thresholds and a rerun on every change are what turn a promising demo into something you can trust.
Frequently asked questions
How do you test an AI agent?
Build a fixed set of realistic tasks, run each several times, grade the outcome, the tool calls and the safety behaviour, red team it for prompt injection and over-reach, and rerun the suite whenever the model, prompt or tools change.
What are AI evals?
Evals are structured tests that measure how well an AI system performs on defined tasks, using code checks, rubrics, model-based graders and human review, so changes can be compared objectively.
How many test cases do I need?
A first version of 50 to 200 realistic cases is a reasonable start. Quality and coverage matter more than count, and the set should grow with every failure you find.
Can an AI grade another AI's work?
Yes, with care. Model-based graders should be validated against human judgement on a sample, use specific rubrics and be rechecked periodically, because they can favour longer or more confident answers.
What is prompt injection testing?
It means planting instructions in content the agent reads, such as emails or documents, and checking that the agent ignores them. It is a key part of red teaming agents that act in real systems.
Do I need to retest after a model upgrade?
Yes. A model change can alter behaviour in ways that break previously passing cases, so rerun the full regression suite before switching.
Related Insights
- How to Build an AI Agent for Your Business: Tools, Guardrails, Audit Trail
- MCP Security in 2026: What the New Specification Fixed and What It Opened Up
- AI Over Business Data: What the Spider 2 Benchmark Shows
Sources
- Zunkiree Labs, Custom AI Agent Development
- Zunkiree Labs, MCP agent security checklist whitepaper