The shortest path through the loop on a real project: initialize, create one learning environment, simulate, optimize.
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 promptrelai learning-env create \ --prompt "{describe the behavior to test}"
# from a log + feedbackrelai 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.
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.