Skip to content

Environment Variables Reference

Complete reference for all environment variables used by the KAOS.

Agent Container Environment Variables

Required Variables

VariableDescriptionExample
AGENT_NAMEUnique agent identifiermy-agent
MODEL_API_URLBase URL for LLM APIhttp://modelapi:8000
MODEL_NAMEModel identifier for LLM callsopenai/gpt-4o

Agent Configuration

VariableDescriptionDefault
AGENT_DESCRIPTIONHuman-readable descriptionAI Agent
AGENT_INSTRUCTIONSSystem prompt for the agentYou are a helpful assistant.
AGENT_PORTServer port8000
AGENT_LOG_LEVELLogging levelINFO

Agentic Loop Configuration

VariableDescriptionDefault
AGENTIC_LOOP_MAX_STEPSMaximum reasoning iterations5

Memory Configuration

Injected by the operator on memory-enabled agents. For the full model see Memory Architecture.

VariableDescriptionDefault
MEMORY_ENABLEDEnable/disable memory (uses NullMemory when disabled)true
MEMORY_TYPEBackend: local (pod-local short-term) or remote (bound MemoryStore)derived
MEMORY_STORE_ENDPOINTMemory service URL; injected only for remote (selects RemoteMemory)
MEMORY_SCOPELong-term scope: private, user, shared, sessionprivate
MEMORY_TOOLSExplicit memory tools: all, read, write (unset = none)
MEMORY_FAILURE_MODEWrite/forget failure mode: soft or strictstore default
MEMORY_SHORT_TERM_TOKEN_BUDGETVerbatim short-term window cap, in tokensruntime default
MEMORY_ROLLING_SUMMARYKeep a medium-term rolling digest of evicted turnstrue
AGENT_IDENTITYVerifiable agent principal (kaos://agent/<ns>/<name>) anchoring private scopealways set
MEMORY_CONTEXT_LIMITRecent history events replayed / forwarded on delegation (runtime default)6
MEMORY_MAX_SESSIONSMax sessions kept (LocalMemory runtime default)1000
MEMORY_MAX_SESSION_EVENTSMax events per session (LocalMemory runtime default)500

The first block (MEMORY_ENABLEDAGENT_IDENTITY) is injected by the operator from the Agent config.memory block and the bound MemoryStore. The last three are runtime defaults consumed by the LocalMemory backend and the delegation context; they are not injected from CRD fields.

Sub-Agent Configuration

Direct Format:

VariableDescriptionExample
AGENT_SUB_AGENTSComma-separated name:url pairsworker-1:http://w1:8000,worker-2:http://w2:8000

Kubernetes Format:

VariableDescriptionExample
PEER_AGENTSComma-separated agent namesworker-1,worker-2
PEER_AGENT_<NAME>_CARD_URLIndividual agent URLshttp://worker-1.ns.svc:80

Note: Replace - with _ and use uppercase for variable name (e.g., worker-1PEER_AGENT_WORKER_1_CARD_URL).

Logging Configuration

VariableDescriptionDefault
AGENT_ACCESS_LOGEnable uvicorn access logsfalse

MCP Server Environment Variables

VariableDescriptionDefault
MCP_HOSTServer bind address0.0.0.0
MCP_PORTServer port8000
MCP_TOOLS_STRINGPython code defining tools""
MCP_LOG_LEVELLogging levelINFO
MCP_ACCESS_LOGEnable uvicorn access logsfalse

ModelAPI Environment Variables

Proxy Mode (LiteLLM)

The operator automatically sets these environment variables based on ModelAPI spec:

VariableSourceDescription
PROXY_API_KEYproxyConfig.apiKeyAPI key for LLM backend
PROXY_API_BASEproxyConfig.apiBaseBase URL for LLM backend

These are used in the generated LiteLLM config:

yaml
model_list:
  - model_name: "openai/gpt-4o"
    litellm_params:
      model: "openai/gpt-4o"
      api_key: "os.environ/PROXY_API_KEY"
      api_base: "os.environ/PROXY_API_BASE"

Custom Environment Variables

Add custom variables via proxyConfig.env:

VariableDescription
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
AZURE_API_KEYAzure OpenAI API key
Any LiteLLM-supported varSee LiteLLM documentation

Hosted Mode (Ollama)

VariableDescription
OLLAMA_DEBUGEnable debug logging
OLLAMA_HOSTHost to bind to
OLLAMA_MODELSModel directory path
Any Ollama-supported varSee Ollama documentation

Operator-Set Variables

The operator automatically sets these variables on agent pods:

From Agent CRD

CRD FieldEnvironment Variable
metadata.nameAGENT_NAME
spec.modelMODEL_NAME
config.descriptionAGENT_DESCRIPTION
config.instructionsAGENT_INSTRUCTIONS
config.reasoningLoopMaxStepsAGENTIC_LOOP_MAX_STEPS
config.memory.enabledMEMORY_ENABLED
config.memory.typeMEMORY_TYPE
config.memory.scopeMEMORY_SCOPE
config.memory.toolsMEMORY_TOOLS
config.memory.failureModeMEMORY_FAILURE_MODE
config.memory.clientParams.tokenBudgetMEMORY_SHORT_TERM_TOKEN_BUDGET
config.memory.clientParams.rollingSummaryMEMORY_ROLLING_SUMMARY
MemoryStore endpoint (remote only)MEMORY_STORE_ENDPOINT
kaos://agent/<ns>/<name> (always)AGENT_IDENTITY

From Referenced Resources

SourceEnvironment Variable
ModelAPI.status.endpointMODEL_API_URL
agentNetwork.access listPEER_AGENTS
Each peer agent service URLPEER_AGENT_<NAME>_CARD_URL

Custom Environment Variables

Add custom variables via config.env:

yaml
spec:
  config:
    env:
    - name: CUSTOM_VAR
      value: "my-value"
    - name: SECRET_VAR
      valueFrom:
        secretKeyRef:
          name: my-secrets
          key: secret-key
    - name: CONFIG_VAR
      valueFrom:
        configMapKeyRef:
          name: my-config
          key: config-key

Note: MODEL_NAME is automatically set from spec.model and should not be overridden via config.env.

Environment Variable Precedence

For agent pods, environment variables are applied in this order:

  1. Operator-generated variables (from CRD fields)
  2. config.env variables (can override operator-generated)

Debugging Environment Variables

Check environment variables on a running pod:

bash
kubectl exec -it deploy/agent-my-agent -n my-namespace -- env | sort

Expected output:

AGENT_DESCRIPTION=My agent
AGENT_INSTRUCTIONS=You are helpful.
AGENT_NAME=my-agent
AGENTIC_LOOP_MAX_STEPS=5
MEMORY_ENABLED=true
MEMORY_TYPE=local
MEMORY_CONTEXT_LIMIT=6
MODEL_API_URL=http://modelapi.my-namespace.svc.cluster.local:8000
MODEL_NAME=openai/gpt-4o
PEER_AGENTS=worker-1,worker-2
PEER_AGENT_WORKER_1_CARD_URL=http://worker-1.my-namespace.svc.cluster.local
PEER_AGENT_WORKER_2_CARD_URL=http://worker-2.my-namespace.svc.cluster.local

Released under the Apache 2.0 License.