Mastra
FreemiumOpen-source TypeScript framework for building AI agents and durable workflows, with memory, RAG, evals and an optional hosted platform.
What is Mastra?
Mastra is an Apache 2.0 licensed TypeScript framework for building AI agents and agentic workflows, created by the team behind Gatsby and adopted by engineering teams at companies including Replit, SoftBank and PayPal. Where most tools in this category are visual builders, Mastra is code: you define agents with models, tools, memory and instructions, compose durable multi-step workflows with typed control flow, and run the whole thing anywhere Node runs, whether embedded in an existing Next.js app or shipped as a standalone Hono server. The framework bundles the primitives that teams otherwise stitch together from separate libraries, including RAG pipelines, observational memory that persists across sessions, MCP support, model-graded and rule-based evals, guardrails against prompt injection, and tracing for agent calls and token usage. The core is free forever and self-hostable. The optional Mastra Platform adds hosted observability, a Studio for collaborative iteration, deployment and a model gateway, metered on observability events and CPU time rather than seats.
Key Features
Integrations
How to Use Mastra
✅ Best For
- TypeScript engineering teams shipping AI agents inside an existing Next.js, React or Node application rather than adopting a separate no-code platform
- Developers who want agents, memory, RAG, workflows and evals from one coherent framework instead of assembling four libraries that were never designed together
- Teams that need agent output quality measured, since built-in model-graded, rule-based and statistical evals let you track regression over time
- Organisations with data residency requirements, because the framework is fully self-hostable and enterprise deployments keep traces and prompts inside your own VPC
❌ Not For
- Non-technical users entirely, since Mastra is a code framework with no visual builder for the core workflow authoring experience
- Python-first teams, as Mastra is purpose-built for TypeScript and a Python shop is better served by frameworks in its own ecosystem
- Teams wanting prebuilt SaaS connectors out of the box, because Mastra gives you primitives and tools rather than a library of thousands of app integrations
- Anyone needing a finished product today, as building a reliable production agent is engineering work regardless of how good the framework is
Reviews
No reviews yet. Be the first to review Mastra!
Pricing
- ✓Apache 2.0 licensed
- ✓self-host anywhere
- ✓agents
- ✓workflows
- ✓memory and evals included
- ✓100K observability events
- ✓24 CPU hours
- ✓15-day retention
- ✓unlimited users and projects
- ✓1M observability events
- ✓250 CPU hours
- ✓6-month retention
- ✓multiple teams
- ✓SSO and SOC 2 docs
- ✓Custom volume and retention
- ✓RBAC
- ✓audit logs
- ✓uptime SLAs
- ✓dedicated support engineer
- ✓Flat annual fee
- ✓enterprise controls
- ✓data stays in your VPC
- ✓no per-trace or per-seat metering
Prompts to Try
Scaffold a Mastra agent that answers product questions using a RAG pipeline over our docs
Build a durable workflow that chains three agents with typed inputs and outputs
Add an eval suite that scores agent responses for factual accuracy over time
Deploy this Mastra agent as a standalone Hono server on Cloudflare Workers