Twice, he showed up before the room filled.
Most mornings the best part of Sam Bhagwat's job is logging into Discord. Not the funding, not the press, not the GitHub star count climbing past twenty-four thousand. The Discord. People he has never met, asking for features and pointing out where his framework falls short, all of them genuinely thrilled about software. "Everyone's excited about technology again," he says, "and we have the tremendous luxury of working on something we care about with folks we enjoy working with."
That framework is Mastra, an open-source TypeScript toolkit for building AI agents - the autonomous, tool-using programs that the entire industry spent 2025 trying to ship. Mastra pulls millions of downloads a month. It graduated from Y Combinator's Winter 2025 batch. In April 2026 it closed a $22 million Series A led by Spark Capital, pushing total funding to roughly $35 million. Bhagwat is the founder and CEO, and if the trajectory feels familiar, it should. He has done this before.
A decade earlier his name sat on a different framework that hundreds of thousands of developers reached for: Gatsby, the React-based engine for fast websites. It raised around $50 million, grew to roughly $5 million in annual revenue, and was eventually acquired by Netlify. Two frameworks, two eras of the web, the same instinct - arrive early, hand developers something good, and let the community do the rest.
"We're building Mastra, a TypeScript AI framework for the next million AI developers."
The pivot hiding inside the product
Mastra did not start as a framework. Bhagwat and his co-founders - Abhi Aiyer and Shane Thomas, both Gatsby veterans - set out to build an AI-powered CRM. Somewhere in the construction they ran into the same wall over and over: the available AI tooling was built for Python, and the developer experience for TypeScript people was thin. The interesting problem was not the CRM. It was the missing layer underneath it. So they put down the application and picked up the infrastructure, which is a very particular kind of discipline - killing the thing you set out to make because the thing you needed to make it is more valuable.
The bet underneath Mastra is a language bet. Most AI frameworks assume you write Python. Bhagwat assumes the next million people building agents will be the same web developers who already write JavaScript and TypeScript every day - the front-end and full-stack crowd, the people who shipped on Vercel and Netlify. Give them agents, memory, workflows, evaluation, and observability in the language they already speak, and you do not have to convince them to switch stacks to join the AI wave.
Build in public, then write the manual
When Mastra launched, Bhagwat did something most founders only talk about. He narrated it. Day by day on X, under the handle @calcsam, he posted "day 5 at Mastra," "day 7 at Mastra," each thread describing exactly what shipped - an OpenAPI spec writer here, the first version of agent memory there, short-term working memory that tracks context with XML-like tags. The product grew in the open, and so did the audience watching it grow.
Then he wrote the book. Literally. "Principles of Building AI Agents" came out in 2025, announced around YC demo day, and it spread the way good developer documentation does - by word of mouth among people who needed it. One fellow YC founder called it "the most popular book in San Francisco." The second edition arrived in May 2025: 133 pages, code examples, diagrams, and a deliberate refusal to lean on hype or buzzwords. The book grew out of whiteboarding sessions with people actually building agents, which is to say it was reverse-engineered from real confusion rather than imagined from a marketing brief. He gave it away free as a PDF even while it was catching fire.
"Showing up and logging on to Discord and seeing all the excitement the community has."
Stanford economics, then a decade of rendering faster
The resume reads sideways for a framework author. Bhagwat earned a BA in economics from Stanford in 2011, not a computer science degree. He started as an early engineer at PlanGrid and Zenefits, two Y Combinator companies, before the framework chapters of his career began. In 2015 his friend Kyle Mathews open-sourced a small React-based site generator. Bhagwat joined, and the side project became Gatsby - venture funding, a real company, a place in the front-end canon during the years when "the JAMstack" and "the modular web" were how everyone described where the internet was heading.
He wrote that era down too. "Modular: The Web's New Architecture (And How It's Changing Online Business)" landed in 2022, a first-hand account of headless content, e-commerce, and the performance arms race from someone who had spent years inside it. The pattern is consistent across both his frameworks and both his books: he tends to be in the room while a shift is happening, and then he explains the shift to everyone arriving late.
Why the language matters
It is easy to wave off the TypeScript-versus-Python question as a religious war among programmers, but Bhagwat's case is more practical than tribal. The web's front-end was rebuilt in JavaScript over the last fifteen years. The people who design interfaces, wire up APIs, and ship to Vercel and Netlify already number in the millions, and they already live in TypeScript's type system, its tooling, its deploy pipelines. Telling that population they must learn a second language and a second runtime to add an AI agent to their product is a tax. Mastra removes the tax. Agents, memory, retrieval, model routing, workflow orchestration, evaluation, and observability all arrive as TypeScript primitives that drop into the stack a web developer already runs.
There is a structural lesson buried in his career here, and it is the same one Gatsby taught. Frameworks win not by being the most powerful but by being the most reachable for the people standing closest to the problem. Gatsby met React developers where they were. Mastra is trying to meet web developers where they are, at the exact moment agents stop being a research curiosity and start being a feature every product needs. That timing - early, but not so early that nobody shows up - is the thread running through everything Bhagwat builds.
The agent-web wager
Mastra today is more than a library. It has grown into an ecosystem - an agent framework, observability tools, a studio for collaboration, cloud deployment, and an AI gateway with memory baked in. The company is around four dozen people, remote across the globe, headquartered in San Francisco, backed by Spark Capital, Gradient, basecase and Y Combinator. There is a podcast, "Agent Hour." There is the relentless Discord. There is the steady drumbeat of releases that Bhagwat still seems to find genuinely fun.
What makes the story worth watching is not that an experienced founder raised money for an AI company in 2026 - everyone did that. It is the repetition. The same person who handed React developers a faster web a decade ago is now handing TypeScript developers a path into AI, using the same playbook: open source first, community second, documentation as a product, and a refusal to pretend the work is finished. Gatsby went to Netlify. The question hanging over Mastra is whether the agent web turns out to be as big as the bet assumes. If it does, Sam Bhagwat will, once again, have been early.
Two books, two eras
Principles of Building AI Agents
A 133-page field guide for developers shipping agents - code, diagrams, and no buzzwords. Reverse-engineered from real whiteboarding sessions. Given away free as a PDF, called "the most popular book in SF."
Modular: The Web's New Architecture
A first-hand account of headless content, modern e-commerce, and the web performance race - written from inside Gatsby during the JAMstack years.
Two frameworks, measured
Bars scaled for comparison. Figures from public funding reports and Mastra's own pages.