Skip to content

Connect an agent and send your first message

By the end of this tutorial you’ll have a live agent connected to Alfe from your own machine, verified from both the CLI and the Agent API, and you’ll have sent it a message. It takes a few minutes.

You need these before step 1:

Terminal window
npm i @alfe.ai/cli -- -g

Then confirm it’s on your PATH:

Terminal
alfe --version

Create the agent record in the dashboard, so the machine has an identity to connect to:

  1. Open Agents at app.alfe.ai and create an agent.
  2. On Hosting, select Run it yourself and choose a runtime. OpenClaw is the default.
  3. Finish the wizard and open the agent’s Overview tab.
  4. Under Get started locally, select Generate setup token and copy the token. It’s shown once.

alfe setup connects the agent on this machine. It installs the agent runtime, starts the local gateway daemon, and registers the Alfe platform tools so the agent can reach memory, model routing, and integrations.

Terminal
export ALFE_API_KEY=<SETUP_TOKEN>
alfe setup

When it finishes, the daemon is running and the agent is connected. Confirm who you are, then check the agent’s health:

Terminal
alfe whoami
alfe doctor

Your setup token is the agent’s API key, and it’s the value of ALFE_API_KEY from step 3. Ask the API who it is:

Terminal
curl https://api.alfe.ai/agent/identity/whoami \
-H "Authorization: Bearer $ALFE_API_KEY"
{ "data": { "agentId": "agt_…", "tenantId": "…" } }

Seeing your agentId confirms the agent is authenticated and reachable. See Authentication for the full token model.

Open the agent’s Chat tab in the dashboard and send it a message. To talk to it where you already work, connect a channel like Slack or Microsoft Teams from Integrations — each agent gets its own bot identity on the channel.