Configuration

Khaos is configured through CLI flags, environment variables, and cloud/session state under ~/.khaos/. This page covers the stable configuration surface in the current SDK.

Priority Order

TEXT
1. CLI flags (highest priority)
2. Environment variables
3. Stored cloud/session state (~/.khaos)
4. Built-in defaults

In practice: use CLI flags for one-off overrides, env vars for CI, and stored cloud state for local interactive workflows.

Common Environment Variables

VariableDescription
KHAOS_STATE_DIROverride local state directory (default: ~/.khaos)
KHAOS_API_URLCloud API base URL (default: https://api.khaos.exordex.com)
KHAOS_API_TOKENCloud token for non-interactive auth (especially CI)
KHAOS_PROJECT_SLUGTarget cloud project for sync and CI uploads
KHAOS_DASHBOARD_URLDashboard URL override (default: https://khaos.exordex.com)
KHAOS_AUTO_SYNCEnable automatic sync defaults where supported
Terminal
# CI example
export KHAOS_API_URL=https://api.khaos.exordex.com
export KHAOS_API_TOKEN=${{ secrets.KHAOS_API_TOKEN }}
export KHAOS_PROJECT_SLUG=my-org/my-project

khaos ci my-agent --eval quickstart --sync

High-Value CLI Flags

Terminal
# Reproducible local run
khaos run my-agent --eval quickstart --seed 12345

# Custom thresholds in CI
khaos ci my-agent --eval full-eval --security-threshold 85 --resilience-threshold 75

# Validate cloud auth and project wiring only
khaos ci my-agent --preflight-only --sync

Full command flags are documented on CLI Reference.

Python Config APIs

The stable config helper in this release is intentionally minimal:

Python
from khaos.config import load_config, DEFAULT_CONFIG_PATH

config = load_config()  # Mapping[str, Any]
print(DEFAULT_CONFIG_PATH)  # ~/.khaos/config.yaml

For cloud auth/sync state, use the cloud config helpers:

Python
from khaos.cloud import load_cloud_config

cloud = load_cloud_config()
print(cloud.api_url)
print(cloud.project_id)
print(cloud.masked_token())

Cost Table Overrides

Khaos reads model pricing from the bundled table, with optional override via KHAOS_COST_TABLE.

Python
from khaos.costs import load_cost_table, estimate_cost_usd

rates = load_cost_table()
cost_usd, source = estimate_cost_usd(
    provider="openai",
    model="gpt-4o",
    prompt_tokens=1200,
    completion_tokens=300,
    table=rates,
)
print(cost_usd, source)

Validation Checklist

Terminal
# 1) Confirm local + cloud wiring
khaos doctor
khaos sync --status

# 2) Confirm command-level options
khaos run --help
khaos ci --help

# 3) Validate CI auth/project configuration
khaos ci my-agent --preflight-only --sync
No khaos config Command
The stable CLI does not include a khaos config command group. Use env vars,khaos doctor, and command help output to validate configuration.