
Today is YC demo day and we're excited to announce the release of our new book: Principles of Building AI agents. While we've been giving print copies away to attendees, the digital version is available to everyone.
The book covers everything you need to get started building AI agents and applications, such as: the basics of choosing a model, prompt engineering 101, building your first agent, workflows and evals, and even serverless deployment.
Here's a glimpse at the foreward, told directly in my (Sam's) voice. It gets at why we wrote the book:
Foreward
For the last three months, I’ve been holed up in an apartment in San Francisco’s Dogpatch district with my cofounders, Shane Thomas and Abhi Aiyer.
We’re building an open-source JavaScript frame- work called Mastra to help people build their own AI agents and assistants.
We’ve come to the right spot.
We’re in the Winter 2025 batch of YCombinator, the most popular startup incubator in the world (colloquially, YC W25).
Over half of the batch is building some sort of “vertical agent” — AI application generating CAD diagrams for aerospace engineers, Excel financials for private equity, a customer support agent for iOS apps.
These three months have come at some personal sacrifice.
Shane has traveled from South Dakota with his girlfriend Elizabeth, their three-year-old daughter and newborn son. I usually have 50-50 custody of my seven-year-old son and five-year-old daughter, but for these three months I’m down to every-other- weekend. Abhi’s up from LA, where he bleeds Lakers purple and gold.
Our backstory is that Shane, Abhi and I met while building a popular open-source JavaScript website framework called Gatsby. I was the co- founder, and Shane and Abhi were key engineers.
While OpenAI and Anthropic’s models are widely available, the secrets of building effective AI applications are hidden in niche Twitter/X accounts, in-person SF meetups, and founder groupchats.
But AI engineering is just a new domain, like data engineering a few years ago, or DevOps before that. It’s not impossibly complex. An engineer with a framework like Mastra should be able get up to speed in a day or two. With the right tools, it’s easy to build an agent as it is to build a website.
This book is intentionally a short read, even with the code examples and diagrams we’ve included. It should fit in your back pocket, or slide into your purse. You should be able to use the code examples and get something simple working in a day or two.
Getting the book
The book is available as a download to everyone online.