
Build more
capable agents
Mastra is the modern TypeScript framework for
AI-powered applications and agents.
Productionize and test
Tune context. Improve recall.
Tweak until your agents achieve human-level accuracy.
Define custom evals
Track performance of your agents over time
Evaluate agent output using model-graded, rule-based, and statistical methods
Process inputs/outputs so you can prevent prompt injection and sanitize responses
Trace agent calls and token usage, with your o11y platform
Secure access to agent endpoints using your identity system
Built-in observability
View traces and logs for your agents
Deploy and scale
Expose your agents as APIs, or bundle them with your app.
With Mastra, your agents are part of your infrastructure.
Manage deployments
Control your source code and infrastructure
Integrates with your framework or server: Next.js, Express, Hono, and more...
Control your source code. Mastra is fully open-source under the Apache 2.0 license
Flexible architecture
Deploy Mastra agents wherever you're hosting your app, or as a standalone service
Build your first agentwith Templatesread theAgent Booklearn with theTutorialwatch theWorkshopstune in toAgents hourand more with our agent builder platform.
Principles of Building AI Agents
A practical guide on how to build AI agents
Get started quickly with pre-built solutions
from Mastra and our community.

MCP Course Mastra 101
Introduced by Shane Thomas, CPO of Mastra
Frequently asked questions
What is Mastra?
Mastra is an open-source TypeScript framework for building AI-powered applications and agents. Mastra provides agents, workflows, memory, workspaces and observability, letting developers go from idea to implementation. Mastra integrates with frontend and backend frameworks like React, Next.js and Node, or can be deployed anywhere as a standalone server.
Why use Mastra instead of a Python AI framework?
Mastra is purpose-built for TypeScript and designed around established AI patterns, giving TypeScript developers everything they need to build AI applications out of the box. Mastra bundles agents and workflows directly into existing React, Next.js and Node.js apps, or ships them as standalone endpoints. Mastra provides a complete set of AI primitives including workflows, agents, workspaces and observability in one modular framework.
Is Mastra an agent builder?
Mastra is a TypeScript framework for building AI agents and AI-powered applications. Mastra agents use LLMs and tools to solve open-ended tasks, reasoning about goals, deciding which tools to use and iterating internally until the model emits a final answer or an optional stopping condition is met. Mastra also provides workflows, memory, workspaces and observability to support the full agent development lifecycle.
What can you build with Mastra?
Mastra supports building AI-powered applications that combine language understanding, reasoning and action to solve real-world tasks. Mastra use cases include conversational agents for customer support, onboarding or internal queries, domain-specific copilots for coding, legal, finance, research or creative work, workflow automations that trigger, route and complete multi-step processes, and decision-support tools that analyze data and provide actionable recommendations.
What AI models and providers does Mastra support?
Mastra's model routing connects to 90+ providers through one standard interface. Mastra supports models from OpenAI, Anthropic, Gemini and more, allowing developers to use different AI providers through a single API.
What are Mastra workflows?
Mastra's graph-based workflow engine orchestrates complex multi-step processes with explicit control over execution. Mastra workflows use an intuitive syntax for control flow including .then(), .branch() and .parallel() methods. Mastra workflows also support human-in-the-loop functionality, allowing developers to suspend a workflow and await user input or approval before resuming. Mastra uses storage to remember execution state, so workflows can pause indefinitely and resume where they left off.
How does Mastra handle agent memory and context?
Mastra's memory system provides conversation history, data retrieval from APIs, databases and files, and human-like working and semantic memory so agents behave coherently. Developers can give Mastra agents the right context at the right time by combining message history with retrieval from external data sources.
Does Mastra support MCP servers?
Mastra supports authoring Model Context Protocol (MCP) servers, exposing agents, tools and other structured resources via the MCP interface. MCP servers built with Mastra can be accessed by any system or agent that supports the protocol.
How does Mastra handle testing and observability?
Mastra includes built-in scorers and observability tools to observe, measure and refine agent performance continuously. Mastra supports evaluating agent output using model-graded, rule-based and statistical methods, with custom evals to track agent performance over time. Mastra's observability features trace agent calls and token usage with support for external observability platforms. Mastra also provides guardrails to process inputs and outputs, helping prevent prompt injection and sanitize responses.
How do you deploy Mastra applications?
Mastra applications can be deployed to any Node.js-compatible environment. Mastra includes optional built-in deployers for Vercel, Netlify and Cloudflare to automate the deployment process. Developers can also deploy Mastra as a standalone server powered by Hono, integrate it with existing web frameworks like Next.js, or use their existing Hono, Express, Fastify or any other server app.
Is Mastra open source?
Mastra's core framework is open source under the Apache 2.0 license. Enterprise features are source-available under the Mastra Enterprise License. Mastra is free to start with no seats or usage tiers.


