Operate and improve

Test your agent for reliability

You cannot improve reliability you do not test. Run the agent against realistic scenarios, many times each, against environments that behave like production.

Build a scenario suite

Collect the tasks your agent will really face, including the awkward ones: ambiguous requests, missing data, and cases it should refuse. Run each many times and track the success rate, because a single pass tells you nothing about a non-deterministic system.

Test against a realistic environment

Reliability failures mostly live where the agent meets real systems, in the state that persists, the permissions that reject, and the services that rate limit. Mocks hide all of that, so it helps to run against something closer to the real thing. That can be a service's own test mode, or, when the agent spans several services, a sandbox that can fail them on cue, which is where the failures that actually reach users tend to hide.

Which testing tool fits

A full reliability test needs two things, an environment realistic enough to fail the way production does and a framework to score what happened. No single tool does both, so most teams combine a couple. Here is how the common options compare.

  • Arga Labs is the environment rather than the scorer. It runs stateful replicas of the services an agent calls and injects failures like rate limits, rejected writes, and partial outages on command, which is what makes a run worth scoring in the first place. It does not grade or trace the run itself, so you pair it with one of the tools below.
  • Promptfoo is config-driven and runs well in CI, which makes it a fast way to assert on outputs across many cases. It is less suited to inspecting the full trace of a long, multi-step agent run.
  • DeepEval frames checks as unit tests with ready-made metrics, so it fits neatly into a pytest workflow. Its LLM-graded metrics still cost tokens and vary from run to run, so they need repetition to be trustworthy.
  • LangSmith and Langfuse are strongest at tracing and inspecting individual runs. Langfuse is open-source and self-hostable; LangSmith is more tightly bound to the LangChain and LangGraph stack, which is convenient there and less so outside it.
  • Braintrust is good at dataset management and comparing versions side by side, with the tradeoff that it is a hosted product you bring your data into.

Inject the bad days

Do not only test the happy path. Inject timeouts, rejected writes, and rate limits, and confirm the agent recovers. An agent is only as reliable as its behavior on its worst inputs, so those are the ones worth testing hardest. Tools like Promptfoo help you run these scenarios repeatedly and assert on the results.

Key takeaways

  • Run realistic scenarios many times and measure the success rate.
  • Test against stateful, production-like environments, not mocks.
  • Inject failures so you verify recovery, not just the happy path.