Mastra Workflows

Orchestrate complex, multi-step processes

Define an execution graph of agents and tool calls. Suspend for human review. Re-use steps and workflows.

precisely define your execution graph

Handle complex workflows with nesting, state management, and sophisticated branching and parallel execution.

Sequential

step.then(
nextStep
)
sequential docs

Parallel

step.parallel([
a,b
])
parallel docs

Branch

step.branch([
[cond1, step1],
[cond2, step2]
])
branch docs

Loops

step.doWhile(cond)
loops docs

compose with agentic primitives

Build intelligent agents that execute tasks, access your data sources, and maintain memory persistently.

Ready to get started with Mastra?