docs/src/course/04-workflows/05-chaining-steps-together.md
Now you'll learn how to chain your steps together to create a complete workflow.
Add this workflow definition to your file:
import { createWorkflow } from '@mastra/core/workflows'
export const contentWorkflow = createWorkflow({
id: 'content-processing-workflow',
description: 'Validates and enhances content',
inputSchema: z.object({
content: z.string(),
type: z.enum(['article', 'blog', 'social']).default('article'),
}),
outputSchema: z.object({
content: z.string(),
type: z.string(),
wordCount: z.number(),
metadata: z.object({
readingTime: z.number(),
difficulty: z.enum(['easy', 'medium', 'hard']),
processedAt: z.string(),
}),
}),
})
.then(validateContentStep)
.then(enhanceContentStep)
.commit()
.then() in the order they should executeThe workflow automatically validates:
Your workflow is now ready to run! Next, you'll test the complete workflow.