Mastra

TypeScript framework for building, observing and shipping AI agents

Advanced API
Screenshot of Mastra, TypeScript framework for building, observing and shipping AI agents

What is Mastra?

Mastra is a TypeScript framework for building AI agents, workflows and memory, with MCP support, a local Studio, built-in tracing and evals, and deployment to Mastra Cloud for teams moving from prototype to production.

Mastra is an open TypeScript framework for building AI agents and applications. It bundles the pieces that agent projects usually assemble by hand: typed agents, workflows, memory, tools, MCP support, a local server and built-in observability. The aim is to carry a prototype all the way to a production deployment without swapping stacks along the way. The framework is aimed at TypeScript developers and engineering teams who want agents embedded in real products or internal systems. Agents are declared in code with instructions, a model string and a set of tools. Workflows chain typed steps with retries and branches, so deterministic business processes can sit next to open-ended reasoning. Memory covers recent messages, semantic recall and an observational memory option, all tied to threads. A harness coordinates multi-mode agents (for example plan and build modes) with shared state and storage, and a factory package describes a group of specialized agents that move software from issue to production. In practice, a project starts with a single create command that scaffolds the app for a chosen provider (OpenAI, Anthropic, Google or xAI) and installs skills for detected coding assistants. A dev server then opens Mastra Studio locally on port 4111, where agents, workflows and tools can be built, tested and managed. The same app can be registered on one Mastra server and deployed to Mastra Cloud. A model router gives access to a large catalog of models through one interface. Observability is a central selling point. Traces show each model call, tool call and handoff on a searchable timeline, metrics follow latency, cost and tool usage, and datasets capture traces and feedback for repeatable evaluation. Evals score runs against checks before changes ship, and signals route webhook or polling events into agent threads. Among alternatives, Mastra sits with code-first agent frameworks rather than visual no-code builders. It suits teams comfortable with TypeScript who want ownership of the architecture. Published customer stories include Salesforce, MongoDB, Sanity, WorkOS and Replit, covering coding harnesses, content agents and internal agent platforms.

How do you use Mastra?

  1. 1Scaffold a new project
    Run the create command with a project name and an LLM provider such as openai, anthropic, google or xai. It generates a default Mastra project and sets up Git where appropriate.
    Mastra — Scaffold a new project
  2. 2Start the dev server
    Enter the project directory and run the dev script. The server starts locally and exposes Mastra Studio on port 4111.
  3. 3Define an agent and tools
    Create an Agent with an id, instructions, a model string and a tools object. Register it on the Mastra instance so Studio can run it.
  4. 4Add workflows and memory
    Compose typed steps with createWorkflow for repeatable processes, and configure Memory with recent messages and semantic recall for durable context.
  5. 5Inspect traces and run evals
    Use the observability views to review model calls and tool usage, then score runs with evals and datasets before changes ship.
  6. 6Deploy to Mastra Cloud
    Register agents and workflows on one Mastra server and deploy the same app to Mastra Cloud once it behaves as expected.

Pros and cons

Pros

  • Covers agents, workflows, memory, tools and MCP in one TypeScript framework instead of several stitched librariesAI
  • Built-in observability with traces, metrics, datasets and evals helps debug and measure agent behaviorAI
  • Local Mastra Studio makes it easy to build, test and manage agents during developmentAI
  • Model router and several provider options reduce lock-in to a single LLM vendorAI
  • Named enterprise case studies show use in production at large organizationsAI

Cons

  • TypeScript only, so teams working mainly in Python need a different frameworkAI
  • Code-first design offers no visual builder, which rules out non-developersAI
  • Broad surface (harness, factory, signals, observational memory) means a real learning curveAI
  • Pricing for Mastra Cloud is not stated on the homepage, making cost planning harderAI

How much does Mastra cost?

Integrations

Supports MCP and a model router for many models, with OpenAI, Anthropic, Google and xAI as scaffold providers. Case studies mention Slack and Teams agents, and a changelog post covers Jira and GitLab incident integrations.

Features

Typed agents, typed workflows with retries and branches, memory (recent messages, semantic recall, observational memory), a multi-mode harness, a factory of specialized agents, a local server with Studio, and observability covering traces, metrics, datasets, evals and signals.

Frequently asked questions about Mastra

  • Does Mastra have an API?
    Yes, Mastra offers an API.
  • How do you use Mastra?
    The walkthrough on this page covers 6 steps: 1. Scaffold a new project 2. Start the dev server 3. Define an agent and tools 4. Add workflows and memory 5. Inspect traces and run evals 6. Deploy to Mastra Cloud.
  • What platforms does Mastra support?
    Mastra is available on Web App, MacOS, Windows and Linux.
  • What does Mastra integrate with?
    Supports MCP and a model router for many models, with OpenAI, Anthropic, Google and xAI as scaffold providers. Case studies mention Slack and Teams agents, and a changelog post covers Jira and GitLab incident integrations.
  • What are the limitations of Mastra?
    TypeScript only, so teams working mainly in Python need a different framework. Code-first design offers no visual builder, which rules out non-developers. Broad surface (harness, factory, signals, observational memory) means a real learning curve.

Status

StatusActive
Views0
Outbound clicks0
Added10/8/2026

Platforms

Web AppMacOSWindowsLinux

Pricing

Freemium