AI/TLDR

Mastra

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

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
AutoGPT★ 185kOne of the earliest autonomous agent projects, now a platform for building and running agents from reusable blocks and workflows.
Agno★ 40.8kA fast Python framework (formerly Phidata) for building agents with memory, tools, and multimodal inputs, plus a runtime for deploying them in production.
AgentGPT★ 36.2kAgentGPT 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.
LangGraph★ 35.2kA library from the LangChain team for building stateful, graph-based agent workflows with explicit control over steps, memory, and human-in-the-loop checkpoints.
Composio★ 28.9kComposio is an open-source SDK for Python and TypeScript that gives AI agents ready-made tools to act on real apps and APIs across many agent frameworks.
Semantic Kernel★ 28.2kMicrosoft's SDK for adding agents, plugins, and planning to apps across .NET, Python, and Java.
smolagents★ 27.9kA minimal agent library from Hugging Face where the model writes and runs Python code to call tools and complete tasks.
Mastra★ 25.3kA TypeScript framework for building AI agents, workflows, and applications