Markdown source

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

Source Video

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

Method

This deck is reconstructed from the existing video frame captures by detecting likely slide regions with OpenCV, cropping/upscaling those regions, deduplicating similar crops, and OCRing the cropped slide images locally. It is a cleaner companion to the full-stage frame deck.

Reconstructed Slides

slide-003.jpg

Slide text:

In December Anthropic wrote a great blog post that canonically defined agents and workflows

slide-004.jpg

Slide text:

In April OpenAI released a paper on the topic

slide-005.jpg

Slide text:

Hot Take #1: Don't be That Guy

slide-006.jpg

Slide text:

Sometimes That Guy works for a FAANG type company in a public facing role Then the rest of us are really in for it

slide-007.jpg

Slide text:

"Use the platform" was a codeword for why React was wrong and anti-web

slide-008.jpg

Slide text:

Some of our users loved this. But many folks didn't.

slide-009.jpg

Slide text:

So when I see APIs

like this, it gives me

(bad) flashbacks

// Langgraph.js

const graph = new MessageGraph()

// nodes

.addNode("nodeA", funcA)

.addNode("nodeB", funcB)

// edges

.addEdge(START, "nodeA")

.addEdge("nodeA", "nodeB")

.addEdge("nodeB", END)

github.com/mastra-ai/mastra

slide-010.jpg

Slide text:

AIE

Or like this:

// Ingest

const [notifyTeam, assignPlan] = await Promise.all([

step.run("notify_team", async () => {

return { notified: true };

}),

step.run("assign_default_plan", async () => {

return { planId: "starter" };

}),

]);

github.com/mastra-ai/mastra

slide-011.jpg

Slide text:

Or like this:

// Ingest

const [notifyTeam, assignPlan] = await Promise.all([

step.run("notify_team", async () => {

return { notified: true };

}),

step.run("assign_default_plan", async () => {

return { planId: "starter" };

}),

]);

github.com/mastra-ai/mastra

slide-012.jpg

Slide text:

A Pattern Language

Towns·Buildings·Construction

Christopher Alexander

Sara Ishikawa·Murray Silverstein

with

Max Jacobson·Ingrid Fiksdahl-King

Shlomo Angel

slide-013.jpg

Slide text:

How the WorkOS folks put it in their

Mastra workshop yesterday:

Agents are stateful AI entities that:

• Maintain conversation memory

• Execute workflows autonomously

• Make decisions based on context

• Use tools to complete tasks

Think of them as AI assistants with both

memory and capabilities.

Workflows are composable pipelines that:

• Chain multiple steps together

• Pass data between steps

• Validate inputs/outputs with Zod

• Handle errors gracefully

Think of them as typed, observable

functions that can do complex multi-step

operations.

github.com/mastra-ai/mastra

slide-014.jpg

Slide text:

Here's another way to put it:

(1) Agents are a turn based game.

(2) Workflows are a rules engine for your tech tree

slide-015.jpg

Slide text:

Here’s another way to put it:

(1) Agents store threads of messages and continuously interact with users

(2) Workflows can have branching, parallelism, conditions, loops, can suspend/resume, etc

slide-016.jpg

Slide text:

At the end of the day it's all just a tradeoff

slide-017.jpg

Slide text:

Rules of agents + workflow composition

(1) Agents have tools

(2) Workflows have steps

(3) An agent can be a step

(4) A workflow can be a tool

(5) An agent can be a tool

(6) A workflow can be a step

slide-018.jpg

Slide text:

Agent supervisor

Supervisor

const researchAgent = new Agent({

name: 'research-agent',

instructions: 'You are a research agent that analyzes',

model: openai('gpt-4'),

});

const summaryAgent = new Agent({

name: 'summary-agent',

instructions: 'You are a summary agent.',

model: openai('gpt-4'),

});

const researchTool = createTool({

id: 'research',

execute: async ({ inputData }) => {

const result = await researchAgent.generate(inputData.query);

return { text: result.text };

},

});

const summaryTool = createTool({

id: 'summarize',

execute: async ({ inputData }) => {

const result = await summaryAgent.generate(inputData.text);

return { text: result.text };

},

});

export const supervisorAgent = new Agent({

name: 'supervisor-agent',

instructions: 'You are a supervisor agent that coordinates research and summarization tasks.',

model: openai('gpt-4'),

tools: [researchTool, summaryTool],

});

aws

World's Fair

slide-019.jpg

Slide text:

Workflow as tool

export const agent = new Agent({

name: 'Agent',

instructions: Ask the user for their location, check weather, and plan a trip,

model: openai('gpt-4o-mini'),

workflows: {

checkWeather,

planTrip

},

memory,

});

Hidden Non-Slide Evidence

Classification audit: raw/sources/slide-ai-classification/reconstructed/8SUJEqQNClw/audit.json