Mastra

Mastra

Freemium

The leading TypeScript framework for agents that run for days.

Agentic AI
Agent Frameworks

Published 27 September 2026

Scores

Popularity4/5

Over 27K GitHub stars and roughly 1M weekly npm downloads with adoption at Replit, Salesforce, and WorkOS mark it as the clear leader among TypeScript-first agent frameworks, though still smaller than the largest Python frameworks.

Learning Curve2/5

Typed agent and workflow configuration reads like idiomatic TypeScript, and JS/TS developers already familiar with Node.js tooling can get an agent running quickly without adopting a new mental model.

Flexibility4/5

Typed workflows with branching and retries, pluggable model routing, and MCP support cover most agent architectures, though the framework stays opinionated toward its own agent/workflow primitives rather than being fully unopinionated.

Performance4/5

Built-in evals, tracing, and metered CPU execution on Mastra Cloud are designed for production workloads that run continuously, backed by production deployments processing thousands of daily agent runs.

Portability4/5

Apache 2.0-licensed core is self-hostable anywhere Node.js runs and is provider-agnostic across 40+ model providers, though the managed Mastra Cloud layer and enterprise features introduce some pull toward the vendor's own platform.

About Mastra

Mastra is an open-source TypeScript framework for building AI agents, workflows, and retrieval-augmented applications, built by the team behind the Gatsby framework. It positions itself as the JavaScript-first alternative to Python-centric agent frameworks like LangChain and LlamaIndex, integrating directly into React, Next.js, and Node.js codebases or running as a standalone server, rather than bolting an AI layer onto an existing JS app from the outside.

Agents are defined with a typed configuration covering instructions, model, tools, and runtime behavior, so agent definitions get the same compile-time safety as the rest of a TypeScript codebase. Workflows compose typed steps with retries and branching for multi-stage automation, and a built-in memory system gives agents observational memory, semantic recall, and thread-aware storage that persists context across long-running sessions. Model access is standardized through routing across 40+ providers, including OpenAI, Anthropic, and Gemini, and agents can be exposed as Model Context Protocol (MCP) servers or consume external MCP tools.

Mastra ships with production-facing tooling out of the box: evals, metrics, traces, and datasets for monitoring agent quality and behavior over time, rather than treating observability as a separate integration. The core framework is Apache 2.0-licensed and free to self-host with no seat or usage limits; a managed Mastra Cloud platform adds hosted observability, CPU-metered execution, and enterprise controls (SSO, RBAC, VPC data isolation) on top, priced separately from the open-source library. Production users include Replit, Salesforce, Sanity, SoftBank, and WorkOS.

Key Features

  • Typed agent definitions: instructions, model, tools, and runtime behavior in one config
  • Workflow engine: typed steps, retries, and branching for multi-stage automation
  • Observational memory with semantic recall and thread-aware durable context
  • Standardized model routing across 40+ providers including OpenAI, Anthropic, and Gemini
  • Native Model Context Protocol (MCP) server authoring and consumption
  • Built-in evals, metrics, traces, and datasets for production observability

Pros

  • TypeScript-native design fits directly into existing React/Next.js/Node.js codebases
  • Apache 2.0-licensed core, free to self-host with no usage limits
  • Built-in observability (evals, traces, metrics) instead of a bolt-on integration
  • Backed by an experienced team (ex-Gatsby) and a well-funded YC-backed company

Cons

  • TypeScript/JavaScript-only, no path for Python-first teams
  • Younger ecosystem than LangChain/LlamaIndex, with fewer third-party integrations
  • Mastra Cloud pricing and enterprise features are separate from the open-source core
  • Smaller community and job-market footprint than the largest Python frameworks

Mastra Pricing

Freemium
Open SourceFree
  • · Apache 2.0-licensed framework, self-hosted anywhere Node.js runs
  • · Full agents, workflows, memory, and MCP support with no usage limits
Starter (Cloud)Free
  • · 100K observability events and 24 CPU hours included, then metered usage
  • · 15-day data retention, unlimited users, deployments, and projects
Teams$250/monthly
  • · 1M observability events and 250 CPU hours included, then metered usage
  • · 6-month data retention, multiple teams, SSO, and SOC 2 documentation
EnterpriseContact sales
  • · Custom volume, retention, RBAC, audit logs, uptime SLAs, and dedicated support
  • · VPC data isolation and flat annual pricing with no per-trace metering

Tools Related to Mastra

Works well with Mastra(7)

Next.js is Mastra's most common deployment target and has a dedicated official getting-started guide — agents and workflows typically run as Next.js API routes or server actions.

Mastra has an official SvelteKit getting-started guide for wiring agent and workflow calls into a SvelteKit app.

Mastra has an official React + Vite getting-started guide for wiring agent and workflow calls into a React front end via the Mastra Client SDK.

Mastra has an official Nuxt getting-started guide, covering the Vue ecosystem the same way its Next.js guide covers React.

Mastra's TypeScript-native design and Client SDK work with plain Vue apps, though the official framework guide targets Nuxt rather than bare Vue.

Mastra ships a first-party @mastra/nestjs server adapter — a dedicated NestJS module that registers Mastra's agent and workflow routes inside an existing NestJS application.

Alternatives to Mastra(5)

The closest head-to-head comparison for TypeScript teams — the Vercel AI SDK is a leaner provider-agnostic toolkit for streaming and tool calls, while Mastra adds a fuller framework layer of workflows, memory, and evals on top of the same JS-native audience.

Both are agent frameworks for building multi-step, tool-using agents — CrewAI centres on role-based multi-agent crews in Python, Mastra on typed agents and workflows in TypeScript. Teams pick one as their primary framework.

Both frameworks let developers hand-build multi-step agent workflows with explicit control flow — LangGraph as a Python state-graph runtime, Mastra as a typed TypeScript workflow engine.

Mastra positions itself as the TypeScript-first alternative to LangChain, covering the same RAG, memory, and multi-agent workflow ground with typed, JS-native primitives instead of LangChain's Python-first component library.

Both are type-safe, production-oriented agent frameworks built around strict typing — Pydantic AI for Python teams, Mastra for TypeScript teams. Competing picks depending on backend language.

Learning Resources

No resources yet — check back soon.

Vendor

Tags

TypeScriptOpen SourceSelf-hostableFree TierAI-poweredWorkflow Automation

Details

Maintained
Yes
Agent type
Framework
Primary language
TypeScript
Open source
Yes
Hosting
Self-hosted
GitHub stars
28.3k
Stars updated
2026-09-23