Skip to main content
Assertions evaluate a completed VevalExecutionContext and return a failure message or null on pass. You can attach them to scenarios (applied to every item) or to individual ScenarioItems.

Built-in assertions

NoErrors

Fails if any step completed with error status.

MaxSteps

Fails if the total number of steps (including nested) exceeds the limit.

MaxCost

Fails if the total cost_usd across all steps exceeds the limit.

MaxDuration

Fails if the total step duration exceeds the limit in milliseconds.

StepExists

Fails if no step with the given name exists anywhere in the trace (including nested steps).

OutputContains

Fails if no step’s output contains the expected string.

ToolCalled

Fails if no step with type = "tool" and the given name was recorded. Use handle.SetMeta("type", "tool") when recording tool steps.

Judge

Scores the trace’s output against a rubric using an LLM judge, evaluated server-side. Fails if the judge’s passed verdict is false. The score and reasoning are recorded on the run whether the judge passes or fails.
All options are optional: A judge call that fails outright (network error, provider error, invalid model) is treated as an assertion failure rather than a silent pass.

Custom assertions

Implement ITraceAssertion to write your own:

Scope: scenario vs. per-item

What’s next

Catch regressions with snapshots

Assert that a run matches a stored known-good baseline.

Run a scenario

Apply assertions across many inputs.