Skip to main content

Overview

Variables make runbooks reusable. Define them once, and reference them in step values with {{variableName}} syntax. Values can come from interactive prompts, environment variables, context files, secrets, or static values.

Variable sources

Variables are defined in the runbook with a source that determines how their value is resolved:

Examples

Resolution priority

At execution time, variables are resolved in this order. The first match wins: This means secrets always take precedence. If you pass a value via --secrets, it overrides any other source.

Secrets handling

Secrets are sensitive values that should never appear in logs or reports. There are two ways to provide them:

Via --secrets flag

Create a JSON file with key-value pairs:
All values in the secrets file are automatically treated as sensitive and masked in all output.

Via sensitive: true flag

Mark individual variables as sensitive in the runbook:

Context-based resolution

When a variable has source: context, AI reads the --context markdown file and extracts the value based on the variable’s description. This is useful when values are documented but not hardcoded:
AI will resolve adminUrl to https://admin.example.com/dashboard.

Template syntax

Reference variables in any string field using double curly braces:
Templates support:
  • Simple references: {{variableName}}
  • Dot notation for captured objects: {{captured.field}}
  • Nesting up to 3 levels deep

Best practices

  • Use prompt for credentials — Never hardcode passwords in runbooks
  • Use env for environment-specific values — Base URLs, API endpoints, regions
  • Use context for documented values — Keep context.md as the source of truth
  • Mark sensitive values — Use sensitive: true or --secrets to ensure masking
  • Keep secrets out of version control — Add secrets.json to .gitignore

What’s next

YAML Variables reference

Full variable schema and field reference.

Execute a runbook

Use variables in runbook execution.