Quickstart
Install Agent AFK, set your API key, and run your first command in under two minutes.
Prerequisites
- Node.js ≥ 22 — check with
node --version - An Anthropic API key (or run
afk loginfor browser-based OAuth)
Install
npm install -g agent-afkConfirm the binary is on your PATH:
afk --versionSet your API key
The simplest path is an environment variable:
export ANTHROPIC_API_KEY=sk-ant-...Add that line to your shell profile (~/.zshrc, ~/.bashrc, etc.) to make it permanent.
Alternatively, write it to Agent AFK's env config file so it's scoped to afk only:
echo "ANTHROPIC_API_KEY=sk-ant-..." >> ~/.afk/config/afk.envOr keep the key out of your shell history with a masked prompt:
afk config env set ANTHROPIC_API_KEY # prompts without echoing the valueOr use the OAuth flow (no API key required — authenticates via console.anthropic.com):
afk loginSmoke test
Verify the installation and provider connectivity:
afk chat "hello"
afk doctor # environment self-check: Node version, API key, paths, configafk doctor will flag any missing keys, path problems, or provider connectivity issues.
Your first session
For a one-shot question:
afk chat "summarise the last 10 git commits in this repo"For an interactive REPL with full tool access (bash, file ops, web fetch, subagents):
afk iInside the REPL, type a message and press Enter. Use /help to list slash commands.
afk i is an alias for afk interactive. The REPL is the default command — running afk
with no subcommand also starts the REPL.
Choose a model
The default model is sonnet. Override per-command:
afk chat "explain this stack trace" --model opus
afk i --model haiku| Alias | Description |
|---|---|
fable | Most capable — hardest reasoning, 1M context |
opus | Complex reasoning, multi-step planning |
sonnet | Balanced speed and capability (default) |
haiku | Fast and cheap, good for simple tasks |
Next steps
- How It Works — session lifecycle, provider routing, terminal states
- Interactive REPL — slash commands, plan mode, background tasks
- One-Shot Chat — pipe-friendly, headless streaming
- Daemon — cron scheduling, unattended runs
- Telegram — bot setup and supervision