Mastra Documentation — TypeScript AI Agent Framework
by Mastra
Build production agents in TypeScript — agents, tools, memory, workflows and evals in one type-safe framework.
Overview
Mastra is a TypeScript-first agent framework (Apache 2.0 licensed core, with an enterprise license covering the ee/ modules) that bundles the primitives an agentic app needs into one type-safe package: agents that reason over goals and iterate with tools until they emit a final answer; graph-based workflows with sequential steps, parallel branches, conditionals, loops and human-in-the-loop suspend/resume; memory, including conversation history and observational memory for coherence across sessions; RAG over your own APIs, databases and files; tool definitions and MCP server support so agents can consume Model Context Protocol tools; and built-in evals and observability. A unified model router covers 40+ providers, letting you swap between OpenAI, Anthropic and Google models without rewriting agent code. The project is actively developed — version 1.50.0 shipped on 8 July 2026 — with templates, case studies from companies including Replit and Medusa, and a `npm create mastra@latest` scaffold to get a project running in minutes. It targets Node.js (22.18.0+ can execute TypeScript files directly).
At a Glance
- Topic
- Frameworks
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- ~3-6 hours, self-paced
- Provider
- Mastra
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓How to define an agent in TypeScript with tools, instructions and a stopping condition
- ✓How to orchestrate multi-step work with graph-based workflows — parallel branches, conditionals, loops and human-in-the-loop suspend/resume
- ✓How to give agents memory: conversation history plus observational memory that persists across sessions
- ✓How to add RAG over your own APIs, databases and files inside an agent
- ✓How to connect an agent to MCP servers and expose your own tools
- ✓How to route across 40+ model providers through one interface, and instrument agents with built-in evals and tracing
Highlights
- •A genuinely TypeScript-native agent stack — full type safety, no Python detour
- •Agents, memory, tools, workflows, RAG and evals ship as one coherent framework rather than assembled libraries
- •Apache 2.0 open source and moving fast: v1.50.0 released 8 July 2026, 26k+ GitHub stars
- •Unified model router across 40+ providers, so switching models is a config change
Who It’s For
Best For
- ✓TypeScript and Node.js engineers building AI agents
- ✓Full-stack teams shipping agents inside an existing JS/TS product
- ✓Developers who want workflows and human-in-the-loop control, not just a chat loop
Prerequisites
- •Solid TypeScript
- •Node.js (22.18.0+ recommended)
- •Basic understanding of LLM tool calling
FAQ
What is Mastra Documentation — TypeScript AI Agent Framework?
The official documentation for Mastra, an open-source TypeScript framework for building AI agents and agentic applications. It is for JavaScript and TypeScript engineers who want a first-class agent stack in their own language instead of dropping into Python.
Is Mastra Documentation — TypeScript AI Agent Framework free?
Mastra Documentation — TypeScript AI Agent Framework is free to access.
What level is Mastra Documentation — TypeScript AI Agent Framework for?
Mastra Documentation — TypeScript AI Agent Framework is aimed at a intermediate audience. Recommended background: Solid TypeScript, Node.js (22.18.0+ recommended), Basic understanding of LLM tool calling.
How long does Mastra Documentation — TypeScript AI Agent Framework take?
Expect roughly ~3-6 hours, self-paced. Most learners work through it at their own pace.
What will I learn from Mastra Documentation — TypeScript AI Agent Framework?
You'll learn: How to define an agent in TypeScript with tools, instructions and a stopping condition; How to orchestrate multi-step work with graph-based workflows — parallel branches, conditionals, loops and human-in-the-loop suspend/resume; How to give agents memory: conversation history plus observational memory that persists across sessions; How to add RAG over your own APIs, databases and files inside an agent; How to connect an agent to MCP servers and expose your own tools; How to route across 40+ model providers through one interface, and instrument agents with built-in evals and tracing.