Head to head · Agent frameworks · October 2026 research run
Mastra vs AI SDK
AI SDK scores 89.8 (AA) on agent readiness against Mastra's 74.2 (BB), and leads in 6 of 7 scored categories. Both do agent frameworks.
Best agent frameworks and SDKs · All 171 frameworks comparisons
Which one, for what
Mastra BB
Best for TypeScript teams that want agents, workflows, memory, evals and a local Studio in one framework.
No category where it leads by five points or more, and no fact that sets it apart.
Watch for
Malicious versions of Mastra npm packages, including @mastra/core 1.42.1, were published on 17 June 2026
AI SDK AA
Best for TypeScript teams building agents and chat UIs who want one API across many providers and a short path to MCP.
Ahead on
- Reliability, 93 against 87
- Security & auth, 90 against 67
- Transparency & trust, 89 against 72
Also in its favour
- No incidents deducted, where Mastra loses 8 points for them
Watch for
TypeScript only, and ai 7.x needs Node 22 or newer
Why the edge
Each category where one leads by five points or more, with the reason behind each side's score from its assessment. The numbers are in the table below; this is what they stand for.
Security & auth AI SDK +23
Mastra 67
The CLI sends PostHog analytics, server startup sends token counts per model and a count of registered agents, tools and MCP servers, and Studio sends browser analytics, all on by default and documented, with one opt-out, MASTRA_TELEMETRY_DISABLED=1. Since #26986 (16 October 2026) each server process also reports token use per provider and model every 15 minutes, and the telemetry reference read on 6 November says server events carry a project identifier that is a raw Platform UUID or a hash of the Git origin remote, so they "aren't anonymous" (12). requireToolApproval on agents and MCP servers, allowedHosts for MCP HTTP, a curated environment for stdio servers, and sandboxed workspaces (20). PromptInjectionDetector, PII and moderation processors, and docs that call tool results untrusted model input (15). Built-in tracing with OpenTelemetry and other exporters (15). No SECURITY.md, no security.txt and no bug bounty found. A blog post says Mastra is SOC 2 Type II audited, which isn't scored for a framework, and we found no public advisory from Mastra about the June incident (5). Framework reading. 15+20+15+15+5 = 70 on 6 October, 12+20+15+15+5 = 67 on 6 November.
AI SDK 90
No telemetry until an OpenTelemetry integration is registered. String model IDs route to Vercel's AI Gateway by default, which is documented and needs a Vercel key, so it isn't silent (25). Per-tool approval, HMAC-signed approvals against forged client history, and Open Policy Agent rules in @ai-sdk/policy-opa, though sandboxes are experimental (20). ToolLoopAgent rejects system messages in prompts by default as an injection risk, URL fetches are checked against private addresses, and MCP HTTP transport refuses redirects by default, but there's no guardrail primitive (10). OpenTelemetry spans for every model and tool call to any backend, opt-in (15). HackerOne programme, a valid security.txt, SECURITY.md and two low-severity advisories published with fixed versions (20). Framework reading, so SOC 2 isn't scored.
Transparency & trust AI SDK +17
Mastra 72
Apache 2.0 for the core, with ee/ directories source-available under the Mastra Enterprise License (25). The privacy policy (last published 25 April 2025) covers the website, the Teams plan states six months' retention, and the subprocessor list sits in a trust centre our reader couldn't render (15). Migration guides and deprecation warnings, without dated removal windows (12). Every telemetry stream is documented with links to its source and one opt-out, and the reference now spells out what the project identifiers can be correlated with (20).
AI SDK 89
Apache 2.0 (30). The library stores nothing. The AI Gateway's ZDR page says it doesn't retain prompts or outputs and per-request ZDR is available on Pro and Enterprise, and Vercel's privacy notice is dated 1 June 2026, but we didn't read a DPA or subprocessor list (22). Deprecated APIs are removed only at majors with a migration guide, and 6.x and 5.x keep getting releases, without a written support window (14). Telemetry is opt-in and documented, with switches for inputs and outputs (20).
Reliability AI SDK +6
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.
AI SDK 93
Official npm packages, with ai 7.x requiring Node 22 or newer (20). A public CI workflow with lint, type checks, unit tests, Node-version tests, MCP tests on Windows and e2e tests runs on every push to main, and the newest completed CI runs on main passed on 6 November (25). 1,517 open issues and pull requests on 6 November from GitHub's API, with 1,059 issues opened in the 90 days to 3 November; 47 of the 50 newest had a comment and 32 were closed (18). A written versioning page with breaking changes only in majors, experimental_ prefixes for unstable APIs and a migration guide per major (15). 7.0.163 (15). 20+25+18+15+15 = 93, up from 73 on 6 October, when GitHub couldn't be read.
Score by category
| Category | Weight this run | Mastra | AI SDK | Edge |
|---|---|---|---|---|
| Reliability | 16%20 | 87 | 93 | AI SDK +6 |
| Performance | 10%pending | pending | pending | not scored in this run |
| Schema & documentation | 13%16.2 | 98 | 100 | AI SDK +2 |
| Agent ergonomics | 13%16.2 | 92 | 95 | AI SDK +3 |
| Security & auth | 14%17.5 | 67 | 90 | AI SDK +23 |
| Payments & pricing | 10%12.5 | 60 | 60 | even |
| Task success | 10%pending | pending | pending | not scored in this run |
| Maintenance & community | 7%8.8 | 96 | 97 | AI SDK +1 |
| Transparency & trust | 7%8.8 | 72 | 89 | AI SDK +17 |
| Negative events | ≤15 | -8 | 0 | |
| Total | BB 74.2/100 | AA 89.8/100 |
Facts side by side
| Fact | Mastra | AI SDK |
|---|---|---|
| Kind | Agent framework | Agent framework |
| Vendor | Kepler Software, Inc. | Vercel Inc. |
| Hosted endpoint | no (local only) | no (local only) |
| Transports | ||
| Auth | API key | API key |
| Pricing | Free | Free |
| x402 | no | no |
| Licence | Apache-2.0 for the core. Code under ee/ directories is source-available under the Mastra Enterprise License, free for development and testing | Apache-2.0 |
| Read-only variant documented | no | no |
| llms.txt | yes | yes |
| Last release | 2026-11-04 | 2026-11-05 |
| Terms last updated | 2026-10-26 | 2026-06-01 |
| Privacy policy last updated | no date given | 2026-06-01 |
| Customer content may train models | yes | yes, with an opt-out |
| Terms restrict automated access | yes | not found in the text |
| Terms restrict benchmarking | not found in the text | not found in the text |
| Terms or service can change without notice | yes | not found in the text |
| Arbitration or class-action waiver | yes | yes |
| Popularity | 29k stars, 3.1M npm/wk | 28k stars, 44.9M npm/wk |
Verdicts
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.
AI SDK
A TypeScript agent toolkit with ToolLoopAgent, a built-in MCP client, per-tool approvals that can be HMAC-signed, opt-in OpenTelemetry and durable runs through WorkflowAgent. It ships three major versions in 14 months (5.0, 6.0, 7.0), each with a migration guide, and plain string model IDs route through Vercel's AI Gateway unless another provider is set.
Before you call either
Mastra
- Set MASTRA_TELEMETRY_DISABLED=1 in every environment that runs the CLI, the server or Studio
- Pin exact versions with a lockfile, and make sure no 17 June 2026 release such as @mastra/core 1.42.1 is installed
- Set requireToolApproval on MCP servers that write, and allowedHosts when server URLs come from configuration
- Add PromptInjectionDetector as an input processor when tools return web or user content
- Use supervisor agents through generate() or stream().
.network()is deprecated
AI SDK
- Pass a provider instance such as openai('model') if traffic shouldn't go through Vercel's AI Gateway
- Set toolApproval on tools that write, and experimental_toolApprovalSecret when approvals come back from a browser
- Raise or replace the default stop condition of 20 steps with stopWhen
- Close the MCP client after the run, and use HTTP transport outside local development
- Set recordInputs and recordOutputs to false when spans would carry secrets
Questions
Which is better for AI agents, Mastra or AI SDK?
AI SDK scores 89.8 (AA) on agent readiness against Mastra's 74.2 (BB), and leads in 6 of 7 scored categories.
Are Mastra and AI SDK open source?
Yes. 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). AI SDK is open source (Apache-2.0).
Other comparisons with Mastra or AI SDK
- AgentOS vs Mastra
- AgentOS vs AI SDK
- Agno vs Mastra
- Agno vs AI SDK
- BoxLang AI vs Mastra
- BoxLang AI vs AI SDK
- Claude Agent SDK vs Mastra
- Claude Agent SDK vs AI SDK
- CrewAI vs Mastra
- CrewAI vs AI SDK
- Cursor Agent SDK vs Mastra
- Cursor Agent SDK vs AI SDK
- Docker Agent vs Mastra
- Docker Agent vs AI SDK
- Agent Development Kit (ADK) vs Mastra
- Agent Development Kit (ADK) vs AI SDK
- guilds.run vs Mastra
- guilds.run vs AI SDK
- LangGraph vs Mastra
- LangGraph vs AI SDK
- LlamaIndex Framework vs Mastra
- LlamaIndex Framework vs AI SDK
- Mastra vs Microsoft Agent Framework
- Mastra vs OpenAI Agents SDK
- Mastra vs Pydantic AI
- Mastra vs smolagents
- Mastra vs Strands Agents
- Mastra vs TradingAgents
- Microsoft Agent Framework vs AI SDK
- OpenAI Agents SDK vs AI SDK
- Pydantic AI vs AI SDK
- smolagents vs AI SDK
- Strands Agents vs AI SDK
- TradingAgents vs AI SDK
Machine-readable
- This page as Markdown
/compare/mastra-vs-vercel-ai-sdk.md· slim.min.md· JSON.json(or sendAccept: text/markdown) - Each listing in full
/api/v1/tools/mastra.json·/api/v1/tools/vercel-ai-sdk.json - From a terminal
anchor compare mastra vercel-ai-sdk(the CLI) - Over MCP
compare_tools {"a": "mastra", "b": "vercel-ai-sdk"}at/mcp, no key