Skip to Content

Test your agent

Write an eval for your AI agent, run it, read the results, and turn real chats into test cases. Every check type, the eval's JSON and its limits.

An eval is a repeatable test of an AI agent: test cases (requests the agent should handle), checks measured on every case, and how many times each case runs. Run it after you change the instructions, a skill or the model, to see what broke before a customer does.

Every trial is a real chat on the Eval channel: it uses tokens and shows in Sessions. A Judge response quality check uses the agent's model a second time to grade the answer.

Click the agent's card on the canvas to open its sheet, then Agent → Evals.

Write an eval

Name it

Click New eval. Give it a Name: lowercase letters, digits and dashes, up to 40.

The editor has two modes: Guided builder (the form below) and Advanced JSON (the same eval as JSON).

Add test cases

Under Test cases, each case has a Test case ID and a Request: the message the agent gets. Add test case adds another (up to 100). The bin icon removes one.

  • Test case ID: letters, digits, - and _, up to 64, different for each case. Left empty, it becomes sample-1, sample-2 and so on.
  • Request: up to 4,000 characters.
  • Each case runs in a fresh chat, as a new visitor would send it, so cases don't see each other.

A test case can also carry reference data: a JSON object that checks can read, like the order id the reply should name. You set it in Advanced JSON (see the eval's JSON).

Add checks

Under Checks, Add check adds a check (up to 20). The bin icon removes it. Each check has a Check type:

  • Judge response quality: a Score name and What should a good result do?. It is graded by the agent's own model in a second chat: a second opinion, not an independent one. The judge answers PASS (scored 1) or FAIL (scored 0), with one sentence why. Where the answer can be named, like a blend or an order number, an Output matches text check is more reliable.
  • Tool was called: a Tool name, like read. mcp__<integration> matches any tool of that integration.
  • Tool call contains arguments: a Tool name and the Expected arguments (Add argument adds one). Values can be text, numbers, booleans, arrays or JSON objects. Objects match by key: the call may have more arguments, or more keys inside an object, than you list. Other values must be equal.
  • Output matches text: a Mode (Contains or Does not contain), Case sensitive, and the Text to look for. Case sensitive is on by default. In our test, with the reply echo: Hello, Contains ECHO failed with it on and passed with it off.
    • In Advanced JSON, the check can read the text from each test case's reference data instead (referencePath, like expected.orderId). It then shows Reference path in place of Text: "Read from each test case's reference data (set in Advanced JSON). A test case without it abstains."
The Check type menu: Judge response quality, Tool was called, Tool call contains arguments, Output matches text
The Check type menu: Judge response quality, Tool was called, Tool call contains arguments, Output matches text

Choose how many times it runs

Under Run settings, Epochs is how many times each test case runs: 1, 2 or 3. Total trials is the number of cases times the epochs.

Save it

Click Save. With a field missing, the form marks it (Write the request., Say what a good result should do.) and says Fix the fields marked above. Cancel closes the editor without saving.

The editor also shows The reply that chat got: under a test case that came from a real chat, so you can write checks against it.

Here is our eval in Advanced JSON. It has one test case, decaf, and three checks: the reply contains Night Owl, the agent called read, and a judge scores whether it said yes and named the blend.

Advanced JSON: samples with the decaf case; checks outputMatches Night Owl, hasToolCall read and llmJudge answered
Advanced JSON: samples with the decaf case; checks outputMatches Night Owl, hasToolCall read and llmJudge answered

The toast says Eval decaf saved. The list shows each eval with its number of test cases and checks, its last result (Not run yet at first), and Run, Results, Edit and Delete.

Evals: decaf, 1 test case, 3 checks, Not run yet, with Run, Results, Edit and Delete
Evals: decaf, 1 test case, 3 checks, Not run yet, with Run, Results, Edit and Delete

Run it

Click Run. An agent runs one eval at a time. While it runs, the heading of the results says running, 2 of 4 trials, and Run, Edit and Delete wait until it's done. Starting another run meanwhile is refused: The eval echo-test is still running. Try again when it has finished.

When it is done, a toast gives the result, for example decaf: Structural: 2 failed · answered 0%, and the results open below the list. Results shows the last run.

The results show three summaries side by side:

  • Structural: the text and tool checks. All passed or Not all passed, with how many passed, failed and abstained, or No structural checks. An abstention is neither a pass nor a fail.
  • Behavioral: each judge's score: the share of trials it passed, with ± the standard deviation when the trials disagree, how many it scored and how many abstained. No judges when the eval has none.
  • Efficiency: the tokens the agent used, the extra tokens the judges used (eval overhead) and the time per trial.

The results never add these up into one score. Below, each test case shows, for each epoch, the agent's reply, the tools it called with their arguments, and every check: ✓ for a pass, ✗ for a fail and – for an abstention, with the reason.

A check abstains when it can't be made. The line under the summaries counts them, like Abstained: 4 JUDGE_FAILED, 2 SETUP_INVALID.

ReasonWhy
SETUP_INVALIDA Reference path that the test case doesn't have, as text. We ran a case without reference data: reference.expected.orderId is not a non-empty string.
TRIAL_ERRORThe agent gave no reply, so a judge has nothing to read. Text and tool checks fail instead.
JUDGE_FAILEDThe judge didn't answer PASS or FAIL: The judge did not answer PASS or FAIL.

We ran an eval on a test agent whose model only echoes the message back, so its judge could never answer PASS or FAIL. A judge with no verdicts shows — and its abstentions:

Structural: Not all passed, 6 passed, 8 failed, 2 abstained; Behavioral: answered, —, 0, 4 abstained; Abstained: 4 JUDGE_FAILED, 2 SETUP_INVALID
Structural: Not all passed, 6 passed, 8 failed, 2 abstained; Behavioral: answered, —, 0, 4 abstained; Abstained: 4 JUDGE_FAILED, 2 SETUP_INVALID

The test case without reference data abstained on the Reference path check. The case-sensitive ECHO check failed and the case-insensitive one passed:

The no-ref test case, two epochs: contains ECHO failed, contains ECHO passed, the reference check abstained with SETUP_INVALID, called read failed, and the judge abstained with JUDGE_FAILED
The no-ref test case, two epochs: contains ECHO failed, contains ECHO passed, the reference check abstained with SETUP_INVALID, called read failed, and the judge abstained with JUDGE_FAILED
Results: Not all passed, 0 passed and 2 failed; answered 0%; 1,836 agent tokens; and the reply with three failed checks
Results: Not all passed, 0 passed and 2 failed; answered 0%; 1,836 agent tokens; and the reply with three failed checks

Our run failed. The agent didn't read its FAQ file and answered I don't sell decaf. The three checks say why: the reply doesn't contain "Night Owl", no tool was called, and the judge found it didn't say yes. This is the same mistake we saw in Knowledge. Change the instructions or the model, then run the eval again.

To delete an eval, click Delete and confirm Delete the eval decaf and its results?

Turn a real chat into a test case

In Sessions, open a chat and click Add to eval. Evals opens with Add this request to an eval as a test case: and the chat's first message. Pick A new eval or an existing eval, then click Add test case. Cancel drops it.

Add this request to an eval as a test case, with A new eval, Add test case and Cancel
Add this request to an eval as a test case, with A new eval, Add test case and Cancel

The eval's JSON

Advanced JSON shows the eval as samples (the test cases), checks and epochs. You can paste a whole eval there, or send it to the API. This is the eval we ran on a test agent:

{
  "samples": [
    { "id": "order", "input": "Where is order A-1042?", "reference": { "expected": { "orderId": "A-1042" } } },
    { "id": "no-ref", "input": "Hello" }
  ],
  "checks": [
    { "type": "outputMatches", "mode": "contains", "value": "ECHO" },
    { "type": "outputMatches", "mode": "contains", "value": "ECHO", "caseSensitive": false },
    { "type": "outputMatches", "mode": "contains", "referencePath": "expected.orderId" },
    { "type": "hasToolCall", "tool": "read" },
    { "type": "llmJudge", "name": "answered", "rubric": "Says where the order is." }
  ],
  "epochs": 2
}

Each sample has an id, an input (the request) and optional reference data. The checks:

typeFieldsIn the builder
llmJudgename (up to 40 characters, different for each judge) and rubric (up to 1,000)Judge response quality
hasToolCalltoolTool was called
toolCallContainstool and arguments (an object with at least one key)Tool call contains arguments
outputMatchesmode (contains or notContains), value or referencePath (one of the two), and caseSensitive (true by default)Output matches text

epochs is 1 to 3. Test cases times epochs is at most 300 trials.

Evals saved in an earlier format still open. When some of their checks couldn't be carried over, the list says so: This eval was saved in the earlier format: 1 per-question tool or criterion check could not be carried over. Edit it to add them as checks.

Limits

  • 20 evals per agent, 100 test cases and 20 checks each, 1 to 3 epochs.
  • 300 trials per run, and 600 seconds per trial.
  • An eval's JSON is up to 512 KB. A request is up to 4,000 characters, a text to match or a judge's rubric up to 1,000.
  • The last 20 runs of each eval are kept.

To find cheaper ways to run the agent from its own sessions, see Optimizations.

On this page