Eval Library
The Eval Library provides scenario-based testing for AI agents. You define test cases with expected outcomes, run them with behavioral variations injected, and measure how much the agent’s behavior shifts under pressure. This is how you answer the question: “Will my agent still do the right thing when conditions change?”Creating Scenarios
A scenario defines a single testable behavior: given a specific input context, the agent should produce a specific output.Auto-Generating from Telemetry
Writing scenarios from scratch is useful but slow. The Eval Library can scan your agent’s OTelskill.invoke spans and auto-generate scenarios from real behavior.
The system analyzes recent telemetry to identify:
- Recurring patterns — skills invoked frequently with consistent inputs
- Decision points — moments where the agent chose between multiple options
- Edge cases — unusual input combinations that produced successful outcomes
Variation Types
Variations are behavioral injections that modify the system prompt to test agent susceptibility. Each variation applies a specific cognitive pressure to see if the agent’s output shifts.
Variations are applied one at a time during evaluation runs, so you can isolate which pressures affect your agent and which it resists.
Running Evaluations
An evaluation run executes a scenario and captures the result. There are two types:Baseline Run
Runs the scenario with no variation applied. This establishes the agent’s default behavior.Variation Run
Runs the same scenario with one variation injected. The system then compares the output to both the expected behavior and the baseline. Two metrics are computed:
A high match rate with low shift magnitude means the agent is robust. A low match rate or high shift magnitude under a specific variation means the agent is susceptible to that pressure.
Test Matrix
For comprehensive coverage, the Eval Library supports factorial testing: every scenario crossed with every variation.- Green (0.0 - 0.2) — No meaningful shift. Agent is robust.
- Amber (0.2 - 0.5) — Moderate shift. Worth reviewing.
- Red (0.5 - 1.0) — Critical shift. Agent behavior changed significantly.
Matrix runs can take several minutes depending on the number of scenarios and variations. The
parallel flag enables concurrent execution. Results are available via the runs endpoint once complete.Best Practices
- Start with 3-5 scenarios. Cover your agent’s most critical decision points first. Expand the library over time.
- Test one variation at a time first. Before running a full matrix, understand how individual variations affect your agent. This makes results easier to interpret.
- Review all flagged runs. Any run with shift magnitude above the threshold is routed to the Review Queue. Do not ignore these — they indicate real susceptibility.
- Use auto-generate to bootstrap. Generate scenarios from telemetry, then refine the expected behaviors manually. This is faster than writing every scenario from scratch.
- Re-run after agent updates. When you update your agent’s model, prompts, or tools, re-run the eval matrix to catch regressions.
-
Set risk levels accurately. Critical-risk scenarios have stricter thresholds and are flagged more aggressively. Reserve
criticalfor decisions with real consequences.