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

# fleet-rlm quickstart

> Install fleet-rlm with uv, pick a Daytona profile, initialize the database, and stream a Turn through pi-tui or the SSE API.

Get fleet-rlm running against a Daytona Sandbox in a few minutes.

## Prerequisites

* **Python 3.13** and [uv](https://docs.astral.sh/uv/getting-started/installation/).
* **Daytona API key** for Sandbox execution.
* **A provider credential.** The default `daytona-recursive` profile uses OpenCode Go (`FLEET_OPENCODE_GO_API_KEY`, `FLEET_OPENCODE_GO_BASE_URL`); the managed and benchmark profiles use the Databricks AI Gateway.
* **A Postgres URL** (`FLEET_DATABASE_URL`) for durable deployments. Local SQLite is only suitable for development.
* **Node 22.19+ and pnpm** if you want to run the supervised backend plus `pi-tui` via `fleet cli`.

## 1. Install fleet-rlm

Clone the repository and sync the extras:

```bash theme={null}
git clone https://github.com/qredence/fleet-rlm.git
cd fleet-rlm
uv sync --all-extras --dev
```

## 2. Choose a profile

Non-secret runtime policy lives in `config/fleet.toml`. Confirm the desired profile in `[config] default_profile` before starting the backend:

```toml theme={null}
[config]
default_profile = "daytona-recursive"
```

Shipped profiles:

| Profile                              | Provider              | Recursion       | Tracing        |
| ------------------------------------ | --------------------- | --------------- | -------------- |
| `daytona`                            | OpenCode Go           | disabled        | local MLflow   |
| `daytona-recursive` (default)        | OpenCode Go           | one child level | local MLflow   |
| `daytona-managed`                    | Databricks AI Gateway | disabled        | managed MLflow |
| `daytona-bench` / `daytona-bench-40` | Databricks AI Gateway | disabled        | disabled       |

The `pi-tui` `/profiles` command rewrites `default_profile` for the next restart. See the [generated profile matrix](https://github.com/qredence/fleet-rlm/blob/main/docs/reference/profile-matrix.md) for the exact environment names and token caps each profile expects.

## 3. Configure environment variables

Only variables named by the selected profile are read; process exports win over `.env` values.

```bash .env theme={null}
# Required for every Daytona profile
FLEET_DAYTONA_API_KEY=...
FLEET_DATABASE_URL=postgresql+asyncpg://user:pass@host/db

# Interactive profiles (daytona, daytona-recursive)
FLEET_OPENCODE_GO_API_KEY=...
FLEET_OPENCODE_GO_BASE_URL=https://<gateway>/v1

# Managed and benchmark profiles instead of the two above
# DATABRICKS_TOKEN=...
# FLEET_DATABRICKS_AI_GATEWAY_BASE_URL=https://<gateway>/serving-endpoints
```

The managed profile additionally requires `FLEET_MLFLOW_EXPERIMENT_NAME`, `FLEET_MLFLOW_TRACE_CATALOG`, `FLEET_MLFLOW_TRACE_SCHEMA`, `FLEET_MLFLOW_TRACE_TABLE_PREFIX`, and `FLEET_MLFLOW_TRACING_SQL_WAREHOUSE_ID`.

## 4. Initialize the database

Fleet never applies migrations at startup. Bring the configured database to the canonical Alembic head before running the backend:

```bash theme={null}
uv run python scripts/db_init.py
```

Confirm the head with `uv run alembic check`.

## 5. Prepare the Daytona snapshot

Verify the required Daytona base snapshot exists so recursive delegations skip the per-run image pull:

```bash theme={null}
make daytona-snapshot-check
```

Use `uv run fleet doctor daytona` for a bounded probe of settings, database head, provider auth, Volume visibility, mount scoping, and interpreter execution before you diagnose a real Turn.

## 6. Start Fleet

Pick one runtime surface:

<CodeGroup>
  ```bash Supervised (backend + pi-tui) theme={null}
  uv run fleet cli
  ```

  ```bash Backend only (fleet) theme={null}
  uv run fleet web --port 8000
  ```

  ```bash Backend only (fleet-rlm) theme={null}
  uv run fleet-rlm serve-api --port 8000
  ```
</CodeGroup>

Launchers default to `127.0.0.1` and reject non-loopback binds unless `--allow-non-loopback-bind` is passed. Backend and MLflow output stream to `.fleet_rlm/logs/`; `latest.log` and `mlflow-latest.log` point to the active files.

Forward arguments to `pi-tui` after `--`:

```bash theme={null}
uv run fleet cli -- --session <session-uuid>
```

## 7. Stream a Turn from the API

Every Turn requires an `Idempotency-Key`. The stream begins immediately with a transient `data-status` chunk, then emits Runtime Events, and closes with `finish` + `[DONE]`.

```bash theme={null}
# Create a Session
SESSION=$(curl -s -X POST http://127.0.0.1:8000/api/sessions \
  -H "Content-Type: application/json" -d '{"title": "hello"}' | jq -r .id)

# Stream one Turn
curl -N -X POST "http://127.0.0.1:8000/api/sessions/$SESSION/turns" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"text": "Summarize the workspace README."}'
```

To cancel a live Run, `PUT /api/runs/{run_id}/cancellation`. Cancelled attempts persist a bounded tombstone in committed history.

## Next steps

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/fleet-rlm/installation">
    Install from source and pin the pi-tui workspace.
  </Card>

  <Card title="Configuration reference" icon="gear" href="/fleet-rlm/reference/configuration">
    Full `config/fleet.toml` and environment matrix.
  </Card>

  <Card title="HTTP API" icon="code" href="/fleet-rlm/reference/http-api">
    Turn streaming contract and error envelope.
  </Card>

  <Card title="Troubleshooting" icon="circle-question" href="/fleet-rlm/guides/troubleshooting">
    Common startup, Daytona, and database errors.
  </Card>
</CardGroup>
