The improvement loop
How a production failure becomes a regression test that gates the fix, and a judge that watches for it coming back.
Judgment turns each production failure into a regression test that gates the fix, and a judge that watches production for the failure coming back. The loop has five steps. Detection and monitoring run on production traffic. Reproducing, fixing and gating happen in your repository and CI.
The Issue lifecycle (the regression suite in the fix prompt, linked pull requests, and the production watch) is in early access. It works only for organizations where it's turned on. Contact support to turn it on.
Steps 2 to 4 need tests set up in your repository: a .judgment/ folder and
a CI job that runs judgeval test run. Your coding agent can do that:
Set up Judgment tests with your coding agent
Paste it into your agent from your repo's root.
| Step | Where it runs | What you get |
|---|---|---|
| 1. Detect | Production | An Issue with its diagnosis and the traces that show it |
| 2. Reproduce | Development | A test suite and test environment that fail the way production did |
| 3. Fix | Your coding agent | A pull request that makes the suite pass |
| 4. Gate | Your CI | A merge that waits for the suite, and a suite that keeps running afterwards |
| 5. Monitor | Production | A judge that labels the failure on live traffic |
1. Detect
Issue detection runs on a schedule, reads recent traces, and records each recurring failure as an Issue. You tell it what matters for your agent in its instructions, and choose how often it runs. Each Issue has a description, its impact, and the traces that show it, so nobody has to search traces by hand to find a failure mode.
2. Reproduce
Fix an agent failure the way you'd fix a software bug: reproduce it first. An agent calls tools and depends on data, so reproducing a failure means recreating the situation the agent was in.
- A test suite is the regression test. Each case is an input and the judges' expected results, like a unit or end-to-end test that runs in CI.
- A test environment is
the situation. It holds the seed data the agent starts with and the results
its tools return, the way you'd mock a storage service or an API in a unit
test. A service that was down in production is down in the environment too.
It is a file in
.judgment/environments/, published withjudgeval test env push <name>.
judgeval test run --suite "<suite name>" plays the suite against the code
in your checkout and exits with 1 when a case fails. The suite has to fail
on the current code before you change anything.
Otherwise it doesn't reproduce the Issue, and passing it later proves nothing.
3. Fix
Fix with on an Issue hands it to your coding agent with a prompt that covers the whole loop: the Issue's evidence, instructions to build the regression suite and environment from the cited traces, and the line that links the pull request back to the Issue. The coding agent builds the suite, shows it failing, makes the fix, and shows it passing. See Triage and fix.
4. Gate
The pull request names the Issue with one line in its description:
Judgment-Issue: https://app.judgmentlabs.ai/org/<org ID>/project/<project ID>/issues/<issue ID>Your CI runs judgeval test run for your baseline suites, the ones listed in
.judgment/judgment.json. A short script reads that line and runs the
Issue's suite the same way, and the check fails when a case fails. It also links the pull request to the Issue,
so the Issue page shows the pull request, its test runs, and the status
Fix in progress. After the merge, the Issue's cases join your baseline, so
every later change runs them too.
Judgment never starts a run and never sees your source code. Your CI runs your agent; Judgment stores the cases, environments and judges, and grades the traces.
5. Monitor
After the fix ships, a judge that checks for the failure runs on production traffic. It's often the same judge that gated the pull request. Its label rate on new traffic tells you whether the fix held, and you can alert on it with a judge action.
Automate it
Every step from detection to monitoring can run without an engineer driving it: from the Judgment Slack agent, your own coding agent connected to the Judgment MCP server, or a pipeline that picks up new Issues. Issues come from your traces, and the suites grow with every fix.
Next step
Fix an Issue behind a regression test walks through the loop on the lunch-order agent.