
Sam Bhagwat
CEO
Sam Bhagwat is the founder and CEO of Mastra. He co-founded Gatsby, which was used by hundreds of thousands of developers. A Stanford graduate and veteran of web development, he authored 'Principles of Building AI Agents' (2025).
Posts by Sam Bhagwat
AI agents for business: what they automate, where they fail
Learn what AI agents for business can reliably automate, where they fall short, how to deploy them safely, and how to test agents in production.
Best AI tools for business in 2026: tested and ranked
Compare the best AI tools for business by category, from chatbots and analytics to agent frameworks, with honest strengths, trade-offs, and pricing.
The AI agent stack: layers, tools, and how to build in 2026
A developer’s guide to the AI agent stack in 2026: models, tools, memory, frameworks, evals, guardrails, and deployment, with real tradeoffs at each layer.
LLM as a judge: how to evaluate LLM and agent outputs at scale
Learn what LLM as a judge is, how to build a reliable LLM judge, avoid bias, and evaluate agent outputs at scale with prompting and calibration methods.
Agent builder: how to build, test, and deploy AI agents
Learn what an AI agent builder is, the core building blocks of an AI agent, and how to build, test, and deploy your first agent to production.
AI agents news: latest developments, adoption trends, and what’s next
AI agents news, adoption trends, use cases, and production challenges. Learn where agentic AI stands and what developers should watch next.
CrewAI multi-agent framework: architecture and use
Learn how the CrewAI multi-agent framework works, how to build and test crews, and how to run production multi-agent systems.
Your open source LLM guide for 2026: models, benefits, and deployment
Compare the best open source LLM models in 2026, how licensing works, deployment tradeoffs, and how to evaluate and run open models in production.
Context engineering for AI agents: a practical guide
Learn what context engineering is, how it differs from prompt engineering, and the strategies for managing context in production agent systems.
Generative AI models: types and how they work
Learn what generative AI models are, the main types of generative AI models, how they work, and how to build and evaluate them in TypeScript.
Generative AI tools: what they are and how they work
Explore the main types of generative AI tools, real examples like ChatGPT and Gemini, and how developers build production apps with models, RAG, and evals
Multi-agent systems: architectures, frameworks, and real-world applications
Learn how multi-agent systems work, compare architectures and frameworks, and see how to build, debug, and evaluate multi-agent AI systems in production.
Long-term memory for AI agents: what it is and how to build it
Learn what long-term memory means for AI agents, why larger context windows fall short, which memory types matter, and how to design persistent retrieval.
LangGraph: the complete guide to stateful AI agent orchestration
Learn what LangGraph is, how its graph-based architecture handles stateful AI agents, and when to choose it over LangChain for complex workflows.
LLM leaderboard: how to read, compare, and use benchmark rankings
Learn how to read LLM leaderboards, compare benchmark scores across reasoning, coding, and safety, and run your own evals to pick the right model.
Embeddings in machine learning: what they are, how they work, and when to use them
Learn what an embedding is, how embedding models work, and how to use embeddings for semantic search, RAG pipelines, and AI agent memory in production.
Guardrails for AI agents: a practical guide for TypeScript developers
Learn how to implement guardrails for AI agents in TypeScript, from input validation and PII detection to tripwires, classifiers, and observability.
AI automation tools in 2026: a practical guide for every use case
Compare the best AI automation tools for workflows, agents, content, and meetings. Honest breakdowns with strengths, trade-offs, and use-case verdicts.
AI hallucination: what it is, why it happens, and how to reduce it
Learn what an AI hallucination is, why language models produce false outputs, and practical techniques to detect and reduce hallucinations.
The 10 Best AI Agent Search Tools (August 2026): Features, Tradeoffs, and Use Cases
This guide compares 10 leading AI agent search tools, explains where each one excels, and helps you choose the right search infrastructure for your next AI application.
The 11 Best Vector Database Providers (August 2026): Features, Tradeoffs, and Use Cases
This guide compares 11 leading vector database providers, explains where each one excels, and helps you choose the right retrieval infrastructure for your next AI application.
AI assistants: how they work, what they do, and where they’re headed
Learn what AI assistants are, how they work, the key types and use cases, and how they compare to AI agents. Practical guide for teams building with AI.
Agentic AI tools: a complete guide for teams building with autonomous AI
Learn what agentic AI tools are, how they differ from traditional automation and generative AI, and how to build and evaluate autonomous AI agents.
Announcing Mastra Factory
From issue to production, run by agents.
Announcing Trace Intelligence
Group traces into clusters.
Best AI agents in 2026: tested, compared, and ranked
Compare the best AI agents in 2026 for reasoning, coding, research, enterprise workflows, and multi-agent systems, with practical selection guidance.
AI Agent Memory: Persistence, Layers, and Tradeoffs
A definition of AI agent memory, including persistence, layers, and tradeoffs in Mastra.
The 11 Best AI Agent Integration Platforms (July 2026): Features, Tradeoffs, and Use Cases
This guide compares eleven leading AI agent integration platforms, explains where each one excels, and helps you choose the right integration infrastructure for your next AI application.
Agent swarm: what it is, how it works, and how to build one
Learn what an agent swarm is, how multi-agent architectures work, and how to design, build, and observe production-ready agent swarms in TypeScript.
Best LLM for coding: a developer’s guide to top models in 2026
Compare the best LLMs for coding in 2026 across performance, context, cost, privacy, and production fit, with practical model-selection guidance.
LLM evaluation: frameworks, metrics, methods, and best practices
Learn how to evaluate LLMs with proven metrics, benchmarks, LLM-as-a-judge methods, and agent evaluation strategies for development and production.
Trace ID explained: what it is, how it works, and when to use it
Learn what a trace ID is, how it differs from a correlation ID, and how to implement distributed tracing with OpenTelemetry in your services.
AI agent examples: Real-world use cases across industries
Explore real-world AI agent examples across finance, healthcare, retail, and more. Learn agent types, production patterns, and how to build your own.
Generative AI vs predictive AI: What’s the difference?
Your guide to generative AI vs predictive AI: how each works, real use cases, tradeoffs, and how to choose the right approach.
The 6 Best AI Agent Web Data Platforms (July 2026): Features, Tradeoffs, and Use Cases
This guide compares six leading web data platforms for AI agents, explains where each one excels, and helps you choose the right web retrieval infrastructure for your next AI application.
AI agent orchestration: patterns, architecture, and implementation
Learn AI agent orchestration patterns, architecture, implementation steps, observability practices, risks, and framework choices for production systems.
The 6 Best AI Agent Sandbox Platforms (August 2026): Features, Tradeoffs, and Use Cases
This guide compares six leading AI agent sandbox platforms, explains where each one excels, and helps you choose the right execution infrastructure for your next AI application.
How to create a chatbot: a complete guide for developers
Learn how to create a chatbot with LLM APIs. Covers the request loop, prompt design, tool calling, RAG, deployment, and production observability.
Workflow orchestration: a complete guide
Learn what workflow orchestration is, how it compares to automation, common patterns like DAGs and state machines, and how to implement it for AI agents.
The 6 Best AI Agent Frameworks (July 2026): Features, Tradeoffs, and Use Cases
This guide compares six leading frameworks, explains where each one excels, and helps you choose the right foundation for your next AI application.
Multi-agent orchestration and how it works
What multi-agent orchestration is, the four workflows Anthropic names (orchestrator-workers, prompt chaining, parallelization, routing), and runnable Mastra code for each, with an interactive explainer.
The 6 Best AI Agent Browser Platforms (July 2026): Features, Tradeoffs, and Use Cases
This guide compares six leading browser platforms for AI agents, explains where each one excels, and helps you choose the right browser infrastructure for your next AI application.
How to Build an AI Software Factory with AI Agents in TypeScript
A governed, observable system where specialized agents own the repetitive work of software development, and humans own the judgment.
The 8 Best AI Agent Email Providers (July 2026): Features, Tradeoffs, and Use Cases
This guide compares eight leading AI agent email providers, explains where each one excels, and helps you choose the right email infrastructure for your next AI application.
What is LLM observability? A span-by-span breakdown
LLM observability records what an agent did at the level of individual model calls and tool executions. This reads the trace of a live agent run span by span from storage, shows what a hallucination and a failed tool call look like, covers where the OpenTelemetry GenAI conventions stand in mid-2026, and walks the four dials that control tracing cost in production.
What are durable AI agents? How state persistence and checkpoints survive a restart
A long-running agent is a durable record that short-lived processes take turns with. This walks through why a context window is not a persistence layer, the three granularities of persistence, how Mastra checkpoints a run to JSON and resumes it on a fresh machine, why a worker can't judge its own work, and the two kinds of state a durable agent has to keep.
What is the Agent2Agent (A2A) protocol? How AI agents delegate work
A2A is a shared standard for one agent to hand work to another on a remote server. This walks through its five-object data model, the agent card, the eight task states, the three ways to watch a task, how trust is decided before work is sent, and how Mastra implements both sides on the official @a2a-js/sdk.
Agent memory: types, techniques, and implementation guide
Learn how agent memory works, from short-term buffers to observational recall. Explore types, engineering patterns, and production implementation strategies.
Agentic workflows: how they work, key components, and how to build them
Learn how agentic workflows work, what components you need, and how to build one step by step, including observability, testing, and real-world use cases.
AI agent framework: a practical guide to choosing and using the right one
Compare AI agent frameworks, learn key selection criteria, and explore TypeScript patterns for agents, workflows, memory, and observability.
AI agent hosting: options, setup, and deployment for production
Compare AI agent hosting options from serverless to containers. Learn how to deploy, observe, and scale TypeScript agents in production.
AI agent observability: a complete guide for production teams
Learn how AI agent observability works, its core pillars, best practices for tracing and evals, and how to monitor agents reliably in production.
AI agent workflows: a complete guide for developers
Learn how AI agent workflows work, common patterns like routing and parallelization, and how to build, evaluate, and monitor agentic workflows in production.
AI agents: what they are, how they work, and how to build with them
Learn what AI agents are, how they reason and act with tools, the five classical types, and practical guidance for building, testing, and deploying your own.
AI workflow automation: how to build reliable pipelines that handle complexity at scale
Build AI workflow automation that handles complexity at scale, with branching, conditions, and human-in-the-loop checkpoints that adapt where rules can't.
LangChain alternatives: the best frameworks for LLM development in 2026
Compare the best LangChain alternatives for 2026, from AI agent frameworks and RAG tools to enterprise platforms and direct LLM access.
RAG chatbot: a complete guide for TypeScript developers
Learn how to build a RAG chatbot in TypeScript, from embeddings and chunking to retrieval, evals, and deployment with Mastra.
RAG framework guide: how retrieval-augmented generation works and which tools to use
Learn how a RAG framework connects LLMs to external data. Covers RAG architecture, tools like LangChain and LlamaIndex, and how to build a pipeline.
Announcing Mastra Harness
Build interactive AI agents with multiple modes, persistent threads, tool approval, and model switching.
Anatomy of a harness: building a coding agent that can run for hours
How Mastra Code's harness wraps the agent loop: conversation-as-channel, event-to-display-state translation, human-in-the-loop tools, observational memory, subagents, modes, and an ordered tool-approval chain.
Building Low-Latency Agents That Help Humans Respond on Live Calls
The engineering and context principles Micro uses to deliver sub-3s answers on live calls with Mastra.
The Rise of Multi-User, Multi-Channel Agents
A look at how Mastra solves the multi-user agent problem: concurrency, memory scoping, tool approval, and per-thread sandboxes.
Announcing Agent Builder
Your internal agent platform.
Announcing Mastra Observability
Production observability for every Mastra project.
Announcing Mastra Platform
Studio, Server, and Memory Gateway. Everything you need to run your agents at scale.
We raised a $22M Series A to help every developer build agents
Mastra raises a $22M Series A led by Spark Capital, bringing total funding to $35M. Plus: the Mastra platform launches today.
Announcing Mastra 1.0!
APIs are locked, server adapters are the new default, and we've shipped thread cloning, composite storage, AI SDK v6 support, and more.
Mastra UI Dojo: Choose your frontend
We have a new UI dojo. It's a collection of working examples showing Mastra agents integrated with the most popular AI UI frameworks. Try it out at ui-dojo.mastra.ai.
Announcing our new logo and brand
We're excited to announce the launch of our new logo and brand for Mastra. We believe developers deserve beautiful tools that match the sophistication and dynamism of the systems they're building.
Announcing our second book: Patterns for Building AI Agents
We're excited to announce the release of our new book: Patterns for Building AI Agents. This book helps you take your agents from prototype to production.
Announcing Mastra v1 beta
Mastra v1 is now in beta, marking the production-ready release of the leading TypeScript framework for AI agents, trusted by top global companies.
Introducing Mastra’s Agent Studio
We've renamed Playground to Studio and it's now shareable with your team.
You can suspend/resume workflows in playground
Mastra workflows now support suspend and resume in Playground. You can also use the new resumeStream API to close streams on suspend and resume them later.
Workflow State: Share Data Across Steps
Workflow state lets you share values across steps without threading them through every `inputSchema` and `outputSchema`.
Announcing our $13m seed round from YC, pg, Gradient, Amjad, Guillermo, Balaji, and 120+ others
Mastra secures $13m from a coalition of legendary investors to fuel AI agent development and production.
Migration Guide: VNext to Standard APIs
Learn how to migrate from Mastra’s VNext streaming methods to the new standard APIs, with details on renaming, compatibility, and key differences between AI SDK v4 and v5.
Model fallbacks: Your safety net for production AI
Model fallbacks ensure your application stays online by automatically switching to backup models when your primary provider fails.
Mastra now supports AI Tracing
Mastra introduces AI Tracing: filter out noise and use multiple observability platforms.
The next evolution of Mastra streaming
We're making our new streaming architecture the default experience starting from `@mastra/core v0.19.0.`
Building agentic copilots with CopilotKit and Mastra
Learn how to build interactive, real-time agentic apps using CopilotKit as a frontend for Mastra agents.
Introducing Output Processors
Introducing output processors: the gatekeepers that sit between your language model's response and your users.
Introducing Cloneable Scorers
Cloneable scorers let you copy, customize, and extend Mastra’s evals into your project.
Introducing Mastra's improved agent orchestration with AI SDK v5 support
Mastra now controls the agent loop and tool calling with increased orchestration capabilities—while maintaining backward compatibility with AI SDK v4 and v5.
Mastra is now Apache 2.0 licensed!
Mastra is now licensed under Apache 2.0, making it easier for everyone to use, modify, and contribute.
Building an AI Research Assistant with vNext Workflows
A deep dive into building MastraManus, an AI research assistant powered by Mastra's vNext workflows.
Announcing the second edition of Principles of Building AI Agents
We're excited to announce the release of v2 of Principles of Building AI Agents.
Announcing Mastra 0.10
Deploy Mastra anywhere
AI prompting techniques
Learn about effective AI prompting techniques, including types of prompts, handling their output, and evals.
FlashGenius: instantly generate flashcards on any topic
How we vibecoded Flash Genius, an instant flashcard generator, in 1 hour
Dynamic Agents: Inserting Runtime Context in Mastra
Mastra's dynamic agents provide a powerful way to handle context in AI applications, without exposing sensitive information to the LLM or relying on globals.
AI with JavaScript in 2025
A dive into four leading open-source JS AI libraries: Vercel AI SDK for model routing, Mastra for agents and workflows, Langfuse for observability, and Stagehand for web automation.
Choosing a JavaScript Agent Framework
When choosing a JavaScript agent framework, consider the needs of your project and the team's expertise. Mastra and LangGraph.js are two leading options.
Introducing Mastra's MCP Registry Registry
Mastra's MCP Registry Registry simplifies the process of finding MCP registries.
Mastra Changelog 2025-03-20
Mastra MCP documentation server, AgentNetwork updates, and more
Mastra Changelog 2025-03-14
Major workflow enhancements, new Mastra Voice features, and more
Announcing our new book: Principles of Building AI agents
Mastra founder Sam Bhagwat is excited to announce the release of our new book: Principles of Building AI agents. This book is a guide for developers who want to rapidly build AI applications.
Building a Code Assistant with Large Context Windows
How we used Mastra and Gemini Flash 2.0 to build a natural language interface for code repositories
Mastra is moving into beta
Mastra moving into beta
Solving the hardest problem in computer science with LLMs
How we use LLMs at Mastra to design clean, intuitive APIs by improving naming, structure, and developer workflow.
Mastra Changelog 2025-02-10
Major updates including AI SDK integration, optimized bundle size through subpath imports, and enhanced storage layer with tracing capabilities
Mastra Changelog 2025-01-31
New Memory API, speech providers, vector store integrations, and core improvements
Multi-Agent AI Travel Planning with Mastra
A demo using Mastra to show how multiple AI agents can work together to plan travel itineraries.
Mastra Changelog 2025-01-24
New `mastra build` command, evals in dev playground, new model support, and an abstracted deployer package
Introducing TTS in Mastra
Use Mastra's TTS system with OpenAI's speech models to create text-to-speech applications, covering voice selection, audio generation, streaming capabilities
Mastra Changelog 2025-01-17
Mastra's changelog for Jan 10th, 2025 through Jan 17th, 2025
Building a NotebookLM clone with an agent orchestrator
A technical guide showing how to build a NotebookLM clone that transforms documents into AI-generated podcasts using Mastra's agent orchestration, Pgvector vector storage, and LlamaIndex for content processing.
Mastra Changelog 2025-01-10
Mastra's changelog for Dec 27th 2024 through Jan 10th, 2025
A framework for the next million AI developers
The next generation of AI products will be built with Apis written in Typescript
AI engineering, two years later
What's changed in AI engineering over the last two years: models, agents, knowledge, tracing, evals