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

AI EngineerAbout 4 min readAug 3, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

AI Agents, Workflows, Design Patterns, Agentic Patterns, Tool Calling, Agent Supervisor Model, Dynamic Tool Injection, Non-determinism, Trade-offs (Power vs. Control), Graph Theory, Fluent Syntax, Readability of Code.

Hot Takes and Discourse

The speaker addresses the recent debate surrounding the use of agents versus workflows, particularly referencing a blog post by Anthropic and a paper by OpenAI. He criticizes the "that guy" mentality, where certain individuals or companies (implicitly referencing large model providers) act as if they have the only correct approach to development, drawing parallels to past experiences in web development with certain Googlers pushing specific technologies. He also critiques the use of graph node and edge terminal APIs within frameworks like Langchain, arguing that they introduce unnecessary complexity and reduce code readability, referencing his experience with GraphQL in Gatsby. He advocates for a more fluent syntax that allows for easy understanding of control flow.

  • Hot Take 1: "Just don't be that guy" - Avoid acting as if you have the only right way to do development, especially if you're in a position of influence.
  • Hot Take 2: "We should consider like graph node and edge terminal APIs within frameworks harmful" - These APIs can make workflows unnecessarily complex and reduce code readability.

Design Patterns for Agents and Workflows

The speaker introduces the concept of design patterns for agents and workflows, drawing inspiration from Christopher Alexander's work on architectural patterns. He notes the lack of a commonly accepted verbiage and glossary for agentic patterns.

  • Christopher Alexander: Architect and author of "A Pattern Language," which cataloged patterns for urban planning and building architecture. Software engineers adopted this concept in the late 80s and early 90s.

Agents vs. Workflows: Definitions and Properties

The speaker provides simple explanations of agents and workflows:

  • Agents: Described as a turn-based game where the user and agent take turns interacting, potentially involving tool calls.
  • Workflows: Analogized to a rules engine for a tech tree, where dependencies must be met before proceeding to the next step (e.g., in a game like Civilization).

He highlights the emergent properties of each:

  • Agents: Conversations have threads, memory, and context due to message history.
  • Workflows: Branching, parallelism, conditions, loops, suspending, resuming, and replaying are possible due to dependency tracking.

He emphasizes that workflows are becoming more popular in AI engineering due to the inherent non-determinism and the need for traceability.

Trade-offs: Power vs. Control

The speaker frames the choice between agents and workflows as a trade-off between power and control. He suggests starting with power (agents) and then adding control (workflows) to address any issues that arise.

  • "At the end of the day, it's just a trade-off. You can have power or you can have control. You can decide which parts you want power on which parts you want control on."

Practical Application and Architecture Design

The speaker shares experiences from whiteboarding sessions where users struggle with agent performance. He suggests breaking down complex tasks into smaller, more manageable steps to improve reliability. He encourages developers to explain their architecture to colleagues and diagram it out to identify potential improvements.

  • Example: Instead of feeding a giant PDF of medical documentation into one LM call, break it down into 12 LM calls to diagnose 12 symptoms.

Agent and Workflow Composition

The speaker explores various ways to combine agents and workflows:

  • Agents have tools: Agents can call tools to perform specific tasks.
  • Workflows have steps: Workflows consist of a series of steps.
  • Agent as a step: An agent can be a step within a workflow.
  • Workflow as a tool: A workflow can be a tool that an agent calls.

He provides examples of specific patterns:

  • Agent Supervisor Model: An agent calls other agents as tools (e.g., a research agent, a summary agent, and an orchestrator agent).
  • Workflows as tools: A workflow (e.g., planning a location, checking the weather, planning a trip) is passed to an agent for iteration.
  • Workflows doing agent handoffs: Workflows can manage the transfer of tasks between agents.
  • Dynamic Tool Injection: Agents are given a limited set of tools relevant to the current task to avoid overwhelming them.
  • Nested Workflows: Workflows can be nested within other workflows.

He reiterates that the real value comes from combining these patterns effectively.

Question and Answer

The speaker addresses a question about the optimal number of tools for an agent. He emphasizes that practical results are more important than theoretical correctness, stating that if an agent works well with 20 tools, then the theory might be wrong.

  • "We are a community of practice more than we are a community of theory. If your agent is working according to what you would need, like do it. If it's not theoretically correct, that probably means the theory is wrong, not the practice."

Conclusion

The speaker advocates for a pragmatic approach to building AI systems, emphasizing the importance of experimentation and collaboration. He encourages developers to focus on creating readable code and to avoid unnecessary complexity. The key takeaway is that the best approach involves understanding the trade-offs between agents and workflows and combining them in creative ways to achieve the desired results.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.