Skip to main content

Get Started

Mastra is a TypeScript framework for building AI agents, workflows, and tools. Create your first project in seconds and start building.

Quickstart
Direct link to Quickstart

Run the command below to create a new Mastra project with an example agent:

npm create mastra@latest

This sets up a project you can test immediately in Studio. See the quickstart guide for a full walkthrough.

Integrate with your framework
Direct link to Integrate with your framework

Add Mastra to an existing project or create a new app with your preferred framework.

For other frameworks, see the framework integration guides.

What you can do
Direct link to What you can do

Conversational agents

Customer support, onboarding, or internal query bots. Agents maintain context across sessions with thread-based message history and observational memory — background agents that compress conversation history into dense observation logs, keeping the context window small while preserving long-term recall. Stream responses token-by-token for responsive chat UIs. Attach tools so agents can look up orders, create tickets, or call APIs mid-conversation.

Domain-specific copilots

Assistants for coding, legal, finance, research, or creative work. Ground agents in your own data with a full RAG pipeline — chunking, embedding, vector storage across 12+ providers, metadata filtering, and re-ranking. Customize behavior with dynamic instructions that adapt per user or request. Connect to external services through typed tools and MCP servers. Add voice interaction with 12+ speech providers, and measure output quality with built-in evaluation scorers.

Workflow automations

Multi-step processes that trigger, route, and complete tasks. Define type-safe steps with Zod-validated inputs and outputs, then compose them with sequential chaining, parallel fan-out, conditional branching, loops, and iteration with concurrency control. Suspend workflows mid-execution to wait for human approval or external events, then resume from where they left off. Nest workflows inside other workflows for reusable sub-pipelines.

Decision-support tools

Systems that analyze data and provide actionable recommendations. Compose multiple tools so agents can query databases, call APIs, and run analysis functions in a single interaction. Use structured output with Zod schemas to return validated, typed results. Coordinate specialist agents through supervisor patterns, with task-completion scoring to verify recommendation quality before finalizing. Add human-in-the-loop gates for high-stakes decisions.

AI-powered applications

Products that combine language understanding, reasoning, and action. Orchestrate multiple agents with supervisor delegation and multi-agent networks. Deploy to any Node.js runtime, cloud provider, or framework — Vercel, Cloudflare, Next.js, Astro, and more. Monitor production behavior with AI-specific tracing that captures token usage, latency, and decision paths. Choose from 10+ storage providers and configure composite backends optimized per workload. Test everything interactively in Studio before shipping.

Browse templates from Mastra and the community to see working examples of these use cases.

On this page