Agent Evals
Agent Evals quickstart
Agent Evals answers one question: did this prompt, model or tool change break what the agent is supposed to do, and which step explains the failure? It checks a recorded run of your agent against a suite of deterministic assertions. No model is called to do the judging, so the same trace always gives the same result.
Updated 2026-11-22. Examples use the synthetic editorial fixture in examples/agent-evals/editorial.
Set up the CLI
# from the root of a PromptFlowEngine checkout
corepack enable && pnpm install
pnpm --filter @promptflow/engine build && pnpm --filter @promptflow/cli build
alias promptflow="node $PWD/packages/cli/dist/cli.js"Run the example
The repository includes a synthetic editorial agent in examples/agent-evals/editorial. It reads source material, drafts an article with references, asks an editor for approval and publishes through a mock tool. It makes no model or network calls.
cd examples/agent-evals/editorial
# Fresh execution: runs the agent code once per case. Exit 0.
promptflow agent eval suite.json --runner runner.json
# The same agent with five injected defects. Exit 1.
promptflow agent eval scenarios.suite.json --runner runner.json
# Trace replay: evaluates traces captured earlier, offline. Exit 1.
promptflow agent eval scenarios.suite.json --traces traces/current \
--baseline baseline/scenarios.report.jsonThe second command fails five cases. For the case that publishes too early, the report says publish_article for articleId article-2001 was attempted at step 10, before its approval at step 12 and marks both steps in the timeline.
Three modes, labelled in every report
| Mode | What it does | What it tells you |
|---|---|---|
Fresh execution (--runner) | Starts your agent once per case and evaluates the trace it emits | How the current code behaves |
Trace replay (--traces) | Evaluates traces captured earlier, with no model credentials | How the captured run behaved. It does not run the current agent |
Demo (promptflow agent demo) | Evaluates the bundled synthetic example | How the checks and reports work |
Connect your own agent
A runner is a small program that receives one case on stdin and prints one trace on stdout. Describe how to start it in a runner config:
{
"schema": "promptflow.agent-runner/v1",
"command": "node",
"args": ["agent/run.mjs"],
"timeoutMs": 30000
}- The command is started directly, without a shell, once per case.
cwdis relative to the runner file. - It receives
{"schema":"promptflow.agent-runner-request/v1","suiteId","caseId","runId","input"}on stdin. - It must print one
promptflow.agent-trace/v1JSON document on stdout and exit 0. - It runs with a minimal environment (PATH, HOME, TEMP and similar). Inherited secrets such as API keys are not passed. Add variables the agent needs under
envin the runner config. - Output is limited to 5 MB and each case to the timeout (60 seconds by default, 10 minutes at most). stderr is counted but never shown or stored.
The example's agent/trace-recorder.mjs is a 70-line recorder you can copy. Record each tool call before the tool runs, so a call that is denied or throws still appears in the trace. The format reference lists every field.
Commands and exit codes
| Command | Does |
|---|---|
agent eval <suite> --runner <file> | Fresh execution |
agent eval <suite> --traces <dir|file> | Trace replay. Repeat --traces for several paths |
agent compare <baseline> <current> | Compares two reports by case and assertion id |
agent validate <file…> | Checks suite, trace, runner and report files |
agent demo | The bundled example |
Options: --case <id>, --baseline <report>, --report <file> (JSON), --markdown <file>, --summary (GitHub job summary), --update-baseline <file>, --timeout <ms>, --timeline, --json.
| Exit code | Meaning |
|---|---|
| 0 | Every case passed |
| 1 | At least one required assertion failed |
| 2 | Invalid input or usage: a malformed, oversized or unsupported file |
| 3 | The runner failed, timed out, or a case had no usable trace |
Codes 2 and 3 take precedence over 1, so a gate that could not evaluate never looks like an ordinary test failure.
Baselines
A baseline is a report you saved earlier. Comparing against it shows new failures, resolved failures, added and removed cases, and results that cannot be compared because the suite definition changed.
- A baseline never excuses a failure. A required assertion that already failed in the baseline still blocks.
- With no baseline, the absolute requirements still apply.
- Baselines are only written when you pass
--update-baseline. Review and commit them like code.
What is shown, stored and redacted
Reports use a field allowlist. They contain ids, tool names, statuses, step numbers, counts, durations and token totals.
| Data | In reports, terminal output, job summaries and extension views |
|---|---|
| Case inputs, prompts and message text | Omitted. Messages show their length only |
| Tool-call arguments | Argument names only. The protected target (for example an article id) is shown after scanning |
| Tool results and final output | Omitted. Only the schema verdict is reported |
| Runner stdout and stderr, error messages | Omitted |
| Values that are shown | Passed through the secret and personal-data scanner, stripped of control characters, and truncated |
Nothing is uploaded. The CLI writes files only where you ask. The Chrome extension keeps run history only when you choose “Save to history”. No prompt, trace or report content is sent to product analytics.
Troubleshooting
| Message | Cause and fix |
|---|---|
schema: version is not supported | The file uses a newer or older format. This release reads /v1 |
mixes events with and without "seq" | Ordering would be ambiguous. Give every event a seq, or none (file order is then used) |
is a tool_result with no earlier tool_call | Record the call before the tool runs |
names case "x", which is not in suite | The trace belongs to another suite or an old case id |
The runner exited with code N | Run the runner by hand with a request on stdin to see its stderr |
An assertion fails with missing_evidence | The trace is incomplete or lacks the field the check needs. Required checks fail when evidence is missing |
Available now and planned
| Capability | Status on 2026-11-22 |
|---|---|
| Deterministic assertions, fresh execution, trace replay, baselines, redacted reports | In the repository: CLI, GitHub Actions workflow, Chrome extension page, VS Code view |
| Chrome extension and VS Code extension builds with Agent Evals | Built from the repository. Not yet in the Chrome Web Store or a VS Code Marketplace release |
| Import of OpenTelemetry or OpenInference traces | Planned. Today traces use the promptflow.agent-trace/v1 format |
| Model-graded checks | Not planned for the release gate, which stays deterministic |
| Hosted production trace monitoring, team retention, access control, alerts | Not built. It will be considered when pilot teams show they need it |