# Mastra

Mastra is a framework option for building AI agents. TypeScript agent framework with workflows, memory, evals and a local playground.

## Facts

- Layer: Framework (What thinks)
- Vendor: Mastra (github.com/mastra-ai/mastra)
- Licence: open source
- Pricing: open source
- Self-hostable: yes
- SDKs: ts
- Install: `npm install @mastra/core`
- Docs: https://mastra.ai/
- Last verified: 2026-08-21

## When to reach for it

- You are choosing a framework component — what thinks.
- You need to run it on your own infrastructure, or your procurement process requires source access.
- You want to start without a commercial conversation.

## Alternatives in the framework layer

| Option | What it does | Licence | Self-host |
| --- | --- | --- | --- |
| LangGraph | Graph-shaped orchestration with checkpointing, interrupts and human-in-the-loop. | open source | yes |
| Pydantic AI | Type-safe Python agents with structured output that actually validates. | open source | yes |
| CrewAI | Role-based crews of agents with delegation between them. | open source | yes |
| Agno | Fast, lightweight multi-agent runtime with built-in memory and knowledge. | open source | yes |
| LlamaIndex | Data-first framework — ingestion, indexing and RAG-heavy agents. | open source | yes |
| DSPy | Programs, not prompts — compile and optimise the prompt against a metric. | open source | yes |
| Vercel AI SDK | Streaming-first TypeScript SDK with a unified provider interface and UI hooks. | open source | yes |

Head to head:

- https://newagent.build/compare/mastra-vs-langgraph
- https://newagent.build/compare/mastra-vs-pydantic-ai
- https://newagent.build/compare/mastra-vs-crewai
- https://newagent.build/compare/mastra-vs-agno
- https://newagent.build/compare/mastra-vs-llamaindex
- https://newagent.build/compare/mastra-vs-dspy
- https://newagent.build/compare/mastra-vs-vercel-ai-sdk

## Curated stacks using it

- Browser automation: Drives real web apps that have no API, on behalf of a specific signed-in user.

## Add it to a stack

```bash
curl -fsSL "https://newagent.build/api/stack?framework=mastra&format=sh" | sh
```

## Machine interfaces

- `GET https://newagent.build/api/registry` — every component as JSON
- `GET https://newagent.build/api/vendors` — vendors, with the repo and releases feed to watch
- `GET https://newagent.build/api/advise?q=<plain english>` — recommended stack for a description
- `GET https://newagent.build/api/stack?<layer>=<id>&format=sh|json|md|yml|agents|env` — a stack as files
- `GET https://newagent.build/llms.txt` — the whole registry in one fetch

Any page here also returns markdown if you send `Accept: text/markdown`.