Skip to main content
Some steps can take a while. Initialization and generation scale with the complexity of the agent project; optimization scales with the rollout budget and how long the agent takes to run.
1

Initialize the repository

Run from the root of your git-tracked Python agent project. Creates the simulator harness under .relai/simulator/.
relai init
2

Create a learning environment

From a prompt, or from a run log plus feedback. The input log can live anywhere — point --log-file at your own path. The generated environment always lands in .relai/learning-envs/.
# from a prompt
relai learning-env create \
  --prompt "{describe the behavior to test}"
# from a log + feedback
relai learning-env create \
  --log-file {path/to/run-log} \
  --feedback "{describe the behavior to preserve}"
3

Optional — register a benchmark

Reuse the same evaluation suite across simulation and optimization.
relai benchmark register --csv {path/to/data.csv} --name {name}
4

Simulate behavior

relai simulate --learning-envs {name}
5

Optimize

Improves the agent against selected environments and benchmarks. When done, it may write changes in a separate worktree and open a GitHub PR if gh is available.
relai optimize --learning-envs {name}

How it works

The core objects, the simulate-then-optimize loop, and the budget math.

Command reference

All flags, defaults, and failure modes for every command.