> ## 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 configuration reference

> Reference for fleet-rlm environment variables: LLM keys, Daytona sandboxes, Entra auth, Neon database, MLflow tracing, and recursive RLM budgets.

fleet-rlm reads configuration from environment variables (or a `.env` file in the working directory). The full template lives at [`.env.example`](https://github.com/Qredence/fleet-rlm/blob/main/.env.example).

## Required: LLM

You can provide LLM credentials either through environment variables (shown below) or through persisted **provider profiles** managed from Settings or the `/api/v1/runtime/llm-profiles` API. Profiles store encrypted keys, allow per-role model bindings (planner, delegate, delegate\_small), and are the preferred path for any setup with more than one provider.

| Variable                       | Description                              | Example                   |
| ------------------------------ | ---------------------------------------- | ------------------------- |
| `DSPY_LM_MODEL`                | Planner model (LiteLLM format)           | `openai/gpt-4o-mini`      |
| `DSPY_DELEGATE_LM_MODEL`       | Delegate model used by recursive RLM     | `openai/gpt-4o-mini`      |
| `DSPY_DELEGATE_LM_SMALL_MODEL` | Optional small-context delegate model    | `openai/gpt-4o-mini`      |
| `DSPY_LLM_API_KEY`             | API key for the LLM provider             | `sk-...`                  |
| `DSPY_LM_API_BASE`             | Optional custom endpoint (LiteLLM proxy) | `https://your-litellm/v1` |

<Tip>
  When migrating an existing `.env` into the profile system, call `POST /api/v1/runtime/llm-profiles/import-env` once. Fleet creates a profile from the current `DSPY_*` values and wires up planner / delegate role bindings automatically. See the [HTTP API reference](/fleet-rlm/reference/http-api#llm-provider-profiles) for the full surface.
</Tip>

## Required: Daytona

| Variable          | Description           | Default                      |
| ----------------- | --------------------- | ---------------------------- |
| `DAYTONA_API_KEY` | Daytona API key       | —                            |
| `DAYTONA_API_URL` | Daytona API base URL  | `https://app.daytona.io/api` |
| `DAYTONA_TARGET`  | Daytona target/region | `default`                    |

## App environment

| Variable            | Values                           | Description                        |
| ------------------- | -------------------------------- | ---------------------------------- |
| `APP_ENV`           | `local`, `staging`, `production` | Environment guardrail              |
| `AUTH_MODE`         | `dev`, `entra`                   | Auth backend                       |
| `AUTH_REQUIRED`     | `true`, `false`                  | Enforce auth on `/api/v1/*`        |
| `DATABASE_REQUIRED` | `true`, `false`                  | Require Neon/Postgres connectivity |
| `DEV_JWT_SECRET`    | string                           | HS256 secret for dev tokens        |

<Warning>
  Runtime settings writes (`PATCH /api/v1/runtime/settings`) are intentionally limited to `APP_ENV=local`.
</Warning>

## Database

| Variable       | Description                       |
| -------------- | --------------------------------- |
| `DATABASE_URL` | PostgreSQL/Neon connection string |

When `DATABASE_REQUIRED=true`, the readiness endpoint reports `database: missing` if the connection cannot be established.

## MLflow tracing

| Variable              | Default                 | Description                                    |
| --------------------- | ----------------------- | ---------------------------------------------- |
| `MLFLOW_ENABLED`      | `true`                  | Enable MLflow tracing                          |
| `MLFLOW_TRACKING_URI` | `http://127.0.0.1:5001` | MLflow server URL                              |
| `MLFLOW_EXPERIMENT`   | `fleet-rlm`             | Experiment name                                |
| `MLFLOW_AUTO_START`   | `true`                  | Auto-start localhost MLflow in `APP_ENV=local` |

To run a local MLflow server explicitly:

```bash theme={null}
make mlflow-server
```

## Recursive RLM

Controls the delegation engine and child sandbox isolation.

| Variable                            | Default         | Description                                                                          |
| ----------------------------------- | --------------- | ------------------------------------------------------------------------------------ |
| `RLM_CHILD_ISOLATION_MODE`          | `auto`          | `auto`, `clean`, `context` (debug only)                                              |
| `RLM_CHILD_FORK_FALLBACK`           | `clean`         | Behavior when fork creation fails                                                    |
| `rlm_max_iterations`                | runtime default | Per-RLM iteration cap                                                                |
| `rlm_max_llm_calls`                 | runtime default | Tree-wide semantic call budget                                                       |
| `FLEET_RLM_LARGE_CONTEXT_THRESHOLD` | `32000`         | Character threshold at which an `auto` turn is routed to native RLM instead of ReAct |

See [Recursive RLM](/fleet-rlm/concepts/recursive-rlm) for the full isolation policy.

When `execution_mode=auto`, fleet-rlm estimates the per-turn context size from attached docs, repo paths, and inline content, then compares it against `FLEET_RLM_LARGE_CONTEXT_THRESHOLD`. Turns above the threshold route to the native RLM path, which handles large inputs as REPL variables instead of inlining them into the planner prompt. Lower this value to delegate long context sooner; raise it to keep more turns on the ReAct path.

Fleet-rlm logs a warning and falls back to the default when the value is not a positive integer.

## Analytics

| Variable          | Default                    | Description              |
| ----------------- | -------------------------- | ------------------------ |
| `POSTHOG_ENABLED` | `false`                    | Enable PostHog analytics |
| `POSTHOG_HOST`    | `https://eu.i.posthog.com` | PostHog host             |

## Quick configurations

### Local development

```bash .env theme={null}
APP_ENV=local
AUTH_MODE=dev
AUTH_REQUIRED=false
DATABASE_REQUIRED=false

DSPY_LM_MODEL=openai/gpt-4o-mini
DSPY_LLM_API_KEY=sk-...
DAYTONA_API_KEY=...
```

### Production

```bash .env.production theme={null}
APP_ENV=production
AUTH_MODE=entra
AUTH_REQUIRED=true
DATABASE_REQUIRED=true

DSPY_LM_MODEL=openai/gpt-4o
DSPY_LLM_API_KEY=sk-...
DAYTONA_API_KEY=...
DATABASE_URL=postgresql://USER:PASS@HOST/DB?sslmode=require
MLFLOW_TRACKING_URI=https://mlflow.example.com
```

<Tip>
  Never commit a `.env` file with real secrets. Use your team's secret-management workflow instead.
</Tip>

## See also

* [Deployment guide](/fleet-rlm/guides/deployment)
* [HTTP API reference](/fleet-rlm/reference/http-api)
