Managing from the CLI
The Alfe CLI connects an agent from a terminal and keeps it running. It installs a small, always-on gateway daemon that keeps the agent connected to Alfe.
- On a self-hosted agent, you run the CLI on your own machine or server.
- On a managed agent, Alfe runs the same CLI on the machine it provisions, so you rarely need to touch it.
Install it with:
npm i @alfe.ai/cli -- -gpnpm add @alfe.ai/cli -gbun add @alfe.ai/cli -gConnect a self-hosted agent
Section titled “Connect a self-hosted agent”alfe setup connects an agent on the machine you run it on. It
needs that agent’s key, which you generate on the agent’s Overview tab.
ALFE_API_KEY=<SETUP_TOKEN> alfe setupIt’s safe to re-run at any time to repair the connection or apply a runtime change.
Provision without prompts
Section titled “Provision without prompts”alfe setup --managed runs the flow without prompts,
reading its configuration from environment variables. Alfe uses it to bring a
managed machine online, and it also suits your own unattended provisioning.
ALFE_API_KEY=<SETUP_TOKEN> alfe setup --managedDay-to-day commands
Section titled “Day-to-day commands”Once an agent is connected, a few commands cover most operation:
| Command | What it does |
|---|---|
alfe doctor |
Check configuration, the API key, the daemon, and the runtime. |
alfe whoami |
Show the connected identity and runtime. |
alfe gateway status |
Show whether the daemon is connected. |
alfe gateway restart |
Restart the daemon. |
alfe gateway logs |
Tail the daemon logs. |
alfe runtime switch <runtime> |
Move the agent to another runtime. |
alfe remove |
Uninstall Alfe’s integrations and revert their config. |
Configuration lives at ~/.alfe/config.toml, and setup writes it for you. See
the CLI reference for the full command set.
Work without a terminal
Section titled “Work without a terminal”You don’t need the CLI to run a managed agent. Creating one in the dashboard handles all of this, and the agent’s Maintenance controls cover restarts. Agents can also work for themselves over MCP and the Agent API.