█

AI/TLDR

Mastra

A TypeScript framework for building AI agents, workflows, and applications

Agent Frameworks & BuildersOpen source
Language
TypeScript
License
Apache-2.0
$npm create mastra@latest

Overview

Mastra is an open-source framework for building AI-powered applications and agents on a modern TypeScript stack. It bundles the common pieces of an AI app — agents, a workflow engine, memory, retrieval (RAG), and observability — so you can go from a prototype to a production service without stitching the parts together yourself.

It is built for TypeScript developers who work with React, Next.js, or Node. You can drop Mastra agents and workflows into an existing app, or run them as a standalone server. A model router lets you reach providers like OpenAI, Anthropic, and Gemini through one interface, so you are not locked to a single vendor.

As a general agent framework, Mastra covers both ends of the control spectrum: autonomous agents that decide which tools to call and iterate on their own, and graph-based workflows for cases where you need explicit, step-by-step execution. It can also expose your agents and tools as MCP servers for other systems to use.

What it does

  • Model routing to 40+ providers (OpenAI, Anthropic, Gemini, and more) through one standard interface
  • Autonomous agents that reason about goals, choose tools, and iterate until a final answer or stopping condition
  • Graph-based workflow engine with control-flow syntax like .then(), .branch(), and .parallel()
  • Human-in-the-loop suspend-and-resume backed by storage, so a run can pause and continue later
  • Context management with conversation history, RAG retrieval, and Observational Memory
  • Author MCP servers and ship with built-in evals and observability for production

Getting started

The recommended way to start is the create-mastra CLI, which scaffolds a new project and walks you through setup.

Scaffold a new project

Run the create command and follow the prompts. The CLI sets up a Mastra project with a chosen model provider.

bashbash
npm create mastra@latest

Start the dev server

From the project directory, start the dev server. This opens Mastra Studio at http://localhost:4111, a UI to build, test, and manage your agents, workflows, and tools.

bashbash
npm run dev

Read the docs

Follow the official Installation guide for step-by-step CLI or manual setup, and browse the docs for agents, workflows, and RAG.

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Build an autonomous agent that uses tools to answer open-ended user requests
  • Orchestrate a multi-step process with explicit branching and parallel steps using the workflow engine
  • Add a RAG-backed assistant with conversation memory to a React or Next.js app
  • Expose your agents and tools as an MCP server for other agents and systems to consume

How Mastra compares

Mastra alongside other open-source agent frameworks & builders tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
DeepSeek Harness★ 260kDeepSeek AI's open-source agent harness (dsh), built on Cordis, where models, tools, skills, sessions, sandboxes, storage and the UI are all plugins composed through profiles.
AutoGPT★ 188kOne of the earliest autonomous agent projects, now a platform for building and running agents from reusable blocks and workflows.
DeerFlow★ 84.4kByteDance's open-source super agent harness built on LangGraph: skills, sub-agents, sandboxes, a filesystem and long-term memory for long-horizon research, coding and content tasks.
nanobot★ 49.3kLightweight self-hosted personal AI agent framework in Python, with a WebUI, terminal and chat-app channels, tools, long-term memory, MCP and scheduled automations.
LangGraph★ 43.8kA library from the LangChain team for building stateful, graph-based agent workflows with explicit control over steps, memory, and human-in-the-loop checkpoints.
Agno★ 42.9kA fast Python framework (formerly Phidata) for building agents with memory, tools, and multimodal inputs, plus a runtime for deploying them in production.
AgentGPT★ 36.3kAgentGPT lets you name a custom AI, give it a goal, and watch it plan tasks, run them, and learn from the results, all from a web browser.
Mastra★ 29kA TypeScript framework for building AI agents, workflows, and applications