Skip to content

Environment variables

Variables live in .env at the repository root (or /opt/claude-sandbox/.env on a deployed host). Compose reads them at start; nothing else does.

Variable Required Consumed by Purpose
ANTHROPIC_ENVIRONMENT_KEY yes worker Environment key (sk-ant-oat01-...) that authenticates the worker to its work queue. Console-generated, queue-scoped.
ANTHROPIC_ENVIRONMENT_ID yes worker The self_hosted environment’s identifier.
ANTHROPIC_BASE_URL no worker API base override, passed through only when set.
Variable Required Consumed by Purpose
MCP_TUNNEL_PORT no, default 8787 compose port mapping Loopback port the tunnel publishes on the host.
CLOUDFLARE_TUNNEL_TOKEN only with the cloudflared profile cloudflared Token-mode tunnel credential from the Zero Trust dashboard.
Variable Required Consumed by Purpose
CLAUDE_SANDBOX_DIR no install.sh Clone destination, default ~/code/systemd-claude-sandbox.
CLAUDE_SANDBOX_MODE no install.sh Skips detection: compose, devcontainer, bare, or wsl.

The worker exports these to each spawned session; you do not set them yourself: ANTHROPIC_SESSION_ID, ANTHROPIC_WORK_ID, ANTHROPIC_ENVIRONMENT_ID, ANTHROPIC_ENVIRONMENT_KEY, and ANTHROPIC_BASE_URL when present on the poller.