# Haystack vs Mastra

> Mastra and Haystack score within a point of each other for agent frameworks, 78 and 77.8 out of 100. Prices, MCP, x402, uptime and agent notes side by side.

- Canonical: https://www.anchorterminal.com/compare/haystack-vs-mastra
- Markdown: https://www.anchorterminal.com/compare/haystack-vs-mastra.md (~3,650 tokens)
- Slim: https://www.anchorterminal.com/compare/haystack-vs-mastra.min.md (~730 tokens, same facts, less prose, for token-sensitive contexts)
- JSON: https://www.anchorterminal.com/compare/haystack-vs-mastra.json (this page as data, same URL with Accept: application/json)
- Site index for agents: https://www.anchorterminal.com/llms.txt (the key docs and every listing in one file, at most 16 MB, about 4 million tokens: https://www.anchorterminal.com/llms-full.txt)
- API: https://www.anchorterminal.com/api/v1/index.json
- MCP: https://www.anchorterminal.com/mcp (the whole catalogue as tools, no key)
- DNS: dig +short TXT <slug>.grade.anchorterminal.com (the grade as a DNS TXT record, for a sandbox with no HTTP where names still resolve; also top., best.<category>. and <a>.vs.<b>. under the zone, and the same under grade.letme.dev)
- Licence: CC BY 4.0, credit Anchor Terminal and link this page (https://www.anchorterminal.com/terms/#data)
- Updated: 2026-11-23

Mastra and Haystack score within a point of each other on agent readiness, 78 (A) and 77.8 (BB). Both do agent frameworks.

- Haystack: grade BB, 77.8/100, rank #72 of 1654. Markdown https://www.anchorterminal.com/tools/haystack.md · JSON https://www.anchorterminal.com/api/v1/tools/haystack.json
- Mastra: grade A, 78/100, rank #66 of 1654. Markdown https://www.anchorterminal.com/tools/mastra.md · JSON https://www.anchorterminal.com/api/v1/tools/mastra.json
- Best agent frameworks and SDKs: https://www.anchorterminal.com/best/frameworks/index.md
- All 253 frameworks comparisons: https://www.anchorterminal.com/compare/frameworks/index.md

## Which one, for what

### Haystack (BB)

Good for: Python teams building retrieval-heavy agents or pipelines who want explicit components, approval hooks and resumable runs.

Also in its favour:
- No key needed to call it

Watch for: Anonymous telemetry to PostHog EU is on by default and includes the Agent's model and tool names

### Mastra (A)

Good for: TypeScript teams that want agents, workflows, memory, evals and a local Studio in one framework.

Ahead on:
- Reliability, 87 against 81
- Schema & documentation, 98 against 88
- Agent ergonomics, 92 against 75

Watch for: Malicious versions of Mastra npm packages, including @mastra/core 1.42.1, were published on 17 June 2026


## Why the edge

### Agent ergonomics: Mastra +17

- Haystack (75): Framework reading. MCPToolset loads an MCP server's tools with a tool_names filter, and SearchableToolset shows the model only matching tools, but MCP needs the separate mcp-haystack package (20). max_agent_steps, a step budget hook, streaming and ToolResultOffloadCompactor bound a run and its context (17). Tool failures go back to the model by default, or raise when raise_on_tool_invocation_failure is set (14). Failed pipelines raise with a snapshot of the last valid state and runs resume from it or from a breakpoint, with no built-in durable store (14). The Agent needs a chat generator passed in, so there is no silent default provider, and the framework is Python only (10). 20+17+14+14+10 = 75.
- Mastra (92): An MCP client in about ten lines with listTools() for static or listToolsets() for per-request tools, and ToolSearchProcessor for loading tools on demand (25). Step limits, memory windows and processors such as a token limiter control what reaches the model (20). MastraError with ids and categories, and processors can abort with a reason the caller can read (17). Workflow step retries, snapshots and durable agents for resuming (20). create-mastra scaffolds a project and the model router takes a plain string, but it's TypeScript only (10).

### Schema & documentation: Mastra +10

- Haystack (88): Framework reading. A typed Python API (py.typed) with a generated API reference (22). llms.txt holds the full documentation, 493 pages in one file (10). The agent pages say what each hook and component is for, with a table of which hook guards which risk (16). Tools are typed from function signatures and components (13). Tutorials, a cookbook and code on every page; error types such as PipelineRuntimeError and tool invocation errors are shown in the guides without a catalogue (12). Versioned docs and release notes per release (15). 22+10+16+13+12+15 = 88.
- Mastra (98): Typed TypeScript API with a reference section (25). llms.txt with a when-to-use list and condensed instructions for coding agents (10). The docs say when to use durable agents, and point multi-agent users from `.network()` to supervisor agents (20). Tools take Zod schemas (15). Examples on every page, and MastraError with ids and categories documented, though errors are spread across pages (13). Per-package changelogs and migration guides (15).

### Reliability: Mastra +6

- Haystack (81): Local-package reading. Official PyPI package haystack-ai with Python 3.11 or newer stated (20). A public tests workflow runs unit tests on Ubuntu, Windows and macOS for pushes to main and pull requests, plus e2e, CodeQL and Scorecard workflows; whether main passes wasn't read, as the Actions API refused us (15). 106 open issues and 68 open pull requests on 23 November 2026. The 50 newest issues were opened from 11 to 23 November, and 24 had a comment and 19 were closed (20). Release notes for every release and a migration guide for 3.0, but the policy says versions don't follow semantic versioning and minors remove deprecated functionality (11). 3.x with a Production/Stable classifier (15). 20+15+20+11+15 = 81.
- Mastra (87): Official npm packages, Node 22.13 or newer (20). Public CI workflows for unit, store, workspace and e2e tests; on 6 November the newest runs on main (Version Packages, Trigger Cloud Integration Tests) succeeded, while the test workflows themselves run on pull requests (22). 436 open issues and 795 open issues and pull requests on 6 November from GitHub's API, with 2,077 issues opened in the 90 days to 3 November; all 50 newest had a comment and 24 were closed, with issue-triage automation (18). A changesets CHANGELOG per package, a CI gate that needs approval for any major bump and migration guides, but no written versioning policy found, and `.network()` is deprecated without a removal date (12). 1.82.0 (15). 20+22+18+12+15 = 87, up from 74 on 6 October, when GitHub couldn't be read.

## Score by category

| Category | Weight | Haystack | Mastra | Edge |
| --- | --- | --- | --- | --- |
| Reliability | 16% | 81 | 87 | Mastra +6 |
| Performance | 10%, pending | pending | pending | not scored in this run |
| Schema & documentation | 13% | 88 | 98 | Mastra +10 |
| Agent ergonomics | 13% | 75 | 92 | Mastra +17 |
| Security & auth | 14% | 63 | 67 | Mastra +4 |
| Payments & pricing | 10% | 90 | 90 | even |
| Task success | 10%, pending | pending | pending | not scored in this run |
| Maintenance & community | 7% | 95 | 96 | Mastra +1 |
| Transparency & trust | 7% | 74 | 72 | Haystack +2 |
| Negative events | ≤15 | -2 | -8 | |
| **Total** | | **77.8 · BB** | **78 · A** | |

## Facts side by side

| Fact | Haystack | Mastra |
| --- | --- | --- |
| Kind | Agent framework | Agent framework |
| Vendor | deepset | Kepler Software, Inc. |
| Hosted endpoint | no (local only) | no (local only) |
| Transports |  |  |
| Auth | None | API key |
| Pricing | Free | Free |
| x402 | no | no |
| Licence | Apache-2.0 | Apache-2.0 for the core. Code under ee/ directories is source-available under the Mastra Enterprise License, free for development and testing |
| Read-only variant documented | no | no |
| llms.txt | yes | yes |
| Last release | 2026-11-10 | 2026-11-04 |
| Terms last updated | 2025-07-24 | 2026-10-26 |
| Privacy policy last updated | 2026-10-23 | no date given |
| Customer content may train models | not found in the text | yes |
| Terms restrict automated access | not found in the text | yes |
| Terms restrict benchmarking | yes | not found in the text |
| Terms or service can change without notice | not found in the text | yes |
| Arbitration or class-action waiver | yes | yes |
| Popularity | 27k stars | 29k stars, 3.1M npm/wk |

## How the scores have moved

### Haystack

No score change since it was listed.

### Mastra

- +3.8 on 13 November 2026 (BB to A): checklist

## Verdicts

**Haystack.** An Apache-2.0 Python framework with an Agent component, per-tool approval hooks, MCP tools, failure snapshots, a written deprecation policy and releases every few weeks. It sends anonymous usage telemetry to deepset's PostHog by default, including agent model and tool names, until HAYSTACK_TELEMETRY_ENABLED is set to False.

**Mastra.** A TypeScript framework with agents, workflows with suspend and resume, memory, an MCP client and server, per-server tool approval and built-in guardrail processors including a prompt-injection detector. On 17 June 2026 malicious versions of its npm packages were published, and the CLI, server and Studio send usage analytics by default, with token counts every 15 minutes.

## Before you call either

### Haystack

1. Set HAYSTACK_TELEMETRY_ENABLED=False before importing haystack if usage events must not leave the machine
2. Add a ConfirmationHook before tools that send, pay or delete
3. Pass tool_names to MCPToolset so only the needed tools from an MCP server load
4. Load pipeline YAML and resume snapshots only from trusted sources, since deserialisation can run code
5. Pin haystack-ai to a minor version and read the release notes before upgrading

### Mastra

1. Set MASTRA_TELEMETRY_DISABLED=1 in every environment that runs the CLI, the server or Studio
2. Pin exact versions with a lockfile, and make sure no 17 June 2026 release such as @mastra/core 1.42.1 is installed
3. Set requireToolApproval on MCP servers that write, and allowedHosts when server URLs come from configuration
4. Add PromptInjectionDetector as an input processor when tools return web or user content
5. Use supervisor agents through generate() or stream(). `.network()` is deprecated

## Questions

### Which is better for AI agents, Haystack or Mastra?

Mastra and Haystack score within a point of each other on agent readiness, 78 (A) and 77.8 (BB).

### Are Haystack and Mastra open source?

Yes. Haystack is open source (Apache-2.0). Mastra is open source (Apache-2.0 for the core. Code under ee/ directories is source-available under the Mastra Enterprise License, free for development and testing).


## For agents

- This comparison as JSON: https://www.anchorterminal.com/compare/haystack-vs-mastra.json, and with the fewest tokens: https://www.anchorterminal.com/compare/haystack-vs-mastra.min.md
- Over MCP at https://www.anchorterminal.com/mcp (no key): `compare_tools {"a": "haystack", "b": "mastra"}`. From a terminal: `anchor compare haystack mastra`
- Each listing in full: https://www.anchorterminal.com/api/v1/tools/haystack.json and https://www.anchorterminal.com/api/v1/tools/mastra.json

## Other comparisons with Haystack or Mastra

- [AgentOS vs Haystack](https://www.anchorterminal.com/compare/agentos-vs-haystack.md)
- [AgentOS vs Mastra](https://www.anchorterminal.com/compare/agentos-vs-mastra.md)
- [Agno vs Haystack](https://www.anchorterminal.com/compare/agno-vs-haystack.md)
- [Agno vs Mastra](https://www.anchorterminal.com/compare/agno-vs-mastra.md)
- [BoxLang AI vs Haystack](https://www.anchorterminal.com/compare/boxlang-ai-vs-haystack.md)
- [BoxLang AI vs Mastra](https://www.anchorterminal.com/compare/boxlang-ai-vs-mastra.md)
- [Claude Agent SDK vs Haystack](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-haystack.md)
- [Claude Agent SDK vs Mastra](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-mastra.md)
- [CrewAI vs Haystack](https://www.anchorterminal.com/compare/crewai-vs-haystack.md)
- [CrewAI vs Mastra](https://www.anchorterminal.com/compare/crewai-vs-mastra.md)
- [Cursor Agent SDK vs Haystack](https://www.anchorterminal.com/compare/cursor-agent-sdk-vs-haystack.md)
- [Cursor Agent SDK vs Mastra](https://www.anchorterminal.com/compare/cursor-agent-sdk-vs-mastra.md)
- [Docker Agent vs Haystack](https://www.anchorterminal.com/compare/docker-agent-vs-haystack.md)
- [Docker Agent vs Mastra](https://www.anchorterminal.com/compare/docker-agent-vs-mastra.md)
- [DSPy vs Haystack](https://www.anchorterminal.com/compare/dspy-vs-haystack.md)
- [DSPy vs Mastra](https://www.anchorterminal.com/compare/dspy-vs-mastra.md)
- [Genkit vs Haystack](https://www.anchorterminal.com/compare/genkit-vs-haystack.md)
- [Genkit vs Mastra](https://www.anchorterminal.com/compare/genkit-vs-mastra.md)
- [Agent Development Kit (ADK) vs Haystack](https://www.anchorterminal.com/compare/google-adk-vs-haystack.md)
- [Agent Development Kit (ADK) vs Mastra](https://www.anchorterminal.com/compare/google-adk-vs-mastra.md)
- [guilds.run vs Haystack](https://www.anchorterminal.com/compare/guilds-run-vs-haystack.md)
- [guilds.run vs Mastra](https://www.anchorterminal.com/compare/guilds-run-vs-mastra.md)
- [Haystack vs LangGraph](https://www.anchorterminal.com/compare/haystack-vs-langgraph.md)
- [Haystack vs LlamaIndex Framework](https://www.anchorterminal.com/compare/haystack-vs-llamaindex.md)
- [Haystack vs Microsoft Agent Framework](https://www.anchorterminal.com/compare/haystack-vs-microsoft-agent-framework.md)
- [Haystack vs OpenAI Agents SDK](https://www.anchorterminal.com/compare/haystack-vs-openai-agents-sdk.md)
- [Haystack vs Pydantic AI](https://www.anchorterminal.com/compare/haystack-vs-pydantic-ai.md)
- [Haystack vs smolagents](https://www.anchorterminal.com/compare/haystack-vs-smolagents.md)
- [Haystack vs Strands Agents](https://www.anchorterminal.com/compare/haystack-vs-strands-agents.md)
- [Haystack vs Terse Durable Actors](https://www.anchorterminal.com/compare/haystack-vs-terse-durable-actors.md)
- [Haystack vs TradingAgents](https://www.anchorterminal.com/compare/haystack-vs-tradingagents.md)
- [Haystack vs AI SDK](https://www.anchorterminal.com/compare/haystack-vs-vercel-ai-sdk.md)
- [LangGraph vs Mastra](https://www.anchorterminal.com/compare/langgraph-vs-mastra.md)
- [LlamaIndex Framework vs Mastra](https://www.anchorterminal.com/compare/llamaindex-vs-mastra.md)
- [Mastra vs Microsoft Agent Framework](https://www.anchorterminal.com/compare/mastra-vs-microsoft-agent-framework.md)
- [Mastra vs OpenAI Agents SDK](https://www.anchorterminal.com/compare/mastra-vs-openai-agents-sdk.md)
- [Mastra vs Pydantic AI](https://www.anchorterminal.com/compare/mastra-vs-pydantic-ai.md)
- [Mastra vs smolagents](https://www.anchorterminal.com/compare/mastra-vs-smolagents.md)
- [Mastra vs Strands Agents](https://www.anchorterminal.com/compare/mastra-vs-strands-agents.md)
- [Mastra vs Terse Durable Actors](https://www.anchorterminal.com/compare/mastra-vs-terse-durable-actors.md)
- [Mastra vs TradingAgents](https://www.anchorterminal.com/compare/mastra-vs-tradingagents.md)
- [Mastra vs AI SDK](https://www.anchorterminal.com/compare/mastra-vs-vercel-ai-sdk.md)

---

Query this catalogue directly over MCP: https://www.anchorterminal.com/mcp (Streamable HTTP, no key). How: https://www.anchorterminal.com/agents/#mcp
