KsADK

Configuration

KsADK reads configuration from command-line options, project YAML, project .env, and optional global configuration. Values closer to the command usually take precedence for that run.

Precedence

  1. command-line flags such as --model and --port.
  2. environment variables exported in the shell.
  3. values loaded from the project .env.
  4. project YAML such as agentengine.yaml.
  5. global developer defaults.

Use command-line flags for temporary experiments and project files for settings that should travel with the sample application.

Configuration Sources

SourceTypical file or commandPurpose
CLI optionagentengine run --model glm-5.2one-off override
Project YAMLagentengine.yamlframework, entry point, region, packaging hints
Project env.envlocal model credentials and provider URLs
Global configmanaged by agentengine config --global style flows where supporteddeveloper defaults across projects

Model Settings

The local runtime uses OpenAI-compatible settings for many examples:

.env
OPENAI_API_KEY=sk-test
OPENAI_BASE_URL=https://api.example.com/v1
OPENAI_MODEL_NAME=my-model

Use placeholder values in docs and tests. Use real values only in local .env files or CI secrets.

Common model-related variables:

VariablePurpose
OPENAI_API_KEYAPI key for an OpenAI-compatible provider
OPENAI_BASE_URLprovider base URL, usually ending in /v1
OPENAI_MODEL_NAMEdefault model for local runs
MODEL_NAMEcompatibility alias used by some projects

When a request explicitly passes model, the local runtime may use it as a per-request override for supported runners.

Unified model policy and fallback

In hosted deployments the platform injects a unified model policy through AGENTENGINE_MODEL_POLICY_JSON, shared by Hermes, OpenClaw, and generic agents for primary / multimodal / fallback defaults. Explicit request parameters or explicit environment variables (such as HERMES_DEFAULT_MODEL / OPENCLAW_FALLBACK_MODEL) still take precedence over policy defaults. The conversation runtime automatically retries once with a fallback on recoverable errors such as timeout, rate limiting, 5xx, model unavailable, or permission/quota errors; 400 parameter errors, business errors, and tool errors are not swallowed.

For the full variable list and 0.6.7 reasoning / thinking-disable injection semantics, see Environment variables reference - Unified model policy and fallback.

Project Configuration

Project-level settings are stored in agentengine.yaml. ksadk.yaml and ksadk.yml are also detected for compatibility.

agentengine.yaml
name: my-agent
framework: langgraph
entry_point: agent.py
agent_variable: root_agent
.env
OPENAI_API_KEY=sk-test
OPENAI_BASE_URL=https://api.example.com/v1
OPENAI_MODEL_NAME=my-model

Common fields:

FieldMeaningExample
namedisplay name and default runtime namemy-agent
frameworkframework adapteradk, langchain, langgraph, deepagents
entry_pointPython file loaded by the local runtimeagent.py
agent_variableexported object nameroot_agent
regionoptional cloud region for deployment-shaped commandscn-beijing-6

Prefer explicit project YAML in public samples. It is easier for contributors to review than relying on framework auto-detection.

Framework-Specific Notes

FrameworkRecommended public config
ADKset framework: adk, point entry_point to the module exporting the ADK agent
LangGraphset framework: langgraph, export a compiled graph or provide the configured variable
LangChainset framework: langchain, export the chain/runnable object
DeepAgentsset framework: deepagents, keep service-only startup code out of import side effects

If the project uses custom state or input preparation, keep those hooks in the configured entry module so the runner can import them consistently.

Config Commands

  1. Interactive wizard:
    agentengine config
  2. Show effective settings:
    agentengine config show
  3. Set values non-interactively:
    agentengine config set region=cn-beijing-6 OPENAI_MODEL_NAME=my-model
  4. Switch the default model:
    agentengine config model

Precedence And Local Overrides

Use CLI options for temporary overrides:

agentengine run . --model another-model
agentengine web . --model another-model

This is useful when comparing models without editing .env.

Runtime Feature Flags

Some capabilities are optional. Public examples should make these variables clearly optional:

VariablePurpose
KSADK_WORKSPACE_FILES_ENABLEDenable workspace file routes
KSADK_WORKSPACE_MAX_UPLOAD_BYTESset the upload limit for workspace files
KSADK_LTM_BACKENDenable long-term memory backend integration
KSADK_LTM_INDEXisolate long-term memory data
KSADK_KB_DATASET_IDenable a knowledge-base integration
KSADK_KB_TOP_Kset knowledge retrieval count
KSADK_BUILD_ENABLE_ATTACHMENT_OCRinclude OCR-related dependencies in build flows when intentionally needed

Leave these unset in the first quickstart unless the page is specifically about that capability.

Secrets And Files

Recommended local layout:

agentengine.yaml
agent.py
requirements.txt
.env
.gitignore

Recommended .gitignore entries:

.gitignore
.env
.agentengine/
dist/
build/
*.egg-info/

Never commit .pypirc, API keys, cookies, kubeconfig files, private registry credentials, customer data, local session databases, or uploaded files.

Public Documentation Rule

Do not publish real internal endpoints, access keys, cookies, kubeconfig paths, registry names, customer data, or private support URLs in examples. For public docs:

  • use https://api.example.com/v1 for placeholder provider URLs.
  • use sk-test or <YOUR_API_KEY> for placeholder tokens.
  • mark cloud settings as optional.
  • prefer local runtime examples over hosted infrastructure examples.

On this page