Skip to content
RehearsalDocs

CLI

Every rehearsal command, with its arguments and an example. The 28 commands, grouped by task.

The rehearsal command does everything the console does, from a terminal or a script. It is part of the rehearsal-kit package. Commands print JSON, so you can pass the output to other tools.

pip install rehearsal-kit
rehearsal login

Without an installation, run any command through uvx: uvx --from rehearsal-kit rehearsal login.

The CLI uses the server and key that rehearsal login saved. The environment variables REHEARSAL_URL and REHEARSAL_API_KEY take precedence, which is what a CI job uses. When a command fails, the CLI prints the server's message and a hint: see Errors.

All commands

Start

CommandWhat it does
rehearsal loginSign in: approve this terminal in your browser, or paste an API key
rehearsal whoamiShow the server, workspace and key this machine uses
rehearsal logoutForget the saved sign-in on this machine

Applications and worlds

CommandWhat it does
rehearsal appsAdd, list and upload applications
rehearsal buildCompile an application into a world
rehearsal worldsList practice worlds, their jobs, re-checks and bundles
rehearsal jobsFollow and control builds and other long jobs

Agents and evaluations

CommandWhat it does
rehearsal profilesList and create agent profiles (agent versions)
rehearsal evalEvaluate agent profiles on a world version
rehearsal runsFollow runs and read their episodes
rehearsal compareCompare agents within a run, or two runs on one world version
rehearsal improvePropose a revised agent profile from train/dev failures

Data

CommandWhat it does
rehearsal exportExport verified trajectories as a dataset
rehearsal artifactsList and download exported files
rehearsal export-exampleWrite examples/<app>/ from a published world version and its runs
rehearsal export-replaySave a job's or run's recorded events (already redacted) as a replay file

AI assistants

CommandWhat it does
rehearsal mcpRun the MCP server for AI assistants (stdio; uses your rehearsal login)
rehearsal skillInstall the Rehearsal skill for Claude Code and other agents

Run your own server

CommandWhat it does
rehearsal serveRun the API and console
rehearsal workerRun a job worker
rehearsal upApply database migrations; starts a local database in Docker only when no cloud database is set
rehearsal migrateApply database migrations
rehearsal bootstrapCreate an organisation, project, and admin API key
rehearsal usersConsole accounts (runs on the server)
rehearsal openapiPrint the OpenAPI document
rehearsal pricesModel prices from every source, for the configured model chains

Coming soon

CommandWhat it does
rehearsal trainTrain a model on a world with reinforcement learning
rehearsal run-bundleStart a world from an exported bundle on your own machine

Two options work everywhere: rehearsal --version prints the installed version, and --help after any command prints its arguments.

Start

rehearsal login

Sign in: approve this terminal in your browser, or paste an API key.

The terminal shows a confirmation code and opens the console. Check that the browser shows the same code, then choose Approve. The terminal receives a key with "Build and evaluate" access and saves it for your user only. See Sign in and keys.

rehearsal login [--url <url>] [--with-key] [--no-browser]
ArgumentDefaultMeaning
--url <url>Rehearsal server (default: REHEARSAL_URL, the last server you signed in to, or https://rehearsalkit.xyz)
--with-keyPaste an API key instead of approving in the browser (servers, CI)
--no-browserPrint the approval link instead of opening a browser.
rehearsal login --url https://rehearsal.example.com
You see
Signing in to Rehearsal at https://rehearsal.example.com

Approve this sign-in in your browser:
  https://rehearsal.example.com/app/cli-login/?code=ZKCZ-BVBS

Confirmation code: ZKCZ-BVBS  (the browser shows the same code)

Waiting for approval (Ctrl+C to cancel)....

✓ Signed in to Acme (project default) at https://rehearsal.example.com.
  Saved to ~/.config/rehearsal/config.json (readable by you only). The CLI, the Python SDK and the MCP server use it.
  Next: rehearsal worlds list
rehearsal login --url https://rehearsal.example.com --with-key

With --with-key the terminal asks for a key and hides what you paste. Use it on a server or in CI, where no browser is at hand.

rehearsal whoami

Show the server, workspace and key this machine uses.

The key is shown by its prefix only.

rehearsal whoami
rehearsal whoami
You see
Server:     https://rehearsal.example.com
Workspace:  Acme (project default)
Key:        rh_1a2b3c4d_…  access: write, evaluator
Signed in:  saved sign-in (~/.config/rehearsal/config.json)

rehearsal logout

Forget the saved sign-in on this machine.

This removes the saved key from this machine only. To disable the key everywhere, revoke it on the console's API keys page.

rehearsal logout
rehearsal logout
You see
Signed out. The saved key is removed from this machine; revoke it on the console's API keys page to disable it everywhere.

Applications and worlds

rehearsal apps

Add, list and upload applications.

ActionWhat it does
rehearsal apps import-catalogRegister the bundled catalog of open-source applications
rehearsal apps listApplications in this workspace
rehearsal apps add <name> [--git <git>] [--commit <commit>] [--path <path>] [--image <image>]... [--policies-file <policies_file>]Add an application from a git repository or a local folder
rehearsal apps upload <app_id> <archive>Upload a .tar.gz of an application's source

Arguments of rehearsal apps add:

ArgumentDefaultMeaning
<name>requiredA name for the application, unique in the workspace.
--git <git>Address of a public git repository.
--commit <commit>The full commit SHA to pin. A branch name is not reproducible.
--path <path>A folder on the server's own disk instead of a repository. It must be inside the server's REHEARSAL_SOURCE_ROOTS.
--image <image>One service and its pinned image, as service=image:tag@sha256:.... Repeat it for each service.
--policies-file <policies_file>A text file of rules the agent must follow, in plain words.

Arguments of rehearsal apps upload:

ArgumentDefaultMeaning
<app_id>requiredApplication id, from rehearsal apps list.
<archive>requiredPath to a .tar.gz of the application's source.
rehearsal apps add helpdesk --git https://github.com/you/app --commit 0123456789abcdef0123456789abcdef01234567 --image app=you/app:1.4@sha256:<digest> --policies-file policies.txt
You see
{
  "id": "app_da77a395b6852c5e",
  "project_id": "prj_7f4a9532b99af3d2",
  "name": "helpdesk",
  "connection_mode": "source",
  "source": {
    "kind": "git",
    "url": "https://github.com/you/app",
    "commit": "0123456789abcdef0123456789abcdef01234567"
  },
  "images": {
    "app": "you/app:1.4@sha256:..."
  },
  "policies": "...",
  "notes": "",
  "created_at": "2026-10-10T20:49:54.962887+00:00",
  "removed_at": null
}
rehearsal apps list
You see
[
  {
    "id": "app_e184a0bb1120d4ce",
    "name": "gitea",
    "source": {
      "ref": "v28.1.0",
      "url": "https://github.com/go-gitea/gitea",
      "kind": "git",
      "commit": "4ebd5e319b6a9e629bfd7a04292a6fe85b08dee9"
    },
    "notes": "split=development; domain=code collaboration / issue tracking; license=MIT"
  }
]

rehearsal build

Compile an application into a world.

A build spends model budget and takes 1 to 3 hours. See Build a practice world.

rehearsal build <app_id> [--model <model>] [--budget <budget>] [--scenarios <scenarios>] [--watch]
ArgumentDefaultMeaning
<app_id>requiredApplication id, from rehearsal apps list.
--model <model>Model chain for the World Compiler, in place of the server's default.
--budget <budget>Model spend in US dollars at which the build stops itself.
--scenarios <scenarios>8How many jobs to write.
--watchStay attached and print each event until the build ends.
rehearsal build <app_id> --budget 6 --watch

The command prints job_id, world_id, world_version_id and version, then one line for each event: the time, the event type and a summary.

rehearsal worlds

List practice worlds, their jobs, re-checks and bundles.

validate spends model budget: it tries each job once with a live agent.

ActionWhat it does
rehearsal worlds listWorlds and their versions
rehearsal worlds show <wv_id>One world version
rehearsal worlds scenarios <wv_id>The jobs of a world version
rehearsal worlds validate <wv_id>Re-check every job of a published world
rehearsal worlds bundle <wv_id> [--include-images]Export a portable world bundle

Arguments of rehearsal worlds bundle:

ArgumentDefaultMeaning
<wv_id>requiredWorld version id, from rehearsal worlds list.
--include-imagesPut the container images in the bundle, so it needs no registry. The file is much larger.
rehearsal worlds list

A workspace with no world prints []. Each world has a name, its application_id and its versions; each version has an id, a version number and a status.

rehearsal worlds scenarios <wv_id>

Each job is printed with its id, slug, family, split and status.

rehearsal jobs

Follow and control builds and other long jobs.

retry restarts a failed or stopped job from its last saved step. Finished steps are not repeated.

ActionWhat it does
rehearsal jobs show <job_id>Show a job
rehearsal jobs watch <job_id>Watch a job
rehearsal jobs pause <job_id>Pause a job
rehearsal jobs resume <job_id>Resume a job
rehearsal jobs stop <job_id>Stop a job
rehearsal jobs retry <job_id>Retry a job
rehearsal jobs show <job_id>
rehearsal jobs retry <job_id>

Agents and evaluations

rehearsal profiles

List and create agent profiles (agent versions).

ActionWhat it does
rehearsal profiles listAgent profiles and versions
rehearsal profiles create <name> [--prompt-file <prompt_file>] [--model <model>] [--external]Create an agent profile

Arguments of rehearsal profiles create:

ArgumentDefaultMeaning
<name>requiredName of the agent. A second profile with the same name becomes version 2.
--prompt-file <prompt_file>A text file with the agent's instructions (its system prompt). Without it, the platform default.
--model <model>Model chain for this agent, in place of the server's default.
--externalActions come from your own agent through the API.
rehearsal profiles create support-agent --prompt-file instructions.txt
You see
{
  "id": "prof_7f37a04a339513ca",
  "project_id": "prj_7f4a9532b99af3d2",
  "name": "support-agent",
  "version": 1,
  "spec": {
    "name": "support-agent",
    "version": 1,
    "driver": "llm",
    "system_prompt": "...",
    "tool_guidance": {},
    "model": null,
    "temperature": 0.2,
    "max_turns_per_actor": 25
  },
  "parent_id": null,
  "created_by": "user",
  "rationale": "",
  "created_at": "2026-10-10T20:49:24.980272+00:00"
}
rehearsal profiles list

Each profile is printed with its id, name, version and created_by.

rehearsal eval

Evaluate agent profiles on a world version.

An evaluation spends model budget for each episode. Without --split or --repeats, every approved job runs twice. See Evaluate an agent.

rehearsal eval <wv_id> --profile <profile>... [--split <split>]... [--repeats <repeats>] [--budget <budget>] [--watch]
ArgumentDefaultMeaning
<wv_id>requiredWorld version id, from rehearsal worlds list.
--profile <profile>requiredAgent profile id. Repeat the option to compare several agents in one run.
--split <split>Train, dev or holdout; default every split.
--repeats <repeats>Default 2.
--budget <budget>Model spend in US dollars at which the run stops itself.
--watchStay attached, print each event, then print the summary.
rehearsal eval <wv_id> --profile <profile_id> --split dev --repeats 2 --watch

The command prints run_id, job_id, episodes and shards, then one line for each event, then the summary of the run. Use Rehearsal in CI shows the summary's shape.

rehearsal runs

Follow runs and read their episodes.

ActionWhat it does
rehearsal runs show <run_id>Status and scores of a run
rehearsal runs watch <run_id>Follow a run live
rehearsal runs episodes <run_id>One line per episode
rehearsal runs episode <episode_id>What happened in one episode
rehearsal runs episodes <run_id>

Each episode is printed with its id, scenario, split, profile, status, reward and termination.

rehearsal runs episode <episode_id>
rehearsal runs show run_doesnotexist
You see
Error (404): Run run_doesnotexist not found
Check the id: list what exists with 'rehearsal apps list', 'worlds list', 'profiles list' or 'runs show'.

rehearsal compare

Compare agents within a run, or two runs on one world version.

rehearsal compare <run_a> [<run_b>]
ArgumentDefaultMeaning
<run_a>requiredA run id.
<run_b>A second run id on the same world version. Without it, the agents inside run_a are compared.
rehearsal compare <run_a> <run_b>

rehearsal improve

Propose a revised agent profile from train/dev failures.

This spends a small amount of model budget. It reads only failed train and dev episodes. See Improve an agent.

rehearsal improve <profile_id> <run_id>
ArgumentDefaultMeaning
<profile_id>requiredAgent profile id, from rehearsal profiles list.
<run_id>requiredA finished run that has train or dev episodes of this agent.
rehearsal improve <profile_id> <run_id>

The command prints a job_id. Follow it with rehearsal jobs show <job_id>.

Data

rehearsal export

Export verified trajectories as a dataset.

rehearsal export <run_ids>... [--split <split>]...
ArgumentDefaultMeaning
<run_ids>requiredOne or more run ids.
--split <split>Which split to export. Repeat for several. Default: train.
rehearsal export <run_id> --split train

The command prints a job. The dataset then appears in rehearsal artifacts list.

rehearsal artifacts

List and download exported files.

ActionWhat it does
rehearsal artifacts listExported files
rehearsal artifacts download <artifact_id> <dest>Download one exported file

Arguments of rehearsal artifacts download:

ArgumentDefaultMeaning
<artifact_id>requiredExported file id, from rehearsal artifacts list.
<dest>requiredWhere to save the file.
rehearsal artifacts list
rehearsal artifacts download <artifact_id> dataset.jsonl

rehearsal export-example

Write examples/<app>/ from a published world version and its runs.

rehearsal export-example <wv_id>
ArgumentDefaultMeaning
<wv_id>requiredWorld version id, from rehearsal worlds list.
rehearsal export-example <wv_id>

rehearsal export-replay

Save a job's or run's recorded events (already redacted) as a replay file.

rehearsal export-replay <stream> <dest> [--episode <episode>]
ArgumentDefaultMeaning
<stream>requiredJob_... or run_... id.
<dest>requiredWhere to save the replay file.
--episode <episode>Only this episode's events (runs)
rehearsal export-replay <run_id> replay.json

AI assistants

rehearsal mcp

Run the MCP server for AI assistants (stdio; uses your rehearsal login).

AI assistants start this command themselves. See AI assistants.

rehearsal mcp
rehearsal mcp

The server talks over standard input and output, so it prints nothing in a terminal. It needs the mcp extra: pip install 'rehearsal-kit[mcp]'.

rehearsal skill

Install the Rehearsal skill for Claude Code and other agents.

rehearsal skill <action> [--dir <dir>]
ArgumentDefaultMeaning
<action>requiredinstall copies the skill into a skills folder. print writes it to the terminal. One of: install, print.
--dir <dir>Skills folder (default ~/.claude/skills)
rehearsal skill install --dir ~/.claude/skills

Run your own server

These commands run on the server, not against it. They need the server extra: pip install 'rehearsal-kit[server]'.

rehearsal serve

Self-hosted only Run the API and console.

rehearsal serve [--host <host>] [--port <port>]
ArgumentDefaultMeaning
--host <host>127.0.0.1Address to listen on. Use 0.0.0.0 only behind a proxy that adds HTTPS.
--port <port>7800Port to listen on.
rehearsal serve --host 127.0.0.1 --port 7800
You see
Rehearsal API on http://127.0.0.1:7800, database 127.0.0.1

rehearsal worker

Self-hosted only Run a job worker.

Builds and evaluations run only while a worker is running. See Install with Docker Compose.

rehearsal worker [--kinds <kinds>] [--once]
ArgumentDefaultMeaning
--kinds <kinds>Comma-separated job kinds.
--onceExit when the queue is empty.
rehearsal worker --kinds world_build

Without --kinds, the worker takes every kind of work: world_build, world_validate, evaluation, improvement, dataset_export and bundle_export.

rehearsal up

Self-hosted only Apply database migrations; starts a local database in Docker only when no cloud database is set.

On a server whose REHEARSAL_DATABASE_URL points at another machine, this only applies migrations.

rehearsal up
rehearsal up

rehearsal migrate

Self-hosted only Apply database migrations.

rehearsal migrate
rehearsal migrate

rehearsal bootstrap

Self-hosted only Create an organisation, project, and admin API key.

Run it once on a new server. The key is shown once: save it.

rehearsal bootstrap [--org <org>] [--project <project>]
ArgumentDefaultMeaning
--org <org>LocalName of the organisation to create.
--project <project>defaultName of the project to create in it.
rehearsal bootstrap --org Acme --project default
You see
project: prj_7f4a9532b99af3d2
admin API key (shown once): rh_1a2b3c4d_...
export REHEARSAL_API_KEY=rh_1a2b3c4d_...

rehearsal users

Self-hosted only Console accounts (runs on the server).

The console needs a person's account. This command creates one in the project you name.

ActionWhat it does
rehearsal users add <email> [--name <name>] --project <project> [--role <role>] [--no-password]Give a person access to a project's organisation

Arguments of rehearsal users add:

ArgumentDefaultMeaning
<email>requiredThe person's email address. They sign in to the console with it.
--name <name>Display name. Without it, the part of the email before the @.
--project <project>requiredProject id, as printed by bootstrap.
--role <role>ownerWhat the person may do in the organisation. One of: owner, admin, member.
--no-passwordThe person signs in with Google only.
rehearsal users add you@example.com --project <project_id>
You see
Password (10+ characters): 
Repeat: 
you@example.com can sign in to the console as owner of project prj_7f4a9532b99af3d2.

rehearsal openapi

Self-hosted only Print the OpenAPI document.

rehearsal openapi
rehearsal openapi > openapi.json

rehearsal prices

Self-hosted only Model prices from every source, for the configured model chains.

rehearsal prices
rehearsal prices

For each model chain, the command prints the price the server charges at, with its source and date, and the range that other hosts charge.

Coming soon

rehearsal train

Coming soon Train a model on a world with reinforcement learning.

Not built yet. The command prints a message that says so and exits.

rehearsal train <wv_id> [--base-model <base_model>] [--rounds <rounds>] [--rollouts <rollouts>] [--serve-url <serve_url>]
ArgumentDefaultMeaning
<wv_id>requiredWorld version id, from rehearsal worlds list.
--base-model <base_model>Qwen/Qwen3-1.7BNot used yet.
--rounds <rounds>2Not used yet.
--rollouts <rollouts>4Not used yet.
--serve-url <serve_url>http://127.0.0.1:8001/v1Not used yet.
rehearsal train <wv_id>
You see
Training a model on your practice worlds (reinforcement learning) is coming soon. Every episode already ends with a verified score from the application's database; today you can export verified episodes as a dataset with `rehearsal export`, and improve an agent's instructions with `rehearsal improve`.

rehearsal run-bundle

Coming soon Start a world from an exported bundle on your own machine.

Not built yet. The command prints a message that says so and exits.

rehearsal run-bundle <bundle>
ArgumentDefaultMeaning
<bundle>requiredNot used yet.
rehearsal run-bundle world.tar
You see
Starting a world from a bundle on your own machine is coming soon. Today, evaluate the published world through the server: rehearsal eval <world_version_id> --profile <agent_id>.
Generated from the code of rehearsal-kit 0.1.2.

Was this page helpful?

On this page

Was this page helpful?