Key points
- Mastra is a full-stack TypeScript AI agent framework created in 2025 by the former core team of Gatsby (the React static site generator with 55K+ GitHub stars). It is backed by Y Combinator W25 and a $13M seed round (YC, Paul Graham, Gradient Ventures, Amjad Masad).
- The core is Apache 2.0 licensed; enterprise features under an
ee/directory use a source-available, dual-license model (similar to Supabase/GitLab). - Repository: github.com/mastra-ai/mastra — a pnpm monorepo with 30+ packages, ~100,000+ lines of TypeScript.
- One-line definition: a complete AI application platform covering Agent, Workflow, RAG, Memory, Voice, MCP, Evals, A2A, Browser, deployment, and a visual Playground.
- Agent = a reasoning loop with memory:
user message → input processors → [model inference → tool call → observation] × N → output processors → response. Notable features: - Multi-model fallback for API limits/outages.
- Tool approval — human confirmation before tool execution (safety).
- Output processors act as a filter layer (e.g., never leak system prompts, enforce API formats).
- Three-tier memory:
- *Working memory*: recent messages under a
tokenBudget. - *Semantic recall*: vector search over historical conversations injected into context.
- *Observational memory*: the agent reflects on its own behavior — a form of metacognition ("I missed constraint Y last time").
- RAG pipeline: document → LLM-powered extractors (title, summary, keywords, questions, schema) → chunking → vectorization → storage; query-side adds vector search, reranking (Cohere / Mastra Agent / ZeroEntropy), and GraphRAG (entity-relationship graph traversal for multi-hop queries).
- Evals as Scorer pattern: LLM-as-judge, programmable scoring dimensions (accuracy, safety, tone), composable pipelines; agents can auto-regenerate when scores fall below thresholds.
- Network loop / multi-agent orchestration: a Router agent dynamically dispatches tasks to execution and review agents based on LLM judgment, not hardcoded flows.
- A2A protocol (JSON-RPC 2.0) with
Task(submitted/working/completed/failed) andMessagetypes, enabling distributed agent networks across servers. - LLM layer built on top of Vercel's AI SDK (v4/v5 internals), extended with model routing, a model gateway, and fallback chains — not reinventing the wheel.
- Processor pattern: Web-framework-style middleware around agent inference for input preprocessing and output post-processing.
- "Everything is a plugin": storage, voice, deployment, and LLMs are all pluggable behind unified interfaces — inherited from Gatsby.
- Developer experience first: Playground visual debugger (live reasoning, tool calls, memory state),
npx create-mastraCLI, TypeScript-first typing,@mastra/reactSDK. - Prototype to production: built-in distributed tracing (spans per agent call), structured
MastraError(domain/category/id), tool approval, continuous evals. - Complexity trap: 30+ packages, 50+ core submodules, 25 DB adapters, 14 voice providers — a heavy cognitive load for newcomers.
- "Do everything" risk: each covered domain (RAG, voice, evals…) has more specialized competitors.
- The Gatsby lesson: Gatsby lost to Next.js partly due to framework complexity; Mastra must balance richness against simplicity.
Architecture: five layers
1. Core engine (packages/core) — 50+ submodules including agent/ (agent abstraction with multi-model fallback, tool approval, output processors), workflows/ (step engine with suspend/resume and streaming), loop/ (the reasoning loop), memory/, rag/, evals/, mcp/, a2a/ (JSON-RPC based agent-to-agent protocol), voice/ (14 providers), browser/, llm/ (routing, gateway, fallback), storage/ (25+ database backends), observability/, events/, di/.
2. Capability packages — rag, memory, mcp, evals, auth, cli, playground, server, deployers, client SDKs.
3. Integration layer — 25 vector DB adapters (pgvector, Pinecone, Qdrant, Chroma, Weaviate, Milvus, Redis, MongoDB, Elasticsearch, Cloudflare Vectorize, DuckDB, S3 Vectors, etc.), 14 voice providers (OpenAI, Deepgram, ElevenLabs, Azure, Google, Cloudflare…), 4 deployers (Vercel, Cloudflare, Netlify, Mastra Cloud), 3 client SDKs (React, JS, AI SDK).
4. Workflow engine — step-based with createWorkflow().then(...).commit(), supporting suspend/resume for long-running/human-approval tasks, streaming step output, and Inngest integration. Workflows handle "how to do", agents handle "how to think".
5. Enterprise edition — advanced auth, audit logs, source-available licensing.
Core design decisions
Framework comparison
| Dimension | Mastra | LangChain.js | CrewAI | Vercel AI SDK | |---|---|---|---|---| | Language | TypeScript | Python/TS | Python | TypeScript | | Agent loop | Built-in | Built-in | Built-in | DIY | | Workflow engine | Suspend/Resume | LangGraph | Task orchestration | — | | Memory | 3-tier | Basic | — | — | | RAG | GraphRAG + rerank | Basic | — | — | | Evals | Scorer | — | — | — | | Voice | 14 providers | — | — | — | | A2A | JSON-RPC | — | — | — | | Vector DBs | 25+ | 20+ | 5 | 3 | | Playground | Full UI | LangSmith | — | — |
Mastra's differentiation: the only TypeScript framework combining agent loops, workflow engine, three-tier memory, GraphRAG, evals, voice, and A2A in one stack.
Design philosophy (the Gatsby genes)
Risks and open questions
Bottom line
> Mastra is the Gatsby team's second act: a TypeScript full-stack AI framework spanning agents, workflows, RAG, memory, voice, evals, and A2A — aiming to be the "Rails of AI application development." Its three-tier memory, Scorer evals, GraphRAG, and 25-DB storage abstraction show genuine framework-grade design. Whether it avoids Gatsby's fate depends on balancing "doing everything" with "doing each thing well."
📎 GitHub: mastra-ai/mastra · Website: mastra.ai · License: Apache 2.0 (core) + enterprise dual licensing