Skip to content

Agent prompt testing: how to test agent prompts and outputs

Agent prompt testing means lifting one prompt out of an AI agent, running it over a fixed dataset of real inputs, and scoring every output, so you can test agent prompts the same way you test any other prompt. The system prompt, the tool-routing prompt, the extraction step and each sub-agent's rubric all get a number you can set beside the last version's. You evaluate agent outputs with deterministic checks for the rules a script can decide and an LLM judge for the rest, and a one-line edit to the system prompt stops being a hunch and becomes a measurement.

The tooling for testing AI agents is arriving fast. LangWatch's Scenario framework runs your agent through simulated conversations and grades how it behaves: which tools it reached for, whether it recovered from a bad step, whether it stayed on task. Anthropic's engineering team published a guide on evaluating task-doing agents end to end, scoring whole runs with code, model, and human graders. Both are real, both are useful, and both look at the whole agent from the outside. Agent prompt testing looks inside it.

When an agent misfires in production, the orchestration and the base model get the blame first, and sometimes they earn it: coordination between sub-agents, brittle tool calls, and context stuffed past what the model can track are all real, common causes. But one of the largest single shares of documented agent failures traces back to the instructions themselves, and the prompt is the one part of the stack that routinely ships with no tests at all. The system prompt drifted when someone added an instruction. The tool-selection prompt is ambiguous about which tool to reach for. A sub-agent's grading rubric is looser than anyone realised. The other layers at least have tools pointed at them; the prompt ships on a hunch.

An agent is a stack of prompts

Strip the framework away and an agent is a handful of prompts run in a loop. The reason-and-act pattern that ReAct described in 2022 is still the shape of it: the model reads context, decides on an action, sees the result, and goes again. Around that loop sit prompts doing specific jobs. A system prompt sets the agent's role and its rules. A routing prompt picks the next tool. A classification prompt decides what kind of request just came in. An extraction prompt turns a messy email into structured fields. A summarization prompt compresses a long thread before the next step. Sub-agents carry their own prompts and their own rubrics.

Every one of those is a prompt with an input and an output, which means every one of them is testable the ordinary way. You do not need the whole agent spun up to check whether the extraction prompt handles a forwarded email with three timezones in it. You need that prompt, a dataset of awkward inputs, and a metric. The framework is orchestration; the prompt is the part that actually has to be correct.

How to test agent prompts

The steps are the ones you would follow for any prompt. The only new work is deciding which prompt inside the agent to pull out first, and the answer is usually the one closest to the last thing that went wrong.

  1. Pick one prompt. Take a single step of the agent, with its template and the variables it fills in, and test it on its own.
  2. Gather real inputs. Collect what that step actually receives in production, weighted toward the awkward cases. The guide to building a prompt eval dataset covers where to find them.
  3. Write down what good looks like. Some of it is a rule (the output is valid JSON, a field is one of a fixed set of values) and some of it needs reading (did it understand what the sender meant).
  4. Run the prompt over every row. Every input gets an output, and every output gets scored.
  5. Compare against the last version. Read the rows whose scores moved, not just the average.

Take an agent that books meetings. Somewhere inside it is a prompt whose only job is to read an inbound message and pull out the details: who is invited, how long, and which timezone the sender means. That prompt is where the agent quietly gets things wrong, and it is a prompt you can test on its own.

The clean request ("a 30-minute call with Sarah tomorrow at 2pm") is the case it already handles, so it earns one row at most. Collect a few dozen real messages, the messier the better: the ones with two timezones, the ones that say "sometime next week", the reply that only makes sense with the quoted thread underneath, the reschedule that cancels one slot and proposes another. Include the messages that leave something out entirely, because the right output there is a gap the agent asks about, not a guess it books.

How to evaluate agent outputs

Point a run at that dataset and grade the output with a mix of checks and a judge. A deterministic check confirms the output is valid JSON with the required fields. A second check confirms the timezone is one of the allowed values. A check passes or fails and gives the same answer every time, so it is the right tool for anything a rule can decide. A rubric metric, scored by an LLM judge from 1 to 5, asks the harder question: did it pick the timezone the sender actually meant, not just a plausible one? Now a change to that extraction prompt has a before and after, and the row where it started guessing California time for a sender in London is right there in the diff. That per-row diff, kept up on every change, is prompt regression testing, and it is what stops a fix for one new case from quietly breaking the old ones.

You can also evaluate outputs the agent has already produced. If you have logs of what the extraction step returned in production, drop them into a column and score them with a judge-only run: no need to re-run the agent, just grade what it already did. That is a quick way to audit a step that has been live for months, and it turns up the inputs worth keeping. When the agent gets something wrong in production, add that input to the dataset, so the same failure has to get past the test suite before it can come back.

Agent prompt testing vs agent evaluation vs observability

Three different things get filed under "testing agents", and it pays to keep them apart, because they answer different questions and you probably want all three.

Agent behavior evaluation asks whether the agent took a good path: did it pick the right tools, in the right order, recover when one failed, stay on task across turns. The unit here is a whole trajectory, not a single prompt and its output. This is the layer Inngest's AgentKit dev server lets you trace and rerun, step by step. It is real work, and it is hard, and it is not what agent prompt testing does.

Observability watches the live agent in production and reports what already happened: latency, cost, which runs errored, a trace of each one to debug. It is the rear-view mirror of the three, and you want one. What it cannot do is tell you, before anything ships, whether the prompt edit you made this morning is safe to release.

Agent prompt testing sits at the layer underneath the behavior and before production: the individual prompts and the outputs they produce, scored against a fixed dataset you control. It is the test drive to observability's rear-view mirror, and the component test to behavior evaluation's integration test. A well-behaved trajectory is built out of prompts that each do their job, and agent prompt testing is how you keep each one doing it.

The prompt is the portable part

There is a practical reason to start at the prompt layer: it is the piece that survives everything else. You will swap models when a better or a cheaper one lands. You will move off one agent framework and onto another, or drop the framework and orchestrate the loop yourself. Through all of it, the extraction prompt and its rubric are the same artifact, and the dataset you test them on is the same bar. A prompt test does not care which framework runs the agent, so it keeps paying off across the churn that agent tooling is going through right now.

It is also the layer you can start on today, without waiting for a full agent-testing platform to settle. If your prompts are already versioned, every score points at the exact version that earned it, and testing the ones inside an agent is not a new discipline. It is the same discipline, pointed at where the agent actually breaks.

In CompletionKit, each prompt in the agent becomes a versioned prompt, and a run scores it over a dataset with your checks and a 1-to-5 judge. The same run can be started from CI over the REST API, or from your coding agent through the MCP server, and paid plans are a flat monthly price for the whole team, not a charge per seat. The docs walk through setting up a dataset, a run, and the checks.

FAQ

What is agent prompt testing?

It means scoring the prompts inside an AI agent against a fixed dataset, the same way you would test any prompt. You pull a prompt out of the agent (the system prompt, a tool-selection prompt, an extraction prompt), run it over representative inputs, and grade the outputs with deterministic checks or an LLM judge, producing a score you can compare across versions.

How is agent prompt testing different from agent evaluation?

Agent evaluation judges the whole trajectory: did the agent pick the right tools, in the right order, and recover when one failed. Agent prompt testing judges one layer down, the individual prompts and the outputs they produce, against a fixed dataset you control. Behavior evaluation is the integration test; prompt testing is the component test. Most teams want both.

Can I test my agent's prompts without a dedicated agent-testing platform?

Yes. A prompt inside an agent is still a prompt with an input and an output, so you can test it in isolation: a dataset of real inputs, deterministic checks, and an LLM judge for the open-ended parts. You can also score the outputs the agent already produced in production with a judge-only run, without re-running the agent.

How do you evaluate agent outputs?

You score each output against what good looks like for that step. Rules a script can decide, such as valid JSON, required fields, or a value from a fixed list, go to deterministic checks that pass or fail. Qualities that need reading, such as whether the agent picked the timezone the sender meant, go to an LLM judge that scores a rubric from 1 to 5, where 5 is best. If the outputs already sit in production logs, a judge-only run scores them without re-running the agent.

Which prompt in an agent should I test first?

Start with the one closest to the last thing that went wrong in production, because you already have the failing input and know what the right output was. After that, test the prompts whose mistakes cost the most downstream: an extraction or routing step feeds every later step, so an error there spreads, while a summary that runs last only affects itself.

Test your agent's prompts free   What is prompt evaluation?

Built by Homemade Software. Disagree with any of this? support@completionkit.com or r/completionkit.

← All posts