Skip to main content
Lesson 10 of 18·3 min

Agents vs. Workflows

You've built the ticket purchase workflow, so now is a good time to draw a clear line between what agents do and what workflows do. The terms get used loosely, but what matters here is how they behave in practice and how they work together in this project.

An agent is the "talking brain" of the system: a language model with tools and memory. The path is not predefined; the model decides what to do, what tools to call, and when it's done. A workflow is the opposite: you define the steps, the order, and what "done" means. The ticket purchase flow is the clearest example. You're not asking the model to figure out checkout, you're defining it. In Mastra, you can combine them: agents inside workflows, or workflows as tools for agents.

This matters because knowing which to reach for keeps you from over-engineering a simple task into a workflow, or asking a model to handle something that should be deterministic and controlled.

"We're not asking the model to figure out checkout. We're defining checkout."

— Guil Hernandez

Mentioned in the lesson
Direct link to Mentioned in the lesson

Relevant Mastra docs:

Join the community
Direct link to Join the community

Ask questions:

Follow Mastra:

  • X — follow Mastra for updates
  • YouTube — watch more tutorials
  • LinkedIn — follow for updates

Don’t miss the next Mastra lessons

Be notified the moment new lessons release and stay ahead of every update. We’ll email you about course improvements, new Mastra features, and upcoming live workshops. Unsubscribe anytime.