Three ways to configure

Every setting can be given as a command-line flag, an AGENT_TANK_* environment variable or a key in a JSON config file, though not every setting exists on every surface. The tables below show all three side by side.

Command-line flags, for one-off runs:

agent-tank --claude --codex --port 8080 --refresh-cooldown 60

Environment variables, for secrets and service managers:

AGENT_TANK_TOKEN=change-me AGENT_TANK_AUTO_REFRESH_MODE=interval agent-tank

A config file, for multiple accounts and settings you keep:

config.json
{
  "agents": [{ "provider": "claude" }, { "provider": "codex" }],
  "autoRefresh": { "mode": "interval", "interval": 120 },
  "history": { "retentionDays": 30 }
}
agent-tank -c config.json

Precedence

The README states the order as: environment variables override CLI flags and config file values, CLI flags override the config file, and defaults apply last.

Effective order (first wins)Options
Environment variable → CLI flag → config file → defaultBind address, Basic Auth user, Basic Auth password, Bearer token, History database
Environment variable → CLI flag (when passed) → config file → defaultRecord history, Dashboard sparkline
Environment variable → config file → CLI flag or its defaultDocker bridge bind, Auto-refresh, Refresh mode, Refresh interval, Refresh cooldown, Activity debounce, Keepalive, Keepalive interval, Retention
On if any of the three turns it onFresh process, Claude API mode
CLI flag or its default; the config key is ignoredPort
Combined from every surface; ids must be uniqueAccounts, Monitor Claude, Monitor Codex, Monitor Antigravity

Background mode has three exceptions: --no-background, --once and --json suppress AGENT_TANK_BACKGROUND=1 for that run. --once also turns off auto-refresh and keepalive whatever else is set.

Boolean flags and variables

Every on/off flag also accepts a --no- prefix. These are the ones that change something: the defaults that are on, and --no-background to override AGENT_TANK_BACKGROUND=1:

agent-tank --no-auto-discover
agent-tank --no-docker
agent-tank --no-auto-refresh
agent-tank --no-keepalive
agent-tank --no-history
agent-tank --no-history-chart
agent-tank --no-background

Boolean environment variables accept 1 or true to turn a setting on, and 0 or false to turn it off:

  • AGENT_TANK_DOCKER, AGENT_TANK_AUTO_REFRESH, AGENT_TANK_KEEPALIVE, AGENT_TANK_HISTORY, AGENT_TANK_HISTORY_CHART: when set, any value other than 1 or true turns the setting off.
  • AGENT_TANK_FRESH_PROCESS, AGENT_TANK_CLAUDE_API, AGENT_TANK_BACKGROUND: 1 or true turns the setting on; any other value leaves it as the flags and config file set it.

Accounts and providers

Which CLIs Agent Tank monitors. With no provider flag, --agent or agents entry, it auto-discovers every supported CLI on your PATH.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Monitor Claude --claude — claude off 0.9.0

Monitor the default Claude Code account.

"claude": true is a legacy top-level config key, still supported for a single default account; use agents for anything more.

Monitor Codex --codex — codex off 0.9.0

Monitor the default OpenAI Codex account.

"codex": true is a legacy top-level config key, still supported for a single default account.

Monitor Antigravity --agy — agy off 0.9.7

Monitor the default Antigravity CLI (agy) account.

"agy": true is a legacy top-level config key, still supported for a single default account.

Accounts --agent <spec> — agents — 0.9.11

Add an account as provider[:alias][=config-path]. Repeat the flag once per account; in the config file, list { provider, id, alias, configPath } objects. See Multiple accounts below.

Accounts from agents, --agent, and --claude / --codex / --agy (or their legacy config keys) are combined; every account id must be unique.

Auto-discover --auto-discover
--no-auto-discover
— — on 0.9.0

Auto-discover the supported CLIs installed on your PATH. Only used when no account is configured.

Multiple accounts

Use the agents array to monitor several accounts, including several accounts of the same provider. Each entry takes a provider (claude, codex, agy), an optional unique id and display alias, and an optional configPath directory:

config.json
{
  "agents": [
    {
      "provider": "codex",
      "id": "work",
      "alias": "Work",
      "configPath": "/srv/accounts/codex-work"
    },
    {
      "provider": "codex",
      "id": "personal",
      "alias": "Personal",
      "configPath": "/srv/accounts/codex-personal"
    },
    {
      "provider": "claude",
      "id": "client-a",
      "alias": "Client A",
      "configPath": "./accounts/claude-client-a"
    }
  ]
}

The same setup on the command line repeats --agent provider[:alias][=config-path] once per account:

agent-tank \
  --agent codex:work=/srv/accounts/codex-work \
  --agent codex:personal=/srv/accounts/codex-personal
  • id and alias. The id (or the CLI alias after :) is the key returned by /status and used by the account-specific status, history and refresh endpoints. If both id and alias are set in JSON, id is the API key and alias is the dashboard label. Without either, the id is the provider name.
  • Allowed ids. Letters, numbers, dots, underscores and hyphens, starting with a letter or number. Every id must be unique.
  • Paths. Relative configPath values are resolved relative to the JSON config file (relative --agent paths, relative to the current directory), and ~/ is expanded to your home directory.

The path is passed to the provider CLI as its config home:

ProviderproviderConfig home variable
Claude CodeclaudeCLAUDE_CONFIG_DIR
OpenAI CodexcodexCODEX_HOME
Antigravity CLIagyGEMINI_CLI_HOME

Server

Where the dashboard and HTTP API listen.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Port --port <port> — port 3456 0.9.0

HTTP server port for the dashboard and API.

In 0.10.0 the --port default always takes precedence, so port in the config file has no effect. Pass --port instead.

Bind address --host <host> AGENT_TANK_HOST host 127.0.0.1 + Docker bridge 0.9.0

Address to bind. When omitted, Agent Tank binds 127.0.0.1 and, if Docker is available, the Docker bridge gateway addresses. Use 0.0.0.0 to expose it on all interfaces.

Docker bridge bind --docker
--no-docker
AGENT_TANK_DOCKER dockerAccess on 0.9.4

Also bind the Docker bridge gateway addresses when --host is omitted, so containers on the same host can reach Agent Tank without exposing it publicly. --no-docker binds localhost only.

Authentication

The HTTP server is open by default. Set a Basic Auth user and password, a Bearer token, or both.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Basic Auth user --auth-user <user> AGENT_TANK_USER auth.user — 0.9.0

HTTP Basic Auth username.

Basic Auth password --auth-pass <pass> AGENT_TANK_PASS auth.pass — 0.9.0

HTTP Basic Auth password.

Prefer the environment variable or config file: flags are visible to other users in the process list.

Bearer token --auth-token <token> AGENT_TANK_TOKEN auth.token — 0.9.0

API key accepted as a Bearer token.

Refresh

When and how often Agent Tank asks each CLI for fresh usage data.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Auto-refresh --auto-refresh
--no-auto-refresh
AGENT_TANK_AUTO_REFRESH autoRefresh.enabled on 0.9.0

Enable or disable background auto-refresh. Turning it off is the same as mode none.

Refresh mode --auto-refresh-mode <mode> AGENT_TANK_AUTO_REFRESH_MODE autoRefresh.mode activity 0.9.0

Refresh strategy: activity, interval or none. See Auto-refresh modes below.

An unknown value falls back to activity.

Refresh interval --auto-refresh-interval <seconds> AGENT_TANK_AUTO_REFRESH_INTERVAL autoRefresh.interval 60 s 0.9.0

Auto-refresh interval in seconds for interval mode. 0 disables it.

Refresh cooldown --refresh-cooldown <seconds> AGENT_TANK_REFRESH_COOLDOWN refreshCooldown 30 s 0.9.5

Minimum time between refreshes of the same agent, applied to manual refreshes, startup refreshes and detected activity. 0 disables the cooldown.

autoRefresh.refreshCooldown is also read; the top-level refreshCooldown wins when both are set.

Activity debounce --activity-debounce <ms> AGENT_TANK_ACTIVITY_DEBOUNCE autoRefresh.activityDebounce 5000 ms 0.9.0

In activity mode, how long to wait after detected CLI activity before refreshing, in milliseconds.

Fresh process --fresh-process AGENT_TANK_FRESH_PROCESS freshProcess off 0.9.0

Spawn a new CLI process for every refresh instead of keeping one session alive. Also disables keepalive.

On if any surface turns it on; AGENT_TANK_FRESH_PROCESS=0 cannot turn off the flag or config key.

Auto-refresh modes

ModeDescription
activityDefault. Watches known local agent directories and refreshes when activity is detected.
intervalRefreshes on a fixed timer (--auto-refresh-interval).
noneNo background refresh. Use manual refresh only (POST /refresh or the dashboard buttons).
# Interval polling
agent-tank --auto-refresh-mode interval

# Manual-only mode
agent-tank --auto-refresh-mode none

# Longer activity debounce
agent-tank --activity-debounce 10000

Activity directories

In activity mode Agent Tank watches these local directories:

ProviderWatched directories
Claude Code~/.config/claude/projects/
~/.claude/
OpenAI Codex~/.codex/sessions/
~/.codex/
Antigravity CLI~/.gemini/antigravity-cli/

If no suitable directories are found, it falls back to interval mode.

Session keepalive

Keepalive helps persistent PTY-backed sessions stay warm. It is disabled automatically with --fresh-process and --once, and is not needed for Codex JSON-RPC mode.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Keepalive --keepalive
--no-keepalive
AGENT_TANK_KEEPALIVE keepalive.enabled on 0.9.0

Enable or disable session keepalive.

Keepalive interval --keepalive-interval <seconds> AGENT_TANK_KEEPALIVE_INTERVAL keepalive.interval 300 s 0.9.0

Session keepalive interval in seconds. 0 disables keepalive.

Claude API mode

By default Claude usage is collected via PTY by running /usage. Claude API mode reads the same OAuth credentials the CLI already uses and calls https://api.anthropic.com/api/oauth/usage instead, refreshing expired tokens when needed and falling back to PTY mode if the API path fails.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Claude API mode --claude-api AGENT_TANK_CLAUDE_API claudeApi off 0.9.0

Read Claude usage from the Anthropic OAuth usage API instead of the CLI’s /usage. Usually faster, and supports a shorter refresh interval.

On if any surface turns it on; AGENT_TANK_CLAUDE_API=0 cannot turn off the flag or config key.

agent-tank --claude --claude-api

# or
AGENT_TANK_CLAUDE_API=1 agent-tank --claude

Usage history

Usage history is stored in SQLite with Node’s built-in node:sqlite, one row per metric per refresh. It needs Node.js 22.5+; on older runtimes Agent Tank logs one warning, keeps running without history and reports store: "none".

OptionCLI flagEnvironment variableConfig keyDefaultSince
Record history --history
--no-history
AGENT_TANK_HISTORY history.enabled on 0.10.0

Enable or disable usage history recording. When off, GET /config and GET /history report store: "none".

History database --history-db <path> AGENT_TANK_HISTORY_DB history.dbPath ~/.agent-tank/history.db 0.10.0

SQLite history database file.

A relative history.dbPath is resolved against the config file’s directory, and ~/ is expanded.

Retention --history-retention-days <days> AGENT_TANK_HISTORY_RETENTION_DAYS history.retentionDays 14 days 0.9.0

Days of usage history to keep. Older rows are deleted on write.

0, negative and invalid values fall back to 14.

Dashboard sparkline --history-chart
--no-history-chart
AGENT_TANK_HISTORY_CHART history.chart on 0.10.0

Show or hide the usage-history sparkline on each dashboard card. --no-history-chart keeps recording but hides the chart.

Never shown while recording is off; GET /config then reports history.chart: false.

Context windows

Corrections to the built-in table of model context windows used for context_window in GET /status.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Context window sizes — — contextWindows built-in table 0.10.0

Object of model name → token count that adds to, or corrects, the built-in table, e.g. { "gpt-6-astra": 300000 }. Keys are matched against the model name the CLI reports, case-insensitively and ignoring spaces, dots, underscores and hyphens, longest key first. A Claude display name without the claude- prefix, such as Opus 5.5, matches claude-opus-5-5.

Values set here are reported with source: "override".

config.json
{
  "contextWindows": {
    "gpt-6-astra": 300000,
    "gemini-4-argon": 1048576
  }
}

Background mode

Start Agent Tank as a detached process: the parent command prints the background PID and log path, then exits.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Background mode --background
--no-background
AGENT_TANK_BACKGROUND — off 0.9.8

Start Agent Tank as a detached background process that prints its PID and log path, then exit the parent command.

Cannot be combined with --once or --json. --no-background, --once and --json suppress AGENT_TANK_BACKGROUND=1 for that run.

Background log — AGENT_TANK_BACKGROUND_LOG — temp file 0.9.8

Log file for the background child’s stdout and stderr. Defaults to agent-tank-<pid>-<time>.log in the system temp directory.

Startup grace period — AGENT_TANK_BACKGROUND_GRACE_MS — 750 ms 0.9.8

How long the parent waits before reporting background success, in milliseconds; success means the child survived this period.

The default is not in the README; it is BACKGROUND_STARTUP_GRACE_MS in src/cli-background.js.

One-shot output

Fetch usage once, print it and exit, without starting the HTTP server.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Run once --once — — off 0.9.0

Fetch usage once and exit, without starting the HTTP server. Auto-refresh and keepalive are off for the run.

JSON output --json — — off 0.9.0

Print pure JSON ({ "providers": [...] }) and suppress logging. Use with --once.

General

Loading a config file, and the informational flags.

OptionCLI flagEnvironment variableConfig keyDefaultSince
Config file --config <path>
-c <path>
— — — 0.9.0

Path to a JSON config file. Relative account and history paths inside it are resolved against the file’s directory.

Version --version
-v
— — — 0.9.3

Print the installed Agent Tank version and exit.

Help --help
-h
— — — 0.9.0

Print the option list, environment variables, examples and endpoints, then exit.

Full example config file

The config file example from the Agent Tank README, using every documented section:

config.json
{
  "agents": [
    {
      "provider": "codex",
      "id": "work",
      "alias": "Work",
      "configPath": "/srv/accounts/codex-work"
    },
    {
      "provider": "codex",
      "id": "personal",
      "alias": "Personal",
      "configPath": "/srv/accounts/codex-personal"
    },
    {
      "provider": "claude",
      "id": "client-a",
      "alias": "Client A",
      "configPath": "./accounts/claude-client-a"
    }
  ],
  "port": 8080,
  "dockerAccess": true,
  "claudeApi": false,
  "refreshCooldown": 30,
  "autoRefresh": {
    "mode": "activity",
    "interval": 60,
    "activityDebounce": 5000,
    "refreshCooldown": 30
  },
  "keepalive": {
    "enabled": true,
    "interval": 300
  },
  "history": {
    "enabled": true,
    "dbPath": "~/.agent-tank/history.db",
    "retentionDays": 14,
    "chart": true
  },
  "contextWindows": {
    "gpt-6-astra": 300000
  }
}

In 0.10.0, port in the config file has no effect (see Port); pass --port 8080 instead. Keys the example does not show: claude, codex, agy, host, auth.user, auth.pass, auth.token, autoRefresh.enabled, freshProcess.