Mastra
TypeScript-first AI framework for building agents, RAG pipelines, and workflows
Mastra is a TypeScript-first AI framework for building agents, RAG pipelines, and structured workflows. It provides assistants with tool use, workflow composition, observability, and integrations with major LLM providers. Designed for TypeScript/JavaScript developers who want type-safe AI application development. 20K+ GitHub stars.
Pricing: Free
Resources
What is Mastra?
Mastra is an open-source TypeScript framework for building AI agents and AI-powered applications. Created by the team behind Gatsby (the React static site generator), it provides a structured, type-safe toolkit for defining agents, tools, workflows, RAG pipelines, and memory systems. The core framework is Apache 2.0 licensed with 22,000+ GitHub stars.
How It Works
Agents are defined declaratively with an ID, instructions (system prompt), and a model specified through a provider/model-name routing format (e.g., openai/gpt-5.4). A single interface connects to 40+ LLM providers. Swapping models requires changing a string, not rewriting agent logic. Tools (API calls, data lookups) are attached to agents, which autonomously decide when to invoke them. Workflows handle deterministic multi-step processes as directed graphs, separate from the open-ended reasoning agents do.
Key Features
Mastra bundles agents, workflows, RAG, memory, evals, guardrails, and observability into one framework. A local Developer Studio provides interactive visualization for building and testing agents. Memory supports PostgreSQL, LibSQL, and Upstash as storage backends. RAG integrates with Pinecone, Chroma, and pgvector. First-class Model Context Protocol (MCP) support enables tool interoperability. Human-in-the-loop workflows can suspend execution, wait for approval, and resume.
Pricing
The framework itself is free and open source (Apache 2.0). A cloud platform (Mastra Platform) with observability dashboards, collaborative Studio, and GitHub-based deployments is in development. Enterprise features in the ee/ directory are source-available under a separate Mastra Enterprise License. The company raised a $13M seed round led by Y Combinator.
Who Should Use Mastra?
Mastra targets TypeScript and JavaScript developers building AI-powered applications who want to stay in the JS/TS ecosystem rather than switching to Python. It integrates with Next.js, React, Express, Hono, Astro, and SvelteKit. Compared to LangChain (modular but heavy on glue code), Mastra is more opinionated and integrated. The framework is evolving quickly (v1.14 as of March 2026), so expect API changes between releases.
Mastra Alternatives
Explore 25 products in the Agents category. View all Mastra alternatives.
AgentOps
Build compliant AI agents with observability, evals, and replay analytics.
Also listed in
Is your product missing?