Back to all workshops

MCP + Mastra: Build a personal assistant agent

April 10, 20254:00 PM UTC1 hour

If you have been looking for an opportunity to get hands-on with MCP, this is it! The digital overload we face today is overwhelming, but the tools to combat it have never been more powerful. This session is your chance to build a custom AI assistant that actually reduces your workload instead of adding to it.

Using Mastra's workflow system combined with MCP, you'll learn how to create a personal assistant that integrates with your existing tools and workflows. Together we will go through the entire process in less than an hour.

Build an assistant that automatically categorizes your email inbox, provides concise summaries of unread Slack messages, and monitors your Git repositories for important commits and pull requests. Free yourself from digital busywork and focus on what matters.

This event is open to all devs and aspiring AI engineers, regardless of background, so feel free to share the invite link. It's recommended that you have a code editor and node v20+ installed prior to the session. You should be comfortable with basic JavaScript and the command line. This isn't a talk; it's a live workshop where you'll walk away with your own personal AI assistant ready to tackle your digital overflow.

Workshop Transcript

0:03

All right. Well, we will give everyone a few more minutes here. We'll probably get started about, you know, maybe two or so after the hour, two or three after the hour. There's usually quite a few people that come in a little bit

0:17

late. While we are uh while we're waiting, if you want to drop in the chat where you're calling in from, that's always uh that's always kind of fun. And yeah, we'll get started here in just a minute.

1:17

We have some people coming in from all over the place. Taiwan, Norway, Canada, Dallas, Michigan. Hey Josh, good to see you here.

1:31

see some other uh some of the people I recognized Switzerland. All right. Yeah, unfortunately uh Luma by default when I set up set this up doesn't mute people when they join. And so if I don't

2:18

go in and remember to uh set that setting before I you know the workshop starts it and unfortunately people might be unmuted when they join. So I will fix that in future meetings. Unfortunately I can't fix that in this one. But glad

2:30

that everyone is here. We will go ahead and get started. There'll probably be a lot more people that join in. But before we do uh get started, if I would

2:43

encourage you all to uh I'm just going to send a link here in the chat. If you have not already, please go to our GitHub and give us a star. That really helps people find us. If you do

3:01

uh give it a star today or if you have if you've already done it in the past just say that you did and we will pick some people and we'll send them uh our book on building AI agents. So principles of building AI agents written by Sam our co-founder. So I know we have we'll have some other people here from the master team that will be answering

3:20

questions along the way. So I think I saw Tyler's here. I'm sure Obby and Sam might also be dropping in. So if you

3:28

have questions as we go through this, please drop them in the chat. We'll get to them a lot of them as we go. If not, we'll spend some time at the end. Today, let me share my

3:40

screen. But today, we wanted to talk a little bit about how you can use MCP with MRA agents and really give your agents various tools. And so I wanted to build a personal assistant example, something that was pretty relatable, pretty simple, but everyone here could leave by, you know, cloning the repo and, you know, conf playing around with it, adding some more MCP servers and

4:05

hopefully, you know, doing some pretty interesting things. So I will share my screen and we will get started. All right.

4:23

So, as I mentioned, the goal is to build a personal assistant agent with MCP and Mastra. We're going to talk a little bit about what MCP is and why does it matter. If you came to our past MCP workshop, some of this stuff is going to be uh stuff we covered. So, I'm going to go through it pretty quick because some of you probably seen it before, but we'll we'll keep it kind of short. We'll

4:42

also talk about how do you actually find MCP servers, how you can use MCP with MRA to actually build this personal assistant agent, and then some Q&A. So, who am I? I'm one of the founders and the CPO of MRA. I was at Gatsby and Netlefi. I built a product

5:01

called audio feed and I was uh I've been doing open source stuff for a long time. I spent a lot of time in the Drupal community, you know, starting 15 years ago. Not to date myself or anything, but please reach out, connect with me on X or Twitter, whatever you call it these days, and LinkedIn. So, a lot of you here probably are somewhat familiar with MCP, but just to kind of give the high level, what is

5:24

MCP? It's an open standard that connects LLM. It's kind of like the USBC port for AI applications. the whether it's like local tools that you can add in or tools

5:36

with thirdparty applications, it it really is a good way to just connect various systems together. And it's especially helpful when you're connecting whether it's AI agents to these systems or tools like Cloud Desktop or Cursor or Windsurf. And why does it did it exist?

5:55

Well, there's always been this like integration problem when you're integrating different systems where you end up writing a lot of this glue code. And so MCP was kind of the protocol that the goal being, you know, Anthropic's goal was maybe we can eliminate a lot of this glue code and make it a lot easier for these systems to be able to be

6:14

connected in a much more standardized way. So how does it work? Well, it uses a pretty simple client server architecture. There's, you know, MCP client, there's the protocol in between, and then

6:27

there's the MCP server that connects to, you know, potentially different services. You can see in this example, there's GitHub, Slack, there's also like a local file system and some real world applications. You know, there's a lot of people using MCP within internal systems. so they can make it easier for

6:50

people internally to connect to different services in a more standardized way. There are a lot of dev platforms that have MCP. We're going to see some examples of a lot of the various registries and all the different options that we have to choose from. And then you have all these different uh connectors like Google Drive, Slack,

7:11

GitHub. And so when you think about what are some of the benefits just that really unified integration, faster development because you don't have to write that glue code and then your separation of concerns. So MCP is kind of a clean split between the AI application you're building and the data and tool

7:29

integrations. So there are a whole bunch of registry options and there's actually more that are not included in this list. So we will talk about that. But it's kind of like if you're familiar with the JavaScript world, which is, you know,

7:40

where I've spent a lot of time, it's kind of like npm. It's a package manager for MCP servers. So there are tools like uh Zapier, Composio, Smithery, MCP Run, Gumloop. There's an official one, a more official one now by Enthropic we'll talk we'll show and talk about, but there's a

7:59

whole bunch of them. And each of them have different uh you know quality of integrations, different number, different types of integrations and so you should definitely uh look through a few of them but we have many options when uh choosing from NCP servers and there are of various quality right there's not a guarantee on the quality level of any of these things. So a lot of them will provide ways to see like

8:24

how many times it's downloaded or some kind of metrics on these different registries so you can kind of validate which ones are the most popular which is usually a signal of quality but not always. So you should always uh make sure you're you're kind of doing your due diligence there. There are so many registries popping up not only just MCP servers but

8:42

MCP registries that list MCP servers. We just actually released today the MCP registry registry which is just a list of all the registries and so I'll I'll show that off here in a second once we get through the slides but you can actually see uh all the different registries we're aware of and you can

9:00

kind of click through those. So what is Mastra? We're an open source AI agent framework for TypeScript. It comes with tools or agents with tools memory tracing. We

9:11

have state machine based workflows for that provide human in the loop and you know simple API that allows you to doep. So it's really easy to kind of build out complex workflows. We have you know eval baked into the framework. We have storage for rag pipelines. We have a local development playground. Really

9:32

just makes it really easy to get started building AI agents with Typescript. Our goal is to be very opinionated but flexible. So we don't we want you to be able to get further faster, meaning that you don't have to think about a lot of the just default decisions. You can get started really quickly, but it's flexible enough that

9:50

you can swap out things, whether that's different storage backends, different database providers, uh different uh different tool providers, all all these different things to make it really easy and flexible so you're not you don't ever feel like you're actually locked in. And what we're going to be doing is we're going to go through a simple

10:09

master agent. We're going to give this master agent access to our email calendar, let it post for us on social media. We'll set up a I'll show how you can set up a telegram bot that allows us to communicate with our agent from anywhere. And we'll walk through this whole process and maybe we'll have some time to show off a workflow or some

10:26

other uh maybe some other MCP servers. This is actually one of the workshops that, you know, most of the time we're going all the way up to the hour and sometimes even past. This was actually so, you know, candidly, this was so easy. I don't even know if it's going to take the entire hour, which is kind of nice because it's actually pretty simple

10:45

once you see how this works where you can hopefully use your imagination and uh think about all the different things you could kind of wire this thing up to do. And I just picked a couple things that were interesting to me that I would use, but you can obviously think of your own use cases and how you might be able to wire it up. And it's actually very easy to do. So we might not even take

11:03

the whole time today. So let's go ahead and why don't we show off just the very simple example. Before we do, let me show we do have this uh master.ai MCP-registry registry. You can see

11:21

there's a list of MCP registries. We have here's the one from an Anthropic or the official one that Enthropic created with a list of servers. There's a whole bunch more. Cursor has one. Gum Loop has

11:33

one. Composio has one which we'll use today. Um MCP Run is is another good one. Smither is another good one. I mean you can we'll also use uh Zapiers today

11:44

as well. But in theory, we could use any of these things. That's the nice thing about what we're doing with our agent that we're building is that you could kind of go through here, look through the different options, and you should be able to use any of these MCP servers alongside your um your master agents. So, that is one of the nice things about

12:01

the protocol. Okay, so the first thing we might want to do is let's actually just run this simple example. I have a very simple master project I just ran. you know, if you if you were to start from the master website and run mpm create

12:21

master at latest, you would get a an agent similar to this. So, we'll walk through all some of this code and I'll show you really simply how it works and we will kind of go forward from there. So, the first thing I'm going to do is I'm just going to run it so you can see what it does right now. I think it's already looks like it's already running.

12:46

All right. So with Maestra, you get this local development playground and you can see there's an agent here. I can actually chat with it. It has access to one tool right now, get weather. So I

12:59

can say, what is the weather in San Francisco, which is where I'm currently at? And so you can see it runs this weather tool which returns the weather. We'll show the code of how that works, but it it works. I also did add, and I'll show the code for this,

13:25

too, a way to interact with this agent while it's running through a Telegram bot. So, the nice thing about this is I can actually now use it on my mobile device. So I can use this on my mobile device and actually then see and interact with this agent from anywhere assuming that my of course dev server was running. But I could leave my computer running, go you know

13:51

out in the world and continue chatting with my my agent. So let's just test it out. What is the weather in Austin? So you can see it's running the weather tool and it now

14:06

returns and it gives me the weather in Austin. So it's pretty cool and we'll we'll do a lot of stuff with this just showing how the Telegram bot works the same way whether I'm using it in the playground or I'm communicating with it from Telegram. But let's start by actually looking at the code that makes

14:24

this work and then let's start adding tools using MCP to give this agent even more capabilities because that's really what we want to do. you want to allow it to do even more. And I'm going to make this just a little bit bigger. So, let's in Maestra when you

14:42

get started, we have a couple folders that we'll kind of talk through. So, it creates a source MRA directory. There's an agents folder, which is what we're in now. And we have one agent, which is our personal assistant.

14:55

It comes with a often will come with a tools folder which is where we're defining our weather tool and then there's a workflows folder which you can define more deterministic work agentic workflows. Really the only thing that this thing does right now is it's a very simple agent with a system prompt. The model is using OpenAI. So I did have to drop in, you know, OpenAI API key and it's using this weather

15:22

tool. So if I were to look at that weather tool, it has an input schema which is location, the output schema which you could see, you know, if I go back to even telegram, it's giving me this output schema and just runs this one function which makes an API call to essentially geocode the location and then get the forecast for that geocoded

15:46

location and then it returns it. So very simple uh function is all that this does. But we want to actually now extend our agents capabilities. So one of the first

15:58

things you'll notice in the playground is that it says the agent will not remember previous messages. So we need to enable memory to actually do that. So we're going to go ahead and just add very simple memory.

16:19

Uh, I'll just import it first. Now, add memory. And now, if I were to save this and come back, you're going to see I have this sidebar over here with any any memories that I have as I go through this. So, what is

16:41

the weather in Sou Falls, which is where I'm originally from? Use the weather tool. It'll now show this uh in my chat history. So, we got memory. That was pretty easy to add. I did have to

16:53

install the appramemory package, which I you know already did before this, but that was pretty easy. We can get a little more complex with memory. So, I'm actually going to copy in an example from some example code and we'll talk through how we can get a little bit more complex with the way we're setting up memory.

17:22

So this is a more complicated example of memory, but I'm using ma master memory. I'm setting some options. I'm saying that I want to keep the last 20 messages in context. So it'll automatically add

17:35

that to the context window. I want to also use a semantic recall to find three that as the top K, which is three related messages based on my prompt. So what it'll do is it'll take the prompt.

17:48

It'll then basically create an embedding and do a vector search and find three other messages that might be relevant. And then before each of those three messages, it'll give me two uh previous messages and one after message. So it's kind of giving me like a three like message chunks with a few different messages in there. And what this allows

18:07

you to do is configure if I were to have a longunning conversation, I keep the last 20 messages in my kind of short-term working memory, but then I also can like go back in time and find like more relevant messages from the past. We can also set up a a working memory template. So, if I were to start give giving my

18:29

agent information about my name, my preferences, my interests, it will then use this template to keep track of that information and allow it to then answer questions. So, it'll it should remember my name and it should remember um if I had any preferences or interests and then it'll use that information uh in its in the LOM call

18:50

sensem. So this is a slightly more uh sophisticated example of memory. We can go ahead and let's just see if that works.

19:07

It's not really it's not really going to work uh that well because it's you it's going to be in the message history but it would use this template and store this as an additional as you can see it did use this tool update working memory it's only because I told it something that should be important right it thinks

19:26

of this as an important uh piece of information so you can see it up updates this template which always gets passed into the the actual context window. So now if I were to have a really long conversation, doesn't matter how far I go, I would be able to always know it would always know that my name is Shane and any other important information I want to kind of put into that

19:50

template. Okay, but now let's actually start looking and doing some stuff with MCP. So I did install in my package.json. I did install

20:06

MRAMMCP and I'm going to just grab an example here and we will start adding adding some information to our adding some capabilities to our agent. All right, we're going to need to import this. All right, so we're going to talk about what this does and how this was all set up. But you can see here I'm using MCP configuration. You could, of course,

20:50

read the docs on how this works, but we define servers. In this case, I'm going to use uh Zapier's MCP. And what that's going to allow me to do is it's going to allow me to uh connect different tools to um to MCP. And just give me one second

21:17

here. I'm going to stop sharing just for a second. There we go. All right. And so if we go

21:46

to we actually go to uh the the Zapier MCP website. If you are unmuted, can you please mute? That' be great. Thank you. And if I go

22:06

here, so in uh Zapier if I go, let's see here. No, MCP is some of these interfaces are so new that they're kind of hard to uh kind of hard to interact with. So sometimes you have to kind of like kind of figure it out as you go because they're I think they're constantly improving it. Zapier

22:29

works really well, but the navigation and everything isn't as polished as it probably will be. So one of the things uh when you're setting up a Zapier MCP, they're going to give you this uh MCP server endpoint. This is kind of like a password or a an API key. So, I'm not going to show you what this one is, but I have it in my uh in my environment

22:50

variable. So, I basically copied that URL and dropped it into environment variable. And so, that's what you'll see in uh the configuration. But I can also

22:58

now edit MCP actions. So, Zapier is interesting because it doesn't just give you one doesn't give you an MCP server for each item. It doesn't give me one for Gmail, one for typefully like uh maybe Composio does. It actually allows

23:12

me to add new actions. So in this case, I've added some capabilities to label emails, find an email, send an email. I've also allowed it access to my typefully account, which I had to then, you know, of course ow to both of these things. But it now has access to create drafts for uh to send on Twitter, for

23:31

instance. I can add new actions and I can, you know, look for maybe Google Sheets or, you know, calendar And so I could allow it to like find events or or do anything like that. But you'll notice now just going to delete this one. You'll notice now if I were to add this in, I'm using that

23:55

URL and I were to save this. If I go back to the playground once it uh finishes. Let's rerun it. Oh, I know what I did. I forgot to actually add it here. So, I need to do that. So, I

24:20

actually have to pass in my tools to my agent. So, if I don't pass if I don't give it the tools, it's not actually going to work. So, if I go back here, refresh, you can see now I have a bunch more tools. So, I can find email. I can create a draft. Now, typically what you'd want to

24:38

do is you'd want to really improve this system prompt. Let's just try it without because if the tool descriptions are good enough, it might actually still work. It probably will because it's right now it's pretty simple. As you add

24:51

more tools though, you have to be very explicit in your system prompt. your system props is going to get very long of when you should use certain tools in what in what circumstances or otherwise what you're going to realize is as you add more tools it's going to be less reliable in actually calling those tools

25:07

it might not always make the right decisions. It's kind of like, you know, as a human, if I give you, you know, three tools and say, you know, pick between the three, you're probably going to make the right answer. But if I give you, you know, 500 tools, it's going to be harder for you to decide which one you should use in what situation. But let's go ahead and just

25:23

see. And I've already since I've connected uh OOTH through uh Zapier, I should already have access to all this stuff. So, just out of curiosity, let's just try it here in Telegram. And let's

25:37

say send an email to shanemster.ai with a subject hello from workshop and a body that says this worked. What could go wrong, right? And I I connect this to one of my other Gmail accounts. So, it'll come from one of my other accounts to my

26:04

master email. So, you can see it's sending an email. There's the subject. There's the

26:10

body of the email. Is errors false? Okay, let's see.

26:17

I'm not going to pull up my email, but I will uh just kind of uh if you're watching on my video, you should be able to see. I did get an email. Hello from the workshop. So, it did work.

26:29

Let's also now try to you create a draft in typefully or a tweet that says so it's going to use typely create draft and it says there's a draft tweet. Let's actually go to Typefully. You can see this. My master agent created this tweet. So, of course, you know, I could have it draft tweets

27:10

for me. I could give it tools to actually send the tweet, too, if I wanted it to do that, but didn't quite want to do that yet. But you can see it was very easy to add that, right? I didn't have to do anything other than

27:21

click a few buttons, you know, OOTH a few times and drop in maybe six lines of code to give this uh this capability to my agent. So that's pretty cool. Let's let's keep going and let's add some more. So another good option uh MC for

27:41

MCP Composio has a bunch and you can see here they have you know Google Sheets and notion, GitHub and a whole bunch more and theirs works very similar. So in this case if you go if I go to GitHub you you know there it kind of gives you some validation based on active users and total people that have used it. But you're going to generate a a unique URL for each MCP. In this case, I'd create

28:08

I'd have to have one for GitHub, one for notion. And then it would give me this URL that I could then use. So in this case, I'm just going to grab this from here. But I

28:26

have another server here, which I just call it GitHub. I give it the URL which is again I just set the environment variable from what I grabbed from that um from the composer website and now I should just be able to save and I don't think I should have to do anything and it should just work. So if I refresh now you can see I got a whole bunch of GitHub uh

28:52

connections here. Now the way that Composio works and I've already done this so it should I won't have to do it again but if I the first time I use the tool if I haven't authenticated it'll give me a link in the chat to do the OOTH basically the OOTH handshake. So I could basically say connect to GitHub. It'll give me a link. I click on it. I

29:12

allow access. And now um this MCP can actually access my GitHub. All right. So I'm just going to ask it for the last five PRs from the MRA repo. Let's see. Let's see what the

29:38

team is trying to ship. All right. So, looks like Nick is is shipping some things today. That's cool.

29:52

Like Kenny's shipping some things. Oh, or the MCP registry registry link must be out on the footer. That's good. We just we just created that today. Ward's shipping some things.

30:03

Daryl's shipping some things. And you know, I'm not surprised to see I'll be shipping some things too. So we we have a whole bunch of PRs and if I were to look at the MRA um GitHub, which you know, feel free to go, you know, look at the MRA GitHub and confirm. And while you're there, you know, give it a

30:20

star. You can see it matches up with those five PRs. So I could ask it to summarize those. that could do all kind of interesting things like summarize the last 10 PRs that were merged and give me

30:34

a sense of what we shipped or give me the last you know 15 commits and give me a summary of those. You can ask all kinds of questions. So, and again I could do this from the, you know, the dev playground or I could have done it from Telegram because it's the same it's talking through to the same agent. All right, let's give it some

30:54

more capabilities. That was easy. GitHub was easy. Let's do few more. Let's give it access to hacker

31:03

news. I like to see what's going on in in the world of tech and sometimes uh you know read some angry comments from people. So that's hacker news for you. Let's go ahead and check that out. So,

31:16

this one I actually I think I found on uh maybe Smithery or or one of one of the other uh MCP that basically it's running this through like an MPX package. So, you can see it's not just always a URL. Sometimes it's a command. In this case, what this runs is

31:34

MPX locally with these arguments. So, MPX-Y and then this specific package which is just a hack, you know, a community contributed hackernews MCP server. So, if I save this and I go back and refresh again, I got hacker news. All right. What are the top posts? Top five posts

32:02

on hacker news. All right. Why tap a wheel of cheese? Usability improvements, hackernews, owning my own data, and ELD.

32:27

All right. So, there's a, you know, it tells you the number of points, the author, how many comments. I could even click on it and it brings me to the link from Hacker News. So, it's pretty cool. I'm now able to kind of see and I could do some

32:41

really cool things like look at all the posts, the top posts and based on these preferences only show me ones that are AI, JavaScript, TypeScript or maybe science since I like to read some of that stuff. But I could kind of have it do a first pass filter and only like surface the ones that it knows are going

32:58

to be interesting to me. And then it would be able to, you know, using working memory, it'll be able to track those interests, right? Those things that I'm interested in. And it would then know that if I ask for the top posts of hacker news that I should

33:10

probably you know I could sort by the you know based on interests. So it's pretty easy way to add capabilities to just you know search or sites that have you know that you might want to get information from. Okay. So we're going to continue to go and do one more thing. So we also

33:31

can give it some local tools. So I mentioned that that's another another thing you can do with MCP. So I'm going to give it a text editor tool. You need to basically give it a

33:44

path. I need to make sure that this notes directory is created. And it is. So let's go ahead

33:52

and try this. I'm just going to shut this down because I think this one might need to be re might need a restart. Let's make sure that it actually runs. Okay, so it did a run

34:05

here and now just going to create a new completely new chat and say, can you create a reminder to uh call my mom today? Why not? I haven't talked to her for I haven't talked to her for the last day or two. I should probably give her a

34:24

call. Okay, it doesn't say it's not seeing. Maybe I need to refresh.

34:32

There it is. Now, let's try it. Okay. So, this is one of those things where if you don't prompt it the correct way, it doesn't. And uh

34:53

honestly, one of these uh one of these problems is probably the system prompts. So, we're starting to run into um the limits of a very narrowly defined system prompt. I kind of mentioned that as you add more tools, things are, you know, will likely start to go off the rails. So, why don't we actually improve the

35:11

system prompt and let's see if it will then, you know, be able to do that correctly. So, I do have just an example of what I used in the past for the system prompt and we'll go through it. It's not uh I haven't I didn't spend that much time on it to be honest. If I were actually going to ship this to you know

35:33

real users, this would probably have to be two or three times as long I would guess just roughly. So it's saying you're helpful assistant. You can help with emails, monitor GitHub activity, scheduling social media post, providing weather information. You have access to the

35:47

following tools. So here I'm saying you have access to the file system access to you can use this to store information store in information such as reminders for later use. Okay. So let's try this and let's see if we get a little

36:08

bit better result. So make sure this is running. Looks like it is. Let's refresh

36:16

and let's just try this again. All right. So, you see, you know, I didn't actually wasn't planning for that to happen, but uh it's, as I mentioned before, it kind of came back, right? I said, you're probably going to run into a situation where a simple

36:34

system prompt isn't going to work. I updated the system prompt. I asked the same thing. And now it created a

36:47

reminder. Let's see if it actually can read this. So, I had some from before when I was testing. So, you know, I call mom, book a flight back to San

36:58

Francisco, call dad. I already already called Okay. So then you can see I can basically interact with it, keep track of to-dos, it can keep track of priorities, keep track of, you know, grocery list, whatever I wanted it to do. But it can read and write files,

37:25

basically store, you know, more permanent types of memories that I wanted to store as like you actually in in a file. All right. So, we did quite a bit already. We gave it a whole bunch of

37:37

capabilities. Let's actually walk through the code of how the Telegram bot works because that is, you know, kind of interesting. It's it's not that complicated. You could basically uh copy it and you'd have a Telegram bot pretty

37:50

quickly. And all this, of course, is going to be it's all already up on our GitHub, but I'll send out the link after this uh after this workshop. So, let's go and look at how this Telegram bot is set up. And uh I'm going to be honest, I did not write this code.

38:10

So, I'm pretty sure Claude wrote this code, but it was curated by Tyler. So, maybe, you know, under under Tyler's supervision, Claude wrote some of this code and Tyler maybe fixed it. So, thanks Tyler for this because it just worked. But, we can walk through how it works a little bit. So you can see that it it's not doing anything that uh you

38:30

know that extensive. It's using node telegram bot API talks you know it has like max message length message response or message result length. It creates a new bot instance and it creates a handler to basically handle incoming messages. So

38:48

let's just look at that handler because that's basically the most important part of this. The rest of it is just uh splitting messages, making sure messages don't get too long. Uh, and there's a lot more you could do. Even if you

38:58

looked at the the output, I might want to actually clean that up. But if it's just a bot for me, I like to see all that extra information so I know it's doing the things I want it to do. But if you didn't, you could of course clean a lot of this stuff up. So let's look at what it's actually doing. So if it right now, it's only set

39:16

up to handle text. So if it's not text, it's going to basically give you an error. When we get the initial message, we respond with thinking. That's why when you see I, you know, I I send it a message, you know, what's

39:31

the what's the weather in Chicago? You can see it says thinking, right? That's just coming from that. While it's actually doing it's doing its thing, it starts

39:43

with that message and then it will, you know, replace it with whatever comes in. So starts there, updates every essentially half a second, and then it calls in our personal assistant agentstream. So we're loading, we're pulling in our personal assistant agent that we created, and we're just calling stream on it. And it gives it a thread ID, a resource

40:12

ID, gives it a little bit of context, and then it starts to process the stream. And this is basically you're reading the chunks of the stream. And if it's text, it's just going to add the text. If it's a tool call, it does that

40:26

formatting where, you know, you see the the little tool icon. It says it's using the tool. And it will then give you the information about calling the tool with what the input was. When you get a result, it'll tell you the output, if

40:39

there was an error, if there's any like reasoning steps, and it basically just uh goes through that whole update loop, right? So you can kind of see that playing out here. Here's the input to the tool. Then here's the actual tool

40:53

result output. So overall, that was uh pretty easy. In order to wire it up, I just went into my source MRA index file and I'm just running it, which basically means when the server starts, it uh starts this Telegram integration. And so it's always running. My playground's running, my Telegram pod is running. In

41:16

order to create the telegram bot, you did have to um in telegram go to what's what they call a bot father and request a new bot and they give you this telegram bot token. It's actually very easy. It was one basically one message to this telegram this other telegram bot which allows you to get a token to create your own bot and then you can

41:34

configure it give it you know give it a icon give it a name all that kind of stuff. But it's very simple to do. Um, we didn't talk about what this master class is, but that's how that's what really powers the playground, makes all this work. I basically give it agents, you can give it workflows, you can specify how you want the logging to

41:53

work, and then it's all um basically set up and working. So, that's how the playground knows for instance to pull in the agents that it pulls in. All right, the last thing we will do is we will talk through our just a simple workflow and how that works because it's kind of an interesting thing. I if I

42:16

were to continue to build on this, what I would really want to do is I'd want to basically have a workflow that runs maybe at specified points during the day. So you can imagine, you know, I would want this personal assistant, maybe I just leave this running all the time, but at certain times traditionally in the morning, maybe Monday through

42:36

Friday, send me a summary of all the GitHub activity that I care about and maybe summarize it so I know, hey, what's actually what's going out in the the master repo today? I would also maybe want to have it send me, you know, pull in some top hacker news articles based on my preferences, so I don't have

42:53

to actually scan the whole homepage. it can kind of scan it for me, give me the top, you know, five or six that I want, but not too many so I don't end up spending too much time. Um, and you can imagine like all these different things that I that you might want to do, but you'd almost want it to be scheduled,

43:09

you know, like on a reoccurring basis. Give me information when when you think that I need it. The other thing that I would also wire it up to do, which I'm not going to show today, and you know, maybe I'll push this example eventually, but it would be really nice if it did the first pass through my email. If I

43:27

get a new email, I want you to basically categorize it for me. For me, I basically categorize things in folders, and you know, I star important emails that I know I need to come back to. So, I could probably write a good system prompt and have the LLM decide that for me and then I wouldn't have to maybe uh

43:45

pay as much attention to my email and kind of do the first pass for me as well. I am not going to show you my email inbox because uh I don't want to be embarrassed at how many unread emails I have. But uh you can imagine that a bot like this could help someone like me. So, let's go ahead and let's take a look at this workflow. Before we do look

44:05

at the code, let's go into our workflows and let's click view workflows. It says three steps. So I kind of mentioned this before. If I had a daily workflow, I would want this to get hacker news

44:20

articles, summarize some of the PRs or commit messages maybe that are going out. And then I have a step just kind of combine that into one single message that it it sends back. So I haven't actually tested this recently. Let's see

44:32

if it works. So you can see it's getting the hacker news articles and you can see here the stories from Hacker News that match your interest in AI, JavaScript and TypeScript and science. Okay, this is going to keep So this one's running now. It's going to go to or it's going to go to this second one here. It's going to take a little

44:54

while longer because I actually have it grabbing quite a few PRs and kind of summarizing. So, it's got to go to the GitHub API. Uh, you can see summarize master PRS is now completed. Here's the recent poll requests. And then, um, it kind of

45:12

combines everything and summarizes it. So, if I look uh, it's not showing in the CLI, but it's kind of in a not necessarily the best format to read. I'd probably actually want it to send to my Telegram bot so I just get a Telegram message in the morning or whenever I ran this. But we can kind of look at this

45:31

and see if it's directionally right. Um, one of the pull requests focus on enhancing the documentation reg. Another update involves adding a link to the MCP registry in the documentation footer. Yep, we mentioned that memory and storage improvements, voice and

45:48

real-time separation. So, you can see it's it does kind of a does what I ask. I would need to spend some time to actually format this a little bit better, make it a little more readable. But again, I wouldn't actually interact with it

46:00

through this. I would want it to just send me a telegram message, which would be pretty easy to wire up. But let's look at how this workflow actually works. When looking at master workflows, I always like to start at the bottom and

46:11

kind of work my way up. So this workflow first gets hacker news articles, summarizes master PRs, and combines them. I could actually just run these two in parallel rather than sequentially. That would actually speed up the whole workflow. But, you know, depending on a, you know, my open AI

46:29

rate limits and all that, you wouldn't want to run too many in parallel. This would probably be fine, though. But let's look at these different steps. So,

46:36

workflow is just a collection of steps. This one loads in my personal assistant agent, creates this prompt, which is fetch the tops 20 stories from Hacker News. after receiving it only return stories that fit into my interests. Here are my interests. Return a maximum of five. And then I call agent.generate

46:56

which will just run it. You know before you notice I called agent.stream when it was actually streaming to telegram. This

47:01

one I'm just calling generate which is don't stream the results. Just wait until it's all done and then send it back. So there's multiple ways you can kind of like actually talk to agents programmatically. And then I just return

47:13

that response text. For summarizing master PRs, it's very similar. I'm just calling that agent. I fetch the last 10

47:21

PRs. Sort by date descending after retrieving. Provide a few paragraph summary of what changes are being made.

47:27

Same kind of thing, same format, right? get the last uh get the last uh x number of PRs, summarize it, return the response text, and I just have a step that kind of combines that into one message, which then I would probably have a step that sends it to my Telegram bot. So, it actually just pings me when when this

47:48

thing is run, but pretty uh pretty straightforward. So the next steps that I would do is maybe run it on cron or there's some node scheduling tools that you could set up which would allow you to basically set a timer of when you want this thing to run and it would uh go ahead and trigger this workflow and

48:04

run everything. So with that I'm going to go ahead and we'll call that good on walking through examples. Got a few slides and then we'll open it up for the last 10 minutes to have some questions. I see there's a lot in the chat that I

48:18

have not been keeping up with, but I imagine hopefully uh some on the team have been keeping up with a lot of that for me. But so it's just some final things. Uh some links here. There's our GitHub, our website. Join us in Discord and if you have

48:34

questions, if you're trying some stuff out and you run into problems, we have a pretty uh pretty helpful community. So it's really good place to go if you just have general questions, if you want to talk about building agents, anything like that. You can check out our MCP registry registry. It's actually this link is wrong. It should be mcp-registry-registry, but it should be

48:53

on the footer of a website as uh if the PR was correct. And uh follow me on Twitter or X connect with me on LinkedIn as well. And then as I mentioned before, please give us a star on GitHub. If you did, drop it in the chat. we will pick some, you know, some people will try to

49:12

follow up with you and send you an actual physical copy of the book. If you didn't get a physical, if you don't have a physical copy, there's also a link to the book in the footer and you can get a a virtual copy. But we'll we'll try to follow with a bunch of you and send out some physical copies. And if you do want to try out Monster Cloud, I didn't show

49:29

Monster Cloud today because I just wanted this agent to run locally, but I could deploy this agent to Monster Cloud and actually have it running. So, it's it's more generally available. I don't need to rely on my machine uh being on all the time. But uh that's if you do want access to that, please go and uh

49:47

sign up and we will we're slowly rolling out access to mastercloud. All right, let's go ahead and I'll stop sharing and we will answer some questions and I am going to take a while to uh catch up on the chat. If anyone on the team is here and if there's any good questions, please just unmute and and we can talk them out together.

50:15

There were a lot. Oh, yeah. Go ahead. I feel like I got most of them, but go ahead, Tyler.

50:22

Yeah, I was just going to say same thing. Yeah. All right. So, if anyone else has

50:27

other questions. All right. So, from what I see from the docs, Master provides storage adapters. What if we want to integrate each M master model into our existing

50:38

database. So yes, you can actually uh there are adapters for you know Postgress and a bunch of other providers already. We are adding more. We're working with some other uh some other

50:52

providers. There'll be you know some deeper integration with like MongoDB and a number of others that we're starting to work with. So, if it doesn't exist today, it probably will, but do let us know if there's one that's not supported so we can, you know, make sure that we add that to the list of things that we're going to make sure we add in the

51:13

future. Um, okay. So, can you please talk about memory in depth a bit? How

51:19

would you set up memory so the agent can serve user for years and learn about the user at a better understanding of what the user wants? I'm gonna actually Tyler if you're here do you want to answer that memory question or at least maybe it's kind of it's kind of a tough question but maybe provide a little guidance. Yeah it is. So so the tricky

51:38

part is like the context window limits right. So um we have like three main features for memory um which is the conversation history that's just a linear history starting from now going backwards. That obviously isn't going to cut it right because years that's way too many messages. Uh so we also have a

51:55

feature called semantic recall which does rag on all the new input user messages against all the previous messages. So it'll kind of rag uh like it'll do like a vector query search on all the old messages and then put any relevant ones in the context. And then we also have a feature called working memory. So it's kind of like a state

52:15

store in a way for uh an agent to store any relevant info over time. it just has one copy of that that it can kind of upload with like you know information about the user like uh you know any events that you talked about things like that. So yes good good answer. Uh another one is was there multi- aent configuration in

52:40

this example? No, there wasn't in this example. But in the original the way I was originally going to architect it, I was going to actually use different agents for different capabilities. Have one be an email agent, have one be my

52:53

social media manager, and it would be pretty easy to wire that up. And the nice thing about splitting it up that way is, you know, that um they you can write the system prompt for that specific agent. So I could be very detailed on just how I want you to manage my email, how I want you to manage, you know, writing social media posts with maybe examples of like past posts and of what my style is. Um, and

53:14

then I would probably have one kind of supervisor agent that would use tools to interact with those other agents. So you can think of that I would interact with the supervisor, it would call the tools. If it, you know, if it's a request about email, it sends it to the email agent. If it's a request about social media, it sends it to social media agent. The

53:31

challenge with that approach is it adds a little bit extra latency. It's a was a little more complicated. So, I didn't want to use that for this example because, you know, I just wanted to show how simple it was to just add MCP uh servers and add all these different tools. But, you could certainly wire it up that way. And if I were to build something more complex, that's probably

53:49

how I would do it, but you'd have to eat a little bit of that extra latency cost because you're making multiple LLM calls. You're kind of passing messages around. But it would much it'd be much more accurate and give you a much higher level of reliability. All right. Uh let's see.

54:06

Got a few more questions. How might the an app consolidate responses from multiple MCP servers? This one. Yeah,

54:14

this one is like it's definitely not obvious. I could think of a couple different ways to do it. If you had a couple different calendars, you'd almost want Yeah, you there's a couple ways I could see doing it. One, you could be very specific in your system prompt that you need to get responses. If you're

54:32

looking up at calendars, look, use these specific tools to get all get events from all calendars and combine it in this format. Uh but now you're reliant on the LOM to do that. So another way could be if you would almost create you know a meta tool which could be maybe a workflow and that workflow would go out and actually go out to each calendar and get events for you know specific date

54:58

ranges or whatever and then you have a combined step in the workflow which combines it into one you know event schema and returns that back to the agent. So something like that could also work if you wanted to be more deterministic. You're going to get better results if you would do the second approach, but it's going to take a little more work. You could you'd

55:16

probably if you didn't have a lot of tool calls, the agent would probably do a good enough job for like definitely demo purposes just doing it itself, but it might break down at larger scale. And yes, we can call workflow using an agent. It's actually it's a few lines of code. So actually have maybe

55:41

might actually have that. Let's see. I have that handy. Maybe

55:52

not. Yeah, I don't have that. I thought I had an example of it. Yeah. So, something like this is close to what you need. I'll just post

56:06

in the chat. So, can you can you call a workflow using an agent? It'd be this is not going to be formatted well, but something like that I posted in the chat of just you basically need to just hold on one second. Yeah. And we also have in the

56:30

pre previous workshop which is on GitHub April I think it's April 3rd there's examples of calling work workflows or agents from work workflows from agents agents from workflows probably both. Um but in this example I'm using I create a tool and it gets a workflow and it runs a workflow. Um okay so we have a couple

56:49

more minutes. Where is rag hosted? Do you have your own instance? I guess Abby, you want to respond to that one?

57:00

Um, in the in the sense of we do not host rag for anyone. Um, we give you the tools to build your own rag. So you could I mean like rag system. So you'll

57:12

have your vector DB, you have embedding protocols, you have the workflows to sync or index data. You could build a rag instance that you know you can serve, but we have the building blocks for one. We're not one. If you want to

57:24

use a rag provider, um, instead there's a really good company called raggy.ai. Um, if they have a rag hosted thing, which is dope. Maybe only good

57:36

for people who are actually serious about rag and are going to go with it. So, if you're just playing around, just do it locally and have fun. Yeah. So, we got to give you the tools out of the box that where I said before, we're kind of opinionated and give you good sensible defaults. So yes, we do

57:51

give you uh like lib SQL built in. If you deploy it to Maestro cloud, we kind of just it it works just like it works locally, but you could also consider maybe using PG vector, maybe using Pine Cone or any other provider for your vector DB, setting up your rag pipelines yourself. So we give you a lot of the

58:10

tools, but ultimately you have the flexibility to kind of architect it the way you want. Okay. What are some tips or recommendations for hitting provider rate limits? Uh

58:24

yeah, that's a that's a good one. Uh there's a couple different like tips we've we've heard like a key rotation. Different agents have different keys. Um breaking up your agents using different keys. There's obviously ways you can uh

58:39

increase your limits over time for some of these providers, but that usually involves, you know, paying more money or getting to a different tier or level. But it's kind of those two things. either like getting you can get to different levels where they they'll raise your limits, but you can also kind

58:52

of use multiple keys and spread it out. So, because typically the rate limits are per key for the mo for the most part when in some providers, it might actually mean you have to have different accounts. There the same strategies we've been using our whole careers if you've been doing this a while to call third party

59:13

APIs that have limits apply, right? you're going to be doing something in your own application to make sure you don't screw your users over based on rate limits. So, I don't know, just think of all the APIs you used to use that always rate limited you and use the same solutions. Yeah. So, I see some questions

59:39

here. Yeah. Can you create MCP servers out of master agents soon?

59:46

Not yet. Uh yeah, there's a whole bunch of questions. There's So we are basically at time and there's a lot of questions that we didn't get to answer. So if you do drop into our Discord, we'll try to answer them. Uh some other

59:59

questions, maybe we can do one or two more. We do have, you know, I would look at our rag docs. We have some pretty good rag examples, Larry, to kind of answer your question on h how to how to do that. Uh how does human in the loop work? We

1:00:18

did a workshop last week which the code is I think it's the April 3rd you repo in that shows kind of like suspend resume in workflows. So that if you're looking for how human in the loop works. We also have examples in our example page I believe for how to do suspend and resume with workflows. Looks like Abby and thanks Brad for jumping in answering the

1:00:41

workflows question. And we are at time. So there's a whole bunch uh whole bunch of other questions we didn't get to. So sorry we didn't get to everything, but as I said before, if you drop into Discord, uh people from the

1:00:53

team will try to answer those questions and uh provide you more information. Thanks everyone for attending. We will send out a recording of this probably in a couple hours. And so you'll get the recording, you'll get

1:01:05

the links to the slides, and you'll get the link to the repo, which is already up on the MRA-ai organization. You can find it, but I'll send it in the email as well. So, thanks everybody. Have a great day.

Workshop Hosts

Watch Recording

YouTube