Mastra is a TypeScript framework for building AI applications and agents. It covers the path from prototype to production and fits into React, Next.js, and Node projects, or runs anywhere as a standalone server, with agents and workflows either bundled into an existing app or shipped as separate endpoints.
Agents reason about a goal, choose tools, and iterate until the model produces a final answer or an optional stopping condition is reached. When you want explicit control instead, a graph-based workflow engine orchestrates multi-step processes with a chained syntax for control flow: .then(), .branch(), and .parallel(). Either can be suspended to wait for user input or approval, with execution state held in storage so a run pauses indefinitely and resumes where it stopped.
Model routing reaches more than 40 providers through one interface, including OpenAI, Anthropic, and Gemini. Context handling combines conversation history, retrieval from APIs, databases, and files, and an observational memory layer for behaviour that stays coherent across turns. Mastra can also author Model Context Protocol servers that expose its agents, tools, and resources to any MCP client.
Built-in evals and observability cover the measurement side, and the CLI scaffolds a project and starts a local studio for building and testing agents, workflows, and tools. The core framework is Apache-2.0, while code under ee/ directories is source-available and needs an enterprise licence for production use.
Features
- Model routing: one interface over 40+ providers, including OpenAI, Anthropic, and Gemini
- Agents: goal-driven loops that select tools and iterate until a final answer or stop condition
- Workflows: a graph engine with .then(), .branch(), and .parallel() for explicit multi-step control
- Human-in-the-loop: suspend an agent or workflow for input or approval and resume from stored state
- Context management: conversation history, retrieval from external sources, and observational memory
- Framework integration: embed in React, Next.js, or Node apps, or deploy as a standalone server
- UI libraries: works with agentic UI libraries such as AI SDK UI and CopilotKit
- MCP servers: expose agents, tools, and resources over the Model Context Protocol
- Evals and observability: built-in evaluation and tracing for iterating on agent behaviour
- Local studio: a development interface for building, testing, and managing agents, workflows, and tools
Integrated by
Agent Governance Toolkit
Policy enforcement, zero-trust identity, execution sandboxing, and audit logging for autonomous AI agents across frameworks and languages
AtomicMemory
Portable, inspectable semantic memory for agents - one protocol across an SDK, CLI, MCP server, framework adapters and host plugins
Circle Agent Stack
Wallet and USDC payment tooling agents call (x402-style autonomous payments), with starter kits for LangChain, Claude Agent SDK, OpenAI Agents SDK, Vercel AI SDK and Google ADK.
DeepEval
Open-source framework for unit-testing and evaluating LLM apps with ready-made metrics that run locally