> ## 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.

# Introduction to fleet-rlm

> fleet-rlm is a FastAPI SSE backend for recursive language-model turns on dspy.RLM, with a maintained terminal client (pi-tui) and Daytona-backed workspace-scoped volumes.

`fleet-rlm` is the RLM-native backend behind Qredence's Fleet product. It runs one `dspy.RLM` per Turn against a Daytona Sandbox with a workspace-scoped durable Volume, streams typed Runtime Events over FastAPI Server-Sent Events, and persists committed Turn history and Artifacts through Alembic-managed Postgres.

The maintained development client is the pi-tui workspace under `tools/fleet-tui/`. There is no Fleet-shipped web UI: the earlier browser workspace and dual runtime were removed in the `dev-0.7` cutover.

## What it is

* **A backend, not an app.** `src/fleet_rlm/` exposes a small `/api/*` surface (Sessions, Turns, Attachments, Artifacts, Volume, Skills, Runs) and one SSE Turn stream.
* **RLM-first orchestration.** One Turn = one fresh native `dspy.RLM` run. Root delegation uses Python, native sub-LM queries, or one level of isolated child RLMs according to a cheapest-sufficient ladder.
* **Daytona-backed execution.** Every Turn acquires an Interpreter Lease against a Daytona Sandbox and mounts a workspace-scoped Volume. Workspace Memory is durable across Runs and Sandbox replacement.
* **Native scrollback client.** `pi-tui` streams the AI SDK UI message stream and does not own a model, provider key, or Sandbox.

## Who it's for

Operators and researchers who want a certified, policy-driven RLM runtime — with idempotent Turns, durable Artifacts, workspace-scoped Memory, and native DSPy tracing — behind a small SSE HTTP contract they can drive from `pi-tui` or their own client.

## Two runtime surfaces

<CardGroup cols={2}>
  <Card title="Supervised backend + pi-tui" icon="terminal">
    `uv run fleet cli` starts the backend, waits for readiness, then launches `pi-tui` in the foreground. Requires Node 22.19+ and pnpm.
  </Card>

  <Card title="Backend only" icon="server">
    `uv run fleet web` or `uv run fleet-rlm serve-api --port 8000` runs the FastAPI SSE surface without a client. Bind to `127.0.0.1` unless you opt in with `--allow-non-loopback-bind`.
  </Card>
</CardGroup>

## Policy-selected profiles

Fleet is strict about non-secret runtime policy. `config/fleet.toml` declares named profiles and `[config] default_profile` selects which one runs. The shipped default is `daytona-recursive`; other options include `daytona`, `daytona-managed`, and the benchmark profiles.

* `daytona` and `daytona-recursive` route through OpenCode Go with `FLEET_OPENCODE_GO_API_KEY` and `FLEET_OPENCODE_GO_BASE_URL`.
* `daytona-managed` and the benchmark profiles route through the Databricks AI Gateway with `DATABRICKS_TOKEN` and `FLEET_DATABRICKS_AI_GATEWAY_BASE_URL`.
* Every profile requires `FLEET_DAYTONA_API_KEY`, and durable deployments require `FLEET_DATABASE_URL` at the canonical Alembic head.

See the [configuration reference](/fleet-rlm/reference/configuration) for the full env matrix.

## Where to go next

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/fleet-rlm/quickstart">
    Install fleet-rlm, pick a profile, and stream a Turn in a few minutes.
  </Card>

  <Card title="Architecture" icon="sitemap" href="/fleet-rlm/concepts/architecture">
    Turn coordinator, RLM runner, Run lifecycle, and Daytona substrate.
  </Card>

  <Card title="Recursive RLM" icon="diagram-project" href="/fleet-rlm/concepts/recursive-rlm">
    Root delegation ladder, one-level child recursion, and shared budgets.
  </Card>

  <Card title="Daytona runtime" icon="cubes" href="/fleet-rlm/concepts/daytona-runtime">
    Sandbox lifecycle, Workspace Volume Scope, and Interpreter Leases.
  </Card>

  <Card title="HTTP API" icon="code" href="/fleet-rlm/reference/http-api">
    `POST /api/sessions/{id}/turns`, SSE stream contract, and error envelopes.
  </Card>

  <Card title="CLI reference" icon="terminal" href="/fleet-rlm/reference/cli">
    `fleet cli`, `fleet doctor daytona`, `fleet web`, and `fleet-rlm serve-api`.
  </Card>
</CardGroup>

## Source of truth

When the docs disagree with the code, trust the code:

* Backend routes and SSE contract: `src/fleet_rlm/api/`.
* Turn lifecycle: `src/fleet_rlm/chat/`.
* Daytona execution: `src/fleet_rlm/daytona/`.
* Non-secret runtime policy: `config/fleet.toml`.
* Canonical HTTP schema: [`openapi.yaml`](https://github.com/qredence/fleet-rlm/blob/main/openapi.yaml).
