This reference lists the environment variables most projects need when running KsADK locally or in a release pipeline. Use placeholders in committed files and put real values in local .env files or CI secrets.
Hosted deployments can inject a shared policy through AGENTENGINE_MODEL_POLICY_JSON. Hermes, OpenClaw, and generic agents share one default semantics. In 0.6.6, model policy v1 defaults to glm-5.2 as the primary model, kimi-k2.7-code as the multimodal model, and deepseek-v4-pro as the fallback model. Explicit request fields and explicit environment-variable overrides (such as HERMES_DEFAULT_MODEL / OPENCLAW_FALLBACK_MODEL) still take precedence over policy defaults.
Fallback retry semantics: the conversation runtime automatically retries once with the fallback model on recoverable errors (timeout, rate limit, 5xx, model unavailable, permission/quota); 400 parameter errors, business errors, and tool errors are not swallowed.
Reasoning declaration (0.6.7): DEFAULT_MODEL_POLICY adds a reasoning: true declaration per model, and the catalog output exposes a reasoning field so the console can tell whether a model supports thinking.
Thinking-disable injection (0.6.7): when model_options.thinking is disabled (reasoning.effort=none, or thinking.type=disabled, or max_reasoning_tokens<=0), the runtime auto-injects enable_thinking=false and chat_template_kwargs.enable_thinking=false into extra_body (DeepSeek-style compatibility) and filters reasoning output items from the stream.
Optional public IAM endpoint override; defaults to iam.api.ksyun.com when unset
KSYUN_IAM_INTRANET_URL
Optional IAM intranet endpoint fallback override; defaults to iam.inner.api.ksyun.com when unset
IAM_INTRANET_URL
Compatibility alias for KSYUN_IAM_INTRANET_URL
When public IAM returns an error such as “inner account can only access through
intranet”, the runtime retries the intranet endpoint. Public environments
normally do not hit this branch; internal environments can override the address
with KSYUN_IAM_INTRANET_URL or IAM_INTRANET_URL.
PostgreSQL session backend connect timeout in seconds, default 5; on failure raises SessionBackendUnavailable and server returns 503 instead of 500 (0.6.7)
checkpoint backend: local / sqlite / memory / postgres; default local (0.6.7)
KSADK_CHECKPOINT_PATH
local SQLite checkpoint path, default .agentengine/ui/checkpoints.sqlite (0.6.7)
KSADK_LANGGRAPH_CHECKPOINT_DSN
LangGraph PostgreSQL checkpoint DSN; required when backend is postgres (0.6.7)
Local agentengine web defaults to local session backend and SQLite LangGraph checkpoints, reducing the local resume path's dependency on PostgreSQL (0.6.7).
image registry username; required for enterprise KCR and third-party registries (sensitive)
KCR_PASSWORD
image registry password; required for enterprise KCR and third-party registries (sensitive)
Personal KCR (*.kce.ksyun.com) allows KSYUN_ACCOUNT_ID to fall back as the username; enterprise KCR (*.ksyunkcr.com) and third-party registries must set KCR_USERNAME / KCR_PASSWORD explicitly, to avoid wrongly using the cloud account id as an enterprise image username (0.6.5).
agentengine deploy and agentengine launch support --env KEY=VALUE (repeatable) and --env-file for runtime environment variables; explicit env goes into the deploy payload env_vars. Real .env / .env.local files are excluded from Code, Container, and MCP build contexts; only .env.example / .env.sample / .env.template template files are kept (0.6.5).
From 0.6.7, setup_tracing() auto-detects CLOUD_MONITOR_* environment variables and mounts the CloudMonitor OTLP exporter and the CloudMonitor Langfuse SDK CallbackHandler in parallel; neither suppresses self-hosted Langfuse or standard OTLP, and a single span can be reported to both the self-hosted cluster and the CloudMonitor trace platform at once.
Variable
Purpose
CLOUD_MONITOR_APP_KEY
CloudMonitor OTLP AppKey; injected as the Ksc-Appkey auth header (sensitive)
CLOUD_MONITOR_OTLP_ENABLED
explicitly enable or disable the CloudMonitor OTLP exporter; auto-detected by default
CLOUD_MONITOR_OTLP_ENDPOINT
CloudMonitor generic OTLP HTTP endpoint; derives /v1/traces when no traces endpoint is set
CLOUD_MONITOR_OTLP_PROTOCOL
CloudMonitor generic OTLP protocol; currently supports http/protobuf
CLOUD_MONITOR_OTLP_HEADERS
CloudMonitor OTLP extra headers, comma-separated and URL-encoded (sensitive)
CLOUD_MONITOR_OTLP_TRACES_ENDPOINT
CloudMonitor traces-specific endpoint; takes precedence over the generic endpoint
CLOUD_MONITOR_OTLP_TRACES_PROTOCOL
CloudMonitor traces-specific protocol; takes precedence over the generic protocol
CLOUD_MONITOR_LANGFUSE_ENABLED
explicitly enable or disable the CloudMonitor Langfuse SDK callback; auto-detected by default
CLOUD_MONITOR_LANGFUSE_HOST
CloudMonitor AppMonitor Langfuse SDK host; falls back to CLOUD_MONITOR_OTLP_ENDPOINT
CLOUD_MONITOR_LANGFUSE_PUBLIC_KEY
CloudMonitor Langfuse public key (sensitive)
CLOUD_MONITOR_LANGFUSE_SECRET_KEY
CloudMonitor Langfuse secret key (sensitive)
Set CLOUD_MONITOR_OTLP_ENABLED=false or CLOUD_MONITOR_LANGFUSE_ENABLED=false to disable the corresponding path.