Skip to main content

Environment Variables

CAO uses CAO_* environment variables as one tier in the configuration precedence chain: CLI flag > env var > settings.json > default.

Wired Through ConfigService​

These variables map 1:1 to a settings.json key. Setting either the env var or the file key has the same runtime effect.

Env VarConfig PathTypeDefault
CAO_TERMINAL_BACKENDterminal.backendstr"tmux"
CAO_HERDR_SESSIONterminal.herdr_sessionstr"cao"
CAO_MCP_APPS_ENABLEDapps.enabledboolfalse
CAO_MCP_APPS_STATIC_DIRapps.static_dirstrnull
CAO_LOG_LEVELlogging.levelstr"INFO"
CAO_MEMORY_ENABLEDmemory.enabledbooltrue
CAO_MEMORY_COMPILE_MODEmemory.compile_modestr"llm"
CAO_MEMORY_FLUSH_THRESHOLDmemory.flush_thresholdfloat0.85
CAO_MEMORY_LINT_ENABLEDmemory.lint_enabledbooltrue
CAO_MCP_REQUEST_TIMEOUTserver.mcp_request_timeoutint30
CAO_EVENT_BUS_MAX_QUEUE_SIZEserver.event_bus_max_queue_sizeint1024
CAO_PROVIDER_INIT_TIMEOUTserver.provider_init_timeoutint60
CAO_STARTUP_PROMPT_HANDLER_TIMEOUTserver.startup_prompt_handler_timeoutint20

Network and Auth (Env-Var Only)​

These have schema entries but only the env var is actually honored at runtime.

Env VarPurposeNotes
CAO_ALLOWED_HOSTSExtend Host header allowlist for TrustedHostMiddlewareComma-separated; extends (not replaces) loopback defaults
CAO_CORS_ORIGINSExtend browser origins permitted by CORSComma-separated
CAO_WS_ALLOWED_CLIENTSExtend client IPs permitted to attach to PTY WebSocketComma-separated; security-sensitive
CAO_FORWARDED_ALLOW_IPSTrusted proxy IPs for X-Forwarded-For parsingComma-separated
CAO_AUTH_JWKS_URIIdP JWKS endpoint (activates auth when set)Bearer tokens are then RS256 JWTs verified against this JWKS
CAO_AUTH_AUDIENCEExpected token audienceIdP mode only
CAO_AUTH_ISSUERIssuer for RFC 9728 PRM endpointIdP mode only
CAO_AUTH_LOCAL_TOKENShared-secret bearer token. Set alone (no IdP) it activates auth: every scope-gated route, the PTY WebSocket handshake and the AG-UI stream must present this value as a bearer (compared after trimming surrounding whitespace; a blank value leaves auth off), and anything else is refused: HTTP 401, or close code 4401 on the WebSocket. Routes that stay open in every mode are listed under "Default posture" in the configuration guide. Set together with an IdP it is instead the machine JWT CAO's own clients forward on their internal calls.Security-sensitive. Generate with openssl rand -hex 32. With none of the three auth variables set, the API trusts every caller that can reach its port (loopback by default, so every process and user on the host).

Remote Fleets (Env-Var Only)​

These two are read directly by utils/fleet.py and have no schema entry, no settings.json key, and no default. They are the entire configuration of cao fleet and cao worker: without both, every subcommand exits with No fleet configured. rather than falling back to the cao-server on this machine.

Env VarPurposeNotes
CAO_ELASTIC_BROKER_URLBase URL of the fleet's worker brokere.g. http://127.0.0.1:9890 after a port-forward
CAO_ELASTIC_BROKER_TOKENShared secret sent as X-CAO-Broker-TokenSecurity-sensitive: it authorizes releasing workers and sending input to their agents, so treat it as a write credential

A supervisor pod in a CAO cluster already has both set, which is why cao fleet status needs no setup when run inside one.

Server and Runtime​

Env VarPurposeDefault
CAO_API_HOSTBind address for cao-server127.0.0.1
CAO_API_PORTPort for cao-server9889
CAO_PYTE_STATUSEnable pyte-rendered status detectiontrue
CAO_EAGER_INBOX_DELIVERYDeliver inbox messages during PROCESSING for capable providersfalse
CAO_ENABLE_WORKING_DIRECTORYEnable working_directory parameter on orchestration toolsfalse
CAO_ENABLE_SENDER_ID_INJECTIONAuto-append supervisor terminal ID to assign messagestrue

Per-Terminal (Set Automatically)​

These are set by CAO on each terminal's environment and used for routing/identification. Do not set them manually.

Env VarPurpose
CAO_TERMINAL_IDUnique 8-char hex ID for this terminal (set by tmux session env)
CAO_SESSION_NAMEName of the parent CAO session (herdr backend only; the default tmux backend sets just CAO_TERMINAL_ID)
CAO_WORKFLOW_RUN_IDWorkflow run identifier (when executing a workflow)
CAO_WORKFLOW_STEP_IDCurrent workflow step identifier
CAO_WORKFLOW_GENERATIONRun generation, incremented on resume

Provider-Specific​

Env VarPurpose
CAO_AGENTS_DIROverride Kiro CLI agent directory (default: ~/.kiro/agents)
CAO_GRAPH_EXPORT_ROOTOverride graph export confinement root
CAO_PROFILE_ALLOWED_HOSTSAllowlist for profile install from URLs (comma-separated)

Managed Environment File​

CAO also supports a managed .env file at ~/.aws/cli-agent-orchestrator/.env. Values here are substituted into agent profiles when they are loaded or installed — they are not injected into the agent's terminal environment. To pass real environment variables to a session, use cao launch --env KEY=VALUE. Manage the file with:

# Set a variable
cao env set MY_API_KEY sk-abc123

# List variables
cao env list

# Remove a variable
cao env unset MY_API_KEY

Variables in the .env file can be referenced in agent profiles using ${VAR} syntax. Flow prompts use a separate mechanism: [[key]] placeholders filled from the flow script's JSON output object.