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)
CAO_AUTH_AUDIENCEExpected token audience
CAO_AUTH_ISSUERIssuer for RFC 9728 PRM endpoint
CAO_AUTH_LOCAL_TOKENLocal bearer token for development/testing

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.