Skip to main content

Overview

Assertions evaluate a completed VevalExecutionContext and return a failure message or null on pass. They can be attached 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.

Custom assertions

Implement ITraceAssertion to write your own:

Scope: scenario vs. per-item