mastra
Mastra is the modern TypeScript framework for AI-powered applications and agents.
What is mastra?
Mastra is the modern TypeScript framework for AI-powered applications and agents.
Overview of mastra
What it is
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack. It integrates with frontend and backend frameworks like React, Next.js, and Node, or can be deployed as a standalone server. It is designed to help build, tune, and scale reliable AI products from early prototypes to production.
Key features
- Model routing: Connect to 40+ providers (OpenAI, Anthropic, Gemini, etc.) through one standard interface.
- Agents: Build autonomous agents that use LLMs and tools to solve open-ended tasks, reasoning about goals and iterating internally.
- Workflows: Graph-based workflow engine with intuitive control flow (
.then(),.branch(),.parallel()) for complex multi-step processes. - Human-in-the-loop: Suspend an agent or workflow to await user input or approval, with execution state stored for indefinite pauses.
- Context management: Provide conversation history, retrieve data from sources (APIs, databases, files), and add Observational Memory for coherent agent behavior.
- Integrations: Bundle agents and workflows into existing React, Next.js, or Node.js apps, or ship as standalone endpoints; integrate with agentic libraries like Vercel's AI SDK UI and CopilotKit.
- MCP servers: Author Model Context Protocol servers to expose agents, tools, and other resources via the MCP interface.
Use cases
- Building autonomous AI agents that reason and use tools to complete tasks.
- Orchestrating complex multi-step workflows with explicit control over execution.
- Adding human-in-the-loop approval or input to AI processes.
- Managing context and memory for coherent agent conversations.
- Integrating AI capabilities into existing web applications (React, Next.js, Node.js).
- Exposing agents and tools via MCP servers for interoperability.
- Observing, evaluating, and iterating on AI applications in production.
Getting started
The recommended way to get started is by running: shell npm create mastra@latest After creation, enter the project directory and start the dev server (see the README for the exact command). Open Mastra Studio at http://localhost:4111 to build, test, and manage agents, workflows, and tools.
License and pricing
This repository uses a dual-license model:
- Apache License 2.0: The core framework and the vast majority of the codebase is open source under Apache-2.0.
- Mastra Enterprise License: Code in directories named
ee/is source-available under the Mastra Enterprise License, requiring a valid enterprise license for production use but free for development and testing. The project is listed as open source.
Based on the project's public README and repository metadata.