AgentKit
ReferenceCLI commands
BetaYou are reading docs for the beta channel (2.4.1-beta.1) — updated automatically on every beta release.Switch to stable →

CLI commands

ak api start

Start the local API + proxy server

Start the AgentKit local API and proxy server. The server listens on 127.0.0.1 by default (loopback-only). Non-loopback binds require --auth-token for security. State is written to ~/.agentkit/api-state.json so ak api stop and ak api status can find the running process.

Who it's for: Power devs integrating the local API into scripts or other tools; non-technical users via the matching dashboard surface.

When to use it: When you need the AgentKit proxy API running for local tool integrations, dashboards, or automated pipelines. Use ak api status to check if already running.

What changes on disk: Writes ~/.agentkit/api-state.json with PID, bind address, and start time. File is removed by ak api stop.

Usage

ak api start [flags]

Examples

ak api start                               # default loopback, port 8765
ak api start --port 9000                  # custom port
AK_API_TOKEN=<secret> ak api start --bind 0.0.0.0  # non-loopback via env (preferred)
ak api start --bind 0.0.0.0 --auth-token @/run/secrets/ak-token  # token from file
ak api start --json                        # emit startup envelope as JSON

Flags

FlagDescription
--auth-token stringBearer token for request auth (required when --bind is non-loopback; env: AK_API_TOKEN). Prefix with @ to read from a file: --auth-token @/path/to/token. Prefer the AK_API_TOKEN env var to avoid secret exposure in process listings.
--bind stringBind address (default 127.0.0.1; non-loopback requires --auth-token) (default "127.0.0.1")
-h, --helphelp for start
--jsonEmit machine-readable JSON (implies --no-interactive)
--no-interactiveDisable interactive prompts (CI-safe)
--port intPort to listen on (0 = OS-assigned) (default 8765)
-q, --quietSuppress non-error output on stderr
-V, --verboseExtra diagnostic output on stderr (loses to --quiet)
-y, --yesAssume yes for all prompts

Output modes

ModeBehavior
prettydefault on TTY (colors, ASCII markers)
plainauto when stdout piped or --no-interactive
json--json (single-object envelope, NDJSON-safe)

Exit codes

CodeMeaning
0success
1runtime error
2invalid flags
3user-cancel (SIGINT, prompt-cancel)
7non-loopback bind attempted without --auth-token (security violation)
  • ak api — Run a local API + proxy server for AgentKit

On this page