Last updated: 2026-08-19
Mastra is an open-source TypeScript framework for building AI agents, workflows, and RAG applications, backed by more than 27,000 GitHub stars as of August 2026. It bundles agent orchestration, durable multi-step workflows, persistent memory, and evals into one TypeScript-first package with native Model Context Protocol server support.
About Mastra
Mastra is a TypeScript framework, released as open source, for building AI agents, workflows, and retrieval-augmented generation applications. It was built by Kepler Software Inc., founded in San Francisco in 2024 by Sam Bhagwat, Shane Thomas, and Abhi Aiyer, the team that built the Gatsby JavaScript framework and scaled it into a multi-million dollar business before selling it to Netlify. Mastra graduated from Y Combinator's Winter 2025 batch and has raised roughly $35 million, made up of a $13 million seed round backed by Paul Graham and more than 120 other investors plus a $22 million Series A led by Spark Capital. The framework bundles four primitives into one TypeScript-first package: agents that reason over goals and choose which tools to call, a graph-based workflow engine with .then(), .branch(), and .parallel() methods for multi-step orchestration with retries, a memory system for persistent conversation context, and built-in evals for scoring agent output over time. Rather than porting LangChain's Python-derived abstractions into JavaScript, Mastra exposes its own agents, tools, and workflows as Model Context Protocol servers that clients such as Cursor, Windsurf, and Claude Desktop can call directly, and it connects to model providers through one standard interface instead of separate provider SDKs. Teams shipping production agents on Vercel, Cloudflare Workers, or Netlify use Mastra's server adapters for Express, Hono, Fastify, and Koa to expose agents and workflows as HTTP endpoints without hand-rolling routing. Its local Studio dashboard lets a developer chat with an agent, feed it documents through RAG, and inspect traces of model calls and tool executions before shipping. Mastra names Replit and WorkOS among the companies running it in production. The framework itself costs nothing to self-host, released under the Apache 2.0 license, with a separate source-available Enterprise License covering advanced features kept in its ee/ directories. Mastra Cloud, the optional hosted platform, layers a pay-as-you-go Starter tier, a Team tier, and custom Enterprise pricing on top; exact figures are in the pricing FAQ below. Because Mastra runs anywhere Node.js does, the hosted platform is opt-in rather than required to ship an agent. Mastra reached a stable 1.0 release in January 2026, after hundreds of teams ran a beta cycle in production, and followed it with a Product Hunt launch the next day that placed third for the day.
Pricing
Self-hosting the framework is free of charge, with no per-seat charges or usage caps. The optional Mastra Cloud platform runs pay-as-you-go: Starter is free with 100K observability events (then $10/100K), 24 CPU hours (then $0.35/hour), 10GB egress (then $0.10/GB) and 15-day retention. Team is $250/month with 1M events (then $8/100K), 250 CPU hours (then $0.25/hour), 100GB egress (then $0.08/GB), 6-month retention, SSO, and SOC 2 documentation. A $100/project Server Always-On add-on keeps servers warm, and Enterprise is custom-priced with RBAC, audit logs, and SLAs.
Key Features
- Agent primitives: Agents combine an LLM, instructions, and a set of tools in one typed definition, then reason over a goal and decide which tools to call and when to stop.
- Graph-based workflows: The workflow engine uses .then(), .branch(), and .parallel() to chain and fan out steps with explicit control flow and built-in retries, so multi-step processes survive a restart.
- Model routing across 90+ providers: One standard interface connects to OpenAI, Anthropic, Google, and more than 90 other model providers, so switching providers does not mean rewriting agent code.
- Persistent memory: Agents keep conversation history and semantic recall across sessions instead of resetting context on every new request.
- Native MCP server and client support: The MCPServer class exposes Mastra agents, tools, and workflows to any Model Context Protocol client such as Cursor or Claude Desktop, and MCPClient lets a Mastra agent call external MCP servers.
- Studio dev dashboard: A local playground at localhost:4111 lets developers chat with an agent, run RAG queries, and inspect traces of every model call and tool execution before deploying.
- Serverless and self-hosted deployment: Server adapters ship for Express, Hono, Fastify, and Koa, plus deployer packages for Vercel, Cloudflare Workers, and Netlify, so the same agent code runs serverless or on a long-running process.
Pros
- Apache 2.0 core with full source access, so teams can self-host the entire framework without a vendor lock-in point.
- Bundles agents, durable workflows, memory, RAG, and evals in one TypeScript-first package instead of stitching together separate libraries the way a raw LangChain.js setup requires.
- Native Model Context Protocol server and client support, so agents built in Mastra can be called from Cursor or Claude Desktop, and Mastra agents can call other MCP servers, without a bridging layer.
- Deploys the same agent code to Vercel, Cloudflare Workers, or Netlify without a bridging layer, covering serverless targets that LangChain's Python-first tooling does not reach directly.
Cons
- TypeScript/JavaScript only; teams standardized on a Python stack get better first-party support from LangChain or LlamaIndex.
- Third-party review volume is thin for a framework this size; its Product Hunt listing carries only 6 reviews as of August 2026, so independent sentiment data beyond GitHub activity is limited.
- The hosted Mastra Cloud platform bills CPU hours, observability events, and egress separately once free allowances are exceeded, which takes deliberate monitoring to avoid surprise overages on the Starter tier.
- Only reached a stable 1.0 API in January 2026, so codebases built against earlier 0.x releases needed a migration pass.
Frequently Asked Questions
How much does Mastra cost in 2026?
The framework itself is free to self-host under an open-source license. Mastra Cloud, the optional hosted platform, is pay-as-you-go with a free Starter allowance, a $250/month Team tier covering 1M observability events, 250 CPU hours, and 100GB egress before overage charges apply, and custom Enterprise pricing for RBAC, audit logs, and SLAs.
Is Mastra free to use?
Yes. The core framework is free to self-host under an open-source license, with no seat or usage limits. The optional Mastra Cloud Starter tier is also free, capped at 100K observability events, 24 CPU hours, 10GB of data egress, and 15 days of trace retention before pay-per-unit overage rates apply.
Which tools compete with Mastra in 2026?
LangChain is the default pick for Python-first teams or anyone who needs its larger catalog of niche integrations. LlamaIndex fits better when retrieval and document indexing is the entire job rather than one part of an agent. n8n is the pick for teams that want a no-code visual builder instead of writing TypeScript directly.
Is Mastra better than LangChain?
Neither is strictly better; they target different stacks. Mastra is TypeScript-only and ships serverless deployers for Vercel, Cloudflare Workers, and Netlify, while LangChain.js is a port of the original Python library and carries more integration breadth but more of the verbosity that comes with that port.
How do you set up Mastra?
Most developers report a working agent prototype within a couple of hours by installing the framework, defining an agent with instructions and tools, and running it against the local Studio dashboard. Deploying to a serverless target adds one deployer package (for example @mastra/deployer-vercel) and a build step.
Top Alternatives
- LangChain: Pick Mastra if your stack is TypeScript and you want serverless-native deployment; pick LangChain if your team is Python-first or needs its wider library of niche integrations.
- LlamaIndex: Pick Mastra if you need agents and durable workflows alongside RAG; pick LlamaIndex if retrieval and document indexing is the whole job.
- Temporal: Pick Mastra if you want AI-native primitives like agents and evals built in; pick Temporal if you need a battle-tested general workflow engine and are willing to add AI tooling yourself.
- n8n: Pick Mastra if your team codes agents directly in TypeScript; choose n8n when a no-code visual canvas fits your workflow better than writing code.
HokAI guides covering Mastra
- Best AI Orchestration Tools in 2026: How to Actually Choose: n8n self-hosts free with 2,067 integrations; Zapier bills by task but lists 9,976 apps. Nine AI orchestration tools sorted into the three tiers that matter.