Skip to main content
A scenario is a named set of test cases for your agent. Each run posts pass/fail results to the dashboard so you can track quality over time. Scenarios have two item types:

RunScenarioAsync

Synthetic items

Use these for new inputs you want to test with a live LLM.

Trace-backed items

Use these to turn a recorded production trace into a regression test. Steps recorded as llm run live with your current prompt, so a prompt change that makes the output worse fails the item. Every other step (tools, untyped steps) returns its recorded output, so the replay sees the same data as the original run and never reaches a real system. Mark your model steps when you record the trace, with step.SetMeta("type", "llm") (set_meta / setMeta), and your tools with "tool". If no step of a trace-backed item ran live, the item fails and tells you to mark the model steps.
The trace must have recorded steps. If it has none, Veval throws rather than silently calling the live LLM.

Mocked trace-backed items

Set MockModelSteps to serve model steps from the recording too. The item is then free and deterministic, which suits checking a code change (routing, parsing, tool wiring), but it can’t catch a prompt regression: every model call returns what the old prompt produced.
To mock every trace-backed item in a run, including items loaded from the dashboard, pass the option to RunScenarioAsync:
VevalTestSdk always replays trace-backed items mocked, so a test built on it never makes a live model call.

Keeping the trace

Traces are deleted after your plan’s retention window. Each time a scenario replays a trace, its retention restarts, so a trace your tests replay at least once per window stays. To keep a trace no matter how often it runs, open it in the dashboard and click Use as fixture. This pins the trace and shows the ScenarioItem for it in each language, ready to copy. Pin on its own keeps the trace without showing the item. Each plan allows a set number of pinned traces (25 on Free); unpin one to free a slot. If the trace is gone, the item fails with trace '<id>' not found and the scenario’s other items still run.

Per-item assertions

Each ScenarioItem can carry its own assertions on top of the scenario-level ones:

Fetching items from the dashboard

If items is null, Veval fetches items for the scenario from the API automatically. This lets you manage test cases in the dashboard without redeploying code.

ScenarioRunResult

What’s next

Write assertions

Built-in checks, the LLM judge, and custom assertions.

Test with replay

Run your agent against recorded traces in tests.