Mastra
by Mastra
Open-source TypeScript framework and platform for building, deploying and observing production AI agents and workflows
Mastra is an open-source TypeScript framework for building AI agents and workflows, with a hosted platform for deploying, observing and adding memory to them. It is for JavaScript and TypeScript engineering teams who want to ship production agents inside their existing Node.js, Next.js or React stack instead of adopting Python tooling.
Mastra is an open-source TypeScript agent framework from Mastra, a San Francisco company founded in 2024 by Sam Bhagwat (CEO), Abhi Aiyer (CTO) and Shane Thomas (CPO), the team behind the Gatsby web framework. It went through Y Combinator's Winter 2025 batch. The framework puts typed agents, graph-based workflows (with branching, parallel steps and human-in-the-loop suspend/resume), memory (observational memory, semantic recall and thread-aware storage), RAG, MCP server support, evals and tracing into one TypeScript package. A model router reaches dozens of providers, including OpenAI, Anthropic, Google and xAI. Apps deploy to Vercel, Netlify or Cloudflare, run as a standalone Hono server, or embed in an existing Next.js or Node.js app. Mastra launched on Hacker News in February 2025 (442 points), switched its core to Apache 2.0 in July 2025, and shipped 1.0 in January 2026. In April 2026 it raised a $22M Series A led by Spark Capital, bringing total funding to $35M, and expanded into a commercial platform: Mastra Studio, a managed Server and a Memory Gateway covering deployment, observability, datasets, auth and RBAC. Enterprise features in /ee directories are under a source-available licence. The GitHub repo has about 28k stars. Mastra lists Salesforce, MongoDB, Sanity, WorkOS, Factorial, SoftBank, Marsh and Replit as users. On 16–17 June 2026 a dormant contributor's npm account was hijacked. Microsoft attributed the attack to the North Korean group Sapphire Sleet. The attacker republished 140+ @mastra packages with a malicious postinstall dependency, and Mastra removed the account and forward-rolled clean releases. Mastra competes with LangChain/LangGraph.js, the Vercel AI SDK, the OpenAI Agents SDK and AWS Strands.
An engineering leader at a TypeScript/Node.js shop who wants to build production agents in the team's existing language and stack, with observability and memory included, rather than stand up Python agent infrastructure.
One typed framework covers agents, durable workflows, memory, RAG, evals and tracing, and it can be self-hosted for free under Apache 2.0 or run on a managed platform.
At a Glance
- Category
- Agent Development
- Pricing
- Freemium, Usage-based, Subscription
- Target Market
- Enterprise Developers, CTOs, Platform Engineering Teams, Product Engineering Teams
- Deployment
- Open-source, Self-hosted, Cloud-first
- Founded
- 2024
- Headquarters
- San Francisco, USA
- Team Size
- 11-50
Key Features
- ✓Typed agents
Define an agent's instructions, model, tools and runtime behaviour in one TypeScript object, with compile-time type safety.
- ✓Graph-based workflows
Orchestrate multi-step processes with branching, parallel steps and suspend/resume for human-in-the-loop approvals in production.
- ✓Observational memory and semantic recall
Durable, thread-aware memory lets agents keep context across long conversations and sessions without hand-built storage.
- ✓Model router
One interface to dozens of LLM providers including OpenAI, Anthropic, Google and xAI, so teams can switch models without rewrites.
- ✓Built-in evals and observability
Traces, metrics, logs, datasets and evals are included, so agent quality regressions are measurable before and after deploy.
- ✓Mastra Studio
A local and hosted UI for building, testing and debugging agents and workflows, including experiment runs with mocked tools.
- ✓MCP support
Agents can consume or expose Model Context Protocol servers, connecting them to the growing MCP tool ecosystem.
Capabilities
Use Cases
- •In-product AI assistant
A SaaS team embeds a Mastra agent in its Next.js app, calls internal APIs as tools and ships it on its existing Vercel deployment.
- •Approval-gated back-office workflow
A workflow drafts a contract change, suspends for legal approval, then resumes to update the CRM once a human signs off.
- •RAG over company knowledge
Engineers ingest docs and database records into a retrieval pipeline so a support agent answers with cited internal context.
- •Self-hosted enterprise agent platform
A regulated enterprise runs Mastra in its own VPC under the enterprise licence, keeping traces, prompts and outputs inside its environment.
- •Regression-testing agent changes
Teams run evals and experiments with tool mocks in Studio to catch quality drops before promoting a new prompt or model.
Ideal For
Best For
- ✓TypeScript and Next.js teams embedding agents directly into existing web products
- ✓Multi-step business workflows that need branching, parallelism and human-approval pauses
- ✓Agents that need durable long-term memory across user threads
- ✓Enterprises that want to self-host agent infrastructure in their own VPC with no per-trace metering
- ✓Teams that want model-provider portability through a single model router
Not Ideal For
- ✗Python-first ML and data science teams, who will find LangGraph, CrewAI or Strands closer to their existing tooling
- ✗Use cases that do not fit Mastra's built-in patterns. HN users report that productivity drops when you step outside them, and deterministic rules-first logic can feel clunky
- ✗Organisations with strict supply-chain policies that cannot pin lockfiles: the June 2026 npm scope compromise exposed users on loose version ranges
Integrations
Deployment
Market Analysis
Pros
- ✓Strong developer adoption: about 28k GitHub stars, and two front-page Show HN launches (442 and 213 points)
- ✓Batteries-included: workflows, memory, RAG, evals and observability ship in the framework
- ✓Permissive Apache 2.0 core with a genuine self-host path and no vendor lock-in on model providers
- ✓Named enterprise users including Salesforce, MongoDB, SoftBank and Marsh
Cons
- ✗In June 2026 a hijacked, never-revoked contributor account was used to backdoor 140+ @mastra npm packages. Microsoft attributed the attack to the North Korean group Sapphire Sleet, which raises supply-chain governance questions
- ✗Opinionated: HN users report productivity drops when a use case does not fit Mastra's built-in patterns, and deterministic rules-first logic feels clunky
- ✗Commenters question differentiation from the Vercel AI SDK and LangChain, and whether it just moves where lock-in happens
- ✗Enterprise features sit in source-available /ee directories rather than under Apache 2.0, and platform metering spans many dimensions (events, CPU, tokens, DB, egress)
Pricing
Open Source (self-hosted)
$0
- ✓Apache 2.0
- ✓Agents, workflows, observational memory
- ✓Host anywhere
Platform Starter
$0
- ✓100K observability events, then $10/100K
- ✓24 CPU-hours, then $0.35/hr
- ✓15-day retention
- ✓Unlimited users and projects
Platform Teams
From $250/mo
- ✓1M events, then $8/100K
- ✓250 CPU-hours, then $0.25/hr
- ✓6-month retention
- ✓SSO
- ✓SOC 2 docs
Enterprise (cloud or self-hosted)
Contact for pricing
- ✓RBAC, audit logs, SSO/IAM
- ✓Uptime SLAs
- ✓Data stays in your VPC
- ✓Flat annual fee for self-hosted
The framework is free under Apache 2.0. The hosted platform is metered on observability events, CPU-hours, retention and extras: the gateway charges market token rates plus 5.5%, memory tokens cost $10 per million, LibSQL and Postgres are billed separately, and 24/7 persistent servers are $100 per project. The Teams tier starts at $250/mo. RBAC, audit logs, SLAs and the self-hosted enterprise licence (a flat annual fee, not per-trace) are Enterprise-only.
Security & Compliance
Connect
Sources
This page was written from 7 sources, 5 on domains other than mastra.ai.
Stay Ahead of the Curve
Weekly enterprise AI insights for technology leaders. No spam, no vendor pitches—unsubscribe anytime.
SubscribeRelated Products
Agentrys
Agentic design automation that lets chip teams build and own a self-improving engineering workforce
OpenAI Agents API
The Codex agent harness behind one API call — managed sessions, sandboxes and subagents
Letta
Open-source platform for stateful AI agents with persistent memory, now with a TypeScript Agents SDK for embedding them in your own apps
Kiro Crew
Open-source workspace for coding agents that keep working after you close the laptop