You cannot test an agent the way you test a function

Adopt testing built for non-deterministic systems, distributions and traces rather than fixed assertions, and you can actually gate an agent for production. Reuse your unit-test playbook and you ship something you never really tested.

B

Balagei G Nagarajan

3 MIN READ


A non-deterministic agent producing varying runs that defeat fixed-assertion testing
Test the outcome and the trace, not the agent's word and not a single run.
— from “You cannot test an agent the way you test a function”

Key facts.

  • PALADIN documents that agents frequently report success when a tool actually failed, so a test that trusts the agent's own success signal passes broken runs. source
  • OpenTelemetry now publishes GenAI semantic conventions for tracing agent spans, giving testing a standard way to inspect what actually happened in a run. source

Why does ordinary testing fail on agents?

A unit test assumes determinism: the same input yields the same output, so you assert on that output and move on. An agent breaks the assumption. The same prompt can take a different path, call different tools and produce a different answer each run, so a fixed assertion either flickers red on correct runs or, worse, passes once and tells you nothing about the next thousand. SLAs inherit the problem: a single green run is not a guarantee when the behavior is a distribution. Testing an agent means testing the distribution, the success rate across many runs, the variance, the tail, not a single execution.

The silent-success failure is why you also cannot trust the agent's own report of how it did. PALADIN shows agents routinely claim success when the tool underneath failed, so a test that checks "did the agent say it worked" passes exactly the runs you most need to catch. Real testing has to read the trace, did the action actually happen downstream, did the tool return what the agent assumed, which is where the OpenTelemetry GenAI conventions help by giving a standard way to capture and inspect what occurred. Test the outcome and the trace, not the agent's word and not a single run.

A scatter of varying agent runs with a success-rate distribution instead of a single pass/fail

What does agent-appropriate testing look like?

DimensionUnit-test playbookNon-deterministic testing
RunsOneMany, as a distribution
AssertionExact outputOutcome and constraints
Success signalAgent's own reportThe trace of what happened
SLA basisA green runMeasured success rate

Testing a distribution is only meaningful if the agent's behavior on a given situation is consistent enough to have a measurable rate, which is what the Pattern Intelligence Layer provides. VibeModel makes the agent handle a pattern the same correct way every time, so its behavior becomes something you can test, gate and put an SLA on, instead of a stream of one-off runs that no fixed assertion can ever pin down.

Frequently asked questions

Does a more capable model remove the need for trace-level testing?
Check only the agent's report and a broken run passes; a bigger model still claims false success, so traces beat the cost. (arXiv:2509.25238)

Why not just set temperature to zero?
It does not make agents deterministic in practice; behavior still varies. Testing has to handle a distribution regardless of the temperature setting.

Why not trust the agent's success report?
Because of silent success: PALADIN shows agents often report success when the tool failed. Read the trace of what actually happened instead.

How do you set an SLA on a non-deterministic agent?
On a measured success rate across many runs, with variance and tail accounted for, not on a single passing execution.


Share this post

Join the discussion

Have a take, a war story, or a question? Sign in with GitHub to comment and react. Comments are powered by GitHub Discussions, ad-free and yours to moderate.

Continue Reading

Find where your agent breaks, before you build it

Faultmap maps where your agent will fail from the goal and your data, then hands you the first test suite it has to pass.