Mastra is a TypeScript framework for building AI-powered applications and agents, intended to carry a project from early prototype to production. It integrates with frontend and backend stacks such as React, Next.js, and Node, or can be deployed as a standalone server.
- Model routing: a single interface to 40+ providers (OpenAI, Anthropic, Gemini, and others).
- Agents: autonomous agents that reason about goals, select tools, and iterate until a final answer or stopping condition is reached.
- Workflows: a graph-based engine for orchestrating multi-step processes with explicit control flow (.then(), .branch(), .parallel()).
- Human-in-the-loop: suspend and resume agents or workflows, persisting execution state so a run can pause and continue later.
- Context management and memory: conversation history, RAG-style retrieval from APIs, databases, and files, and observational memory.
- MCP servers: author Model Context Protocol servers that expose agents, tools, and resources to any MCP-compatible system.
It also includes built-in evals and observability for measuring and refining agents, and integrates with UI libraries such as the Vercel AI SDK and CopilotKit.