Skip to content

CLI Reference

The kdeps CLI creates, runs, tests, packages, and deploys agents. All commands follow kdeps [command] [options].

Global Flags

All commands support these global flags:

FlagDescription
--verboseEnable INFO-level log output (default: WARN)
--debugEnable DEBUG-level log output with source locations
--instrumentEnable call-chain instrumentation tracing

Structured Logging

kdeps uses structured JSON logging via Go's log/slog. Warnings and errors go to stderr in human-readable format by default.

Flag / EnvLevelOutput
(none)WARNWarnings and errors only
--verboseINFOInformational messages + above
--debug or KDEPS_DEBUG=trueDEBUGDebug details + above
KDEPS_LOG_FORMAT=json(any)Structured JSON output on stderr

JSON format:

bash
export KDEPS_LOG_FORMAT=json
kdeps run workflow.yaml
# Output: {"time":"...","level":"WARN","msg":"experimental software",...}

Commands

CommandPageDescription
kdeps runDev CommandsRun a workflow locally
kdeps serveDev CommandsAgent mode REPL
kdeps validateDev CommandsValidate workflow config
kdeps newDev CommandsScaffold a new agent
kdeps editDev CommandsEdit global config
kdeps doctorDev CommandsSystem health checks
kdeps chatDev CommandsInteractive workflow generator
kdeps registryRegistry CommandsSearch, install, publish packages
kdeps bundle packagePackaging CommandsPackage for distribution
kdeps bundle buildPackaging CommandsBuild Docker image
kdeps export isoPackaging CommandsExport bootable image
kdeps export k8sPackaging CommandsGenerate Kubernetes manifests

Command Workflow

Typical Development Flow

bash
# 1. Create new agent
kdeps new my-agent

# 2. Validate configuration
cd my-agent
kdeps validate workflow.yaml

# 3. Run locally with hot reload
kdeps run workflow.yaml --dev

# 4. Package for deployment
kdeps bundle package . --output dist/

# 5. Build Docker image (optional)
kdeps bundle build dist/my-agent-1.0.0.kdeps --tag my-agent:latest

Production Deployment Flow

bash
# 1. Validate before packaging
kdeps validate workflow.yaml

# 2. Package workflow
kdeps bundle package . --output dist/

# 3. Build Docker image
kdeps bundle build dist/my-agent-1.0.0.kdeps \
  --tag registry.com/my-agent:v1.0.0 \
  --gpu cuda

# 4. Push to registry
docker push registry.com/my-agent:v1.0.0

Kubernetes Deployment Flow

bash
# 1. Build Docker image
kdeps bundle build . --tag registry.com/my-agent:v1.0.0
docker push registry.com/my-agent:v1.0.0

# 2. Generate Kubernetes manifests
kdeps export k8s . \
  --image registry.com/my-agent:v1.0.0 \
  --output k8s.yaml

# 3. Deploy to cluster
kubectl apply -f k8s.yaml
kubectl rollout status deployment/my-agent

Exit Codes

CodeMeaning
0Success
1General error
2Validation error
3Execution error

Environment Variables

VariableDescription
KDEPS_DEBUGSet true to enable debug logging (equivalent to --debug)
KDEPS_LOG_FORMATSet json for structured JSON log output
KDEPS_EDITOREditor for kdeps edit (overrides VISUAL/EDITOR)
KDEPS_PYTHON_VERSIONGlobal Python version (e.g., 3.12)
KDEPS_OFFLINE_MODESet true to block all external LLM calls
OLLAMA_HOSTOllama server URL
TZTimezone applied to all workflow runs
KDEPS_CHAT_TIMEOUTDefault timeout for LLM chat resources
KDEPS_HTTP_TIMEOUTDefault timeout for HTTP client resources
KDEPS_PYTHON_TIMEOUTDefault timeout for Python resources
KDEPS_EXEC_TIMEOUTDefault timeout for exec resources
KDEPS_SQL_TIMEOUTDefault timeout for SQL resources
KDEPS_ON_ERROR_ACTIONDefault error action: fail, continue, retry
KDEPS_ON_ERROR_MAX_RETRIESDefault max retries for retry action
KDEPS_ON_ERROR_RETRY_DELAYDefault delay between retries

Tips

  • Use --dev flag for hot reload during development
  • Use --debug flag to troubleshoot issues
  • Validate frequently with kdeps validate
  • Always validate before packaging: kdeps validate workflow.yaml
  • Use --gpu cuda for GPU workloads
  • Tag images with version numbers: --tag my-agent:v1.0.0

See Also

Released under the Apache 2.0 License.