docs/src/course/04-workflows/02-understanding-steps.md
Steps are the building blocks of workflows. Each step is a self-contained unit that takes some input, processes it, and produces an output.
A step has three main parts:
Every step follows this pattern:
const myStep = createStep({
id: 'unique-step-name',
description: 'What this step does',
inputSchema: z.object({
// Define expected input structure
}),
outputSchema: z.object({
// Define output structure
}),
execute: async ({ inputData }) => {
// Your logic here
return {
// Return data matching output schema
}
},
})
Schemas provide several benefits:
Next, you'll create your first step!