AIAI EngineerJul 12, 2025· 1:51:14

[Workshop] AI Pipelines and Agents in Pure TypeScript with Mastra.ai — Nick Nisi, Zack Proser

This hands-on workshop introduces Mastra.ai, a TypeScript framework for building production AI agents and pipelines, and demonstrates how to build an AI meme generator using composable workflows, tools, and agents. Hosts Nick Nisi and Zack Proser walk through creating a multi-step workflow: extract user frustration, find a base meme via ImageFlip, generate captions, and publish the meme at a stable URL. They show how to chain steps with Zod schema validation for deterministic output, then wrap the workflow in an agent that accepts natural language requests. The workshop also covers MCP (Model Context Protocol) and a live demo of MCP.shop for ordering a shirt, emphasizing local iteration with Mastra's playground, built-in memory, and evaluation tools. Real-world patterns include building internal AI assistants for data cleaning, email drafting, and document summarization with minimal code.

  1. 0:00Welcome & Intros
  2. 2:57Mastra Concepts
  3. 10:45Meme Generator
  4. 14:12Workshop Setup
  5. 34:27Step 1: Workflow
  6. 53:07Step 2: Pipeline
  7. 1:27:52Step 3: Agent
  8. 1:45:52Wrap-Up & Q&A

Powered by PodHood

Transcript

Welcome & Intros0:00

Nick Nisi0:15

Allright, should we get it going?

Zach Proser0:16

Let's do it.

Nick Nisi0:17

Allright, welcome everyone. Uh, this is "AI Pipelines and Agents in Pure TypeScript" with Mastra.ai. Uh, today's mission, do you want to talk?

Zach Proser0:26

Sure. Um, so what we're going to do today is we're going to build an AI-powered meme generator, and yes, that's humorous. Sounds like a toy, but the patterns that we're going to use here, uh, both with the Mastra framework and in terms of using TypeScript to build a production agent, are the same patterns that we've used and that you can use, um, to deploy to production with, uh, AI applications.

Um, so the rough format that we're going to follow here is we're going to do like a 20-minute intros and concept just to make sure everyone's level set. Feel free to, you know, stop us, ask questions, and then, um, the majority of the time this workshop is going to be spent coding, uh, together, um, collaboratively, and then we'll have about 10 minutes wrap-up and Q&A and a little fun demo for you at the end to get some swag.

Nick Nisi1:04

Yep. And, uh, yeah, so this is a true workshop format. Uh, we'll be building together. If you have questions, uh, reach out to us. We're happy to help. And, uh, just so you can get kind of a head start on it, if you go to "Workshop AI Agents with Mastra," uh, the Slack channel in the AI Engineer Slack, all the materials are in the pinned link there, and we can have discussions there as well, continuing.

Uh, so we work at a company called WorkOS. Um, we build developer tools and make enterprise features happy—uh, enterprise developers happy—with easy-to-use tools like SSO and SAML, directory sync, audit logs, fine-grained auth. Uh, and we're really getting into AI, uh, and securing your AI, uh, things like securing your MCP, attaching identity to those agents so that they can act on your behalf and know who you are.

Zach Proser1:48

Yep. Um, another good way to think about WorkOS is if you—like, let's say Nick and I built the ultimate app this weekend, we're ready to go sell it, and then the first time we demo it to somebody, they say, "Can you give us, uh, single sign-on for our 2,000 users over here in a different path over here?"

Um, so then we would go and buy WorkOS or use WorkOS, drop the JavaScript in, and we would have those features, uh, ready to sell.

Nick Nisi2:09

Uh, so my name's Nick Nisi. I'm Developer Experience at WorkOS. Uh, I'm also a host on the Dysfunctional.fm podcast, formerly JS Party. Any JS Party listeners ever? Huh? Nice. Um, uh, I also do conference MC-ing and speaking. Um, I'll be at Squiggle Conf MC-ing that, uh, which is a dev tools-focused conference in Boston later this year.

Uh, I'm also a TypeScript enthusiast, as you'll see. I'm a Vim user, by the way, and I'm Nick Nisi everywhere.

Zach Proser2:38

Hey everyone. I'm Zack. Um, really excited to be here with you all. I've mostly been an application and infrastructure developer, uh, my career, but for the last two years I've really been focused on GenAI, uh, MLOps, and then retrieval-augmented, uh, generation pipelines or RAG pipelines.

So, um, yep, really excited to be here and building with you today.

Mastra Concepts2:57

Zach Proser2:57

Uh, okay, so what is Mastra? Um, I'll just embarrass, uh, two folks quickly and just point out that we have some core Mastra team members here, so this is very exciting. So you'll not only be able to get some assistance from us, hopefully, but also, uh, from the Mastra core team for any questions that go over our heads.

Mastra is a framework, um, and so it's a framework for building, you know, production AI applications in an agentic manner. And these are the components that we're all going to learn and get hands-on with today in this workshop and understand very well by the time we leave here.

So we're going to build workflows. Just think of them as, um, composable and typed pipelines, which are very exciting. Uh, tools that you can optionally use, uh, and give to agents. Agents are like the interfaces that we're chatting with.

Um, they're the ideal interface for humans to work with. And then, uh, the Mastra framework does some incredibly cool things, uh, out of the box with batteries included that we'll see. Um, so not just, you know, a playground that makes it super easy to debug everything, but built-in persistence, memory, observability, and even, um, evaluation so that you can determine over time how healthy your pipeline is, which is critical for, you know, successfully deploying an AI application in production.

Nick Nisi3:59

Yep. And we'll be—we'll be focusing on, uh, pieces of this. We don't have time in two hours to go over everything, but there's a lot of really cool tools in there. Uh, so we're going to be focusing on some core concepts for the, uh, example app that we're building, um, and we'll kind of understand some of those building blocks as we get going.

Zach Proser4:15

Cool. So let's start off, uh, what are workflows? Um, workflows are composable pipelines. So the way that I think about this is I map it in my head mentally to if a coworker says, "I just keep on having to go scrape the site and download people that look interesting and look up their info and then take an image and then write an email."

You know, that sounds to me like a, a workflow,right? It's a pipeline of discrete steps. You want them to happen in a certain order. And as we can begin to see with this example code on the screen, you can even have control over transforms that happen in the middle of your pipeline.

So the idea is you're chaining multiple steps together to get some work done. You can pass data between steps. And then, very importantly, because as we know, LLMs are incredibly powerful, but they're non-deterministic. And so how do we rely on their output?

How do we coerce their output into something that we can actually build against dependably? That's, uh, where we're going to validate inputs with Zod, but we're also going to learn how Zod can even coerse, uh, at runtime and then handle errors, uh, errors gracefully.

But really, the key i-idea here is that workflows are a discrete set of ta uh, steps to get a task done.

Nick Nisi5:16

Yep. And the, the API is very similar. Uh, it reminds me of, like, RxJS. Like, very similar. You're starting with one thing and then doing something and then mapping to something else and then doing something else, uh, and running through all of that to give a little bit of determinism to the, the call of all of these tools as they're being called by your agent or some other tool.

Um, and speaking of tools, uh, tools are just functions that agents can call. Uh, they can give you things like file system access, API calls, database queries, uh, custom business logic. If you've used MCP, uh, MCP calls tools, and, uh, so that's like a really cool thing.

It gives the, the LLM a bit the ability to act on your behalf or to read in data that it doesn't just inherently know from its latent space, uh, so that it can do more things and be more powerful for you.

Zach Proser6:05

Yep. Um, absolutely. I'll just say that, you know, we, we think of, like, uh, AI systems getting better the more data and context they have access to. And, and one of the things that MCP is really excellent at doing is, is giving granting context to Claude to OpenAI, uh, that it normally wouldn't have, and that's not in its training data.

Nick Nisi6:22

Yep. And one note for today's workshop: we did build everything using tools, uh, but then we switched as we brought in an agent, uh, to call, and we had the agent call a workflow rather than the tools independently.

So we wanted to touch on them there. There's something powerful that you should look into on your own, uh, and figure out your use case for them, but we didn't really use them in, uh, the final version of this workshop.

Zach Proser6:44

Um, and then finally, what are agents? So we've all probably seen and used the chatbot, um, type demos, but, you know, the way that we're thinking of agents, uh, these days is really that they're kind of an ideal human interface.

So if I set up a workflow, that's a deterministic set of steps to get some discrete task done for my colleague. Let's say that my colleague is in a hurry or they're busy or they're doing this while they're on the phone or they're not technical, then a chatbot can be an ideal interface for that human colleague,right?

Because they can describe their problem or their issue, what they need, with natural language, and then the system can be smart enough to actually do what they want. And so this is the core—this is a very, uh, core kind of pattern that we're seeing in, in a lot of, um, AI applications.

And so we're actually going to build this and understand this here. So after we create our workflow, we'll create an agent, and we'll grant that agent the ability to call the workflow.

Nick Nisi7:32

Yep. And agents were something that when I first heard of them, like, it like in a lot of these things, like the, the naming adds more confusion than is really necessary. And we spent, like, an hour on the phone call, and I kept being like, "But what is an agent?

What is how is that anything beyond just a simple prompt?" And it's really like the marriage of that prompt plus the workflows or the tools that it can use, uh, to do things in a specialized way.

Zach Proser7:53

Yeah. The other way I think of it is like if, you know, in the past, maybe five, ten years ago, you might have written deterministic, more deterministic software. With agents, you're expecting that the system overall can kind of interpolate or can understand, introspect what's the state, and then make a decision, um, in like a graph sense of, "We need to actually go here."

So, um, that's the other piece that you'll hear when you're discussing agentic systems.

Nick Nisi8:15

Yep.

Cool. Uh, another thing: MCP or Model Context Protocol. I told you I'd show you how to spell it. Um, this is a way for you to—it's an open standard for a way to bring, like, universal plugins or these tools to AI agents so that they can be called.

Uh, this was really developed, uh, by Anthropic, and you can use it easily in Claude Code, uh, among other places like Cursor, um, Windsurf, I think.

Zach Proser8:39

Yep.

Nick Nisi8:40

Uh, and even OpenAI is, is, uh, adopting these tools as well. So it's really a nice, easy-to-use API that these tools know how to use and call.

Zach Proser8:48

And to also make it concrete, like you—so you work on the DX team at WorkOS. You're constantly crushing a ton of, of bugs in all various SDKs, and you use Claude Desktop,right? And so, like, what changed the day that you enabled the, the GitHub MCP server for Claude Desktop?

Nick Nisi9:01

Yeah. The GitHub MCP server was the one that really, like, made me understand what MCP is doing because I was like, "Why do I want to do this? How is this different than just, like, having access to GitHub and, and, you know, calling all of that?"

But it's really an easy way for me to have a conversation with Claude and for it to bring in the context that it needs based on the tool the, uh, issue that I'm working on. For example, if you have an issue on a, a GitHub repo, I can just say, "Hey, can you check out that issue and tell me, uh, you know, here's my example app.

Tell me how I might reproduce this." And it can, like, go figure that out, pull in the comments, understand what's going on, link out to other repos or other examples from there, and then, uh, look at my example repo and tell me how to, uh, to make that change.

Zach Proser9:43

Cool.

Nick Nisi9:47

Speaking of MCPs, uh, we built a fun little demo called MCP.shop. You can go there now, and you can use MCP to order a shirt. And it's the only way that you can order this shirt. And for the low, low price of $0, you can get an MCP shirt.

The, the point is you just have to use the MCP. So it's just a fun demo to, to try out MCP, play with it.

Zach Proser10:06

Yep.

Nick Nisi10:07

You can add it, uh, it has instructions for adding it into Claude or into any of the, um, MCP servers, uh, sorry, MCP clients that support it.

Zach Proser10:15

Yep. Totally. Uh, I'll also mention that recently, so MCP is, you know, one of the protocols that's really hotright now in, in the AI space, um, and a lot of folks are, are taking notice. We recently had an MCP night, and it was at the Exploratorium.

It was a ton of fun. We, we blew out, like, the capacity of the event, um, and we had people, like, lined up around the block, which we didn't expect. Um, we're almost certainly going to do something like this again soon, so, uh, be sure to follow us if you want to hear about it.

Um, and yeah, we'd love to see you there in the future.

Nick Nisi10:43

Yeah.

Zach Proser10:45

Allright. Um, what we're going to actually build today, though, to, to get into it, is the AI meme generator. Um, so we're going to, uh, if you imagine the input to this is going to be you venting any random frustration, workplace frustration, frustration with your colleagues or boss, um, into the pipeline, and, uh, the workflow will process your frustration.

Meme Generator10:45

Zach Proser11:04

Um, it's going to find the best base meme that already exists that would be ideal or might be humorous. It's going to think about how to, um, actually edit and, and create new captions, and it's going to publish a new meme at a stable URL that's, uh, available for you.

And again, I just mentioned, like, this is a toy. We've got two hours. It's a quick demonstration. But the patterns that you see here and the Mastra framework are, are definitely, you know, AI, um, production ready. Uh, we'll use OpenAI just for the understanding, and ImageFlip is the only other API involved here, which you can get free, uh, username and keys for that, and there's information in the workshop MD file for that.

Nick Nisi11:37

Yep. Yeah. And it's a really fun demo just to kind of showcase some of the tooling that you can do with Mastra, uh, and how easy it is to really get all of this going, but also not just to get your, your tools going, but to test them very easily along the way.

So we can start with just, like, a single step in a workflow and test that without an agent. And then we can test the agent independent too. And we can do all of this and not have to have, like, a full picture, uh, to understand how it's going to work, but kind of iterate along the way.

And the tooling that Mastra provides is just super nice. That's why we love it. We're also huge fans of TypeScript, which makes it awesome as well. And so, yeah, it's just nice and easy.

Zach Proser12:13

Yep. Absolutely.

Okay. This is the way that we've structured this, uh, workshop. And so, you know, we weren't really sure the level that everyone's coming in at, and some folks are experts and some folks are just getting started. So, uh, it's self-paced learning, and you can go at the speed that you want to go.

If you want to go and fly all the way through it, you're free to do that. Workshop MD in that repo is the entirety of this course, and so you can kind of follow along that way. And then we also created, uh, Git branch checkpoints for you.

So in case, for example, you're to fall behind, uh, you get stuck on something, and then we get to phase two, you can also skip to phase two and stay, stay with everybody just by, you know, Git checking out theright branch.

Um, if you get uns uh, if you get stuck at any point, we're here to help, so please raise your hand. We'll come around.

Nick Nisi12:54

Come to the mic.

Zach Proser12:54

And then if you yeah, if you have questions that other folks likely have or might benefit from in the future, please be sure to come up to a mic and, uh, we'll make sure that your question is heard.

Uh, and then, you know, the other way we're thinking about this, this workshop is, again, it's, it's a anyone can read online. We can all talk online anytime, but we're actually here in person today. So, you know, please shout out questions and raise your hand and ask us things you want to know.

Um, we feel that understanding is more important than completing stuff here, and it's okay to explore, so.

Nick Nisi13:20

Yeah. We're all very new to this. This is all very new stuff, very new tools, and it's very cool. It's also changing every single week, so it's, uh, it's fun, like, snapshot in time to play with this stuff.

Um, and if you have, uh, like I said, you, you don't have to finish it. Uh, we do have the whole workshop.md that you can follow step by step all the way through to the end, uh, and then those, those branches to, um, to get us there.

And if you just look at the main branch, that's the completed version, but it's more fun to build along the way. So with that, let's get started. Um, like I said, everything is in the, uh, workshop AI agents with Mastra channel on Slack.

So if you're in there, uh, you can go grab it. There's also, uh, the Git clone commandright there to grab the repo, and, uh, we can get started with that. Um, just go to the step/step0 branch. That has everything kind of as a baseline to start from.

Workshop Setup14:12

Nick Nisi14:12

Uh, and then you can npm install from there and get going with the workshop.md. So here, I think we can stop and, uh, you, you can get started. We'll give you some time to build. Um, but if there are any questions, um, please come to the mics, and we'd be happy to continue the chat.

Guest14:29

Hey, I had a quick question.

Nick Nisi14:30

Yeah.

Guest14:31

Um, so the before you were you showed the example of an agent and.

Nick Nisi14:34

Uh-huh.

Guest14:34

Workflows. That's kind of different from what I'm used to seeing in these, like, agent SDKs where they usually have tools.

Nick Nisi14:40

Mm-hmm.

Guest14:41

So is the workflow kind of like a tool that I can use, or?

Zach Proser14:43

Yeah. I mean, to I feel like correct me if I'm wrong here. I feel to some degree that, like, the create tool and create step APIs are, are somewhat similar. And in my mind, at leastright now, it's sort of like an organizational preference.

Like, if I have a simple, um, use case and there might be three different tools, and I want the agent to decide theright time to call those tools, I might create three separate, mostly fun essentially functions, name them tools, grant them to the agent, and then start chatting with the agent and ask for things and let the LLM determine at runtime which, which ones to call.

The difference is with the workflow is I'm saying, "I always want you to proceed in exactly this sequence with these steps and these transforms." And then you can also in Mastra, at least, you can optionally grant an agent the ability to call that workflow.

So and then also in my conversation recently with, with Sam, that's kind of like, you know, these are these are various tools that you can build up and, and kind of assemble into the exact, uh, paradigm that you need.

Guest15:34

Can you do both tools and workflows? Like.

Zach Proser15:36

I think so. Yeah. You can grant because, uh, it's basic like, you, you're passing, like, this giant, uh, JSON object to the agent saying, "You can call these tools and you can call these workflows." And then.

Nick Nisi15:45

Cool.

Zach Proser15:45

The tricky part is, like, if you give something 100 tools and then ask an LLM, like, "You've got 100 tools. Let's, like, go to Disneyland." I don't know exactly what we're going to get out of that, but that's where, like, the determinism of a of a pipeline can be of a a workflow can be beneficial.

Guest15:59

Cool. Thanks.

Zach Proser16:00

Thanks. Great question. Um, anybody want to raise their hand? Any, uh there's no shame here. Anyone having difficulties getting started, um, need help with that?

Guest 216:10

Permission issues? Do we expect to have another version?

Zach Proser16:13

No. Not at all. Uh, what's the permission issue? I'll come by. Uh, yeah, the repo should be fully public. Um.

Nick Nisi16:20

Yep.

Zach Proser16:21

So should be able to clone that.

Nick Nisi16:26

While Zack's doing that, I will also bring up the, um, Mastra docs, um, because these are oops. These are wonderful. Uh, they're really easy to go through. But also, as, uh, Zack and I were working, we, uh, discovered something that was actually really awesome, and that is the MCP doc server.

Um, once I installed this, things like got my tooling got a lot smarter and knew how to work with Mastra, and it made things way easier. Uh, so if you get stuck or if not and you want to see MCP in action, I would recommend installing, uh, the Mastra tools for your IDE.

I installed it into.

Guest 217:04

So we did.

Nick Nisi17:04

Claude Code and into, um, Claude Desktop and played with it in both, and.

Guest 217:09

Oh, no.

Nick Nisi17:09

It immediately knew a lot.

Guest 217:10

It was easy for the workshop.

Nick Nisi17:12

Okay.

Guest 217:12

Gotcha. You can can you clone with HDPS? Can you clone, um, not over SSH? Try the HDPS.

What specifically? Um, so if you if you go back to the repo, uh, look at the GitHub repo, like, in the browser, it should have a different option. Oh, you found it,right? Yep. So what do you want to do?

Um, so go to github.com, WorkOS, and then Mastra agents. You have to change that from a colon to a forward slash thing. So, like, grab this whole grab everything after the ampersand.

Where's my ampersand? You mean after the at? At the at. Sorry. Yeah. Grab everything after that. And then go, yeah. And then go up here. And so, uh, make put together change the URL. So do HDPS.

And then github.com. Yep. And then change. Yep. Hit that.

Sorry, I'm having trouble seeing the.

Nick Nisi18:14

Oh. You're doing well.

Guest 218:15

Oh, that's why.

Nick Nisi18:16

Go ahead.

Guest 218:17

Thank you. Um, it searched for that URL instead of going directly. So make that a HDPS. And then change this from a colon to a forward slash and then get rid of that final Git dot Git. That should go.

Okay. Now this. If you hit there.

And then go local. You should have that option. And then.

Guest 319:08

ChatGPT, welcome to his office.

Come up and HDPS version of the GitHub repo.

Guest 219:18

Oh.

Guest 319:18

Because people are getting confused and they don't have SSH configured on their work laptops.

Guest 219:22

Yeah, it's.

Guest 319:23

And no one knows how to get to the repo for it.

Guest 219:25

Yeah.

Zach Proser19:28

Anybody else, uh, any setup issues or everyone, everyone good?

Nick Nisi19:35

I'll post the HTTP, uh, s clone command in the.

Guest 219:39

Yep. Thanks.

Nick Nisi19:40

Uh, in the Slack as well.

Zach Proser19:41

Yeah. In case anyone's having trouble with, um, SSH clone because you're on a work laptop, we'll, uh, put in the instructions for HTTPS too.

Guest 319:58

Do I do it at a time at a time set? Do I do it at a time set? Like, do we do it at a time? Oh, yeah, we're doing it. We're ahead by five minutes.

Nick Nisi20:08

Cool.

Zach Proser20:13

Allright. We're going to do about five more minutes setup. Um, feel free to raise your hand if you have an issue. Yeah.

Guest 220:17

Actually, it's not too bad. So just use all packages over the table. Yeah.

Zach Proser20:21

Oh, sorry. What's that?

Guest 220:25

Oh, the Wi-Fi's bad.

Nick Nisi20:27

The yeah, the comment is the, the Wi-Fi is bad. Uh, I wish we could do something about that.

Zach Proser20:31

Sorry. Sorry. Yes.

Nick Nisi20:33

Classic conference Wi-Fi.

Zach Proser20:40

For Claude Code, yeah. Um, you if you open Claude Code, you just need that. You still need that, like, JSON object, I think. I mean, that's what I use for my MC client, but it should, uh yeah.

Guest 220:50

Yep.

Guest 322:06

Allright. 65, version 65, 65.

Zach Proser24:20

Going to do about two and a half minutes until we move on. Anybody have any issues? Everyone good?

Guest 224:27

Slow internet.

Zach Proser24:28

Slow internet still. Okay.

Nick Nisi24:29

Yeah. We can give more time. We got.

Zach Proser24:33

We'll do a queuing system. Everyone turn off their Wi-Fi. One person download packages. Move to theright.

Nick Nisi24:38

Put it on a flash drive and then we'll pass it around.

Zach Proser24:40

Yeah. That's that'll be a sneaker net.

Guest 224:43

The repo's 77% cloned.

Zach Proser24:46

Nice.

Guest 224:47

Yeah. Get in there.

Zach Proser24:48

This guy clones.

Nick Nisi24:49

Whoa.

We will. We, we can give more time.

Zach Proser24:54

Excellent. These are great numbers.

Nick Nisi25:03

The end goal of this first step is really just seeing the playground, and we'll kind of show that here in a minute.

Zach Proser25:08

Yeah.

Nick Nisi25:08

Uh, but it's there's not going to be any tools or agents or anything yet, and we'll build those out. Uh, but it's just seeing kind of what Mastra gives youright out of the box so that you have everything you need to get going fast.

Zach Proser25:20

Absolutely.

Guest 325:25

That's kind of less press 60. I think it won.

Zach Proser25:27

Question.

Guest 325:28

Press 60 or 75?

Zach Proser25:29

Yes. Why, why Mastra compared to all the other frameworks? I can tell you why I'm excited about it.

Guest 325:33

Why?

Zach Proser25:34

So the first couple of things I heard were pure TypeScript,right? And I'm already kind of bought into that with I like compilers finding my errors before I ship them. Um, then there's, uh, the Vercel AI SDK that they I think that the team wisely chose to build upon.

Um, my experience with that has been excellent. It's kind of mind-bending to kind of wrap my head around. But the idea that I can multiplex between any LLM provider. I mean, when, when GPT-4.0 came out, I shipped a two-character change in a PR, and my entire pipeline got way smarter.

And that was the day where I was like, "This, this SDK." Then I found out that the, you know, Mastra came out and it was like Vercel AI SDK and, uh, pure TypeScript. And, uh, I can tell you that there's a ton of stuff that they put in there, like including evals that are just, uh, baked in.

So that's one of OpenAI's own recommendations about theright way to deploy agents at, at enterprise and at scale, uh, is to start with a evaluated pipeline. Um, and I can also I can tell you from working in, like, vector database companies too, that that's people that are actually in prod are, are using evaluations to determine the health of their pipeline and the health of each individual generation.

And Mastra has those baked in. So it's like, import and then, like, also evaluate my pipeline. And then finally, so it's like because of that, um, and it's on the Vercel AI SDK, then being able to deploy it quickly, um, and then have a good experience that way too.

And, and honestly, what we'll see just in the, the local, uh, playground was pretty great. Um.

Nick Nisi26:57

Okay.

Zach Proser26:57

Yeah. Very complete in my in my experience. Like, every everything has issues, but that was the experience I've had with it so far.

Nick Nisi27:03

And real quick.

Zach Proser27:04

Yep.

Nick Nisi27:05

Uh, I think that for me, like, TypeScript's moving fast with that. I still don't have to figure out what pip is, so it's prolonging that.

Zach Proser27:12

Prolonging that.

Nick Nisi27:14

Um, but also, like, we had how many of you have had these, like, come-to-AI moments within your company? Like a big, "Hey, we're going to have everybody, we're going to work hard with AI."

Zach Proser27:24

We're all doing AI now, whether you like it or not.

Nick Nisi27:25

Yeah. That Shopify post came out and then, like, we had it. Uh, my wife's company's had it. Like, everybody that I've talked to, like, "Oh, we're, we're going to have this meeting where we're going to do everything with AI.

We're going to see how AI can, you know, solve every problem in every domain." And, um, after we had that, we did like an open workshop thing and we had, uh, like immediately we showed Mastra and then we had like 10 people just like.

Zach Proser27:49

10 individuals.

Nick Nisi27:49

Start going off with 10 individual demos and it was just like fast.

Zach Proser27:52

That'sright. And because they successfully built the exact workflow they were looking to build. And so then for me, the reason I'm the most excited about that piece of it is that I think it's an ideal platform for internal tooling.

I think all of us are rapidly experimenting with this stuff. And, you know, do I want to live in a world where Nick's writing bespoke LLM scripts while I'm sleeping and I wake up and I'm like, "What is this spaghetti mess?"

And he has to do the same with my, you know, crap or, or are we all using yeah, I'm bad. Or are we all using like, you know, an actual framework that we can agree on certain primitives? It makes us faster to use.

There's, there's even forethought I can see, um, in, in the way it's been organized so that once you've defined an agent, a different project can reach in and call that agent via code or API. So, um, all those reasons, I'm kind of excited to use it as sort of a unifying internal tools platform.

But we'll see. Uh, yes. Yes, sir.

Yeah. Just a quick question on steps.

Yeah.

This might be a little premature, but, um, step one, number five, where you so you create a workflow, you pass a discrete array of steps.

Mm-hmm.

Um, which of which there's only one, which makes sense to me. And I would think you would just I guess I'm asking the desi the design decision behind then needing to just also explicitly do test workflow.then and then invoke the step.

Yeah.

Is that not implicit in the array of steps?

That's a good question. The commit the ergonomics around are you asking about the ergonomics around the commit method itself? Like why I actually have to find the commit?

Right. Why, why explicitly say, "Here's workflow."

What is what is going on? What's the gentleman, what's the decision behind that? No, I'm just kidding. I'm sorry. I actually don't know. Um, I've looked at it recently and I actually checked that API today.

I'm just curious.

Because I was curious about the same thing. I was like, "Oh, does it return?" I actually argued with Nick because he correctly said, "No, it commit finalizes your pipeline, returns it." And I argued with him incorrectly.

Gotcha.

So I'm not certain. What's the what's the final idea behind commit?

Guest 229:34

Uh, that then I mean, so for sort of the local dev server, it's kind of like a visualization. Um, so the commits like page.

Zach Proser29:44

It's synchronized. It's synchronized. It's synchronized. Okay. Got it. It's the final step that's like actually creates the whole object and adds the steps and returns the final output. Okay.

Gotcha. But why sorry, I don't mean to berate this, but like why the .then and then the name of the step? Is that is that step not already in the workflow steps array there?

Guest 230:02

Uh, so we should be able to, um, so there's, there's sort of two ways of defining steps.

Zach Proser30:09

Can you I'm sorry. Would you mind coming to the mic? Just so we sorry. I apologize.

Guest 230:12

No, no, no.

Zach Proser30:16

So there's, uh, there's two ways of, uh, coming to of defining, um, steps. You can either give it a step array, um, which as you might expect is kind of, um, the most a lot of times we just have these linear pipelines of steps.

And so you can just give it a step array and it will execute things in a linear pipeline. Um, or if you want to add sort of like branching and conditionals and a lot of that kind of thing, um, we have this like fluent syntax where you can do .then and then you can do .if.

Guest30:45

.branch.

Zach Proser30:46

.do.y and like loop and, and do conditionals and, and all the fun complex stuff. You know, but a lot of times you're just you're running through a pipeline. So the steps.

Do you do you also just do test workflow.commit and then it would run that.

Yeah.

All the steps?

Yeah. Yeah, yeah, yeah.

Okay.

For, for what it's worth, I have also recently had the experience where I had built two different GenAI apps like experimentally internally and realized that I had implemented a pipeline concept in both of them. And that was another reason why I was like, "Okay, I'm excited now about a single framework with one pipeline."

Nick Nisi31:16

We're learning.

Zach Proser31:17

Yeah.

How are we doing on time?

Okay. We mostly got packages installed or still waiting on code.

Nick Nisi31:28

Anybody get 200?

Guest 231:30

Yeah. Yeah. That added to the odds.

Zach Proser31:32

Nice. Nice. Okay. Excellent. And you're selling access, uh, for $5,right? Okay.

Guest 331:46

Do we have any more time?

Zach Proser31:48

I think we're good.

Nick Nisi31:54

Allright. We'll kind of show what's, what's happening. Um, feel free to keep working on it. It's not, uh, you'll be able to catch up quickly or you can skip to the next step, which I'll show here. Um, oops.

Allright. So I'm going to just, um, switch over to steps/step, uh, one, which is the end of step zero. That's where it would bring you to. Um, and so

I don't know what's happening. Okay. Nope. I'm not on.

Guest 332:29

I think it's like switch.

Nick Nisi32:33

There we go. I didn't know how to spell switch apparently. Um, okay. So once you have it all installed, then, uh, you really should just have kind of a Mastra index. It also has memory, um, set up for you automatically.

Uh, but this just creates the Mastra instance. Um, currently we have nothing enabled, no agents, no workflows, uh, no tools. And that's okay. And when we oops. When we run npm dev,

uh, we will get this URL, localhost:4011. And if we go there, this nope. This is the, the end of step one, which is maybe there we go. Uh, you look here, you have agents, networks, tools, MCP servers, workflows, and then this runtime context.

And currently we have nothing in there. Um, and that's currently by design because we've done nothing. We've just gotten the project set up, but now we have all of these tools to help us with building along the way.

And so, um, once you get this set up, uh, you should be able to switch over to step one or just continue on in your branch. I think it might actually be the same because it's just npm installing.

Um, and then you should be able to continue on in the, uh, the steps.

Zach Proser33:56

Uh, this is I'll just say that this is one of my favorite things though about Mastra, like the local playground. And if you look in the console, you'll see that there's also a couple other things spun up. There's the API endpoint.

There's also an, uh, Swagger spec that you get automatically. And so, like, the amount of thought that's been put into this, and you can see how once everyone's comfortable with it, you could, you know, very rapidly deploy applications in a standardized way that other tools can consume, uh, reliably.

So that's, um, another exciting feature of it. And again, this is like without us having built anything yet.

Nick Nisi34:27

So the goals that we're going to do in, in step one now, uh, is just create our first workflow. And this is just a very basic workflow. We'll end up throwing it away, uh, but it's going to be one workflow with a single step and it's not going to do anything else, but we'll see kind of the power of it.

Step 1: Workflow34:27

Nick Nisi34:41

Uh, and then we'll build upon that in the next step to add additional steps. We're using steps a lot. Um, and then we will, we'll, uh, be able to put that together into a full workflow in the next step.

But we will more importantly, we'll be able to see it in the Mastra playground and start really seeing the power of that.

Zach Proser35:00

Yep. Testing.

As always, any questions, uh, feel free to shout them out. Anyone get stuck, just raise your hand.

Nick Nisi35:23

Yep.

Zach Proser35:23

We'll run past.

Nick Nisi35:26

We really tried to give ample time for this, not, uh, not including Wi-Fi issues. Um, and so, um, yeah, if you have questions, we'd love to, to chat or just ideas of this stuff because I think there's a lot of really cool powers, uh, that you can do with this.

Zach Proser35:41

Sure. Do you want do you want to hop, hop up to the thanks.

Guest 235:45

Uh, I'm just kind of curious since you're upset using Vim and kind of deepen the hole.

Nick Nisi35:49

Yeah.

Guest 235:49

Have you played around with any of like the AI integrations into Neovim? Kind of like how what's your current workflow?

Nick Nisi35:56

Yeah.

Guest 235:56

What are you kind of adopting?

Nick Nisi35:58

I thought nobody would ask.

Zach Proser36:00

What have you done?

Nick Nisi36:01

Um, yeah, I'm a big fan of Vim. I haven't used Cursor yet at all because it's not Vim. Um.

Zach Proser36:09

There's Vim mode.

Nick Nisi36:10

It's not great. Um, but I have played with the tools. There, there's one, I'm forgetting, a goose, I think, that in Vim. I haven't played with that one yet, but it's on my list to play with. Uh, the one that I have played with is Avanti, uh, which I think I have still set up.

Uh, yeah. So it gives you kind of that like chat-like interface here. So I can just start having, uh, a chat with this code. Uh, I don't know.

Zach Proser36:35

There's also was it NeoAI? Have you used that for Neovim? Even a year and a half ago, you could do that before, before most of the tools allowed you to chat in IDE.

Nick Nisi36:43

Yeah.

Zach Proser36:44

Yeah. That's always going to be the benefit of open source. Is it lands first,right?

Nick Nisi36:47

Yep. Um, but I honestly, like, I didn't like the ergonomics of playing with this and like switching buffers and things like that. And I honestly felt that, uh, for me, uh, a better workflow was just not using this at all.

Uh, I'm also a big TMUX user, so, um, you know, I will have like Vim open and then I'll just open a split and Claude, Claude code, um, gives me that kind of the same thing. And it's often like its own TMUX split.

So I can work in Vim as I normally would without like weird buffer things. And then it's just off doing things and I can, uh, you know, oops, use, um, use TMUX to like full screen Vim when I need it.

Claude's out of the way. And then when I want it, I just bring it back in and go.

I would also be interested in hearing how all of you are using these AI tools just for like not just what you're building, but how you're interacting with them day-to-day because they're changing our workflows. And I feel like everybody's like in their own bubble doing their own thing.

And then we like we have this opportunity to come together and learn like amazing new tips and tricks.

Guest 238:41

Yeah. I'm all for that. I, I don't know that I'm all for everybody getting on the same, you know, uh, plus.

Nick Nisi38:51

Yeah.

Guest 238:51

I think I think it should depend on, on, you know, product or, or, you know, service or whatever, but, um. I'm, I'm afeared of, of, you know, somebody coming down from on high with like this is the golden framework.

Everybody use this.

Nick Nisi39:07

Yeah.

Guest 239:08

We've been through that for decades.

Zach Proser39:10

Yep. For sure.

Guest 239:11

So that's my personal.

Zach Proser39:13

You like to mix and match and let everyone kind of choose their own lane. That's exactly.

Guest 239:17

Even with coding agents.

Zach Proser39:18

Yeah.

Guest 239:18

I'm, I'm like here and there and everywhere.

Zach Proser39:20

Yep.

Guest 239:21

AI, same thing. Here and there, everywhere.

Nick Nisi39:24

Yeah. To, to summarize for the video, mixing and matching tools is good. And I think that that's really what is like powering thisright now, especially among like us hackers,right? We're like there's all these cool new things. It's a whole new world of figuring out what to do, how to do it.

And you're not just being prescribed. Oh, just, you know, go use random. I don't want to shame any specific editor, but like.

Guest 239:44

Not anybody specifically.

Nick Nisi39:46

Yeah.

Zach Proser39:46

Yep.

Guest 239:46

But I mean, the leaders come forward.

Nick Nisi39:49

Yeah, for sure.

Guest 239:50

You have those choices, you know.

Nick Nisi39:51

For sure.

Zach Proser39:52

Absolutely.

Guest 239:52

In the meantime, I'm going to play around.

Nick Nisi39:54

Yeah.

Zach Proser39:54

Yeah. It's all about experimentation, I think. Yep.

Nick Nisi39:56

Yeah. There's all sorts of experimentation, all sorts of fun. Um, and, and the, the winners will bubble up for sure. Um, also, I, I do worry that it's like, uh, you know, the, the first hit is free and then we're, we're all like, oh no.

Zach Proser40:10

Becoming dependent on it now.

Nick Nisi40:12

Yes, sir.

Guest40:12

Uh, question for you guys. Do you have a framework specific like set of rules like that would integrate not that everyone has to use Cursor, but just like also in like, um, at my company, we've started to essentially say, "Hey, here's the top 10 tools that we use and here's Cursor rules to do all those the same kind of way."

And it's not so much trying to like box people in, but it's more trying to say, give them like in Mario Kart, it's like you get the, the three booster packs. It's like how can we give people, people booster packs from the beginning?

Nick Nisi40:44

Yeah. We, we were talking about this earlier actually with Nick Taylor. Um, we were talking about like Cursor rules growing and evolving kind of like tests. And then it's like this thing that, that evolves with your, your code base to prevent you from doing bad things.

Um, I don't know what that means though 'cause I've never used Cursor.

Zach Proser41:01

It's not exactly the question you asked, but I will just say that that's also, uh, like when you run, you know, npx install Mastra, it asks you if are you going to use Cursor? Are you going to use WinServe?

'Cause if so, I know I can inject the MCP server for our docs. And then the experience that I had after accepting that, I saw it's like, oh, it enabled that. I checked in my MCP in, in Cursor.

And then that session where I coded, um, there were zero hallucinations. And so that means that every time I asked for a feature, it was one-shotted correctly. Furthermore, because it was in TypeScript, I could quickly lint it and compile it and know it was good.

And so that's almost like I we were almost starting to Nick and I were starting to suspect that MCP might be more powerful because the other problem is that Cursor rules are specific to Cursor,right? So what if like half your team's on WinServe, half's on Cursor?

You know, we've got tons of licenses for Cursor internally, so it's kind of like, but it's not prescriptive. I think the MCP doc server so far is more powerful of a pattern because it is the it's almost like the, the guarantee that the end user dev is going to get your latest docs and is not going to get a hallucination.

Nick Nisi42:05

And I really wonder if that's like, like there's so much excitement around that. We saw that at MCP night a couple weeks ago. Like there's so much excitement around that. And I'm, I'm just starting to wonder, is it really just because it's like a standard emerging, um, and that's the reason?

'Cause it's, it's very simple. Uh, but it's, it's enabling all of these tools across, you know, it's not just an Anthropic thing anymore.

Zach Proser42:25

Yep.

Nick Nisi42:26

Uh, which makes it super powerful.

Zach Proser42:27

Absolutely. Totally agree. Yes, sir.

Guest 242:30

Yeah. I'm not sure if this is a better question for y'all or for the Mastra team, but I saw that Mastra has experimental support for ingest, which is a durable execution backend, but that it's labeled as experimental. And I was curious like how experimental that is 'cause I'm.

Zach Proser42:43

Great question.

Guest 242:44

Really excited about durable execution for agents. You know, if you've read the 12-factor agents manifesto, it's really good.

Zach Proser42:49

Oh, no. I haven't. Where's that? Who published that?

Guest 242:51

Uh, it's on GitHub. Uh, Dex from Human Layer. Um, originally did a lot of the work on that. Um, but yeah, just was curious about jamming on that.

Zach Proser42:59

Awesome. Great question. Thank you. Unfortunately, we haven't the folks in the room for that. Okay.

Guest 343:03

Yeah. I'll, I'll send Dex to shout him out. He'll be happy to hear that. Um, uh, so the we shipped in, uh, sort of a what we call workflows VNext about three, four weeks ago now. Um, the idea being that basically it allows you to have the same syntax, but switch out the, the workflow, um, engine.

So the first, um, the, the first, uh, integration that we shipped, we, we sort of initially had we initially built our workflow engine using XState as a backend because it kind of makes sense. Um, and then we kind of we, we need to make a couple of syntax changes.

And then we also kind of realized that, uh, people started asking us, "Hey, like I love the syntax, but I'd love to have this work with, and I love the visualization in the dev server, but I would love to have this work with ingest or temporal, um, or Cloudflare workflows or dot, dot, dot, dot, dot."

Um, and so we're like, "Yeah, that's a really good idea." So then we shipped workflow VNext that was like again, three, four weeks ago. And then now we're just starting to, you know, do the list of integrations. And so ingest is first.

Um, it's you should use it. Like it's experimental 'cause we shipped it like a week ago, but I would be surprised if the API changed after a week from now.

Guest 244:17

Thank you.

Zach Proser44:19

I actually have a question. Um, just curious, what how is the team thinking about, uh, deployments going forward? Like are you targeting specific platforms first? Are you going serverless first? Like are you thinking about trying to go everywhere?

Like what's top of mind for you there?

Guest 344:32

Uh, so by default, um, by, by default, like Mastra will bundle into a Hono server. Put the Hono server in a Docker container and put it on EC2 or DigitalOcean or wherever you want to put, uh, put it.

We also have adapters, uh, for Cloudflare, um, Netlify or Sal. Um, we also heard on, uh, Mastra Cloud. Um, we also so those are kind of the two, um, you know, the, the two we also like Hono's not a, you know, if you want to use Hono great, but also you can put it in Express or, um, whatever, whatever you can, um, you know, put it in the backend of a, you know, Next.js operator app, you know.

Uh, in general, I think like you can't really I mean, you can call it open source and it cannot work everywhere, but like these days you should actually make it work everywhere. So that's just our philosophy on things.

Zach Proser45:23

Yep. Awesome. Thanks. Yes, sir.

Certainly. Yes.

Hi. Hey.

Okay. And then, uh, what's the full error?

Guest 246:07

I was going to say I heard my hands shirt for you.

Nick Nisi46:10

Oh, nice. Yeah. What are your MCP shirts?

Such a fun demo.

Guest 246:55

So we have 74 minutes.

Nick Nisi46:57

Yep. I think we're good.

Guest 347:15

Um, I had a question. So I saw I was just reading ahead a little bit. Um, so I noticed that you sp you're specifying like Zod schemas, but also adding instructions to the prompt, um, to kind of follow that schema.

Zach Proser47:29

Yep.

Guest 347:29

So I was wondering, is there anything sort of inbuilt into the framework that ensures that the output of each step matches the schema kind of by default? Because what if like you specif like, you know, let's say in the prompt you've you kind of forgot what your schema was and you like how does it reconcile that as well?

Zach Proser47:48

Yeah, great question. Um, so I, I think the answer to that is essentially the Zod schema,right? And the way that I look at that is, um, like LLMs are non-deterministic. That's part of why we love them. But then it's at the point where they're so useful, we're trying to get specific JSON out of them while coding too,right?

And the Zod, um, package and, and like validation library is now ubiquitous in AI engineering, at least in JavaScript. Like you'll see it literally everywhere. So it's doing the work under the hood. Um, my understanding is that the OpenAI team couldn't get to a certain level of accuracy without adding on top of training the Zod, uh, runtime validation, which can also do coercion into theright types.

So that's kind of doing the heavy lifting there. Um, I don't think there's anything framework specific that's doing structure generation, but correct me if I'm wrong, but you can define like the transform steps between the workflow.

Guest 348:40

Um, yeah, there's actually we actually just did a blog post on this, but it's funny that the models don't always actually respect the schemas that you give them, especially there's some, you know, yeah, okay, z dot string, like they'll respect that, but if you, you know, z dot string dot, you know, length, you know, four or whatever, like they're not necessarily going to respect that like level of, of nuance.

Um, so we actually added, uh, uh, we, we added sort of for, for this is especially challenging. This is mostly works, works reasonably well with structure generation. It's more challenging with, with tool calling, um, for reasons that are not quite clear to us, but we're clear when we ran 16, uh, you know, uh, with the 30 schemas across 16 models.

So we added like a tool compatibility structured output layer that reduced that like reduced the error rate a lot.

Zach Proser49:32

Um, so in addition, on top of the side, like there's also Mastra side like optimizations to ensure structure generation.

Guest 349:39

The, the longer version of this is in a blog post we published over the last week if you're if you want to dive into the, the details.

Nick Nisi49:45

And I, I don't know if it's related to this, but one thing that we were running into constantly, uh, while we were developing this was, um, we were like, as you'll see, we were accidentally sending, sending like a base 64 encoded image, uh, which was huge and, and failing, and it would retry a lot.

So I assume that there's some retry logic built into it to if like it wasn't getting back what was expected from the schema. Um, is it built into the, the schema validation piece?

Guest 350:10

I mean, I would assume probably what was happening was that the agents has like a max steps.

Nick Nisi50:15

Yeah.

Guest 350:15

And so you was running until in a loop until it hit max steps.

Nick Nisi50:20

But I, I guess what I'm asking is if you, if you said, "I want a string that's length four," and I, it gave back a length five, would it automatic would Mastra automatically retry?

Guest 350:28

There are cases in which it would, it would retry. I don't know if that particular case is one of them.

Nick Nisi50:33

Okay.

Guest 350:33

Yeah.

Zach Proser50:35

Does that?

Guest 350:35

Yeah, that does answer, um, my question.

Zach Proser50:37

Cool.

Guest 350:38

To kind of to add to that with if you were to specify, uh, certain things into the schema that aren't inherently like supported, for example, the, the length, would that, um, would that be kind of error? Like would that error be displayed in compile time at all?

Zach Proser50:55

Uh, let's try it. I don't know. I, I would expect Zod to coerce it actually at runtime, um, but I'm not sure.

Guest 351:04

Usually the model will fail silently and just give you an output that doesn't conform to the.

Zach Proser51:10

Okay.

Guest 351:10

To the, um, to the, uh, to the schema. And we kind of made a decision, should we error or not? And we're like.

Zach Proser51:19

Makes sense.

Guest 351:20

You, you maybe you should decide if you want to error.

Zach Proser51:22

Yeah.

Guest 351:22

Allright. Thank you.

Zach Proser51:23

Thank you. Yeah. Great question.

Sorry, just talking about deployment again, I, I noticed the serverless deployments, there's no like AWS Lambda or anything. It's all through Netlify or.

Yeah.

Guest 351:43

Um, there's also an AWS Lambda, um, deployer that the community had.

Zach Proser51:48

Okay.

Guest 351:48

If you, if you Google, you'll probably find that you have issue.

Zach Proser51:51

Okay. And how does the, the serverless deploy work? Does each step kind of map onto its own Lambda function or how's that?

Guest 351:58

Yeah. I mean, we just sort of pack bundle it in a, in a, in a, a platform specific way that works for those platforms. So like Cloudflare has like a 300 meg, um, uh, bundle size limit. And so we need to do some specific things to get down under that.

Zach Proser52:16

I guess I'm just meaning in terms of the runtime model, each step kind of maps logically to a function or are you putting multiple steps inside a single function?

Guest 352:24

I did not work on that part of that.

Zach Proser52:26

Okay.

Guest 352:26

So I was just asked for it.

Zach Proser52:27

I'm assuming they're all bundled into one, but could be wrong.

Guest 352:30

I mean, I, I think they are all bundled into one, but yeah.

Zach Proser52:34

Really? Okay.

Guest 352:35

Yeah.

Zach Proser52:35

That would just be weird for long running stuff 'cause there's timeline or something.

Guest 352:39

Yeah. I mean, we, yeah, that's yeah, we, I think we, we, we all, we bundle it all into one. I'm pretty sure.

Zach Proser52:44

Okay. Thanks.

Cool.

Nick Nisi52:57

How are folks doing on step, uh, step one?

Zach Proser53:01

Good.

Nick Nisi53:01

Good?

Zach Proser53:02

Awesome. Okay. Allright. We got functioning Wi-Fi. Excellent.

Nick Nisi53:07

So we can kind of show that. I'll go to, um, step two. Did I spell thatright? Yep. Uh, which is the end of step one. Um, and so now like looking at the code, uh, we've got if I update this, we've now got our test workflow in our Mastra object.

Step 2: Pipeline53:07

Nick Nisi53:29

Um, and then we've got a workflows directory with the test workflow and the schema for it. And it's just going to have you, um, basically extract from the user input, uh, the type of frustration that you're experiencing. And the really cool thing now is like without building anything else, uh, we can go to our Mastra playground, refresh it, and go to workflows.

And now we've got our test workflowright there. And you can see the graph here isn't very impressive with just one step in the workflow, but it's there. And we can see that it would accept a raw user input about work frustration.

So does anyone have a work frustration?

Zach Proser54:11

Use your, your boss by name, please. Please state the company you work for and your boss's name. We won't tell them.

Nick Nisi54:20

Conference Wi-Fi sucks. Not really. This is a great job, AI engineer.

Um, in general, sometimes though. So we can see just by calling that, it turned green in the, in the graph. And you can see that we click on it and we can see that that's the input that we gave.

It ran the step and it gave us back this output, this, uh, JSON object. Uh, and we can see with the text, conference Wi-Fi sucks. The overall mood is frustrated. I think that's accurate. Uh, and the analyzed frustration is technology.

We're so we're frustrated about technology in this room.

So in the next step, where did I go? Oh yeah, here we go. Uh, in the next step, um, we're going to create our frustration schema with Zod, uh, build our first workflow step. No, that's what we just did.

I have my slides backwards. In this one, we're going to, uh, create all of the workflow steps. Uh, we're going to chain them together with data mapping. Uh, and then we're going to successfully generate a meme. Uh, and we'll understand the composition of that workflow as we go.

Uh, it still won't be like the perfect end result, but it will give us the full workflow where we can like kind of plug it in, in that, uh, workflows tool and see it go through all of the steps from our user input to an actual meme that's, uh, uploaded to image flip.

So you can skip to step two, uh, or continue on in your branch and, uh, continue from there.

Guest59:26

Oh.

Nick Nisi59:28

Yeah.

Guest59:28

I'm not sure what I'm looking at.

Nick Nisi59:34

Uh, sorry, can you repeat that?

Guest59:35

I, I did the, uh, uh, frustration,right?

Nick Nisi59:39

Uh-huh.

Guest59:40

Put in a topic, ran it, got back to blue box. It's highlighted.

Zach Proser59:45

Mm-hmm.

Guest59:45

It says input, output, so I put it on output.

Nick Nisi59:48

Yep.

Guest59:49

So I, I got a JSON object.

Nick Nisi59:50

Yep.

Guest59:51

Right? And, and so what is this? Is this something, an object that I would then pass to another pass on?

Zach Proser59:58

Precisely. Precisely. And it's justright now, we're just in the early stages of showing exactly that and that you could have structured this object however you want.

Guest1:00:06

Right.

Zach Proser1:00:06

Um, but in our case, because of the pipeline that we're building, this is the data that we found valuable. And so we formed it this way and then we're going to pass it further into the pipeline to do more work based on that.

Nick Nisi1:00:15

Yeah.

Guest1:00:16

And so, um, the output is, is, uh,

you can change it.

Zach Proser1:00:25

Totally.

Guest1:00:26

I mean, so I.

Zach Proser1:00:26

It's your, it's your arbitrary schema.

Guest1:00:28

If I want Markdown, if I want JSON, if I want whatever.

Zach Proser1:00:31

Yep. Yep. Absolutely. And that's part of what Zod will help you do too 'cause you can define like, you know, maybe you have some giant object and, you know, this may fields and this is a string and this is an array of strings and all that.

Um, but it's really for you to compose together the exact structure that you need.

Guest1:00:46

You would, you would have to know what the next stage is.

Zach Proser1:00:49

Yeah. Yeah.

Guest1:00:50

So there's a little bit of forethought.

Zach Proser1:00:52

Absolutely. The forethought or the third time you've written that app. You've had enough. You've had two shitty first drafts and you're ready for the third. Um, sometimes I do it that way, but yeah, sometimes I'll plan it out and be like, what's the logical breakdown for these steps?

Yeah.

Nick Nisi1:01:05

Yep.

Zach Proser1:01:07

Yep.

Nick Nisi1:01:08

The main point of this one is to just determine like the level of frustration and what you're frustrated about so that it can be fed in in the next step to, uh, Image Flips API to get back an, an image template, um, that or a meme template that would accurately fit that.

And then we kind of shoehorn it in from there.

Zach Proser1:01:27

Totally. But the, but again, the, the like I guess the mental mapping that we're all trying to do here too is like to think about how do we take this home and like turn it into something that actually solves a problem or automate something at work so we get promoted before the machines come for us, you know?

That's the general.

Guest1:01:44

It's a race.

Zach Proser1:01:45

Pretty much.

Guest1:01:45

It's a human race.

Zach Proser1:01:46

Yeah, I think so.

Nick Nisi1:01:51

And just so we're level setting, this is like the memes that you've seen. Image Flip is a, they have an API for not only finding great memes, uh, but also just having blank templates. So they, they can give us back information about this, the rock meme, the rock, uh, in a taxi meme or whatever.

And those boxes are blank. And then you can post to their API with whatever you want it to say in each of those. And it'll tell, tell you like, oh, I have three boxes. And, uh, then you just post in there.

And that's what we're eventually going to be doing in one of these steps.

Zach Proser1:02:22

But that's, that's a perfect real world example. It's like knowing those box slots is critical to the rest of the pipeline. If any other step in the pipeline didn't know the box slots correctly,right? Like that'd be a problem.

So you can define that in your schema and make sure that it's there. And like that's part of it. Yeah.

Guest1:02:35

Okay.

Zach Proser1:02:36

Yep.

Nick Nisi1:03:08

Putting this workflow together too is probably the biggest of the steps.

Zach Proser1:03:12

Yep.

Nick Nisi1:03:12

Um, once we have this, we'll, we'll create an agent in the next one, and that's pretty straightforward, uh, as you'll see. Um, and so there's, there's time built in also to, to play with this, experiment, tweak things like the, um, like the prompt.

Zach Proser1:03:26

Temperature.

Nick Nisi1:03:27

Temperature, things like that.

Zach Proser1:03:28

Yeah. We'll, we'll look at that in the playground. That's the cool thing is like once we get the agent and start chatting with it, um, you know, like there's just a, a iterating locally is so much faster,right? And that's really what the, the playground's about.

So you can even tweak the prompt on a per request basis. You can change temperature, model, whatever.

Guest1:03:59

Can you get help with the UI?

Zach Proser1:04:01

Certainly. Yep.

Guest 21:05:06

That's what I did too. It's just so weird. But try that on the other trip.

Guest1:05:10

It's not unusual.

Guest 21:05:12

Okay.

Guest1:05:14

So I was looking at that.

Guest 21:05:17

So it's like

slowly. That's great. And from there, you once you get to the point where you remember the answers, then once you get to stuff that was, um,

what I thought is that. So you might not have that back. You are correct at that point in memory. And people like to do work or do you? Okay. So yeah.

Guest1:05:51

Precisely.

Guest 21:05:54

Correct. And, uh, now there are other, other for example, for example, the actions are there. And actually we're looking at it in our timeline. And it's looking easy to work. It's a work result,right? But the reason we did this here is that we're not able to do it.

Like you said, we have this chat service. It's

if you can, yeah, and if you didn't have that file open before we added it, you, um, you would chat it and then you'd like either read it or you'd go to the,

uh, the, uh, the, uh, the, uh, the, uh, the, uh, the, uh, chat account.

Guest1:06:42

Yeah.

Zach Proser1:06:51

Please.

We got it. We have it.

Guest1:07:07

Oh.

Guest 21:07:07

And why?

Guest1:07:10

I think.

Guest 21:07:12

Okay. Good. Uh, did you make a move?

Guest1:07:16

Nope.

Guest 21:07:16

Okay. Probably that. And that's the, the, the other trick is when you get the answers, it's not really knowing.

Guest1:07:25

Okay.

Guest 21:07:26

And the option of that.

Guest1:07:27

Okay.

Guest 21:07:28

So I need to go to image flip.

Guest1:07:29

It's good if I have the, uh, the.

Guest 21:07:32

There's Google and GFO history.

Guest1:07:35

I just need to.

Guest 21:07:36

Their dashboards.

Guest1:07:37

Stop.

Nick Nisi1:07:39

Does it sound like the credentials are being rate limited?

Guest 21:07:41

Yeah. So in general, if you get an error.

Zach Proser1:07:42

Uh, at the generate meme stuff and you don't get a clear error message and you have not created an image flip username and password, that's likely the problem.

Guest1:07:51

I did it first.

Zach Proser1:07:52

Sweet. Allright. And then if you sign in with Google, which is the same thing I did, that's fine. And then you just have to go into image flip settings after and set a password because you're OAuthing in, so you didn't get to set a password.

Guest1:08:05

Right. Right. Okay.

Zach Proser1:08:06

So the complexity is in the UI of image flip. Just.

Guest1:08:10

Thank you.

Zach Proser1:08:11

Yes. Absolutely. Let me know if you have another issue. Yes.

Guest1:08:14

Do we need to set it?

Zach Proser1:08:16

So, um, in our testing, like, and also there, there's a public, I think it's for image flip, there's a public key that floats around. So there is an anonymous key that's public. Like Git guardian will flag. Others consider it a secret, but apparently it's not and people are using it.

And the reason that we finally asked people to make their username and password is that it gets you a significantly higher rate limit. And so you're less likely to run into this issue in the workshop at least.

Guest1:08:39

But the error is that.

Zach Proser1:08:40

Yeah, the error. The, uh, what's, what's the specific error you're getting? Is it opaque?

Guest1:08:45

Actually, now, now I'm getting just, uh, like 20. Uh, but I don't know. Just like cannot run.

Zach Proser1:08:53

Oh, if you like, are you on the which branch are you? Are you on the.

Guest1:08:56

I was, I guess I was

on.

Zach Proser1:09:02

Okay. I think we're on two. What, we're on two?

Nick Nisi1:09:05

Mm-hmm.

Zach Proser1:09:05

Yeah. I think so try doing Git switch and yeah, just do two. I'm going to just stash all that stuff first. Yeah.

Nick Nisi1:09:15

You have no idea the struggles of trying to do a workshop with, with when API keys are involved. Uh, we originally had a step that it would not, it would take an inspiration from an image flip image and then generate a new meme.

So it was a completely unique meme. Uh, but in order to do that, you would have to go in and verify your OpenAI account, which means like you'd have to scan your passport to be able to do it.

We thought that might be a little much to ask in this workshop.

Zach Proser1:10:12

Can, um, can you guys say more about like how you're, I guess, like interacting with these workflows and agents like in the cases you've seen? You said something about Vercel. Like are you deploying them and then contacting them through like an API call or like are they actually embedded into your application?

Yeah. Um, what I'm primarily doingright now is, uh, you're still using the Vercel AI SDK. So everything I've got like at least at work that's deployed already, that's mostly Vercel AI SDK. And then we're building a ton of like internal tooling with Mastra that started like two, three weeks ago.

And most of our stuff goes to Vercel, um, just 'cause we already had that and it's pretty fast. Um, and then most of the things I've built so far are web applications that might have a pipeline. So there's a UI and there's still a user kind of requesting generations and asking for things.

Um, what I think would be super cool and powerful though is like the, the workflows expose like an API endpoint to just start them and hit them from anything. And so I think that's also like a pretty powerful pattern.

I've not really used it really fullyright now in prod yet, but that's, um, something I would think about for sure. Like cron jobs almost. Workflows that need to run like every night, you know, maybe have a cron that fires that or something.

Allright. Cool. Thanks.

Yeah. Great question.

Allright. We got about five minutes and then we're going to move to next step. So if anyone's stuck on anything or has questions, don't be shy.

Nick Nisi1:12:06

Does anybody have the memes generatingright now through the workflow?

Zach Proser1:12:09

Allright. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13.

Nick Nisi1:12:15

Nice.

Zach Proser1:12:15

That's amazing.

Nick Nisi1:12:17

Post some of your favorites in the, in the Slack.

Zach Proser1:12:19

Yeah. Uh, there's no filters left on them. So if you like what happened, it's, uh, we did it. And if you are offended, it's not our fault.

Nick Nisi1:12:29

This is the, when you're dealing with memes like this, it really brings out the non-determinism of, of this. If it generates offensive ones, we tried to, to curb that, but also these AIs are not great sometimes.

Guest1:12:47

People who initiatively want to raise their hands, I'll go around and give you guys folks.

Zach Proser1:12:51

If you want a, yeah, a free, a signed. Are we talking autographs here, Sam, or?

Guest1:12:54

Ooh. Oh, autographs.

Zach Proser1:12:56

We're talking autograph copies. Are they first edition or second edition?

Guest1:12:59

Uh, first edition.

Zach Proser1:13:00

Autograph first edition from, from the CEO of Mastra itself. If you, if you got a meme working and you want, or you just want a book, raise your hand. Excellent.

That's pretty offensive. That's pretty offensive, Nick.

This, this gentleman would like a book as well.

Guest1:13:41

Awesome. Thank you.

So this is the Bible. This is the Bible.

Zach Proser1:13:51

On, on building. On, yeah, on building agents in TypeScript. Got it.

Oh, these are all, this is amazing.

Yeah. I got some pretty racy ones by saying, "Why did they put a systems engineer on an open floor plan with the sales folks that are screaming all day?" That's a fun prompt.

I love this.

That's awesome.

Every project is high priority.

Yes, sir.

So I come from a data engineering background and there's something called DAGs in Airflow, which are for whatever reason culturally they've caught on. Um, as you guys have designed workflows, have you thought of DAGs? Are they similar, dissimilar?

Are you talking about direct-to-day cyclic graphs?

Yeah. Control, what does the control flow look like for workflows?

So far, uh, stuff that I've, I've seen, you know, supported by the semantics of like a, a Mastra pipeline. Honestly, um, to be perfectly frank, the place that my mind goes with that is just graph RAG, like a graph plus retrieval augmented generation.

So like some vector database plus a graph, knowledge graph to like do traversal, um, to also answer like structured questions about entities in addition to like semantic search capabilities. Um, that's honestly what I've built mostly or seeing people kind of like, uh, like positing is going to be a next-gen architecture.

But so far what I've needed has just been pretty simple pipelines. Basically run these steps, branch over here if this happens. Um, you know, I see the DAG is like, that's like Terraform in my mind from, from DevOps like land of like it must proceed this way and the entire thing fails if, if like node three, uh, is unhealthy kind of.

Guest1:16:00

So in my workflow, I see like success instead of one, two, three are super expensive.

Zach Proser1:16:07

Uh-huh.

Guest1:16:08

Like an LLM perspective.

Zach Proser1:16:09

Yeah.

Guest1:16:10

Is it possible to trigger just step four?

Zach Proser1:16:13

That's a great question. We were actually, Nick asked if we could, uh, trigger a specific step. I'm not sure. But the other thing I'll say is that in those cases, that's the other reason I love the pipelines and also even just the concept of steps and agents is 'cause I can do a specific model for each one.

So like extracting frustrations is like that's pretty simple and should be fast and cheap. So it's like do 4.0 or even something simpler or maybe even get away with like a 7 billion parameter model that's deployed on like Cloudflare workers,right?

And then which it's like essentially free. Um, that's like, and that, that question by the way, this is like the, uh, like how do youright-size AI application workloads? Like that is top of mind for everybody now. Everyone's asking that question.

It's like how do I get the infra to be what's correct for the workload I have? I think everyone's trying to figure that out.

Nick Nisi1:16:56

And, and another thing, like you can explore different ways of doing this. Uh, when we first started with this, we had all of these steps as tools and then kind of let the AI decide when it should call them.

Um, so that could be another approach depending on if it can intelligently skip steps, um, it might be able to do that.

Zach Proser1:17:14

Um, there was a question. Is this is in our chat,right? Or is it, is it, is I'm looking at okay. So there's a question is, is there a way to implement or configure caching with Mastra? I think the answer is yes.

Yeah, for sure.

Guest1:17:26

Yeah. This, so I, I did, I did implement the, uh, image flip method.

Zach Proser1:17:31

Mm-hmm.

Guest1:17:32

And I, and I tried a decent improvement.

Zach Proser1:17:36

It's the same here. Show me the, your .env file if you would.

Okay. Yeah. Okay.

Guest1:17:50

Yeah.

Zach Proser1:17:53

Yeah. Right.

Guest1:17:55

That looks great to me.

Zach Proser1:17:57

Assuming those are your actual creds.

Guest1:18:00

Yeah.

Zach Proser1:18:00

And then the other thing is did you, uh, did you restart and finish?

Guest1:18:04

I, I saved it and then I, and then I, uh.

Zach Proser1:18:11

And I'll use a new password combination.

Guest1:18:14

So it's still saved.

Zach Proser1:18:16

Oh, so restart it now 'cause I bet you did you update env while that was running?

Guest1:18:22

Correct.

Zach Proser1:18:22

So if you restart it, it should, um, pick up the new .env and let's see if it's the same or not.

Guest1:18:28

Okay.

Zach Proser1:18:32

Yep.

Yep.

Yep. Exactly. Yep.

Guest1:18:48

Uh, what did I say?

Zach Proser1:18:50

Bad food. Yeah.

Guest1:18:53

I thought it was because it was two words instead of one.

Zach Proser1:18:56

Am I still have a, is there an extra space anywhere? And 'cause I had that issue even after I had the correct values. Like there has to be.

Guest1:19:06

Yeah.

Zach Proser1:19:07

Still saying that.

Guest1:19:08

How long should it take for this shirt? Like the MCP shirt?

Nick Nisi1:19:11

Oh, uh, it'll take a, a few weeks probably.

Guest1:19:14

Oh, no. I mean like.

Nick Nisi1:19:16

Oh, is it not going through? Did it try and execute the tool?

Guest1:19:20

Yeah.

Nick Nisi1:19:21

Uh, what?

Guest1:19:22

Try a different key?

Nick Nisi1:19:23

What, um.

Guest1:19:24

I don't think it's a problem.

Zach Proser1:19:26

Right? 'Cause it's a shirt.

Nick Nisi1:19:28

It should. It should be relatively fast.

Guest1:19:31

Second time trying is just waiting for approval.

Nick Nisi1:19:35

Ah, okay. Uh, good to know. Let's try that.

Guest1:19:39

I don't think you guys have an early active AP for that either.

Nick Nisi1:19:42

Uh, yeah.

We should.

Um, so I can show this now.

Uh, so if you go, if you have it installed, which I do, um.

Guest1:19:56

If I change it in here though.

Nick Nisi1:19:58

Down in here. I have MCP shop set up. This is Claude, by the way. Uh, hey bro, I hear I can get a shirt. Let's see if it works.

Guest1:20:09

Should I do install or just, you know, just research this over and make sure that's all.

Nick Nisi1:20:14

Pondering t-shirt potential. That was awesome.

Guest1:20:16

Thank you.

Nick Nisi1:20:17

Ah, I can't provide physical shirts or merchandise. That's interesting. I thought you.

Should be connected. Nope. That's the problem.

There we go. Try that again.

Guest1:20:46

Yeah. Oh, that's okay. Yeah.

Nick Nisi1:20:52

Hey bro, I hear I can get a sweet MCP shirt now that we're maybe connected. Yeah. Cool. So it pops up. We'll allow that.

You can definitely get an MCP shirt. There's one availableright now. Here's what you can get. Minimal design. I don't know that it says context is everything, but it might.

Yeah. I don't think it says that.

Guest1:21:27

Yeah. Go to the last one.

Nick Nisi1:21:29

Oh, oh, yeah. Okay. It does.

Zach Proser1:21:33

Context is everything.

Nick Nisi1:21:34

Yep.

Zach Proser1:21:34

Nice.

Nick Nisi1:21:36

Cool. Uh, so it just needs for me my company name, my mailing address, and my t-shirt size. So I'll say XL, um, one infinite loop and company name, uh, WorkOS.

Oh, it needs my city, state, and zip code. I don't, I don't know what that is for Apple. Um, so I'll just, I'm, I live in Omaha.

Oh, and look at that. It's going to buy my shirt.

And it's ordered.

Zach Proser1:22:30

We will, we will actually send you a shirt, so be sure to.

Nick Nisi1:22:32

Yeah.

Zach Proser1:22:33

Be sure to submit it while you're here.

Nick Nisi1:22:34

You can also ask things like, um, can you tell me about my order?

Guest1:22:42

I have a question. Technically on Cloudflare or technically on WorkOS?

Nick Nisi1:22:47

Uh, it's deployed on, is, is this.

Zach Proser1:22:49

You put it on Cloudflare.

Nick Nisi1:22:50

Yeah. I have a version deployed on Cloudflare. Um, this one I think is, it might be deployed.

Zach Proser1:22:55

MCP shop?

Nick Nisi1:22:56

Yeah.

Zach Proser1:22:56

Probably in Vercel.

Nick Nisi1:22:57

I think it's, yeah, it's deployed to Vercel. Um, for this specific instance of it. I, I have a talk on Thursday where I'm also, I have the same thing deployed to Cloudflare. So, um, we'll go into the code and I can send out the repo for that.

But, um, yes, that one just saves it, saves the info to a KV store. Uh, and then that's, that's what's used to order the shirts.

Zach Proser1:23:19

Uh, you can deploy MCP servers to Cloudflare now using WorkOS as the auth layer.

Nick Nisi1:23:23

Yeah.

Zach Proser1:23:23

So, so, uh, feel free to check that out. We have a blog post and a couple of tutorials.

Nick Nisi1:23:27

Yeah.

Zach Proser1:23:27

Yeah.

Nick Nisi1:23:27

That's the thing. It's using WorkOS to do that auth. You didn't see it 'cause I'm already authed in, but when I hit connect, it opened up and it was do completing that auth flow to get me a token so that I could, uh, do that here.

And you can see that in here. It's got like my order information. Um, I don't know. Do you know my name and email, which is totally not something I've said yet.

Zach Proser1:23:56

But, but also to tie it again, uh, back together,right? 'Cause again, like toy, it's fun. Got a t-shirt, but imagine this as an e-commerce workflow,right? This is what people are building. Like this is what everyone's trying to figure out how to do correctly.

What I actually want to do is just go, I'm in a hurry. I want to get on the page and say, it needs to be a product exactly like this. Does it support that? Okay, fine. Go. Not $40, less than that,right?

That's what everyone wants to do. Um, and so that's what this interface is.

Nick Nisi1:24:18

Yeah. Pretty soon you'll be social engineering your way through LLMs to get a free shirt when it's not free.

Zach Proser1:24:24

Yep.

Nick Nisi1:24:26

I can't wait for the future.

Zach Proser1:24:27

Yeah.

Nick Nisi1:24:30

Uh, cool.

Guest1:24:30

These are challenges.

Nick Nisi1:24:32

Yeah. Let's, let's, uh, look at the workflow. So I switched over to the step three branch, which is the end of step two, uh, where you should be at. And you've got a new meme generation workflow. Uh, and it's got, you know, a bunch of schemas set up for the input and output schemas, uh, and all of the steps set up to run each of these.

And, you know, that's the code for it. Let's go look at the, the actual get out of here. Um, the tools in Mastra. So I'll refresh this and go back to work. Yep. Workflows. There we go. Now we have our meme generation workflow and it's got four steps.

And so this is a little bit better, a little, little more detailed in what, what it's doing. Um, it's got not including these mappings. It's got our extract functions, find base meme, generate captions, generate meme. Oh, come on.

Uh, and then a final mapping. Um, and so I don't know. Someone give me a work frustration.

Zach Proser1:25:36

Somebody to eat my sandwich out of the fridge.

Nick Nisi1:25:39

When no one in the workshop is.

Zach Proser1:25:44

Someone was too busy preparing a workshop to review my PR.

Nick.

Nick Nisi1:25:51

No, never.

And won't review my PR. That's a made-up one. Um, so yeah, it can run. You can see it running. Um, and then we can go, we can see all of the steps are now green. And so we can see the input and debug the input and output on each of the steps.

So there's the input that we got, and it gave out a frustration, a communication frustration.

And I am all sorts of messing this up. Uh, but we can have it find the base meme and then generate the captions for it. Find out what that is. So when the meeting could have been an email, but everyone is just smiling like it's fine.

That's relatable. Um, but then down in the generate meme one, that's going to receive the captions. It's going to receive apparently a meme called Disaster Girl. And

did I mention that these are non-deterministic and I don't know what it's going to generate?

Ah, the meeting could have been an email, but everyone is just smiling like it's fine. This is fine. Yeah. Um, yeah. So this is fun,right? We can see the workflows, the inputs and outputs of it, and we can debug those steps along the way.

We can see exactly what is what we're starting with and how it progresses through each of the steps, uh, to give us a full workflow, which is awesome. Um.

Zach Proser1:27:25

We haven't even had to do a deployment yet.

Nick Nisi1:27:27

No.

Zach Proser1:27:27

And we can just iterate locally, change the prompts, change the schemas until you get it exactly the way you want. And then you haven't wasted time going back and forth. You've like iterated rapidly.

Nick Nisi1:27:36

Yeah. And so really easy debugging. That's why we love this tool. Like it's, it's just really fun and easy to do. So in the final step, um, the, the final main step we have, uh, we're going to like take that workflow now and call it with an agent.

Step 3: Agent1:27:52

Nick Nisi1:27:52

So this is a pretty straightforward step. We're just going to create an agent, give it a prompt to work with, and give it the, the knowledge of the this workflow that it can run. And then it'll run it for us.

So instead of having to use that interface, we can use a chat interface, uh, that we're more familiar with and go from there. And so.

Zach Proser1:28:13

And, and again, to tie it back to actually taking this home and doing something useful with it, like we've gotten to the point where we've described a workflow of steps that completes a discrete task. And maybe that's something that our, our coworker needs.

And then again, maybe they are technical, maybe they're not, maybe they're just in a hurry. So by building them an agent and saying, use this workflow, and you, you have the ability to call this workflow, that becomes an ideal interface to give to our colleagues to start using this.

And then something that they used to have to do piecemealy, they're just now firing off a chat request and it's done for them automatically.

Nick Nisi1:28:43

Yep. Yeah. So with this you'll learn what agents are, how you give them instructions, um, the memory systems for them, the workflow integration, uh, through Mastra, and then how you can test them in the playground.

Zach Proser1:29:17

Wow, these are awesome. So these are new community memes pouring in real time. We finally catch up on Slack messages, but there's already 20 more waiting. Nice.

Yeah, that's a great idea.

Nick Nisi1:29:39

Yeah.

Zach Proser1:29:40

There's some great, um, feedback on the framework guys in the, in the Slack channel. There's like some UX requests as well. You can see it.

That's great.

Nick Nisi1:30:02

Ah, too real.

You can also play with the, uh, prompt, uh, the prompts a little bit to tweak it about what it's, how it's like analyzing the frustration, the level of frustration, the type of meme, um, things like that.

It's really fun to get a, a vibe for it.

Zach Proser1:30:31

Yeah, indeed.

Allright. Does everyone more or less have, uh, what they need? Is anyone still stuck on anything? Any last minute questions or pickups? No? Cool.

That's amazing. I'm going to make a t-shirt with that.

Uh, just a, I guess a comment from us and I guess from the team as well. Like honestly, like thanks everybody for coming and building these. We didn't even know this workshop was happening until last week it was.

But, um, I mean previously like so like most of us at Mastra were previously building Gatsby. Like I was the co-founder. And so we've been doing open source JavaScript stuff for a while, but it's like pretty humbling when you show up for a conference and actually someone else is giving a workshop about how to use the thing that you built.

Um, and I think I speak for all of us. So like thanks everybody.

Thanks a lot.

Nick Nisi1:32:27

Yeah, thanks.

Zach Proser1:32:28

Been a pleasure.

Nick Nisi1:32:32

And on the same side, we didn't know that you were going to be here until I think like yesterday.

Zach Proser1:32:36

But we got very excited 'cause it's like, hey, you got a question about commit? Let's go ask him.

Nick Nisi1:32:40

Yeah.

Zach Proser1:32:46

I'm just personally curious how many folks have or like already have agents deployed at work in prod that they're using for things. How many folks, a couple, how many folks are trying to get them in, into prodright now?

Nick Nisi1:32:59

I'd be curious to know what you're using them for.

Zach Proser1:33:01

Yeah. I'd also be curious if anyone wants to share either in the Slack or just call it out or come up to the mic. Like what are the top use cases that you're thinking of for agents or struggling with?

I'd be curious to know too.

Nick Nisi1:33:12

This is such a fun time 'cause there's like, like you, you have to get your head around what it's doing and then get your head around what it can do. And it just, it starts to feel like the possibilities are endless and just super fun.

Zach Proser1:33:25

Yep.

Oh, nice.

Guest1:33:33

Getting around the online and online playing close.

Zach Proser1:33:35

Yeah.

Guest1:33:36

Customer

cluster. We have physical servers that have issues operationally.

Zach Proser1:33:44

Yep.

Guest1:33:44

And then goal is to have a problem to get logsright now.

Zach Proser1:33:50

That's awesome. Yeah, that's awesome. So like you've got, um, so you want to be able to chat with your infrastructure and like ask questions, like either an incident, like show up to the incident and even already have like initial guesses maybe.

Guest1:34:01

Right there.

Zach Proser1:34:02

Yeah, that's awesome. Cool. Any other use cases? I think that we're finding, um, we're mostly able to just knock out a ton of like low-hanging fruit that folks are doing manuallyright now. It's, you know, especially with tools like this, like you, you know, create a simple agent or even just a pipeline with a few steps and a couple API calls and that can like free up hours of somebody's week.

Um, I think that's the part that I'm most excited aboutright now.

Nick Nisi1:34:27

Yeah. It's like all the little paper cuts, you can just so quickly iterate on them and get things going.

Zach Proser1:34:32

Yep.

Nick Nisi1:34:32

And not just with these, these tools, but just like vibe coding in general. Like you can, you know, be like, I'm going to spend an hour just seeing where I can get to and.

Zach Proser1:34:40

Yeah.

Nick Nisi1:34:40

It's amazing.

Zach Proser1:34:41

Incredible how quickly you can get there.

Nick Nisi1:34:45

Always review the code though, please.

Zach Proser1:34:48

What's that?

Nick Nisi1:34:48

Always review the code, please.

Zach Proser1:34:50

Yeah, please review the code. Use tools like Git Guardian before you commit.

Nick Nisi1:34:53

Yeah.

Yeah, we had our, our AI moment, uh, a couple weeks ago at our last onsite and, um, we had like a couple hours just to spend doing something with AI. And it, there was really no prescription to it.

It was just explore and play. And if you can solve a problem, great. If not, you learned something along the way. And, uh, the thing that I worked on was like as the maintainer of several SDKs across several languages, uh, a pain point I saw was like people adding in, you know, very simple PRs to one repo that's like the node repo, the node SDK, and then doing the same thing.

It's like adding a new field to the node SDK and then adding the same field to the Ruby, Go, PHP, Kotlin, like all of the SDKs. I was like, I wonder if we could do something to alleviate that and make it easier.

And after two hours of pure vibe coding with Claude, I had a GitHub action that when you label the first PR that you do, you just add a label to it, it will go and generate the PRs for every other repo and just automatically PR it.

Zach Proser1:36:02

Every other SDK.

Nick Nisi1:36:02

Yep.

Zach Proser1:36:03

That's awesome.

Guest1:36:04

Were you using like a software engineering framework like Dagger or something to essentially do the changes or QBOD?

Zach Proser1:36:12

Making the, oh, that's a great question. Making the changes is one thing. And that's something that, yeah, I think Dagger would make a lot of sense. But what were you doing with that?

Nick Nisi1:36:18

I wasn't, I wasn't doing any of that. Um, I vibe coded it and I actually don't know what the code does.

Zach Proser1:36:24

And he had to.

Nick Nisi1:36:25

I didn't review it.

Zach Proser1:36:26

He had a 4,300 line, uh, GitHub action that's working great.

Nick Nisi1:36:29

How?

Guest1:36:30

I want to hear more about that.

Nick Nisi1:36:33

But to be clear, we didn't ship it. Uh, it's, it's an experiment. Maybe, maybe we will for sure. Um, but the week after that, I think, um, Claude had come out with like the ability to run Claude code as a, uh, like via an API so that you could like spin it up, run it, give it the instructions on what to do, and then let it figure out how to do it.

'Cause like most of the code that it generated was just handling how it was going to do the diffs. And for several hours of that, it was just like it made the changes I wanted and then deleted the rest of the files and that wasn't great.

Zach Proser1:37:13

Um, we're also for what it's worth finding, uh, incredible utility with tools like V0 Dev. So if you're already in the Vercel ecosystem or have used Next.js, there's now, there, they were originally conceived of as like rapid prototyping tools that maybe for designers or maybe for developers.

But like an example is that somebody on our marketing and sales team was trying to figure out who would be interesting engineers that are already doing work with MCP to contact about conferences like this. And their workflow is completely manual and they're, you know, talking to me about it on a, on a call.

And four minutes after they started telling me about it, I had it working like in V0 Dev and handed it to them and they had a completely separate, you know, tool that's available on a URL that they can just paste in whatever they need essentially and get like the analysis done.

Um, and so that was very eye-opening for me 'cause it's in some cases now it's faster to create the tool that your colleague needs than it is to continue talking about the tool that your colleague needs and even ticketing it or saying next Tuesday we should try and like sometimes you can literally sit down in V0 Dev with like a paragraph, very discrete prompt and get what you need.

Nice. That's pretty good.

Guest1:38:26

So then question.

Zach Proser1:38:26

Yes.

Guest1:38:28

Do salespeople do this process and they're creating a keyboard? Now I want to be next to you.

Zach Proser1:38:33

No.

Guest1:38:34

And I'm.

Zach Proser1:38:34

Not in my experience. Not yet.

Guest1:38:36

Cold call.

Zach Proser1:38:37

Yeah, totally. I think that's, that's a fascinating question. Yeah. The question is like when, um, folks in other roles that are not traditionally technical see how quickly you can scaffold this stuff? Are they all clamoring for the keyboard?

That's not been my experience yet. There, I think that's also like part of what the trepidation and anxiety is around is like, well, now everyone can do it. But then I also comfort myself and say that I define a pleasurable evening as like sitting down for 12 hours on one of these machines and going back and forth to try and get it to go the way I want.

And that's not most people's description of a fun time. So like even when the tools are better, I, I still think you kind of have to find this enjoyable. You know what I mean? I don't, I don't, I, I, I think it might change to some degree like when, like most generation becomes one shottable and you say, I want this app and it's of like this complexity and most people can get something working immediately.

That's correct. I think that'll take a lot of low-hanging fruit off, but.

Guest1:39:30

I heard, um, some people said like the lawyers would put some CSVs.

Zach Proser1:39:37

They would do what?

Guest1:39:38

Put lawyer like legal questions and data into CSVs and then they would essentially, um, almost like a blind mouse start telling Claude code, go do XYZ and tell me what the results are. And so I don't know. I don't know.

From a philosophical point of view, some cultures. That structure really engages and the other engagement.

Zach Proser1:40:08

Yeah. I, I think that's super fascinating. And anecdotally, um, it's mostly been lawyers when I've been at meetups that have come up and asked the most like salient questions about Gen AI and they'll say like, I'm not a coder, but like this is what we're trying to do.

Also semantic search and all like the information compression that's available with a lot of the Gen AI tools like I think uniquely speaks to their use case too of there's this gigantic corpus of case law and need to know exactly thisright now,right?

Yeah, it's, but it is, um, it's an intense time I think for that reason. Yeah, culturally,right?

Nick Nisi1:41:03

I've gotten away some 20 minutes. What are we doing? Nothing. We're doing great. We've got a nice slide slot. Oh,

you guys are going to configure an MPC server,right? It's like you have trouble with this.

Zach Proser1:41:34

Uh, in this, uh, session or in general? Sorry, I didn'tright now. Uh, no. Yeah. But, uh, I have a, I have a.

Guest1:41:43

Needed it?

Zach Proser1:41:43

Yeah. Yeah, for the most part. I have a tutorial for you that does that if you want it. Thanks. Thanks for coming. Appreciate it.

Nick Nisi1:41:48

Yeah.

Guest1:41:49

Yep.

Nick Nisi1:41:52

Allright. So we can show the agent piece of it now. Um, so I switched over to the step four branch, uh, which is the end of step three, uh, where we should have the created, uh, agent now that can run, uh, and actually have a conversation with the tooling, uh, which makes it really a lot easier to work with.

Uh, but we still have the power of being able to use the workflow tool to see what's going on and debug the steps along the way. Uh, but now if we go to the agents tab in Mastra, we've got a meme generator.

And this gives us a very sim, a very familiar look and feel. Gives us a chat window. Uh, but it gives us more than that. In the, uh, the sidebar here, we've got an overview. We can see the instructions, uh, that are given to the agent.

So it's a helpful UI agent, uh, or AI agent that's going to help us do that. Uh, it's got some critical steps in there. It's got the workflow that it should follow, um, and telling it what it has access to.

We also can see the model settings and we can adjust this as we go. So we can add more or less temperature, uh, top P. We can change all of these on the fly and test it to really hone in on like what works best for whatever we're trying to build.

So I'll ask one more time. Work frustration.

Zach Proser1:43:09

Who's got the gnarliest work frustration? Who's the most frustrated at workright now? Raise your hand. And again, you must state your company and your immediate superior's name.

Um, I always get asked to go to large meetings for four hours and then, uh, I don't speak at all.

This bothers you too. I see.

Nick Nisi1:43:46

Yes. Meeting fatigue. Um, so now we can just ask the chat and see the output and it's much cleaner. It'll actually give us the image in line too, um, which makes it really nice and easy to work with.

That pointless meeting I was dragged into.

Zach Proser1:44:06

But if you scroll up a little bit too, the other thing, uh, to see here is like, so the user asked a question and you saw that the workflow got run. Um, but now there's also additionally like the agent is still chatting and it's in a familiar way that you already are familiar with if you use GPT.

Um, but then again, just a reminder that this is kind of the ideal interface for, uh, folks that might be your clients or your customers or your colleagues.

Nick Nisi1:44:28

Yep. And we can see like in line what happened, you know, the tool arguments that were passed in, the total result. We can see what tools were called, uh, and how in this case it was the workflow and here's all of the information and then the end result that we can actually play with.

Zach Proser1:44:45

Yeah. So this could be, you know, a chatbot that someone is, uh, requesting.

Guest 21:44:49

Because he is moving for a mode.

Zach Proser1:44:53

Mode.

Guest 21:44:53

Here.

Zach Proser1:44:54

It designed like a new image. Uh, you can kind of put whatever you want behind the same interface.

Nick Nisi1:45:17

Not really. Not really.

It's non-deterministic, guys.

Um.

Zach Proser1:45:47

There's, there's no HR for this conference. I was told that in advance.

Nick Nisi1:45:52

So, uh, kind of to wrap that up, uh, what we built was a multi-step workflow that we could give to a conversational agent who knows how to execute it, knows what to pass into it and what it's going to get back, and then it can do without what it will.

Wrap-Up & Q&A1:45:52

Nick Nisi1:46:05

It gave us, you know, human feedback. Uh, it wasn't just spitting out JSON in the end. Uh, it was giving us an actual response and then showing us the image in line and giving us a clickable link so that we could go share that image, uh, to whoever we wanted to.

Um, and we were able to create some awesome memes. I highly recommend you deploy this and use it because it's cathartic to really vent to it. Um, and if you're deploying it, your data's safe probably. I don't know.

Find out together.

So some key takeaways, uh, from this. Uh, we learned about the workflows, agents, we learned, uh, type safety, um, catching errors in that, uh, and the structured generation to ensure a reliable output, uh, and some of the benefits of Mastra.

Zach Proser1:46:52

Yep. Um, also just say that, that we didn't show this here, but one of the examples that's on Mastra site you can go check out is like a 37 line of code, uh, pipeline that does retrieval, augmented generation.

And if you've worked, if you've built those pipelines before, like two years ago, you know, you had to glue together at least three or four libraries. It was a super crappy experience. Um, so it's just really nice to have a single place you can go and define that pipeline at a high level.

Um, so yeah, excited to experiment more with that as well. There's a ton here that you can do that we did not even scratch the surface of or, or point to yet.

Nick Nisi1:47:25

Yeah, for sure. Coming up with, uh, what to do in two hours. It's, uh, not a lot of time.

Zach Proser1:47:29

Yeah.

Nick Nisi1:47:29

And there's a lot, a lot more that we could dig into and we highly encourage you to. So this was meant as a, a primer. Uh, you, you now have like an example.

Zach Proser1:47:37

Yeah. Yeah.

Nick Nisi1:47:38

Uh, now experiment with it. Add things, add tools, um, deploy it with MCP, like figure out how.

Zach Proser1:47:44

Share it with your coworkers. Yeah.

Nick Nisi1:47:45

Yeah.

Zach Proser1:47:45

Ask them to use it, see what happens.

Nick Nisi1:47:49

So yeah, explore the tool creation, uh, add a vector database, implement RAG, uh, all of those. And just a final reminder, uh, mcp.shop, um, go order a t-shirt, check it out. Uh, it's really cool. So thank you with that.

Um, we've got 15 minutes left. We wanted to save that for questions, any, uh, additional follow-up, any just general casual conversation about these tools, uh, the fascinating world of AI, anything.

Zach Proser1:48:17

Vote on memes that we generated and see who is the ultimate winner in the Slack channel.

Guest 31:48:25

So I'm giving a talk on agents and workflows tomorrow and I really liked your agents and workflows side. Can you bring them up again?

Nick Nisi1:48:32

What? I didn't hear what you said.

Zach Proser1:48:33

Yeah, I didn't hear it. Sorry.

Guest 31:48:34

Oh, sorry. I'm giving a talk on agents and workflows tomorrow. Agents and workflows sides were really good. Can you bring them up again?

Zach Proser1:48:42

Sure. We can share them too. They're open source because they're in our repo and they're on Markdown.

Guest 31:48:51

How do you make those in Markdown?

Zach Proser1:48:53

There's a couple tools that Nick, Nick likes.

Nick Nisi1:48:54

Uh, yeah, this was slide. Uh, slidev or slide.dev. Um, yeah, it was something that we switched to relatively not that long ago.

Zach Proser1:49:06

20 minutes before this talk.

Nick Nisi1:49:07

Pretty much. Yeah.

Zach Proser1:49:14

Uh, questions for us or the Mastra team?

Uh, do make sure that you, if you want a shirt, buy a shirt because we will actually send you a shirt. We might not send it this week, but, uh, we're tracking all the orders and we're going to honor all of them.

So it's a limited edition mcp.shop shirt that will never be seen again.

Guest 31:49:41

We've got some here and I think we've got some in the back.

Zach Proser1:49:45

Yep.

If you want an official Mastra book, um, autograph copies are $30,right? And otherwise.

Nick Nisi1:49:57

Cool. Um, but yeah, yeah, question.

Guest 31:50:01

Where's the memory and execution step?

Nick Nisi1:50:03

The memory and execution step? Um.

Zach Proser1:50:06

Yeah. So you, you, you can configure, you know, we, we configured SQLite for this demo and that's what's powering like the ability as you create additional chats, you'll see the previous chats on the left rail. Um, but there's a ton of different storage drivers like there's the Postgres and everything else,right?

Um, so you can basically choose what you need to. Um, and then once you configure the memory, you pass it into either the workflow or agent. Um, and then that's by, by way of doing that, you're telling it can use it essentially.

Is that your question?

Guest 31:50:33

The demo one doesn't have memory?

Zach Proser1:50:35

The demo one does have memory using SQLite and it's.

Guest 31:50:37

That's what I saw, but, uh, it says check execution step. Where do I find that?

Zach Proser1:50:42

Uh, check execution step.

Guest 31:50:44

Where are you? Let me, I'll come over.

Zach Proser1:50:51

Great.

Guest 31:50:52

Oh, thank you.

Nick Nisi1:50:52

Thank you.

Zach Proser1:50:53

Thanks so much for coming. Appreciate it.

Nick Nisi1:50:55

And, uh, yeah, we'll be around, uh, all week, uh, at the conference, so reach out. Uh, we'd love to chat more.

Guest 31:51:01

He's talking about just, uh, like that graph.

Nick Nisi1:51:06

This is the main. Thank you.