PortfolioSourcePyPI

AI / Machine Learning · 2026

agentrial

The pytest for AI agents. Run an agent a hundred times and get Wilson confidence intervals instead of anecdotes, with step-level failure attribution by Fisher exact test. Published on PyPI, 450 tests, 45 models tracked.

Python · Statistics · LLM APIs · FastAPI · VS Code Extension · CI/CD · PyPI

In the terminal

agentrial run
$ agentrial run tests/calculator_agent.yml --trials 25
agentrial v0.5.2 · calculator_agent
Model: claude-3.5-haiku · Parallel: 8 · Provider: auto-selected
basic-math$0.080.25s100%PASS
micro-step-color$0.060.18s100%PASS
add-subtraction$0.060.26s100%PASS
multi-digit$0.070.30s60%WARN
error-handling$0.050.19s80%PASS
multi-digit: output format mismatch (Fisher p=0.027)
Results
Suites: 4 pass · 1 warn · 0 fail
Reliability: 94.0% [83.5%, 98.7%] (Wilson CI)
Score: 87/100
Cost summary
Total: $0.31 (25 trials) · Avg: $0.012/trial
Duration: 8.2s parallel · est. 62s serial
Report saved to ./reports/calculator_agent_2026-02-08.html

Research reports up to 72 percent variance between runs at temperature=0

The same agent, with the same prompt and the same model, can pass on Monday and fail on Wednesday. One green run bounds nothing, and it does not name the step that broke. I built agentrial in 2026 to run the agent N times and put an interval around the pass rate.

Wilson bounds the rate, Fisher names the step, three detectors watch drift

StatisticWhat it decides
Wilson intervalthe pass rate over N trials, with an upper and a lower bound
Fisher exact testwhether one step of the pipeline fails more often than the others
CUSUM, Page-Hinkley, Kolmogorov-Smirnovwhether production traffic has drifted away from what was tested
Agent Reliability Scoresuccess rate, latency, cost and consistency, folded into 0 to 100

The method is borrowed from clinical trials: repeat the run, bound the pass rate, then isolate the step that carries the failure.

Six built-in adapters, and about 50 lines to add a seventh

The adapters cover LangGraph, CrewAI, AutoGen, the OpenAI Agents SDK and custom stacks, so the agent under test is not rewritten to be measured. Trials run in parallel at a configurable width, and the real cost of each one lands in a per-test breakdown. A built-in scanner checks the agent's MCP tools for common vulnerabilities before they reach production.

Two test formats, and nothing leaves the machine

Tests are defined in YAML or in Python, and results, traces and cost tables stay on local disk: no SaaS, no telemetry, no cloud dependency. The runner reports into GitHub Actions for CI, and the VS Code extension shows results inline in the editor, under an MIT licence.