pub struct Step {Show 40 fields
pub name: String,
pub prompt: String,
pub provider: Option<String>,
pub model: Option<String>,
pub depends_on: Vec<String>,
pub inject_context: bool,
pub condition: Option<String>,
pub json: bool,
pub json_schema: Option<String>,
pub output: Option<String>,
pub saves: HashMap<String, String>,
pub timeout: Option<String>,
pub tags: Vec<String>,
pub on_failure: Option<FailurePolicy>,
pub max_retries: Option<u32>,
pub next: Option<String>,
pub system_prompt: Option<String>,
pub role: Option<String>,
pub max_turns: Option<u32>,
pub description: String,
pub interactive: bool,
pub auto_approve: bool,
pub root: Option<String>,
pub add_dirs: Vec<String>,
pub env: HashMap<String, String>,
pub files: Vec<String>,
pub context: Vec<String>,
pub plan: Option<String>,
pub mcp_config: Option<String>,
pub worktree: bool,
pub sandbox: Option<String>,
pub race_group: Option<String>,
pub retry_model: Option<String>,
pub command: Option<StepCommand>,
pub uncommitted: bool,
pub base: Option<String>,
pub commit: Option<String>,
pub title: Option<String>,
pub plan_output: Option<String>,
pub instructions: Option<String>,
}Expand description
A single workflow step — one agent invocation.
Each step maps to a zag spawn (or zag exec for terminal steps).
Steps form a DAG via depends_on and can conditionally execute based
on workflow variable values.
Fields§
§name: StringUnique step identifier (used in depends_on references).
prompt: StringPrompt template sent to the agent. May contain ${var_name} references
that are resolved against workflow variables before execution.
provider: Option<String>Zag provider to use (claude, codex, gemini, copilot, ollama). Falls back to the project/global zag default if not set.
model: Option<String>Model name or size alias (small, medium, large).
depends_on: Vec<String>Steps that must complete before this step starts.
inject_context: boolIf true, dependency outputs are automatically injected into the prompt.
condition: Option<String>Condition expression that must evaluate to true for this step to run.
Uses a simple expression language: var < 8, status == "done", etc.
If the condition is false, the step is skipped.
json: boolRequest structured JSON output from the agent.
json_schema: Option<String>JSON schema to validate agent output against (implies json = true).
output: Option<String>Output format override: “text”, “json”, “json-pretty”, “stream-json”, “native-json”.
When set, maps to -o <FORMAT> on zag and overrides the json bool field.
saves: HashMap<String, String>Map of variable names to save from this step’s output.
Values are JSONPath-like selectors (e.g., "$.score").
If the output is plain text, use "$" to capture the full output.
timeout: Option<String>Step timeout (e.g., “5m”, “30s”, “1h”).
Tags applied to the spawned zag session.
on_failure: Option<FailurePolicy>Behavior on step failure: “fail” (default), “continue”, or “retry”.
max_retries: Option<u32>Maximum retry attempts when on_failure = "retry".
next: Option<String>Explicit next step to jump to after completion (enables loops). Without this, execution follows the DAG order.
system_prompt: Option<String>System prompt override for this step’s agent.
Mutually exclusive with role.
role: Option<String>Role name or ${var} reference — resolved to a role from [roles] at runtime.
The role’s system prompt is used as this step’s system prompt.
Mutually exclusive with system_prompt.
max_turns: Option<u32>Maximum number of agentic turns for this step.
description: StringHuman-readable description of this step’s purpose.
interactive: boolIf true, spawn a long-lived interactive session (FIFO-based). Enables Human-in-the-Loop and Inter-Agent Communication patterns.
auto_approve: boolIf true, auto-approve all agent actions (skip permission prompts).
root: Option<String>Working directory override for this step’s agent.
add_dirs: Vec<String>Additional directories to include in the agent’s scope.
env: HashMap<String, String>Per-step environment variables.
files: Vec<String>Files to attach to the agent prompt.
context: Vec<String>Session IDs to inject as context (beyond depends_on).
Maps to --context <SESSION_ID> flags on zag.
plan: Option<String>Path to a plan file to prepend as context.
Maps to --plan <PATH> on zag.
mcp_config: Option<String>Per-step MCP configuration (JSON string or file path, Claude only).
Maps to --mcp-config <CONFIG> on zag.
worktree: boolIf true, run this step in an isolated git worktree.
sandbox: Option<String>Docker sandbox name. If set, the step runs inside a sandbox.
race_group: Option<String>Race group name. Steps sharing a race_group run in parallel; when the first completes, the rest are cancelled.
retry_model: Option<String>Model to use when retrying this step (only applies when on_failure = “retry”). Enables escalation to a larger model.
command: Option<StepCommand>Zag command to invoke for this step. Default (None) uses zag run.
Other options: “review”, “plan”, “pipe”, “collect”, “summary”.
uncommitted: boolReview uncommitted changes (only valid when command = "review").
base: Option<String>Base branch for review diff (only valid when command = "review").
commit: Option<String>Specific commit to review (only valid when command = "review").
title: Option<String>Title for the review (only valid when command = "review").
plan_output: Option<String>Output path for generated plan (only valid when command = "plan").
instructions: Option<String>Additional instructions for plan generation (only valid when command = "plan").