Agents are fundamentally web applications that integrate multiple data sources and perform actions, making TypeScript more suitable than Python for agent development due to its token efficiency, ability to build both backend and frontend in one language, and superior performance in navigating websites and executing actions. The rapid evolution of AI models requires frameworks to be adaptable, with roadmaps limited to 2-3 months ahead, and organizations should prioritize fixing procurement processes before allocating large token budgets to engineers.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Agents belong in TypeScript, not Python | Sam Bhagwat, CEO of Mastra
Added:Hey everybody, my name is Erica and welcome to the browserbased podcast. We are here at AI Engineer Worlds Fair in San Francisco and I am with Sam Bwat from Mastra. Um Sam, could you tell me a little bit about you and what Mastra does?
>> Yeah, excited to be here. We love browserbased. Um so um I'm Sam. I'm the co-founder CEO of Mastra, which is a Typescript agent framework. Um harness framework now too. uh um you know we were sort of one of the lead you know we're one of the leading um agent frameworks people use us to build you know customerf facing agents people use us to build internal agents people use us to build sort of like developer agents like AI SRRES um we we integrate with browser base a lot of times the agents will browse the web you know using using browser base as well >> so cool I first met you when you got into Y cominator which I guess was only a year and a half ago feels like it's been a century >> time flies so fast in in this world.
Eric, >> dude, it does. And so I met Sam. He was like, "We're building a TypeScript agent framework. My co-founders and I are like some early TypeScript guys and like people need a better way to build agents." And I was like, "I love it. Let me be friends with you." And then I saw him six months later and he was like, "I wrote a book. That's what we have in our hands."
>> We two books actually. So >> this is new.
>> This is the this is the first one.
Principles of building AI agents. Um and then we recently released patterns of building AI agents. So this is how you build an agent and that's how you get it into production.
>> I love the sound of that. I feel like I've been spending a lot of time with our customers recently talking about like what exactly does it take to get agents into broad? So I have a couple of questions for you particularly like when you were building the framework and releasing this book and sort of starting your company like what were some early findings about like how people were building agents before and I guess like some of the gaps and areas you guys felt like you really needed to cover and fix in building sort of your first type framework. So, so early on the you know the perception and when I say early on I mean you know late 2024 this is like not actually that long ago but in late 2024 the perception was very much that uh Python was the way to you know do AI all AI stuff and you know I think that's very true for MLE and any you know anything that requires lots of like data munching um but agents were really just starting to emerge at that time and um as we started to build agents uh just you know we were working at some on something else at the Um it it felt to us very much like agents, you know, were like kind of like building a web app.
You know, you're munching around data from like a lot of different sources.
You're like integrating a lot of things together. Uh and then you were sort of building something that could take action and like you know, so so we were kind of sort of OG JavaScript TypeScript people. I was the co-founder of Gatsby.
My co-founders Shane and Abby were worked at at Gatsby um with me. Um and um and it's just like gosh, why? In fact, if you're looking for something that's like really good at like gluing together APIs and like a, you know, and munching around data, like you should really be building in Typescript, right?
Um, and and and it was just crazy to us that the consensus was that like no, you should just use Python for like not not the people like us don't want to use Python, right? Why?
>> Well, I mean like you know the the advantage is that like Typescript is more information token dense right than than Python in the sense of like what do what does replet you know builds? What does what does what does the replet agent write? What does a lovable agent write? Well, it's writing TypeScript right because you can build the back end, you can build the front end, you can do it all in one language. You don't have to like it's sort of like more token dense. more token efficient in many ways like like agent like I mean TypeScript just passed Python as kind of a on on the GitHub sort of like stat boards as like the most used uh programming language like I I think like the age of agents is actually like a renaissance for like and a continued growth for TypeScript as opposed to like other languages right >> I think that that makes a lot of sense I live with a data engineer who >> is not a JavaScript and TypeScript fan he's definitely long Python as a But what I think even he's found working at a startup and having to build agents in fact >> an agent using the Mastra typescript framework and with Stan our agent framework sort of inspired by master in a lot of ways >> he's like no typescript is better for this for navigating like crazy front-end websites for taking action like Python is really great at observing Python is really great at data and modeling Python is not really built for computer use particularly which I think is really fascinating and what has been really fun about working at browser base is like learning about sort of where each programming language has like huge sort of advancements or like legs up on the others when it comes to like building better browser agents.
>> Yeah, I mean absolutely and and like the agents are like so much of what we're doing is like browsing the the web to see like hey like what >> can I like perform an action on behalf of a user? Can I get this piece of information? Um and and like ultimately like agents are only as good as the actions they can take and the data that they have. Um and as as we've seen, you know, it's interesting because like a lot of teams sort of like you know they'll building agents and it will take time to productionize agents. They'll have to go through early rollouts.
They'll have to you sort of make sure it's not they're not ending up paying their whole ARR to anthropic, right? Why does this user cost us thousand dollars per month to serve, right? How can we like do some prompt engineering? How can we do some context engineering? How can we like maybe switch to some cheaper models? How can we make this thing run in a loop less? Um, you know, like like people spend a lot of time optimizing and and like but like a lot of it is about the actions and a lot of it is about the data that that the >> that makes a ton of sense. And I think for like the really big enterprises that are like trying to ship agents into production, they have so much data. They have so many users. They probably are running quite complex tasks. Like that is going to create some crazy token creep. like >> they don't want to spend all of their like they don't want to go to their quarterly earnings report and be like >> so we built an AI product and we also spent more money than we ever have ever.
>> It's so interesting to watch really the vibe shift in the last you know four to six months from you know like we're just giving our engineers unlimited token budgets to wow we spent our whole 2026 budget and we don't actually see a productivity gain. One of the things that I will also say especially you know like obviously we were both at you know startups and start but like one of the things we observe at some larger companies is that the companies that are the mo that give their engineers the largest token budgets but like at the same time it might take 3 months to get something in through procurement. And one of the lessons of like running an organization is that you know if you're trying to solve things and make things more efficient that are not the bottleneck you're not actually making your organization more efficient. You should start by thinking about as an organization, you know, hey, like maybe you should fix your procurement process before you give your engineers, maybe give your engineers like, you know, $1,000 or $2,000 a month of tokens.
That's fine, but don't give them like $20,000 a month tokens before you fix your procurement process, right? But what's funny about procurement actually is that it is a widely known manual based in the email checking out websites looking at security docs process that can absolutely be done by an agent.
>> Absolutely.
>> In the browser. So I think that that's really funny uh and so true. And I like >> well she told me this patterns for building a agents book is about like what it takes to run agents in production. And like what would you say are some of the like big themes in this book? And like I know you've been working with customers at Mostra like what are some big takeaways that you've learned from your customers that maybe have like informed what you put into this book?
>> Yeah, I mean there there's sort of a agents have an interesting development life cycle and often you know the engineering work of the agent is up front. Maybe you don't really need to write so much of a spec. you can kind of like, you know, almost figure out how to get it working. But then then the then you sort of start running into the hard problems of like how do I make sure my agent is accurate? How do you how do I worry about, you know, the cost of running this agent at at scale? What are like the weird types of edge cases like the different types of queries that people might and and like those are something where like it's nice to be able to like create a set of evals which is almost more of like a product brain type thinking than like tradition and and like and then be able to have like a sort of like boil it down into like a single number on a couple of single numbers on accuracy and cost. Make the accuracy number go up, make the cost numbers go down. Um meanwhile while you're doing that you're sort of expanding it to a wider and wider audience and and like again this these are mostly concerns for like external facing customer agents. If you're if you're building an AIS you're a little bit more able to sort of like okay cool I can I can kind of test whether this works because I'm kind of the user >> tinker a little more like >> yeah it's I would say it's like inherently I mean AISR sort of high risk but inherently lower risk because it's not touching your customers. It is touching like the most important thing in your codebase >> which is instant response and reliability.
>> Yeah. Yeah.
>> I would say but but it is different like you are your own customer. The people you're serving are your teammates and like it is kind of a very different sort of like framework for your mind. Like when you say like from like an eval product thinking perspective like your the set of eval benchmarks and like requirements that you set for something that isn't going to be exposed to your customers >> is is really different. What have you learned? Do you guys have like a benchmark that you've created >> for certain things?
>> We the the benchmark suite we mostly rely on you know certain like we we longme eval um other sort of like you know the co code writing and and execution. Um we we haven't like we haven't created our own benchmarks. I the reason I ask is because like we primarily service our partners Deep Mind and Microsoft on eval minds web and web voyager and we found like sometimes the eval can be like a little bit >> reductive like they're they're not really testing for perfect accuracy because they're like a set of tasks that aren't included in those benchmarks and so we actually just recently created one. So I was wondering if that was something that you guys have been thinking about because it kind of gives us better control on understanding the performance of the model. We've thought about the the first the first sort of set of evals that we're probably going to make are a set of um are are a set of evals for sort of how well agents are able to write monster code because those are sort of like a as you know as sort of like closely tied I mean most of the most of the time like right now we're just hearing increasingly like well why did you choose monster? Oh, I asked I asked Claude code, you know, or I asked Codeex and Codeex just started writing, you know, the MRAA for me. And so like, you know, like we would like to make given that that's we're hearing that increasingly much, we would like to make sure that the that, you know, they're using the most up-to-date APIs that they're able to, you know, complete the tasks as quickly as possible in the most token dense uh, you know, way as possible. We've done a certain affordances as well like we'll like download a local copy of our docs alongside the framework uh for example so that like you that way you can get the version of the docs that's versioned for >> right >> your you know for for like the version that you have installed in case an API has like changed >> right and then it's like the harness will >> like the agent will just read your file system which I actually think is very smart and I think that's also something that I like you said that you know cloud codecs are just like oh well they just started writing master code. I'm like that is so crazy to me. I don't even think cloud code was out when you started this company.
>> No, I mean it it wasn't and and and >> that is bananas, >> right? And then there's also an interesting thing and you you guys have probably seen this as well, but like there's a delay between when you release a feature when it gets into the you know then obviously it's available on >> the mind of the corpus later, right? And so like you know like sometimes the agents are like a little bit behind which is okay. you just need to like give them the the tools to get up to date if they're like using a version of your, you know, their pre-training corpus is like a little out of date, you know?
>> So funny. It's it's crazy how that happens like in developer like when you were working on Gaps Gatsby, like that was not something that your team was thinking about. They weren't thinking about how the LLMs would learn about your product so that way it could use your product, promote it, get people to sign up for it on other people's behalf.
>> Like we have a ton of signups coming from agents from >> Yeah. like that are like working on behalf of users at browser base and when we started browser base that was not >> like that like that wasn't happening >> we were working for the signups ourselves you know >> we were thinking about good oldfashioned developer experience >> human person >> how can I build the best API how can I make this the most understandable for and suddenly it's a whole new game and I I think we're adapting to this world but honestly like I maybe we're experts on an older version of the world maybe we're you know >> I don't know well and that's another question that I have for you like how do Do you feel as a CEO and founder running a developer tools company when like the target is constantly moving like the models change fable's back online today everybody so it's like you know the models change the capabilities expand what agents are able to do every 3 to 6 months seems to like have like a step function and improvement like >> how are you building the framework and like roadmapping that to be prepared for advancements like >> we don't you know and I'm curious for how you guys should we we don't make f we don't make uh like road maps more than two or three months in advance, right? Like we we say this is what we're shipping this week, this is what we're shipping this month, this is what we're shipping like in the next two or three months and and like we don't but like we're we're all fire hosted tuned to Twitter. We're we're all sort of just like every model release we're just paying attention to the capabilities like what is possible now that wasn't possible. Um so my talk that my talk yesterday was about um every claw every harness will become a claw and it sort of like laid out this like you know hey you move from an LLM to an agent to like an agent an agent can take actions with like tools and and memory you know then we're moving from an agent to a harness we have like parallel sub aents with clean context windows you know there's like you know then you know moving from like sort of like harness you know a local harness to a cloud harness you get this like always on you have like mobile apps you can text it you know moving from a harness to a claw you have like a heartbeat it has subscriptions. You know, there are these like levels of the agentic spectrum that like we're constantly and like we have to be constantly attuned to how do we help our users. You know, last last year's talk that I did at AI engineer was about agents versus workflows and cost that sounds so outdated, right?
>> Agent versus workflow sounds like very old school.
>> No, exactly. Right. Like and that was, you know, 2025. That was a year ago. And I had this, you know, we were actually like really early in saying like agents or workflows. Why not both? Don't have a holy war of agents versus workflows. You should be and like now that sounds like again like it's ancient times. Well, I would say with regards to that sounding like an ancient times, like when you service all types of customers, like I have we have super fast growing crazy AI native startups like >> do shipping the crazy stuff as our customers and then we have like very old school legacy like storied companies also trying to build and ship agents to production like >> they are thinking more in workflows and that's okay because they have a million other risks and concerns both token cost efficiency sort of like data exposure determinism things that they need to cover >> that really isn't isn't well positioned with where the models are today to service their customers in like a even like harness or claw format. It really does need to be more of a workflow. And so it's it's crazy to me because it does I'm like yeah that totally sounds outdated but also no >> you almost have to like service every part of that stack. It comes back to that quote like the future is here. It's just not distributed evenly yet, right?
Like and and and I think like we we think about Monster as like what we call like a domain complete framework, which is it should have all the primitives you need. So no matter where you are on on your agent journey and it's okay to be wherever you are, you know, we will have if you need agents versus workflows, you know, you can you can have both. And if you need a harness, if you want to build your own cloud code, if you want to build your own cloud tag, if you want to build your own devon, you can do that too. If you want to build your own software factory, if you want to have durable long and agents, you can do that too. And you can like it's you should be able to complete your whole journey of of getting to, you know, wherever you are in that journey, there there should be a a primitive for you.
>> Yes. And I definitely feel like that's why our companies are so aligned and why we've just had such a good relationship with you is because we I feel like are built on the very same sort of foundations which is like what are the primitives that we need to build this product to service anybody who's building anything on the web and that does cover like a very wide assortment of work and needs. It's why we like when we saw you guys come out with Station, we're like this is exactly right. Of course, you have the browser primitive, but you also have an agent that can use the browser and now you you guys also have searched, right? Like it's it's sort of >> and we released fetch. We have a model gateway product and we released an agent harness yesterday.
>> Yeah, exactly. So, we have to cover the whole >> spectrum because everybody needs something different >> and because you're right, the future isn't evenly distributed, which is really crazy. And I would say it's like >> I think something some people here might forget.
>> Yeah. Absolutely. And and like like this is part of dev tools too like you know I ask people like you know well what's the difference between your your nextjs dev server and your you know render or your versel deploy preview right well it's kind of the same thing but it's a local version versus a cloud version you need both right like people in like right dev tool as dev tools like providers and vendors we need to like you know give people like all the different form factors they need like that's yeah >> I totally align with that and I think it makes a lot of sense. Okay, I have time for one more question.
>> Yeah.
>> Um, I've been asking everybody this.
What would you say is your like biggest, most hatery AI hot take?
>> Oo. Um, build agents in Typescript.
>> You heard it here first, people. Do not build agents in Python. Agents belong in Typescript.
>> Yeah.
>> Um, well, thank you so much for coming on, Sam. I had a great time talking with you. It was good. This is so fun. It was really fun.
>> Browser base. Heart master heart.
Browser base.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

One Must Imagine Sisyphus Happy
vlogbrothers
61K views•2026-07-21

Future of Taylor Farms
maighstirtarot5385
11K views•2026-07-21

The Downfall of OnePlus!
techwiser
65K views•2026-07-21

My Friend Locked Up The Engine On His K-Swapped Bug...
boostedboiz
128K views•2026-07-21