Mastra
Mastra is a TypeScript framework for building AI-powered applications and agents. It provides tools for model routing, agent creation, workflow orchestration, and production essentials like evals and observability, helping developers go from prototype to production.
✨ Key features
- Connect to 40+ model providers via one interface
- Build autonomous agents with tools and reasoning
- Graph-based workflow engine with .then(), .branch(), .parallel()
- Human-in-the-loop with suspend and resume
- Context management with memory and RAG
- Author MCP servers and integrate with frontend frameworks
🎯 Use cases
- Create AI agents that solve open-ended tasks
- Orchestrate multi-step processes with explicit control flow
- Add human approval steps to workflows
- Build AI-powered UIs with React or Next.js
- Expose agents as MCP servers for external systems
📦 Installation
🧰 Requirements: Requires Node.js and npm; no API keys needed for installation, but model provider keys are needed for usage.
The recommended way to get started is by running:
npm create mastra@latest
Follow the Installation guide for step-by-step setup with the CLI or a manual install.
🚀 Usage
Create a new Mastra project with:
npm create mastra@latest
Then start the dev server:
npm run dev
Open Mastra Studio at http://localhost:4111.
⚠️ Good to know
The repository uses a dual-license model: core is Apache-2.0, but code in ee/ directories is under the Mastra Enterprise License and requires a valid enterprise license for production use.
❓ FAQ
What is the recommended way to install Mastra?
Run npm create mastra@latest to create a new project with the CLI.
Can I use Mastra with any LLM provider?
Yes, Mastra supports 40+ providers including OpenAI, Anthropic, and Gemini through a standard interface.
How do I add human-in-the-loop to my workflows?
Use Mastra's suspend and resume feature, which uses storage to remember execution state and allows pausing indefinitely.
Is Mastra open source?
The core framework is Apache-2.0 licensed, but some enterprise features in ee/ directories are source-available under a separate license.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.