You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: 'AI Pipelines and Agents in Pure TypeScript with Mastra.ai',
17
+
title: 'Live Workshop: AI Pipelines and Agents in Pure TypeScript with Mastra.ai - Nick Nisi and Zack Proser',
12
18
description: 'Nick Nisi and I taught 70 engineers how to build AI workflows and agents with Mastra.ai at the AI Engineer World Fair in San Francisco.',
13
19
image: aieWorkshop,
14
20
slug: '/blog/ai-pipelines-and-agents-mastra',
15
21
})
16
22
17
23
<Imagesrc={aieWorkshop}alt="Nick Nisi presenting with me" />
18
24
19
-
On June 3rd, 2025, my colleague **Nick Nisi** and I hosted a two hour workshop at the **AI Engineer World Fair** in San Francisco. The event gathered more than 70 engineers eager to build AI powered workflows in their own products.
25
+
On June 3rd, 2025, my colleague **Nick Nisi** and I hosted a two hour workshop at the **AI Engineer World Fair** in San Francisco. The event gathered more than 70 engineers eager to build AI powered workflows in their own products using **Mastra.ai** - a new framework that allows you to orchestrate AI tasks using pure TypeScript.
20
26
21
-
Mastra.ai provided an early preview of their workflow tooling, which allows you to orchestrate tasks using pure TypeScript. We showed how to chain those workflows together into pipelines and grant access to them through natural language driven agents.
27
+
<figure>
28
+
<Imagesrc={zackAndNick}alt="Zack and Nick ready to teach" />
Nick Nisi is a TypeScript expert, and I'm a full stack developer who has gone deep into GenAI and the <Linkhref="/blog/vercel-ai-sdk"className="text-blue-600 hover:text-blue-700 underline">Vercel AI SDK</Link>.
31
+
</figcaption>
32
+
</figure>
22
33
23
-
All of the materials are open source in the [mastra-agents-meme-generator](https://github.com/workos/mastra-agents-meme-generator) repo. We built the full app first, wrote up the steps in `workshop.md`, and staged each phase on a separate git branch so everyone could work at their own pace.
34
+
## Live Demo: AI Meme Generator in Action
35
+
36
+
Here's our complete workshop demonstration showing the agentic application we built running end-to-end. Watch how workplace frustrations get transformed into shareable memes through a multi-step AI workflow:
Users simply enter their random workplace frustrations - anything from "my meetings always run over" to "the deployment process is completely broken." Then our **4-step agentic workflow** takes over:
50
+
51
+
1.**🧠 Analyzes their frustrations** - Uses structured AI generation to extract and categorize the workplace pain points
52
+
2.**🎭 Selects the right base meme** - Searches through Imgflip's extensive template database to find the perfect format
53
+
3.**✍️ Humorously recaptions it** - Generates contextually funny text that transforms frustration into humor
54
+
4.**🚀 Creates and hosts it** - Produces the final shareable meme with a stable URL
55
+
56
+
The result? Common workplace struggles become genuinely funny, shareable content that teams can actually use.
57
+
58
+
## Key Learning Outcomes
59
+
60
+
By the end of the workshop, attendees had:
61
+
62
+
- ✅ Built a complete agentic workflow with multiple specialized steps
63
+
- ✅ Integrated external APIs (Imgflip, OpenAI)
64
+
- ✅ Used structured generation for reliable data extraction
65
+
- ✅ Created a fun, shareable application that solves real problems
66
+
- ✅ Learned Mastra's agent and workflow patterns
67
+
- ✅ Gained experience with AI-powered workflows and step composition
68
+
69
+
## From Toy Example to Production Patterns
70
+
71
+
While we chose a humorous implementation for our workshop, the **patterns, architecture, and Mastra framework** we demonstrated are ideal for creating **enterprise-grade agentic applications**. The same workflow concepts apply whether you're building:
72
+
73
+
-**Customer Support Automation** - Multi-step ticket resolution workflows
74
+
-**Data Processing Pipelines** - ETL workflows with AI-powered transformations
75
+
-**Content Generation Systems** - Marketing copy, documentation, and reports
76
+
-**Complex Business Logic** - Approval processes and intelligent routing
77
+
78
+
The modular, typed, and testable approach we used for meme generation scales directly to serious production use cases.
79
+
80
+
## The Meme Generation Pipeline: Technical Deep Dive
81
+
82
+
Our workshop demonstrates a complete **4-step agentic workflow** that transforms workplace frustrations into shareable memes:
83
+
84
+
### Understanding the Workflow Architecture
85
+
86
+
```typescript {theme: 'gruvbox-dark'}
87
+
// Our main agent orchestrates the entire meme generation process
88
+
const memeGeneratorAgent =newAgent({
89
+
name: 'MemeGenerator',
90
+
instructions: 'Help users turn their work frustrations into funny memes',
91
+
workflows: {
92
+
'meme-generation': memeGenerationWorkflow,
93
+
},
94
+
});
95
+
```
96
+
97
+
The workflow consists of four modular, reusable steps:
98
+
99
+
1.**Extract Frustrations** - Parse user input and categorize workplace pain points
100
+
2.**Find Base Meme** - Select appropriate meme templates from Imgflip's API
101
+
3.**Generate Captions** - Create contextually funny text using AI
102
+
4.**Generate Meme** - Produce the final shareable meme image
103
+
104
+
### Step 1: Extract Frustrations with Structured Generation
105
+
106
+
One of Mastra's most powerful features is its integration with **structured generation** using Zod schemas and the Vercel AI SDK:
107
+
108
+
```typescript {theme: 'gruvbox-dark'}
109
+
const extractFrustrationsStep =createStep({
110
+
id: 'extract-frustrations',
111
+
description: 'Extract and categorize user frustrations from raw input',
112
+
inputSchema: z.object({
113
+
userInput: z.string().describe('Raw user input about work frustrations'),
*When you refer an engineer who constantly asks for your help but gets paid more than you...*
241
+
242
+
<Imagesrc={good4}alt="Salary disparity meme" />
243
+
244
+
*That awkward moment when your mentee's starting salary is higher than your current one...*
245
+
246
+
These examples demonstrate how our AI workflow transforms common workplace frustrations into contextually appropriate and genuinely funny memes that teams can actually share!
247
+
248
+
## Why Mastra.ai for Production Workflows
249
+
250
+
### Modular Step Design
251
+
252
+
Each workflow step is designed to be:
253
+
254
+
-**Modular**: Can be used independently or as part of larger workflows
255
+
-**Typed**: Uses Zod schemas for input/output validation
256
+
-**Testable**: Can be tested in isolation using Mastra's built-in tools
257
+
-**Reusable**: Can be composed into different workflows
258
+
259
+
### Built-in Testing and Development
260
+
261
+
Mastra provides excellent development experience:
262
+
263
+
```bash {theme: 'gruvbox-dark'}
264
+
# Start the development server
265
+
npm run dev
266
+
267
+
# Visit the Mastra playground at http://localhost:4111
268
+
# Use the chat interface to test the complete workflow
269
+
```
270
+
271
+
### Error Handling and Reliability
272
+
273
+
The framework includes graceful error handling and recovery mechanisms, essential for production AI applications.
274
+
275
+
## Workshop Experience and Results
276
+
277
+
All of the materials are open source in the [mastra-agents-meme-generator](https://github.com/workos/mastra-agents-meme-generator) repo. We built the full app first, wrote up the steps in `workshop.md`, and staged each phase on a separate git branch so everyone could work at their own pace.
26
278
27
279
The hands-on format let attendees build a simple pipeline from scratch, then wrap it with an agent interface. Seeing the agents successfully complete tasks through our pipelines was an awesome moment for everyone in the room.
28
280
29
281
One of us stayed on the mic while the other roamed the room answering questions and fixing issues. This tag-team approach kept everyone moving forward and made sure no one fell behind.
30
282
31
283
We tied the workshop back to lessons from my [earlier talk at a16z](/blog/a16z-sf-dec-2023-ai-apps-production) about taking prototypes to production. This time, it was all coded live in TypeScript with the Mastra.ai SDK.
By the end, almost every attendee succeeded in getting the finished agent running. The energy in the room was incredible, and we were fired up by how many developers were brainstorming ways to use Mastra.ai in their own workflows. We can't wait to run more of these sessions in the future. If you want to follow along yourself, head to the [mastra-agents-meme-generator](https://github.com/workos/mastra-agents-meme-generator) repo.
287
+
By the end, almost every attendee succeeded in getting the finished agent running. The energy in the room was incredible, and we were fired up by how many developers were brainstorming ways to use Mastra.ai in their own workflows.
288
+
289
+
## Glowing Feedback from Attendees
290
+
291
+
The response from workshop attendees was overwhelmingly positive. Here's what engineers said about the experience:
The feedback validated our approach of combining humor with serious technical patterns - attendees appreciated both the engaging format and the practical, production-ready skills they gained.
299
+
300
+
## Beyond Memes: Enterprise Applications
301
+
302
+
While our workshop focused on meme generation, the same patterns apply to serious business applications:
-**Business Logic**: Complex approval and routing processes
310
+
311
+
---
312
+
313
+
## Interested in AI Workshops for Your Team?
314
+
315
+
Want to bring hands-on AI training to your organization? I provide workshops and training sessions on building production AI workflows, agentic systems, and practical machine learning implementations.
I'm available for corporate workshops, conference talks, and team training sessions on AI engineering, workflow automation, and developer tools. From hands-on coding sessions to strategic AI implementation planning.
If you want to see more events like this one, check out my <Linkhref="/speaking">speaking page</Link>.
338
+
We can't wait to run more of these sessions in the future. If you want to follow along with the workshop materials yourself, head to the [mastra-agents-meme-generator](https://github.com/workos/mastra-agents-meme-generator) repo.
0 commit comments