> ## Documentation Index
> Fetch the complete documentation index at: https://cli-docs.relai.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> The shortest path through the learning loop on a real project: initialize, create one learning environment, simulate, optimize.

This runs [the learning loop](/learning-loop) end-to-end on your **own** agent project — initialize, create one learning environment, simulate, then optimize. It assumes the CLI is installed and configured — if not, start with [Install & setup](/installation). No project of your own yet? [Try the sample agent](/sample-agent) to walk the same loop in your browser.

## Project requirements

Before running `relai init`, consider reviewing the [compatibility requirements](/compatibility). They cover supported languages, runtimes, dependency declarations, and the adapter capabilities that init can verify locally.

<Warning>
  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.
</Warning>

<Steps>
  <Step title="Optional — limit project inputs">
    Add a root-level `.relaiignore` file for files and directories the CLI can ignore because they are not needed to import, configure, or simulate your agent. RELAI uses these patterns to keep matching project files out of agentic init model context and other generation snapshots. Replace placeholders with project-specific paths. See [Controlling project inputs with `.relaiignore`](/cli/init#controlling-project-inputs-with-relaiignore) for scope and examples.

    ```gitignore theme={"system"}
    {local-only-directory}/
    *.{local-extension}
    {generated-output-directory}/
    ```
  </Step>

  <Step title="Initialize the repository">
    Run from the root of your git-tracked agent project. RELAI seeds and
    validates the simulator harness under `.relai/simulator/`, then registers
    the agent. If init pauses for an answer, approval, external action, or
    interruption, continue it with `relai init --resume`.

    ```sh theme={"system"}
    relai init
    ```
  </Step>

  <Step title="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/`.

    ```sh theme={"system"}
    # from a prompt
    relai learning-env create \
      --prompt "{describe the behavior to test}"
    ```

    ```sh theme={"system"}
    # from a log + feedback
    relai learning-env create \
      --log-file {path/to/run-log} \
      --feedback "{describe the behavior to preserve}"
    ```
  </Step>

  <Step title="Optional — register a benchmark">
    Reuse the same evaluation suite across simulation and optimization.

    ```sh theme={"system"}
    relai benchmark register --csv {path/to/data.csv} --name {name}
    ```
  </Step>

  <Step title="Simulate behavior">
    ```sh theme={"system"}
    relai simulate --learning-envs {name}
    ```
  </Step>

  <Step title="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 [GitHub CLI (`gh`)](https://cli.github.com/) is available.

    ```sh theme={"system"}
    relai optimize --learning-envs {name}
    ```
  </Step>
</Steps>

<CardGroup cols={2}>
  <Card title="The learning loop" icon="refresh" href="/learning-loop">
    The loop and the objects it uses, step by step.
  </Card>

  <Card title="Command reference" icon="terminal" href="/cli/overview">
    All flags, defaults, and failure modes for every command.
  </Card>
</CardGroup>
