Mastra

TypeScript framework for building AI agents, workflows, and RAG applications with memory and observability built in.

Works with AI agents:llms.txtCLI
Ask your AI about this, with this page as the source:ChatGPT ↗Claude ↗Perplexity ↗

Mastra is an open-source TypeScript framework for building AI agents and multi-step workflows inside a JavaScript or TypeScript codebase. It covers what an agent feature needs beyond a model call: tools, memory, workflows, evals and tracing.

You register agents, tools and workflows on one Mastra instance. An agent is instructions plus a model, given as a provider/model string that Mastra's model router resolves using the matching API key from the environment, plus tools and optional memory. Workflows are typed steps with branching, parallel runs, loops, and suspend and resume backed by saved snapshots. State lives in pluggable storage adapters. Mastra runs on Node.js 22.13 or later, Bun, Deno and Cloudflare, either inside Next.js or Astro or as its own Hono-based server.

Running mastra dev opens Studio, a local UI for chatting with agents, running workflows and reading traces. Memory covers message history, semantic recall and working memory; agents can call MCP servers or expose tools to MCP clients; and @mastra/ai-sdk streams agents into AI SDK UI hooks such as useChat. You deploy with mastra build to any VM, container or PaaS, through built-in deployers for Vercel, Netlify and Cloudflare, or on the hosted Mastra platform.

It is TypeScript only. Persistent memory and resumable workflows need a database you choose and run, the default in-memory store loses data on exit, and the file-based libSQL store does not work on serverless hosts. Code under the repository's ee/ directories (auth, agent builder, editor) is under a separate license, not Apache 2.0.

Where it fits

How Mastra itself is built

53 tools, from its own code, website and Product Hunt page.

Who uses it

24 makers' products, each linked to the source that shows it, and 13 open-source projects that declare it in their code.

The maker says so 7Customer story 17Declared in code 13How evidence is collected →
supersetDesktop IDE for running several coding agents in parallel, each in an isolated workspace…

“Mastra powers our chat infrastructure and makes developing a coding agent seamless”

AI SDK & Agent FrameworkMaker says so · source ↗
@OYour AI coworker, in Slack. Just tag @O.

“Mastra, the agent framework that let us go from idea to shipping agents fast.”

AI SDK & Agent FrameworkMaker says so · source ↗
Upsolve AIAnalytics platform for deploying AI data agents that query, chart and explain a company'…

“We use Mastra as our foundational agent framework.”

AI SDK & Agent FrameworkMaker says so · source ↗
ImagineBuild something real with the most complete AI builder

“Shoutout to the team at Mastra for building an excellent agent orchestration layer. Mastra is a key part of Imagine.dev’s agentic architecture, helping us coordinate specialized agents and reliably turn high-level intent into structured execution. Their focus on developer experience and composability made it possible for us to move fast without sacrificing correctness.”

AI SDK & Agent FrameworkMaker says so · source ↗
RevolteAI for Software Engineering

“Revolte runs a harness of specialized agents across the full dev lifecycle, so the framework underneath had to be production-grade, not a prototyping toy. Mastra's modern TypeScript stack gave us type safety, real workflow control, and structure we could actually build a platform on, without the sprawl and glue code that slows other frameworks down. A serious TypeScript foundation with clean agent orchestration is what set it apart.”

AI SDK & Agent FrameworkMaker says so · source ↗
siiftTurn AI noise into better business decisions

“Really like the depth of product here, very hard to make a product of this scale high quality, impressed!”

AI SDK & Agent FrameworkMaker says so · source ↗

Open source: a project that declares Mastra as a dependency in its public code — verifiable, but not necessarily a live product.

What makers say

5 makers on why they use Mastra, in their own words on Product Hunt.

Revolte runs a harness of specialized agents across the full dev lifecycle, so the framework underneath had to be production-grade, not a prototyping toy. Mastra's modern TypeScript stack gave us type safety, real workflow control, and structure we could actually build a platform on, without the sprawl and glue code that slows other frameworks down. A serious TypeScript foundation with clean agent orchestration is what set it apart.
RevolteSep 2026 ↗
Shoutout to the team at Mastra for building an excellent agent orchestration layer. Mastra is a key part of Imagine.dev’s agentic architecture, helping us coordinate specialized agents and reliably turn high-level intent into structured execution. Their focus on developer experience and composability made it possible for us to move fast without sacrificing correctness.
ImagineSep 2026 ↗
Really like the depth of product here, very hard to make a product of this scale high quality, impressed!
siiftSep 2026 ↗
Mastra powers our chat infrastructure and makes developing a coding agent seamless
supersetSep 2026 ↗
Mastra, the agent framework that let us go from idea to shipping agents fast.
@OSep 2026 ↗

Loved and watch-outs

Themes that recur in makers' words and Hacker News comments, each linked to what it summarises, with how Product Hunt tags its reviews.

Most loved
Watch-outs
  • Workflows with rule-based, non-LLM branching feel clunky, pushing some to write their own. HN
  • The Elastic v2 license bars offering it as a hosted service, so it is not open source in the usual sense. HN
  • Several Mastra npm packages were compromised in a supply-chain attack. HN

Who switches

Public pull requests on GitHub since Oct 2024 whose title says "X to Y" — real code changes moving a project from one tool to another, by developers in general. Open a row to see the pull requests.

LangGraph → Mastra5 PRs

Alternatives to Mastra

All alternatives by situation →

On Product Hunt, people weigh it against: OpenAI API, LangChain, Trigger.dev.

Questions makers ask about Mastra

Does it work inside a Next.js app?

Yes. Mastra can live in a Next.js or Astro project and deploy with it; on Vercel you add @mastra/* to serverExternalPackages and drop the file-based LibSQLStore, which needs a filesystem. source ↗

Where can I deploy it?

Anywhere that runs Node.js 22.13 or later, Bun, Deno or Cloudflare. mastra build produces a standalone server for a VM, container or PaaS, and optional deployers handle Vercel, Netlify and Cloudflare. source ↗

What database does agent memory need?

A persistent storage adapter whenever state must survive restarts, such as libSQL, PostgreSQL or MongoDB for memory. The default in-memory store is for tests; a file-backed libSQL database works for local development. source ↗

Which model providers can I use?

Any provider in its model router, addressed as a provider/model string with the API key read from the environment. You can mix models across agents and configure fallbacks if a provider goes down. source ↗

Can I use it with AI SDK UI hooks like useChat?

Yes. The @mastra/ai-sdk package provides route handlers that stream Mastra agents and workflows in the format useChat, useCompletion and useObject expect. source ↗

Do I need the hosted platform to test agents and see traces?

No. Studio runs locally at localhost:4111 when you start mastra dev, and you can also deploy it yourself behind your own authentication. source ↗

Is Mastra free?

Yes — there is a free tier a small product can run on; paid use starts at $250/mo. source ↗

Is Mastra open source or self-hostable?

Open source, and you can self-host it. source ↗

Can AI coding agents work with Mastra?

It serves an llms.txt docs index; it has an official CLI (mastra).

Who uses Mastra?

24 makers' products we track, each with a source, and 13 open-source projects declare it in their code. source ↗