Skip to content
RehearsalDocs

Improve an agent

Let Rehearsal fix an agent in rounds, keep only versions that verify more, and prove the best one on jobs it has never seen.

Time
10 to 40 minutes for the fix loop, or 1 minute for a single proposal
Needs:
a finished run with train or dev episodes

The improvement step reads how an agent failed and writes the next version of its instructions. The fix loop repeats that step for you: it rehearses every new version, keeps only the ones that verify more, and proves the best one on the holdout jobs. You can also run a single proposal and check it yourself.

What it reads, and what it may change

It readsThe failed episodes of one agent in one run, on train and dev jobs that are approved
It never readsholdout episodes. They stay unseen, so the final score stays honest
It changesThe agent's instructions and its guidance for tools. The result is a new version of the same profile
It keeps generalThe changes do not name record ids or copy a job's wording. A version that memorised the jobs would not help in production
It does not changeThe earlier version. Versions are kept, so you can go back

Before you start

  • Run the agent on train, dev or both: see Evaluate an agent. The run must be finished.
  • Read the failures first: see Read results. If every failure is an environment error or an unfair job, there is nothing to learn. Do not run the improvement.

Fix it in rounds

Each round of the fix loop does three things:

  1. Propose. The improvement step writes a new version from the failures of the best version so far. It also sees the ideas that earlier rounds tried and that did not help, so it tries something else.
  2. Rehearse. The new version runs every train and dev job, with the default stress layer on.
  3. Keep or discard. The version is kept only when it verifies more episodes and adds no rule violation and no false completion. A tie is not kept.

After the last round, or as soon as every train and dev job passes, the original and the best version run side by side on the holdout jobs. No round has seen those jobs, so that comparison is the result to trust. When no version beat the original, there is nothing to prove and the loop ends without the holdout run.

Open the finished run and choose Fix my agent with the agent's name. The console opens the loop: each round, its reason, its score next to the best so far, the change to the instructions, and at the end the holdout result.

The loop runs inside one job, on one sandbox, and saves each step. If a worker restarts, the loop continues from the round where it stopped. Stopping the job fails the loop's own runs, and keeps every version made so far.

One proposal, checked by hand

Ask for a new version

Open the finished run and choose Improve with the agent's name. The new version appears on the Agents page when the work is done, in about a minute.

Read the reasons

Open Agents. The new version shows Why this version: the reason for each change. Read it. A change you do not agree with is a reason to write the next version by hand.

Check both versions on holdout

Run the old version and the new version together, on the holdout split, with 2 or more repeats.

rehearsal eval <wv_id> --profile <old_profile_id> --profile <new_profile_id> --split holdout --repeats 2 --watch

Both agents get the same jobs at the same time, so the comparison is fair.

Compare, then decide

rehearsal compare <run_id>

Keep the new version only when it is better on holdout and it does not add duplicates or rule violations. A higher success rate with more duplicates is not an improvement for an agent in production.

When the new version is worse, keep the old one. Nothing is lost.

After the decision

The console's Overview shows the result under Before and after improvement: the verified success of each version on the same world.

A version made by the improvement step has learned from the train and dev jobs. For that reason, its readiness on the Overview page counts only holdout episodes.

Do not tune on holdout

If you change the agent because of a holdout failure, the holdout score no longer tells you how the agent does on new work. Build a new world version to get fresh jobs.

A bring-your-own agent

Rehearsal cannot change code that you run, and it cannot rehearse your agent without you. The fix loop is not available for a bring-your-own agent. The single improvement step still proposes new instructions. Treat them as a suggestion, and apply them in your own agent.

Improve by hand

You do not need the improvement step. Create a profile with the same name and your new instructions: it becomes the next version. Then check it on holdout in the same way.

rehearsal profiles create support-agent --prompt-file instructions-v2.txt

Next

Checked against rehearsal-kit 0.1.4 on 27 October 2026.

Was this page helpful?

Edit this page

On this page

Was this page helpful?

Edit this page