AI Agent Platform
Build stateful AI agents with memory, tools and MCP, using any LLM
Mastra agents use any LLM to reason, decide and act on open-ended tasks. Every agent comes with memory, tool calling, MCP, logging, tracing and eval primitives built in. Build and test agents in a local playground, then deploy to production with the same configuration.
Built-in agent primitives
When you need agents that retain context, call tools and evaluate their own output, Mastra gives you every primitive built in. Tool calling connects agents to external APIs and services. Memory retains conversation history, user data and relevant context across interactions. Logging, tracing and evals surface what happened and why.
Tool calls and MCP
Build your AI agent app with the Model Context Protocol to connect agents to any compatible tool server
docsLong-term and working memory
Recall relevant context across conversations and store persistent user data
docsLogs, traces and evals
Trace agent execution and score output quality across every run
docsOrchestrate agent networks
Single agents handle open-ended tasks well. Compose them into reliable pipelines using Mastra's AI agent workflow builder, or assemble agent networks where they collaborate on more complex problems. Specify execution paths for control or delegate to a team for power.
Context and guardrails
Mastra gives you precise control over what agents know and what they can do. Dynamically inject context based on the request, configure access from user identity and enforce guardrails against prompt injection and data leaks. Suspend and resume agent execution for human review when it matters most.
Frequently asked questions
What LLMs does Mastra support for agents?
What is the best AI agent platform for supervisor patterns?
How do Mastra agents use tools and MCP?
When should I use agent networks instead of a single agent?
How do Mastra agents handle security and prompt injection?
Ship better agents
Go from prototype to production on the open-source AI agent platform built for developers