Agent SwarmAgent Swarm
Reference

Environment Variables

Complete reference for all configuration environment variables

Environment Variables

Complete reference for all environment variables used by Agent Swarm.

Server Variables

VariableDefaultDescription
PORT3013Port for MCP HTTP server
API_KEYAPI key for server authentication (required)
MCP_BASE_URLhttps://agent-swarm-mcp.desplega.shBase URL for MCP server
SWARM_URLlocalhostBase domain for service discovery
APP_URLDashboard URL for Slack message links
ENVEnvironment mode (development adds prefix to Slack agent names)
DATABASE_PATH./agent-swarm-db.sqliteSQLite database file path
SCHEDULER_INTERVAL_MS10000Polling interval for scheduled tasks (ms)
OPENAI_API_KEYOpenAI key for memory embeddings
CAPABILITIESAll enabledComma-separated feature flags
HEARTBEAT_INTERVAL_MS90000Heartbeat sweep interval (ms)
HEARTBEAT_DISABLEfalseSet to true to disable the heartbeat module
HEARTBEAT_STALL_THRESHOLD_MIN30Minutes before an in-progress task is considered stalled
HEARTBEAT_STALE_CLEANUP_MIN30Minutes before stale resources (sessions, reviewing tasks) are cleaned up
HEARTBEAT_MAX_AUTO_ASSIGN5Max pool tasks to auto-assign per sweep

Docker Worker Variables

VariableRequiredDefaultDescription
CLAUDE_CODE_OAUTH_TOKENYesOAuth token for Claude CLI. Supports comma-separated values for multi-credential load balancing
ANTHROPIC_API_KEYAltAlternative to CLAUDE_CODE_OAUTH_TOKEN. Also supports comma-separated values
API_KEYYesAPI key for MCP server
AGENT_IDNoAuto-generatedAgent UUID. Keep stable for task resume
AGENT_ROLENoworkerRole: worker or lead
AGENT_NAMENoAuto-generatedDisplay name for the agent
MCP_BASE_URLNohttp://host.docker.internal:3013MCP server URL
SESSION_IDNoAuto-generatedLog folder name
YOLONofalseContinue on errors
SYSTEM_PROMPTNoCustom system prompt text
SYSTEM_PROMPT_FILENoPath to system prompt file
STARTUP_SCRIPT_STRICTNotrueExit on startup script failure
SHUTDOWN_TIMEOUTNo30000Grace period (ms) before pausing tasks
MAX_CONCURRENT_TASKSNo1Maximum parallel tasks per worker
SWARM_URLNolocalhostBase domain for service URLs
LEAD_PORTNo3020Host port for lead service. Example variable used in docker-compose.example.yml — adjust to your setup. In isolated network namespaces all services can share the same port.
WORKER1_PORTNo3021Host port for worker-1 service. Example — see LEAD_PORT.
WORKER2_PORTNo3022Host port for worker-2 service. Example — see LEAD_PORT.
PM2_HOMENo/workspace/.pm2PM2 state directory

Git Configuration

VariableDefaultDescription
GITHUB_TOKENGitHub token for git operations
GITHUB_EMAILworker-agent@desplega.aiGit commit email
GITHUB_NAMEWorker AgentGit commit name

Slack Integration

VariableDescription
SLACK_BOT_TOKENBot User OAuth Token (xoxb-...)
SLACK_APP_TOKENApp-Level Token for Socket Mode (xapp-...)
SLACK_SIGNING_SECRETSigning Secret (optional for Socket Mode)
SLACK_DISABLESet to true to disable Slack
SLACK_ALLOWED_EMAIL_DOMAINSComma-separated email domains
SLACK_ALLOWED_USER_IDSComma-separated user IDs to always allow

GitHub Integration

VariableDescription
GITHUB_WEBHOOK_SECRETWebhook secret for GitHub App
GITHUB_BOT_NAMEBot name for @mentions (default: agent-swarm-bot)
GITHUB_APP_IDGitHub App ID (for bot reactions)
GITHUB_APP_PRIVATE_KEYGitHub App private key (base64-encoded)
GITHUB_DISABLESet to true to disable GitHub

AgentMail Integration

VariableDescription
AGENTMAIL_DISABLESet to true to skip AgentMail integration
AGENTMAIL_WEBHOOK_SECRETSvix signing secret for webhook verification
AGENTMAIL_INBOX_DOMAIN_FILTERComma-separated domains to allow for incoming inbox webhooks (e.g., yourdomain.com,example.com). Unmatched inbox domains are silently dropped
AGENTMAIL_SENDER_DOMAIN_FILTERComma-separated sender domains to allow (e.g., gmail.com,company.com). Unmatched sender domains are silently dropped

Sentry Integration

VariableDescription
SENTRY_AUTH_TOKENSentry Organization Auth Token
SENTRY_ORGSentry organization slug

x402 Payments

Environment variables for the x402 payment module, enabling agents to make USDC micropayments on x402-gated APIs.

Common

VariableDefaultDescription
X402_SIGNER_TYPEAuto-detectedSigner backend: "openfort" or "viem". Auto-detects based on which credentials are set
X402_MAX_AUTO_APPROVE1.00Maximum USD amount to auto-approve per request
X402_DAILY_LIMIT10.00Daily spending limit in USD
X402_NETWORKeip155:84532CAIP-2 network ID. eip155:84532 = Base Sepolia (testnet), eip155:8453 = Base mainnet

Openfort Signer

VariableRequiredDescription
OPENFORT_API_KEYYesOpenfort API key (sk_test_ or sk_live_ prefixed)
OPENFORT_WALLET_SECRETYesP-256 ECDSA key for wallet authentication (base64 encoded)
OPENFORT_WALLET_ADDRESSNoReuse existing wallet address instead of creating a new one

Viem Signer

VariableRequiredDescription
EVM_PRIVATE_KEYYesWallet private key (0x-prefixed hex). Use a burner wallet with minimal funds

Multi-Credential Support

To distribute load across multiple Claude subscriptions, provide multiple credentials as comma-separated values:

# Multiple OAuth tokens — one is randomly selected per session
CLAUDE_CODE_OAUTH_TOKEN=token1,token2,token3

# Also works with API keys
ANTHROPIC_API_KEY=sk-key1,sk-key2

When a session is spawned, the runner splits the credential value by commas and randomly selects one. Each session gets a single credential, distributing load across subscriptions. A log line indicates which credential index was selected (never the credential itself). Single values (no commas) work unchanged — fully backward compatible.

Priority

When both CLI flags and environment variables are set:

  • CLI flags take precedence over environment variables
  • Inline text (SYSTEM_PROMPT) takes precedence over file (SYSTEM_PROMPT_FILE)

On this page