Mastra is an open-source TypeScript framework for building AI agents and workflows, made for developers, with an optional hosted platform billed by usage.
Mastra handles the plumbing behind an agent that has to run for days: calling models, invoking tools, remembering earlier conversations and pausing for a person to approve a step. Kepler Software Inc., a Delaware corporation, sells it under the Mastra name, and the project started in 2024. The code lives in a public GitHub repository under the Apache 2.0 license, so a team can read, fork and run every part of it. Mastra Platform adds hosting, tracing and team controls for anyone who would rather not operate those servers. An Agent in Mastra is defined in code with instructions, a model, tools built with createTool, and memory. Each agent can use a different model provider. Workflows chain steps, then suspend at any point and resume later from a saved snapshot. Supervisor agents hand tasks to subagents, and the RAG module pulls context from a team's own documents. Input and output processors act as guardrails, while structured output forces replies into a schema. Scorers grade agent answers and can run in a CI pipeline. Tracing records how each request moves through agents, workflows, tools and model calls, and the Editor versions stored agents and prompt blocks through draft and publish steps. The people who get the most from it are TypeScript and JavaScript engineers who review and test agent logic like the rest of their application. A startup can build its first agent on the framework without paying anything. Larger product teams move to Mastra Platform when they need longer retention, single sign-on and several teams under one account. Hosting is bought as a flat monthly plan plus metered usage beyond each allowance, and Enterprise terms are quoted. Companies that keep every run inside their own network can instead license the self-hosted edition for a flat annual fee. Most deployments start from a concrete job. A support agent answers customers in Slack or Discord through Mastra's channels, and a research agent searches internal documents before it replies. An approval workflow waits for a manager's sign-off, then picks up exactly where it stopped. Webhook signals wake an agent when an outside system posts an event. The Mastra server publishes agents as HTTP endpoints for the application to call, or as an MCP server that other AI clients can use. Chat front ends connect through the AI SDK UI hooks. Mastra fits teams for whom an agent is a feature of the product they ship, written and deployed beside the rest of their TypeScript code.
Pricing
View plans-
Starter
Free
- Free hosted Mastra Platform tier, $0 a month, no billing toggle
- Unlimited users, deployments and projects
- 100K observability events included, then $10 per 100K
- 24 CPU hours included, then $0.35 an hour
- 15 days of data and stale thread retention
- 10GB data egress, then $0.10 per GB
- 100,000 memory tokens, then $10 per 1M
- 250MB retrieval storage, then $20 per GB
- Postgres compute 5 hours, then $0.50 an hour
- Database storage 1GB, then $1 per GB-month; platform data storage 1GB
- Persistent Server for 24/7 uptime costs $100 per project extra
- Gateway input and output tokens at market rate plus 5.5%
-
Teams
$250 per month
$250 a month, billed monthly; no annual option shown
- Usage beyond the allowances below bills at the listed rates
- 1M observability events included, then $8 per 100K
- 250 CPU hours included, then $0.25 an hour
- 6 months of data and stale thread retention
- Multiple teams, SSO and SOC 2 documents
- 100GB data egress, then $0.10 per GB
- 1M memory tokens, then $10 per 1M
- 1GB retrieval storage, then $20 per GB
- Postgres compute 5 hours, then $0.40 an hour
- Database storage 1GB, then $0.75 per GB-month; platform data storage 100GB
- Persistent Server for 24/7 uptime costs $100 per project extra
- Gateway input and output tokens at market rate plus 5.5%
-
Enterprise
Custom pricing
- Custom pricing, quoted by sales
- RBAC, audit logs, support and uptime SLAs
- A dedicated support engineer
- Custom limits on every metered item
- Extra CPU time as an add-on at $0.00008 a second
- Extra retrieval storage as an add-on at $20 per GB
-
Self-Hosted (open source)
Free
- Apache 2.0 licensed framework, $0 a month
- Agents, workflows and memory, built and hosted anywhere
- Runs on any Node.js-compatible environment
-
Self-Hosted Enterprise
Custom pricing
- One flat annual fee, quoted by sales
- No per-trace or per-seat metering
- Enterprise support for the agent lifecycle
Features
- Not included: Visual agent workflow canvas
- Included: Custom tool and function definitions
- Included: Model provider choice per agent
- Included: Retrieval-augmented knowledge bases
- Included: Multi-agent handoff and delegation
- Included: Conversation state and checkpointing
- Included: Structured output schema validation
- Included: Input and output guardrails
- Included: Human-in-the-loop approval steps
- Included: Built-in execution tracing
- Included: Prompt versioning in the builder
- Included: Agent evaluation and test suites
- Included: MCP server support
- Included: Webhook and event triggers
- Included: Code-first SDK
- Included: Deploy an agent as an API endpoint
- Included: Embeddable agent chat widget
- Included: Self-hosted agent runtime
Additional Features
- Agent class with model, instructions, tools and memory
- createTool with input and output schemas
- Workflows that suspend and resume from a snapshot
- Tool call approval with requireApproval
- Supervisor agents delegating to subagents
- Agent memory across conversation threads
- RAG over a team's own data sources
- Input and output processors
Best for
- TypeScript and JavaScript developers building agents into their own product
- Engineering teams that review and test agent code like the rest of the codebase
- Startups prototyping an agent on open source before paying for hosting
- Teams that need tracing and evaluation before an agent reaches customers
- Companies that host agents on their own infrastructure under an enterprise license
- Product teams running agents inside Slack, Discord or Microsoft Teams
- Enterprises that need RBAC, audit logs and uptime SLAs
Use cases
- building a tool-using agent with long-term memory
- running a durable workflow that waits for a manager's approval
- answering questions from internal documents with RAG
- deploying a support agent into Slack or Discord
- exposing internal tools to other AI clients as an MCP server
- grading agent answers with scorers in a CI pipeline
- tracing a failed agent run step by step
- starting an agent from an incoming webhook
- splitting a large task between a supervisor agent and subagents
- serving an agent behind an HTTP API
- rolling a stored prompt back to an earlier version
Screenshots & Videos
Explore Mastra in action
User Reviews
Compare with Similar Software
Click to compare side by side with Mastra