Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

StepOptions

Configuration options for workflow steps that control variable mapping, execution conditions, and other runtime behavior.

UsageDirect link to Usage

workflow.step(processOrder, {
variables: {
orderId: { step: "trigger", path: "id" },
userId: { step: "auth", path: "user.id" },
},
when: {
ref: { step: "auth", path: "status" },
query: { $eq: "authenticated" },
},
});

PropertiesDirect link to Properties

variables?:

Record<string, VariableRef>
Maps step input variables to values from other steps

when?:

StepCondition
Condition that must be met for step execution

VariableRefDirect link to VariableRef

step:

string | Step | { id: string }
Source step for the variable value

path:

string
Path to the value in the step's output

On this page