agentafk

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 login for browser-based OAuth)

Install

npm install -g agent-afk

Confirm the binary is on your PATH:

afk --version

Set 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.env

Or keep the key out of your shell history with a masked prompt:

afk config env set ANTHROPIC_API_KEY   # prompts without echoing the value

Or use the OAuth flow (no API key required — authenticates via console.anthropic.com):

afk login

Smoke test

Verify the installation and provider connectivity:

afk chat "hello"
afk doctor       # environment self-check: Node version, API key, paths, config

afk 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 i

Inside 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
AliasDescription
fableMost capable — hardest reasoning, 1M context
opusComplex reasoning, multi-step planning
sonnetBalanced speed and capability (default)
haikuFast and cheap, good for simple tasks

Next steps