Skip to main content
Open-source TypeScript agent framework

Build AI agents that work in production

Build, observe, and improve agents that can run for days. Mastra gives TypeScript teams one framework for agents, workflows, memory, evals, and deployment.

npm create mastra@latestGet a working project in minutes
mastra-project
running
Workspace
Agents
Tools
Workflows
Memory
Observe
Traces
Evals
Agent runresearch-assistant
completed
Agent startedInstructions and memory loaded
18ms
Model generationSelected tools and planned the response
842ms
searchDocs3 relevant documents returned
126ms
Response completedTrace, tokens, and score recorded
1.2s
Tokens1,284Tool calls1Score0.94

Built for teams shipping real agent systems

ReplitSanityWorkOSMongoDBPayPalSoftBank
Build with code

Typed from the first prompt to the final tool call

Define an agent with the same language, package manager, schemas, and deployment workflow your team already uses.

  • Typed inputs and structured outputs
  • Provider-independent model routing
  • Built-in tools, memory, and workflows
Explore agents
src/mastra/agents/assistant.tsTypeScript
import { Agent } from '@mastra/core/agent'

export const assistant = new Agent({
  id: 'assistant',
  name: 'Assistant',
  instructions: 'Help users complete their work.',
  model: process.env.MODEL,
  tools: { searchDocs },
})
Observe and improve

See what every agent is doing

Trace each model call and tool decision, evaluate results, and turn production feedback into better behavior.

Use cases

One framework across the company

For product teams

Customer-facing agents

Answer questions, complete tasks, stream structured UI, and hand users back to your product flows.

For operations teams

Internal automation

Connect tools and business systems, then coordinate repeatable work with explicit workflow control.

For platform teams

Agent infrastructure

Offer shared agent primitives with server APIs, model routing, storage, evals, and observability.

FAQ

Frequently asked questions

Find implementation details in the current documentation included with this site.

Open documentation
What is Mastra?

Mastra is an open-source TypeScript framework for building AI applications and agents. It includes agents, workflows, memory, model routing, evaluation, observability, and deployment tools.

Can Mastra run in an existing TypeScript application?

Yes. Use Mastra inside Node.js and web framework projects, or run it as a standalone server. The same agent and workflow definitions can move from local development to production.

Which AI models does Mastra support?

Mastra provides a standard model interface across major providers and gateways. Open the model directory to browse the current provider and model documentation.

How do I debug an agent run?

Mastra records traces for model calls, tool calls, workflows, and handoffs. Use Studio during development and observability integrations in production.

Is Mastra open source?

Yes. The framework and this documentation are developed in the public mastra-ai/mastra GitHub repository under the Apache 2.0 license.

Start building

Ship your first Mastra agent today

Start locally, inspect every run, and deploy with the same TypeScript project.