MASTRA FRAMEWORK

Everything you need to build AI agents in TypeScript

Quickstart

Agents

Build AI-powered applications and agents with an all-in-one framework.

Workflows

Orchestrate complex, multi-step processes. Combine agents, tools, and logic in a single type-safe flow.

Studio

Test agents, trace execution, and refine prompts together. Connect your own frontend when you're ready to ship.

Self host your Mastra projects for free or contact us for enterprise features

Full Pricing

Free

Apache 2.0 licensed

$0/ month
  • Build and host agents anywhere
  • AgentsDefine agent behavior with models, tools, memory, and instructions.
  • WorkflowsBuild durable multi-step agent processes with typed control flow.
  • Observational MemoryPersist conversation context and application state across sessions.

Enterprise

Licensed self-hosted features

Custom pricing
  • Scalable enterprise features
  • Enterprise controlsRBAC, SSO, IAM, and network policy integration.
  • Data stays in your VPCNo traces, prompts, or outputs leave your environment.
  • Predictable costOne flat annual fee — no per-trace or per-seat metering.

Mastra is powering the best AI teams

Case Studies

Frequently asked questions

Why use a unified TypeScript framework for AI agents?

Mastra is an open-source TypeScript framework that gives you every primitive you need in a single framework: agents, memory, tools, workflows and evals. Building without a unified framework means stitching together separate libraries that were never designed to work together. Mastra is trusted by engineering teams at Replit, SoftBank, PayPal, PLAID and Marsh McLennan.

What primitives do Mastra agents come with?

Mastra agents come with the primitives you need to get to production faster, all built in. Connect to more than 1,000 models through a unified model router, give agents tools to act on and share them across agents via MCP. Track the context that matters across sessions using observational memory that learns about your users automatically. Require a human or external system to approve or reject any tool call before it executes. Split complex work across specialized agents and coordinate them with a supervisor. Every capability is there from the start.

What can you orchestrate with Mastra workflows?

Mastra workflows let you orchestrate complex, multi-step processes by combining agents, tools and logic in a single type-safe flow. Define exactly what happens, when and in what order using sequential steps, parallel branches, conditional logic and loops. Call an agent or run deterministic code at each step, using models where you need reasoning and plain functions where you do not. Any step can suspend execution, hand control to a human and resume when input arrives. Persist workflow state automatically so you can suspend a workflow and resume whenever ready.

What model providers does Mastra support?

Mastra's unified model router supports more than 1,000 models across providers including OpenAI, Anthropic, Google and others. Set your provider API key as an environment variable and Mastra auto-detects it.

What JavaScript and TypeScript frameworks does Mastra integrate with?

Mastra integrates with Next.js, React, Astro, Express, SvelteKit and Hono. Add Mastra to an existing project or create a new app with your preferred framework. For other frameworks, Mastra provides framework integration guides covering additional setup and configuration.

How does Mastra handle production readiness for agents?

Mastra provides guardrails, scorers, evals and tracing to make agents production-ready. Scorers evaluate agent output using model-graded, rule-based and statistical methods. Built-in observability traces agent decisions and captures token usage, latency and costs. Input and output processors sanitize responses and prevent prompt injection before agents reach production.

What does Mastra Studio do?

Mastra Studio provides an interactive environment for testing agents, tracing execution and refining prompts before and after you ship. Run agents and workflows in Studio, switch models, tweak settings and see results instantly. Follow execution traces to see exactly where an agent stalled or made the wrong call. Edit prompts and create datasets directly in the UI without requiring code access, then hand it to your product manager, designer or data scientist.

How does Mastra Studio connect to the framework?

Mastra Studio connects directly to your Mastra instance and lets you interact with your agents, workflows and tools in an interactive UI. Run agents locally during development at localhost:4111, then deploy Studio to production so your team can manage agents, monitor performance and inspect traces with no source code access required.

Can I deploy Mastra agents to my existing infrastructure?

Mastra deploys to any Node.js-compatible environment including Bun, Deno and Cloudflare. Server adapters let you run Mastra with Express, Hono or your own HTTP server. Mastra is fully open source under the Apache 2.0 license, so you control your source code and infrastructure.

Start building today.