Skip to main content

Step

Struct Step 

Source
pub struct Step {
Show 41 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 resources: Vec<ResourceSpec>, 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: String

Unique step identifier (used in depends_on references).

§prompt: String

Prompt 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: bool

If 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: bool

Request 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: Vec<String>

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: String

Human-readable description of this step’s purpose.

§interactive: bool

If true, spawn a long-lived interactive session (FIFO-based). Enables Human-in-the-Loop and Inter-Agent Communication patterns.

§auto_approve: bool

If 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.

§resources: Vec<ResourceSpec>

Step-level reference files advertised in the system prompt.

These are appended to the workflow-level resources for this specific step. Paths are resolved relative to the .zug file’s directory. See ResourceSpec for the accepted shapes.

§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: bool

If 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: bool

Review 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").

Trait Implementations§

Source§

impl Clone for Step

Source§

fn clone(&self) -> Step

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Step

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Step

Source§

fn default() -> Step

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Step

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Step

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Step

§

impl RefUnwindSafe for Step

§

impl Send for Step

§

impl Sync for Step

§

impl Unpin for Step

§

impl UnsafeUnpin for Step

§

impl UnwindSafe for Step

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,