Capability · Framework — agents
Mastra
Mastra is an opinionated TypeScript framework for building AI agents and workflows. It covers agents with tools, deterministic step-based workflows, RAG (with a pluggable vector store), memory, evals, voice, and OpenTelemetry tracing. It runs on Node, Bun, and edge runtimes, integrates with the Vercel AI SDK for model providers, and ships a local dev playground.
Framework facts
- Category
- agents
- Language
- TypeScript
- License
- Elastic License 2.0
- Repository
- https://github.com/mastra-ai/mastra
Install
npm create mastra@latest Quickstart
import { Mastra, Agent } from '@mastra/core';
import { anthropic } from '@ai-sdk/anthropic';
const agent = new Agent({
name: 'assistant',
instructions: 'You are a helpful assistant.',
model: anthropic('claude-opus-4-7'),
});
const mastra = new Mastra({ agents: { assistant: agent } });
const res = await mastra.getAgent('assistant').generate('Hello!'); Alternatives
- Vercel AI SDK — lower-level streaming primitives
- LangChain.js — TS port of LangChain
- LlamaIndex.TS — RAG-focused TS framework
- OpenAI Agents SDK (JS) — OpenAI's TS alternative
Frequently asked questions
Mastra or the Vercel AI SDK?
The Vercel AI SDK is a thinner layer focused on streaming and provider abstraction. Mastra builds on top of it (for model access) and adds agents, workflows, RAG, memory, evals, and dev tooling. Use Vercel AI SDK for minimal apps; Mastra once you need agents and orchestration.
Can I self-host Mastra?
Yes. Mastra is open source under the Elastic License 2.0 and runs anywhere Node, Bun, or a modern edge runtime does. There's also an optional Mastra Cloud for managed deployment and observability.
Sources
- Mastra — docs — accessed 2026-04-20
- Mastra — GitHub — accessed 2026-04-20