---
title: "Test your agent"
description: "Run your agent on a test suite's cases and check every run with your judges."
sidebar:
  label: "Overview"
seo:
  title: "Test your agent | Judgment Docs"
  description: "Start a test run, tag each case's root span with two attributes, and Judgment checks every case with your judges."
---

A **test suite** is a set of **cases**. Each case is an input for your agent,
the judges to score it with, and the answer you expect from each judge. You
send the input to your agent, and Judgment scores the trace it produces.

Use a test suite to:

- **Gate pull requests in CI.** Run every case and fail the build when a case
  fails.
- **Compare models, prompts, or tools** on the same cases.
- **Test a deployed agent** in staging or a preview deployment.
- **Score a past run against changed cases** without running the agent again.

In the app, open **Tests** in the sidebar to create test suites, edit their
cases, publish versions, and read run results. You can also manage test suites
with the SDK, the HTTP API, or a coding agent connected over
[MCP](/documentation/reference/mcp-tools#test-suites). Runs are started from
your code: **Run suite** in the app shows the SDK code for a suite, and it does
not start a run.

## How it works

Running a test suite takes two steps:

1. **Start a run** with the SDK or the API. You get back a `run_id`, and for each
   case its `case_id` and the `input` to send to your agent.
2. **Run your agent once per case**, and put two attributes on that case's
   **root span**:

   | Attribute | Value |
   | --- | --- |
   | `judgment.test.run_id` | The run ID. |
   | `judgment.test.case_id` | The case ID. |

Judgment scores each case as soon as its trace arrives. You can set the two
attributes with any tracer, including plain OpenTelemetry that
[exports to Judgment](/documentation/connect/integrations/send-otlp-directly):

```python
with otel_tracer.start_as_current_span("support-agent") as span:  # your root span
    span.set_attribute("judgment.test.run_id", run_id)
    span.set_attribute("judgment.test.case_id", case_id)
    support_agent(case_input)
```

### SDK helpers

The judgeval SDK provides optional helpers that reduce this setup:

- **`Tracer.test_case(run_id, case_id)`** wraps the agent call and tags the root
  span for you.
- **`headers`**: each started case includes a ready-made `baggage` header for an
  agent you call over HTTP.
- **`client.test_suites` and `client.test_runs`** in the SDK cover creating test
  suites, editing cases, starting runs, and reading results.

See [Connect your agent](/documentation/tests/connect-your-agent) for all
supported ways to tag a trace.

## How it fits together

| Part | What it is |
| --- | --- |
| **Test suite** | A named set of cases, published as numbered versions. Runs use a published version. |
| **Case** | The `input` your agent gets, plus `expected`: which [judges](/documentation/judges/overview) to run on its trace and the result each should return. |
| **Run** | One pass over the test suite's cases. Each case produces exactly one trace. |

A case **passes** when every judge listed in its `expected` returns the
expected result. A judge error counts as a failed check.

Judge evaluations in a test run use Judgment Units (JU), like any other judge
evaluation. See [Billing and plans](/documentation/administration/billing-and-plans).

## Move from test configs

Test configs and dataset test runs stop working for every organization on November 12, 2026. Your datasets stay as they are.

- **Datasets of agent inputs:** add the rows as cases in a test suite, then start a new run on that suite each time you test. See [Create and edit a test suite](/documentation/tests/create-a-test-suite).
- **Re-scoring stored traces**, such as judge calibration or golden sets: [add cases from those traces](/documentation/tests/create-a-test-suite#add-cases-from-traces), so each case has its trace in `metadata.trace_id`, and start the run with `"stored_traces": true`. See [Score stored traces](/documentation/tests/run-a-test-suite#score-stored-traces).
- **Code judges that read dataset columns:** put those values in each case's `metadata`; code judges read the same keys, except `name` and the reserved keys that identify a trace, span, session or conversation. See [Create and edit a test suite](/documentation/tests/create-a-test-suite).

## Next steps

- [Run your first test suite](/documentation/tests/first-test-suite) end to end.
- [Create and edit a test suite](/documentation/tests/create-a-test-suite).
- [Run your agent on a test suite](/documentation/tests/run-a-test-suite) in CI.
