← back

Agents vs Workflows: Why Not Both? — Sam Bhagwat, Mastra.ai

22.0K views · Aug 01, 2025 · 15:36 min · Watch on YouTube ↗
Takeaway

Build with both agents and workflows using readable fluent APIs — don't make your team learn graph theory for production agentic systems.

Summary

  • Pushes back on OpenAI's April anti-workflow post; argues both agents (turn-based) and workflows (rules engines for tech trees) are needed in AI engineering.
  • Critiques graph/node/edge APIs (à la LangGraph) as harmful — teams shouldn't need graph theory to write workflows; fluent top-to-bottom syntax like Mastra's is more readable.
  • Non-determinism makes traceability/replayability 10x more critical in AI engineering than in normal software, hence the workflow renaissance.
  • Maps Christopher Alexander's design-pattern lineage to needing a shared glossary for agentic patterns — branching, parallelism, suspend/resume, replay.
  • Tradeoff frame: pick power (agent autonomy) or control (workflow determinism) at each step rather than as a global decision.
agentsworkflowsmastra
Original description
One current hot debate is should you make your top-level abstraction a ReAct type agent running in a loop? or should you make it a structured workflow graph?

OpenAI is launching their new framework and throwing shade on workflow graph approaches

TBH we think this whole debate is kinda dumb.

We've seen a lot of folks be able to structure the problem in a way that a workflow graph makes a lot of sense.

We also see a ton of agents where you need to run the core bit in a loop for a long time.

You can also give your agents structured workflow graphs as a tool. You can use structured workflow graphs as a handoff mechanism between agents. What we've seen from the community is frankly that folks need to tinker with multiple approaches and combine primitives in interesting ways

We'll share a couple stories where teams ended up with workflow graph based approaches, a couple where teams ended up with agent based approaches, and a couple where a blended approach made sense.

About Sam Bhagwat
Sam is the co-founder and CEO of Mastra and the author of Principles of AI Agents. Previously, Sam was the co-founder of Gatsby.js, the popular web framework.

Recorded at the AI Engineer World's Fair in San Francisco. Stay up to date on our upcoming events and content by joining our newsletter here: https://www.ai.engineer/newsletter

Timestamps:

00:00 Introduction: Agents vs. Workflows
01:00 The Debate and Controversy
02:15 "Don't Be That Guy": Critiquing Dogma in AI Development
03:40 Harmful APIs and the Case for Fluent Syntax
08:00 Defining Agents and Workflows
10:00 Composition, Design Patterns, and Trade-offs
11:49 Composing Agents and Workflows
12:12 Architectural Patterns for Composition
14:43 Q&A and Concluding Thoughts