Skip to content
Level up your prompts with SurePrompts — curated prompts for every workflow.
agentscamp

Mastra

An open-source TypeScript framework for building AI agents, workflows, RAG, and tool-calling, with memory, model routing, and built-in observability.

Mastra is an open-source TypeScript framework for building AI agents, workflows, RAG, and tool-calling, from the team behind Gatsby. It targets JavaScript/TypeScript engineers who want typed agents, graph-based workflows, memory, and observability in one stack instead of dropping to Python.

Mastra is an open-source TypeScript framework for building AI agents, workflows, RAG, and tool-calling, from the team behind Gatsby (Sam Bhagwat and co-founders). It packages the primitives an agentic app needs — typed agents, a graph-based workflow engine, agent memory, model routing, and observability — into one modular framework so you stay in TypeScript instead of reaching for a separate Python stack.

It is aimed at JavaScript/TypeScript engineers building production agents and AI features: you define an agent with instructions, a model, and tools in one place, then compose deterministic multi-step workflows around it. That makes it a natural fit when your app, your tooling, and your AI logic all live in the same Node/TypeScript codebase.

Highlights

  • Typed agents — declare instructions, model, tools, and runtime behavior in a single typed object; the agent reasons over tools and iterates until it returns a final answer.
  • Graph-based workflows — orchestrate multi-step processes with explicit control flow via .then(), .branch(), and .parallel(), separate from open-ended agent loops.
  • Memory and RAG — built-in conversation history, working memory, semantic recall, and observational memory (background agents maintaining a dense observation log), plus RAG chunking and vector store adapters.
  • Model routing, Gateway & observability — connect across providers through one interface — or use Mastra Gateway (launched November 19, 2026: 500+ models behind one key and bill with failover) — with built-in scorers, OTel tracing, and Mastra Factory for issue-to-PR workflows.

In an AI-assisted workflow

Scaffold a project, define an agent, and call it from your TypeScript app. See where it sits among peers in Agent Frameworks in 2026.

npm create mastra@latest
# then, in code:
# import { Agent } from "@mastra/core/agent";
# const agent = new Agent({ name: "support", instructions: "...", model, tools });
# const res = await agent.generate("Summarize this ticket");

TIP

Reach for Mastra when your stack is already TypeScript and you want agents, workflows, memory, and tracing in one framework — rather than splitting agent logic into a separate Python service.

Good to know

Mastra's core framework (@mastra/core 1.86.0, ~30k GitHub stars as of November 2026) is open source under Apache-2.0 and free to self-host; code under ee/ directories falls under the Mastra Enterprise Edition License v2.0 (effective September 22, 2026), which prohibits production use and redistribution without a commercial agreement with Kepler Software, Inc. As of November 2026, the optional hosted Mastra Platform lists Free ($0/mo), Starter ($25/mo, launched November 10, 2026 when the old free tier was renamed Free), Team ($250/mo), and Enterprise (custom). For a TypeScript head-to-head see Mastra vs LangChain, and for broader framework trade-offs see LangGraph vs. CrewAI.

Frequently asked questions

What is Mastra?
Mastra is an open-source TypeScript framework for building AI agents, workflows, RAG, and tool-calling, built by the team behind Gatsby. It bundles typed agents, a graph-based workflow engine, agent memory, model routing across many providers, and built-in observability so JavaScript/TypeScript engineers can build agentic apps without dropping to Python.
Is Mastra free?
Mastra's core framework is open source under Apache-2.0 and free to self-host (deploy to Node.js, Vercel, Cloudflare, Netlify, or your own infra); code under ee/ directories requires a commercial agreement. As of November 2026, the optional hosted Mastra Platform offers Free ($0/mo), Starter ($25/mo, launched November 10, 2026 with a small dedicated server), Team ($250/mo), and Enterprise (custom).
How does Mastra compare to LangGraph?
Both build controllable, multi-step agents, but Mastra is TypeScript-native and ships agents, workflows, memory, and observability as one framework, while LangGraph is a low-level graph library for explicit state machines, available in Python and JavaScript (both reached 1.0 in October 2025). If your stack is Node/TypeScript, Mastra keeps you in one language; LangGraph is the more common choice in Python shops.

Filed under

typescript · agents · workflows · rag · open-source

Related