Create an eval
Create.eval.ts files in the evals/ directory at your agent root:
Eval instances as the default export or named exports.
Conversation turns
An eval’sconversation is a sequence of turns. Each turn can send a user message, fire an event, or assert the agent stays silent, plus optionally assert on what happens.
Send user messages:
Assertions
Each turn’sassert block can hold any combination of the assertion types below.
Response
Assert on the text of the agent’s reply:| Assertion | Description |
|---|---|
{ contains: "text" } | Response includes this string |
{ not_contains: "text" } | Response does not include this string |
{ matches: "regex" } | Response matches this regex pattern |
{ similar_to: "text" } | Response is semantically similar to this text |
{ llm_judge: "criteria" } | An LLM evaluates whether the response meets the criteria (see LLM judge) |
Tools
Assert on which tools the agent called:| Assertion | Description |
|---|---|
{ called: "toolName" } | Tool was called |
{ called: "toolName", params: { key: { equals: "value" } } } | Tool was called with matching parameters |
{ not_called: "toolName" } | Tool was not called |
{ call_order: ["tool1", "tool2"] } | Tools were called in this order |
params to match tool arguments:
| Operator | Example |
|---|---|
{ equals: value } | Exact match |
{ contains: "text" } | String contains |
{ not_contains: "text" } | String does not contain |
{ matches: "regex" } | Regex match |
{ in: [1, 2, 3] } | Value is in array |
{ exists: true } | Field exists |
{ gte: 10 } | Greater than or equal |
{ lte: 100 } | Less than or equal |
State
Assert on state changes after a turn:Tables
Assert on table data:Workflows
Assert on workflow state:Timing
Assert on response time:LLM judge
Usellm_judge when the right answer isn’t a fixed string. You describe what a good response looks like in plain English, and an LLM scores the agent’s reply against it. It’s the right choice for subjective checks like tone, intent, or whether the agent understood the user:
Setup and outcome
setup runs before the first turn. outcome runs after the last.
Setup
Seed state or trigger a workflow before the conversation starts:Outcome
Assert on state, tables, or workflows after the entire conversation completes. Outcome assertions use the same shapes as turn assertions:Configure eval behavior
Set defaults for all evals inagent.config.ts:
| Option | Type | Description |
|---|---|---|
judgeModel | string | Model for llm_judge assertions. Defaults to "fast" |
judgePassThreshold | number (1–5) | Minimum score for llm_judge to pass. Defaults to 3 |
idleTimeout | number (ms) | How long to wait for the agent to respond. Defaults to 15000 |
judgePassThreshold or idleTimeout on a specific eval:
Organize evals
Evals have two organizing fields that pair with CLI filters:tags and type.
Tags are free-form labels. Use them to group evals you want to run together (smoke tests, critical paths, slow suites):
capability: tests that a feature works as designedregression: reproduces a past bug so it doesn’t come back
Run evals
From the CLI:
