Mastra: A TypeScript framework for agents, workflows, and MCP servers
Mastra is the modern TypeScript framework for AI-powered applications and agents.
At a glance
- What is it?
- Mastra is a TypeScript framework for building AI agents and workflows with model routing, human-in-the-loop, and built-in evals. This review covers its architecture, setup, limitations, and who should adopt it.
- Who is it for?
- Adopt Mastra if you are a TypeScript developer building AI agents or workflows that need explicit control flow, model flexibility across 40+ providers, and built-in evaluation and observability. Do not adopt it if you require a permissive single license for all code, because the ee/ directories are source-available under a separate enterprise license that restricts production use.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What Mastra solves and who it is for
Mastra addresses a specific gap in the AI development stack: there is no single TypeScript-native framework that covers the full lifecycle from prototype to production. The README positions it as a framework for building AI-powered applications and agents, integrating with React, Next.js, and Node, or running as a standalone server. The target user is a TypeScript developer who wants to avoid stitching together separate libraries for model access, agent loops, workflow orchestration, memory, and evaluation. Instead of assembling these pieces manually, Mastra bundles them into one package with a consistent interface. The framework is especially aimed at teams that need both autonomous agents and deterministic workflows, because it offers two distinct execution models rather than forcing one approach.
The two execution models: agents and workflows
Mastra gives you a choice between autonomous agents and graph-based workflows. Agents reason about goals, decide which tools to use, and iterate internally until the model emits a final answer or an optional stopping condition is met. This is the open-ended path. Workflows, by contrast, are for when you need explicit control over execution. The README describes a graph-based workflow engine with an intuitive syntax for control flow: .then(), .branch(), and .parallel(). That syntax suggests a declarative way to chain steps, branch conditionally, and run steps concurrently. The key difference is that agents hand control to the LLM, while workflows keep control in the code. This is a meaningful design decision: you can use agents for tasks where the path is unknown and workflows where every step must be auditable and predictable. The trade-off is that you must choose the right model for each task, and Mastra does not blur the line between them.
How Mastra works under the hood
The architecture visible from the README centers on a few core primitives: models, agents, workflows, memory, and evals. The model router connects to 40+ providers through one standard interface, which means you can swap OpenAI for Anthropic or Gemini without rewriting your agent logic. Agents use LLMs and tools, and they can suspend execution for human input or approval. This human-in-the-loop feature relies on storage to remember execution state, so a workflow can pause indefinitely and resume where it left off. That storage requirement is a concrete architectural point: Mastra is not stateless by default. If you want durable pauses, you need a storage backend configured. The README also mentions context management features like conversation history, retrieval from APIs or databases, and Observational Memory, which gives agents a form of long-term coherence. Finally, built-in evals and observability are part of the framework, not add-ons.
Getting started with the CLI
The recommended way to start is with the command npm create mastra@latest. The README even includes a pre-built prompt that an AI assistant can use to scaffold a project. That prompt asks for a project name and a provider, which must be one of openai, anthropic, google, or xai. The actual command is npm create mastra@latest <project-name> -- --llm <provider>. After scaffolding, you start the dev server with npx bgproc start -n <project-name> -w -- npm run dev, and then open Mastra Studio at http://localhost:4111. Studio is described as the interface for building, testing, and managing agents, workflows, and tools. This CLI-driven setup is a clear departure from manual configuration, but it also means you need to accept the scaffolded structure. If you prefer to wire things by hand, the README points to an installation guide, but it does not show the manual steps.
Limitations and wrong-tool cases
Mastra is not the right choice if you need full control over every dependency or if you want a minimal library rather than a framework. The README makes clear that Mastra is opinionated: it has its own model router, workflow engine, memory system, and evals. If you already have a preferred tool for orchestration or a custom agent loop, Mastra may duplicate or conflict with that. Another limitation is the human-in-the-loop feature's reliance on storage. The README states that Mastra uses storage to remember execution state, so you can pause indefinitely. That implies you must configure and maintain a storage backend, which adds operational complexity. The documentation does not specify which storage backends are supported, so you need to check the docs before assuming it works with your existing database. Finally, the dual-license model is a real constraint: any code in ee/ directories is source-available under the Mastra Enterprise License and requires a valid enterprise license for production use. This means some features, such as those under packages/core/src/auth/ee/, are not fully open source.
Alternatives and how they differ
A direct alternative is Vercel's AI SDK, which the README mentions as an integration target for building UIs. The AI SDK is a lighter-weight library that focuses on streaming and UI components, not on full agent orchestration or workflow engines. Mastra, by contrast, is a framework that includes agents, workflows, evals, and observability out of the box. Another alternative is LangChain, which is language-agnostic and has a larger ecosystem, but it is not TypeScript-first in the same way. LangChain's approach is to compose chains and agents through abstractions, while Mastra offers a more explicit graph-based workflow syntax. The key difference is scope: Mastra aims to be a complete application framework with a Studio UI, while the AI SDK is a toolkit that you assemble yourself. If you already use the AI SDK for UI, you can still use Mastra for the agent logic, as the README suggests bundling Mastra agents into existing apps.
Maintenance and licensing considerations
The repository is actively maintained, with recent releases for @mastra/core at version 1.65.0 in September 2026, and prior releases in August and September of the same year. This cadence suggests a stable release pipeline, but the material does not include a changelog or migration guide, so upgrade cost is unknown. The license is marked as NOASSERTION in the repository metadata, but the README clarifies a dual-license model: Apache License 2.0 for the core framework and the vast majority of the codebase, and a Mastra Enterprise License for code in ee/ directories. The README states that those enterprise features can be freely used for development and testing, but require a valid enterprise license for production use. This is a significant licensing implication for any team that plans to deploy features from the ee/ directories. You must review the full license mapping in LICENSE.md and the ee/LICENSE file before production deployment. The README does not list any enterprise features, so you need to inspect the repository to see what is gated.
Editorial conclusion
Adopt Mastra if you are a TypeScript developer building AI agents or workflows that need explicit control flow, model flexibility across 40+ providers, and built-in evaluation and observability. Do not adopt it if you require a permissive single license for all code, because the ee/ directories are source-available under a separate enterprise license that restricts production use. Before committing, verify that your preferred model provider is supported by the model router, confirm that the human-in-the-loop storage backend fits your infrastructure, and check the current state of the Mastra Enterprise License terms for any feature you plan to use in production.
Community notes