> ## 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 Python entry points

> Reference for the maintained fleet-rlm Python entry points: FastAPI factory, CLI, standalone backend command, and Daytona snapshot builder.

Fleet is delivered as a backend service plus a terminal client. The maintained public surface is the [HTTP + SSE API](/fleet-rlm/reference/http-api) and the [CLI](/fleet-rlm/reference/cli). This page documents the small Python surface exposed for embedding and scripting.

There is no maintained public runtime library. Modules under `src/fleet_rlm/` (`api`, `chat`, `rlm`, `daytona`, `sessions`, `persistence`, `composition`) are internal ownership boundaries and change without notice. When the docs disagree with the code, trust the code.

## Application factory

Fleet exposes one FastAPI factory. The default composition inventory comes from the profile selected in `config/fleet.toml`.

```python theme={null}
from fleet_rlm.api.app import create_app

app = create_app()
```

`create_app()`:

* Builds the FastAPI application.
* Installs handlers and routers.
* Eagerly constructs the immutable bundled Skill catalog.

FastAPI lifespan validates settings and installs one complete Daytona (or explicitly injected private-test) runtime inventory. Lifespan owns startup rollback and shutdown.

## Console-script entry points

These are the packaged commands. Each is thin glue over Click or the FastAPI factory.

| Command                      | Module                                 | Purpose                                                                 |
| ---------------------------- | -------------------------------------- | ----------------------------------------------------------------------- |
| `fleet`                      | `fleet_rlm.cli.entry:cli`              | Operator CLI. `cli`, `web`, `doctor`, `settings`, `skills` subcommands. |
| `fleet-rlm`                  | `fleet_rlm.cli.serve:serve_api`        | Standalone backend launcher, plus `daytona-snapshot`.                   |
| `fleet-doctor`               | `fleet_rlm.cli.doctor:main`            | Bounded diagnostics.                                                    |
| `fleet-rlm-daytona-snapshot` | `fleet_rlm.cli.serve:daytona_snapshot` | Build or refresh the Daytona base snapshot.                             |

See the [CLI reference](/fleet-rlm/reference/cli) for their flags and semantics.

## Programmatic backend startup

To embed the backend inside another Python process, call the FastAPI factory and hand it to your ASGI server. Loopback binding stays enforced through the CLI layer; when embedding, enforce network exposure at your ASGI server or reverse proxy.

```python theme={null}
import uvicorn
from fleet_rlm.api.app import create_app

if __name__ == "__main__":
    uvicorn.run(create_app(), host="127.0.0.1", port=8000, log_config=None)
```

The lifespan probe still requires `config/fleet.toml` with an explicit `[config] default_profile` and every environment variable referenced by that profile. The database must already be at the Alembic head; startup does not run migrations.

## Sandbox-serializable inputs

`dspy.RLM` receives large inputs through DSPy's own `SandboxSerializable` contract (DSPy 3.3.0). Fleet-owned host code builds these values on the Fleet Root's behalf. They are host-constructed under strict local validation and are not part of a public Python-integration surface.

Custom Skill Signatures see only JSON-compatible common input fields. If you are authoring a Skill, define your Signature against the shipped common input contract; do not import Fleet-internal capsule classes.

## Import verification

Verify the small maintained entry points import cleanly against the installed distribution:

```bash theme={null}
uv run python -c "from fleet_rlm.api.app import create_app"
uv run python -c "from fleet_rlm.cli.entry import cli"
uv run python -c "from fleet_rlm.cli.serve import serve_api"
```

## See also

* [HTTP API](/fleet-rlm/reference/http-api) for the maintained public contract.
* [CLI](/fleet-rlm/reference/cli) for the packaged commands.
* [Configuration](/fleet-rlm/reference/configuration) for `config/fleet.toml` and the environment inputs each profile requires.
