Skip to main content

rehearsal-kit

Rehearse AI agents on a sandboxed copy of your own application before they reach production.

Rehearsal starts your real application from its published container images in an isolated network with fictional data, writes jobs for your agent to do, and decides each outcome by reading the application's own database. It reports what agents get wrong in practice: duplicate side effects after a timeout, acting on a request the customer already changed, claiming "done" when the records disagree.

Install

The client (Python SDK and rehearsal CLI) talks to a Rehearsal server:

pip install rehearsal-kit

To run the server, workers, and sandboxes yourself:

pip install "rehearsal-kit[server]"

Python 3.11 or newer. Running a server needs Linux with Docker; the client runs anywhere.

Use Rehearsal

Sign in to the hosted service at https://rehearsalkit.xyz, or to a server of your own with --url:

rehearsal login                               # opens the console in your browser; approve the code shown
# rehearsal login --url https://your-rehearsal-server

rehearsal apps add my-app --git https://github.com/you/app --commit <sha> \
  --image web=registry.example.com/app@sha256:<digest>
rehearsal build <app_id> --watch            # compile a practice world
rehearsal profiles create support-agent --prompt-file prompt.md --model nebius:deepseek-ai/DeepSeek-V4.1-Flash
rehearsal eval <world_version_id> --profile <profile_id> --watch

From Python:

from rehearsal.sdk import Rehearsal

rh = Rehearsal()  # your sign-in, or REHEARSAL_URL and REHEARSAL_API_KEY (in CI)
app = rh.applications.create("my-app", {"kind": "git", "url": "https://github.com/you/app", "commit": "<sha>"},
                             images={"web": "registry.example.com/app@sha256:<digest>"})
build = rh.worlds.build(app["id"])
rh.jobs.wait(build["job_id"])

Bring your own agent, in any language, through the episode API: read rh.external.observation(episode_id) and send tool calls with rh.external.act(...).

From TypeScript, the npm package rehearsal-kit has the same client, command and MCP server, and shares the sign-in:

import { Rehearsal } from "rehearsal-kit"; // npm install rehearsal-kit

const rh = new Rehearsal();
const build = await rh.worlds.build("<app_id>");
await rh.jobs.wait(build.job_id);

Run your own server

rehearsal up          # local PostgreSQL in Docker, then migrations
rehearsal bootstrap   # organisation, project, and the first admin key
export REHEARSAL_URL=http://127.0.0.1:7800   # point the CLI at this server
rehearsal serve       # API and console on http://127.0.0.1:7800
rehearsal worker      # builds and evaluations; needs Docker access

Configure model providers with environment variables (REHEARSAL_MODEL_COMPILER, REHEARSAL_MODEL_AGENT, and the provider keys they name). The worker executes application images and controls Docker, so run it on a dedicated machine.

When upgrading an existing server, stop its workers, run rehearsal migrate, then restart the API and workers. Migration 0010 adds a monthly model-spend ledger. Older cumulative job costs retain their creation-month allocation because their individual charge dates were not recorded; new charges use the month they occur.

Jobs with a model-spend limit require a known provider price before making a model call. If a model has no published price available, configure REHEARSAL_PRICING_FILE with a sourced price entry. The self-hosted REHEARSAL_MONTHLY_ALLOWANCE_USD cap covers all projects on that server; hosted plan allowances cover all projects in each workspace.

Model budgets stop further work at usage checkpoints. Calls already in flight can exceed a budget; use provider-side limits when a strict spending ceiling is required.

Hosted billing retains a top-up's credits while its invoice line remains partly paid, and removes them when that line is fully refunded. Ambiguous product-to-invoice matching requires reconciliation rather than guessing which credits to remove.

Build packages from source

This package lives in rehearsal/py/ of the repository; the npm package is in rehearsal/ts/. Build the console before creating a release; rehearsal/py/rehearsal/api/static/ is generated and ignored by Git. Run these commands from the repository root:

pnpm --dir web install --frozen-lockfile
pnpm --dir web build
python -m build rehearsal/py
python -m twine check --strict rehearsal/py/dist/*

Both the wheel and source distribution must include the console export, application catalog, Compose file, agent skill, and Alembic migration files and template. Building from a checkout without the console export produces a server package without the console.

Console fonts are included locally under their SIL Open Font License; the build does not fetch Google Fonts.

Status

Alpha. World compilation, evaluation, comparison, and improvement work end to end; training a model with reinforcement learning is coming soon, and standalone bundle replay is not part of this release.

Metadata

Release files for rehearsal-kit 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rehearsal-kit 0.1.3
File Size Uploaded Provenance Actions
rehearsal_kit-0.1.3.tar.gz 1.6 MB With provenance Details for rehearsal_kit-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rehearsal-kit 0.1.3
File Interpreter ABI Platform Actions
rehearsal_kit-0.1.3-py3-none-any.whl Python 3 none any Details for rehearsal_kit-0.1.3-py3-none-any.whl

Total release size: 3.5 MB

Release files / rehearsal_kit-0.1.3.tar.gz

Download URL rehearsal_kit-0.1.3.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
00a37dce2ddecb2e04330370c7962b445eb4bf1e1eede4e865e684227fab5ac4
BLAKE2b-256 checksum
How to use checksums
a431c94ce2549258e7eb05ee6d2e2c811583ea57b00b031aeba046408e0f9fde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / rehearsal_kit-0.1.3-py3-none-any.whl

Download URL rehearsal_kit-0.1.3-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b4846abc641b30d4f8ed539e609dc68ba37310d3df1655a4c2f6bdfbd3641de9
BLAKE2b-256 checksum
How to use checksums
1def70b58d965073990f5423835b076ba7fbc31b5c3405a10cfc75c75261841b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for rehearsal-kit 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rehearsal_kit-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page