Skip to content

alfe setup --managed

alfe setup --managed runs the connection flow without prompts, so it suits cloud-init scripts, Dockerfiles, and other unattended provisioning. It reads its configuration from environment variables and marks the machine as managed.

Terminal
ALFE_API_KEY=<SETUP_TOKEN> alfe setup --managed

Use a setup token from the agent’s Overview tab. The token decides which agent the machine runs.

These variables configure the run:

Variable Required Purpose
ALFE_API_KEY Yes The API key the agent authenticates with.
ALFE_API_URL No Override the API endpoint. By default it’s derived from the key.
ALFE_MANAGED No Set to true to enable managed mode without passing --managed.

If ALFE_API_KEY isn’t set, the command falls back to the key in ~/.alfe/config.toml. If neither exists, it exits with an error.

Managed setup runs these steps in order:

  1. Resolves the API key and writes ~/.alfe/config.toml with managed mode on.
  2. Asks Alfe which agent and runtime the key belongs to.
  3. Installs the runtime if it’s missing, and installs a diagnostics helper on a best-effort basis.
  4. Prepares the workspace and applies the agent’s persona.
  5. Installs and starts the gateway daemon as a system service.
  6. Registers the Alfe platform MCP server. A failure here doesn’t fail setup.

The result is a connected agent that comes back online after a reboot.

Confirm the agent is healthy:

Terminal
alfe doctor

You can also check its status in the dashboard.