← frameworks directory○ community

Framework · TypeScript · Mastra

Mastra.

If the stack is TypeScript and the team writes Next.js, Mastra is the agent framework that does not fight you. Workflows, agents, RAG, evals, all typed, all idiomatic, no Python required.

$ npm create mastra@latest

Most agent frameworks are Python-first and treat TypeScript as a port. Mastra inverts that. It is TypeScript-native from day one, ships with the primitives that production builds actually need (workflows, agents, evals, vector RAG, voice), and integrates cleanly into existing Next.js or Node projects. The result is a framework that finally feels like it belongs in a TypeScript codebase rather than translated into one.

The thing that keeps standing out across production builds is type safety end to end. Tools, inputs, outputs, and workflow steps are all typed. The model contract is the source of truth, and the rest of the code just lines up with it. The cost of changing a tool signature is paid by the compiler, not by a runtime trace at midnight.

§01What's in the box

The framework ships the primitives a production build actually uses, with sensible defaults rather than a kitchen sink:

  • Agents, which combine an LLM, tools, and memory, all typed.
  • Workflows, which are declarative step graphs with branching, retries, and parallelism.
  • RAG, with built-in vector store integrations for pgvector, Pinecone, Chroma, and others.
  • Evals, a first-class testing harness for agent behavior with sensible defaults.
  • Voice, the STT and TTS primitives for speaking agents.
  • A local dev playground that runs in a browser, so workflow runs can be stepped through interactively during development.

§02When it earns its keep

Mastra shines when the work is building a production agent feature inside an existing TypeScript app, not when the work is researching agent architectures. The opinionated defaults remove a lot of decisions. The dev playground catches bugs before prod. The eval primitives stop a regression from shipping silently. For greenfield Python work or research-heavy multi-agent coordination, LangGraph or CrewAI is a better fit.

§03Setup

# scaffold a new project
npm create mastra@latest

# or add to existing project
npm install @mastra/core

# define an agent
import { Agent } from "@mastra/core";

const agent = new Agent({
  name: "support",
  model: "anthropic/claude-opus-4-7",
  tools: { lookup, escalate },
});

§04Caveats

  • Younger ecosystem. Fewer integrations than LangChain, though most of what production builds need exists, and the rest takes a small adapter.
  • Opinionated by design. Composing primitives a different way means fighting the framework, which is usually a signal to step back and ask whether the original shape was actually better.
  • TypeScript only. For Python teams, LangGraph or CrewAI is the right answer.