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

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

Model Configuration

VariableDescriptionDefault
MODEL_NAMEModel identifier for LLM callssmollm2:135m

Agentic Loop Configuration

VariableDescriptionDefault
AGENTIC_LOOP_MAX_STEPSMaximum reasoning iterations5

Memory Configuration

VariableDescriptionDefault
MEMORY_ENABLEDEnable/disable memory (use NullMemory when disabled)true
MEMORY_TYPEMemory implementation type (only local supported)local
MEMORY_CONTEXT_LIMITMessages to include in delegation context6
MEMORY_MAX_SESSIONSMaximum sessions to keep in memory1000
MEMORY_MAX_SESSION_EVENTSMaximum events per session before eviction500

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

Operator-Set Variables

The operator automatically sets these variables on agent pods:

From Agent CRD

CRD FieldEnvironment Variable
metadata.nameAGENT_NAME
config.descriptionAGENT_DESCRIPTION
config.instructionsAGENT_INSTRUCTIONS
config.reasoningLoopMaxStepsAGENTIC_LOOP_MAX_STEPS
config.memory.enabledMEMORY_ENABLED
config.memory.typeMEMORY_TYPE
config.memory.contextLimitMEMORY_CONTEXT_LIMIT
config.memory.maxSessionsMEMORY_MAX_SESSIONS
config.memory.maxSessionEventsMEMORY_MAX_SESSION_EVENTS

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

ModelAPI Environment Variables

Proxy Mode (LiteLLM)

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

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)

Example:

yaml
spec:
  config:
    env:
    - name: MODEL_NAME
      value: "gpt-4"  # Overrides default smollm2:135m

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
MEMORY_MAX_SESSIONS=1000
MEMORY_MAX_SESSION_EVENTS=500
MODEL_API_URL=http://modelapi.my-namespace.svc.cluster.local:8000
MODEL_NAME=smollm2:135m
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.