> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Evals

> Replay past agent runs with a different model or prompt, score the results, and compare against a control — without touching your real tools.

Offline evals let you answer "would this agent do better with a cheaper model?"
or "does my new prompt regress anything?" using runs the agent has already
done. Runlayer replays selected past runs under your changed configuration and
scores the outcome against a matched control replay. Run an eval without any
override and it becomes a pure regression test: each replay restores the
original run's captured setup and is scored against the historical run.

![Evals tab on the agent page, listing completed offline evals](https://mintcdn.com/anysource/WmIxELXNqzA1vgem/images/agent-evals/evals-tab.png?fit=max\&auto=format\&n=WmIxELXNqzA1vgem\&q=85\&s=057900b66edbf412b9080e5dcc2f4fad)

## How offline evals work

With at least one override, Runlayer spawns **two fresh replays** of the same
task for every past run you select:

* a **control** replay using the original run's captured model and prompt
* a **candidate** replay using the same setup plus your overrides

Scorers then compare the candidate against the control. Comparing two live
replays (rather than the historical run) keeps the comparison fair — both
sides run under the original run's captured conditions, and only your
override differs. The historical run's output is still shown for reference.

With **no overrides**, each selected run replays **once** restoring the
original run's captured setup, and scorers compare it against the
**historical run** itself. Use this to catch regressions from drift outside
the snapshot — for example, the underlying model's behavior or the runtime
that runs the replay changed between the original run and now.

**By default, replays never call your real tools.** MCP tool calls are not sent
to your real services — Runlayer simulates their results using the original run
as reference, so the replay stays representative without side effects. An agent
that normally sends Slack messages or writes to your
database does neither during an eval. Sandbox-internal commands (shell,
filesystem inside the sandbox) still execute. Memory writes are also disabled
during replays. You can opt out of this per eval with the **Tool mocking**
option in the eval dialog — non-default policies let some or all tool calls run
against your real services and can perform real side effects.

Simulated results are generated fresh for every replay, so the control and
candidate can see slightly different data. Pick **Replay recorded results** to
remove that noise: when a replay makes a call the original run made, with the
same arguments, it gets the original run's recorded result, including any
error. Calls the original run never made are still simulated. This option is
side-effect free too.

## Run an eval

Evals live on the agent page under the **Evals** tab (visible to anyone who
can edit the agent).

**1. Open the eval dialog**

On the **Evals** tab click **New eval**. Alternatively, on the **Monitor**
tab click **Select**, pick up to 20 finished runs (shift-click selects a
range), and click **Run offline eval** to start from those runs. The
dialog then shows a summary of them; click **Edit selection** to change it.

**2. Pick runs to replay**

Select up to **20 finished runs** from the last 30 days. To find them:

* **Search** run text, or **filter** by status, start date, and topic.
  Shift-click a row to select a range, or use the header checkbox to
  select every run shown.
* **Quick picks** replace the selection in one click: latest runs,
  failures from the last 7 days, a spread across topics, unretried write
  failures, or the most expensive runs.
* **Ask AI**: describe the runs you want, for example "failed Slack runs
  this week where it never answered", and press Enter. Status and date
  parts become normal filters; the rest becomes an **AI match** filter,
  and each matched row says why it matched. Matches are added to the
  selection, and you can uncheck any of them.

Picks stay selected when you change filters. Recurring agents work best —
replaying several instances of the same scheduled task gives you a
distribution instead of a single sample.

**3. Choose what to change (optional)**

Overrides are optional:

* **Model override** — try a different model available to your workspace
* **Override system prompt** — edit the agent's prompt for the replay
* **Harness override** — where bring-your-own-harness is enabled for your
  workspace
* **No override** — replay under the original run's captured setup and
  compare against the historical runs (regression test)

Then pick one or more **scorers** (see below) and click **Run eval**.

![Run offline eval dialog with run selection, scorers, and overrides](https://mintcdn.com/anysource/WmIxELXNqzA1vgem/images/agent-evals/create-eval-dialog.png?fit=max\&auto=format\&n=WmIxELXNqzA1vgem\&q=85\&s=e375afbd95ac8da13f5c68f45b370996)

Cases replay in parallel in the background. The eval page updates live while
the eval is running.

## Scorers

Scorers judge each case and return a score from **0 to 1** (1 is best). Three
built-in LLM scorers are available:

| Scorer | What it does |
| - | - |
| **Baseline battle** | Compares the candidate replay against the control and picks a verdict: **improved**, **similar**, or **regressed** |
| **Goal completion** | Rates how completely the replay accomplished the task |
| **Instruction adherence** | Checks whether the replay followed the agent's system instructions |

You can also create **custom scorers** per agent. Click **Author scorer with
AI**, describe what to measure in plain language (e.g. "Score 1 when the reply
contains no apology boilerplate and is under 200 words"), and Runlayer
generates a TypeScript scorer you can review, edit, and save. Custom scorers
run with a 30-second timeout and no filesystem writes or child processes.

The scorers you select are frozen into the eval when it starts — deleting or
editing a scorer later doesn't change past results.

## Read the results

Each eval has a detail page with one row per replayed case: status, one
column per scorer, and cost and runtime with deltas versus control.
Aggregates for cost, runtime, and every scorer appear in the sidebar.

![Eval detail page with per-case scores, verdicts, and cost/runtime vs control](https://mintcdn.com/anysource/WmIxELXNqzA1vgem/images/agent-evals/eval-run-detail.png?fit=max\&auto=format\&n=WmIxELXNqzA1vgem\&q=85\&s=4f08a1f350f5e2c1911910cb5829d02b)

Click a case to read the answer first: each judge's verdict, score, and
reasoning, plus the cost and runtime change, then the control output
(switchable to historical) and candidate output side by side. From either
output you can open the full run trace.

![Eval case view comparing the baseline (control or historical) and candidate outputs](https://mintcdn.com/anysource/WmIxELXNqzA1vgem/images/agent-evals/eval-case-drawer.png?fit=max\&auto=format\&n=WmIxELXNqzA1vgem\&q=85\&s=819992f2955fa958bd7f038d515edbbf)

LLM judges are a signal, not ground truth — you can record your own verdict
(**Improved** / **Similar** / **Regressed**) and notes on any case. Human
verdicts are tallied in the sidebar alongside the scorer averages.

Comparative scorers such as **Baseline battle** also show **Agreement with
you**: how many of your labelled cases the judge gave the same verdict, plus a
confusion matrix of your verdict against the judge's. Until you've labelled at
least 10 cases, the sidebar warns that the number is too noisy to trust.

## Costs and limits

* Each case runs **two real agent replays** (one for a no-override eval) plus
  scorer and tool-simulation LLM calls, billed to your configured AI provider
  like any other run. The **Cost** column is often the headline result when
  evaluating a cheaper model.
* Up to **20 runs per eval**; only finished runs can be replayed.
* Replays appear in the agent's run history like normal runs.
* LLM scoring is non-deterministic — treat small score differences as noise
  and look at verdict counts and cost/runtime deltas across many cases.
* Creating evals, recording verdicts, and managing scorers require edit
  access to the agent. If workspace redaction is enabled, a redacted run must
  be unredacted before it can be used as an eval source.

## Send runs to Braintrust

When Braintrust export is enabled for your workspace, finished agent runs can
be exported to Braintrust as traces. Setup has two levels: an administrator
connects one key for the workspace, and each agent's Braintrust project is set
on that agent. An agent with no project never exports, and Runlayer never falls
back to another agent's project.

### Connect the workspace

An administrator with the organization-settings permission does this once, from
**Settings → Integrations → Braintrust**.

1. In Braintrust, create a dedicated **service token** (not a personal API key)
   and grant it **Update** on **Project Logs** for each project agents will
   export to. It does not need **Read**. One token can cover several projects.
   See [Service token permissions for log ingestion](https://www.braintrust.dev/docs/kb/service-token-permissions-for-log-ingestion).
2. Select **Connect Braintrust**, enter the token and select **Verify and
   connect**. Runlayer checks that Braintrust recognizes the token.

The token is encrypted before it is stored in Runlayer's database and is
write-only: Runlayer never displays it again. **Replace key** rotates it without
a backend or worker restart. Before a replacement is saved, Runlayer confirms it
can write to every project agents already export to; if any project rejects it,
nothing changes and the error names that project. The card lists which agents
export and where.

### Set an agent's project

Open the agent, go to its settings and find **Braintrust export**. The section
appears once the workspace is connected. Enter the agent's Braintrust **project
ID** and select **Verify and save**. **Stop exporting** clears it.

Who can do this is its own permission, **Manage trace export**
(`manage_trace_export`): the agent's owner and super admins hold it. Sharing an
agent with edit access does not grant it, because editing an agent is a
different decision from sending its conversations to another system. To let
someone else manage it, or to take it from an owner, write a policy on the agent
for that action. See [Agents](https://docs.runlayer.com/access-control-resources.md#agents). Everyone else
who can open the agent sees the project read-only. Runlayer-managed agents, such
as the Runlayer Assistant, cannot be exported.

When a new or changed project is saved, Runlayer writes one row named **Runlayer
connection check** to it. This confirms the project exists and the workspace
token can write to it; Braintrust accepts an empty request for any project ID,
so only a real row proves it. The row contains no agent data, is tagged
`runlayer:connection-check`, and has a fixed ID, so later checks rewrite the
same row instead of adding more. Runlayer cannot delete it; remove it in
Braintrust if you do not want it. The check shows the token can write there, not
that it is limited to that project: keep the token's Braintrust permissions as
narrow as you need. Braintrust's permissions, not Runlayer's, decide who can
read exported traces.

Runlayer has no per-agent environment setting. To keep development and
production traces apart, give each Runlayer agent the project for the
environment it runs in: a development copy of an agent gets the development
project, and a separate staging deployment has its own Braintrust connection.

### What is exported

Each finished run becomes a trace containing its input, output or error, model,
tokens and recorded cost, with child spans for model answers, reasoning and tool
calls, including arguments and results. Traces normally arrive about five
minutes after completion. Existing history is not backfilled: an agent exports
only runs started after its project is saved, and changing its project starts a
new cutoff. Standalone MCP activity and externally ingested hook sessions
are not native agent runs and are not included in this export.

Eval replays, investigation runs and actor-private runs are excluded. Workspace
redaction or session-content policies also prevent export, including per-user
targeting rules. Braintrust does not receive unredaction consent or content grants.

### Stop exporting

**Stop exporting** on an agent stops that agent, including runs already queued.
**Disconnect** in Settings → Integrations erases the stored token and every
agent's project, and stops queued and future exports; reconnecting later does
not resume them. A request already in flight may finish; traces already in
Braintrust remain there. Revoke unused tokens in Braintrust too.

If Braintrust export is later turned off for your workspace, nothing is exported
and the stored token stays until you remove it: Settings → Integrations keeps a
Braintrust card with **Disconnect** for as long as a token is stored.

> [!NOTE]
>
> Braintrust export must be enabled for your workspace (contact Runlayer) before
> connecting it in Settings. No separate managed secret store or organization KMS setup is
> required. Deployment-wide Braintrust environment variables are not a substitute
> for connecting a workspace.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.