Skip to main content

Mastra vs AI SDK: A Full Agent Framework or a TypeScript Toolkit?

Replit's Agent 3 generates Mastra agents on durable workflows, and openstatus runs its production Slack agent on the AI SDK alone. Two maintainers moved agents from Mastra back to plain AI SDK calls in October 2026, one to shed 69 of 72 open dependency advisories.

Reading time
9 min read
Sources
36 cited
In this piece

GILD verdict

Choose Mastra when a TypeScript team wants durable workflows, memory and evals built in, and the AI SDK for one model loop.

The workflow
A TypeScript team adding its first agent with tools and multi-step work to a web product, choosing between a framework and a toolkit.926
The decisive evidence
  • Reported2 of 5 named teams adopted one; What teams report below sets out each account.
  • ReportedMaintainers who moved agents from Mastra to plain AI SDK calls in October 2026 cite dependency weight, one removing 69 of 72 open advisories, and a builder found a Mastra agent ending at its fifth step with empty text and no error.567
  • DocumentedMastra names no default model and reads each provider's key from the environment, while the AI SDK routes plain model strings through AI Gateway by default. Mastra's agents stop at 5 steps by default and the ToolLoopAgent at 20.10152831
  • DocumentedMastra bundles memory with storage adapters and workflows that suspend and resume. The AI SDK leaves memory storage to the app and offers durability through WorkflowAgent, and Mastra agents can drive AI SDK UI hooks through @mastra/ai-sdk.1113192930
  • GILD analysisAt 10,000 runs a month with US$1,000 of tokens, Mastra Platform adds about US$61 on Starter or US$250 on Teams, and its gateway adds 5.5% to tokens. The AI SDK side adds no token markup, and its hosting cost depends on your own infrastructure, which the sources leave unpriced.
The tradeoff
The AI SDK covers a loop with tools and a chat UI inside its own app. Mastra saves assembly work at the cost of more packages to pin and an ee/ license for enterprise features. The AI SDK keeps the dependency small and leaves memory, storage, and hosting to your team.121113142426273033
What would change the call
The call moves to Mastra when the team needs evals, workflow suspension, and trace storage it would otherwise build, and to the AI SDK when the product is mainly a chat UI over one model loop.111433

Named teams split by how much framework they want around the model. Mastra's customer story says durable execution on Inngest raised the workflow success rate of the agents Replit's Agent 3 builds from 80% to 96%, while openstatus runs its production Slack agent on the AI SDK with six tools. Mastra supplies workflows that suspend and resume, memory, scorers, a local Studio and an optional hosted platform; the AI SDK supplies model calls, tool loops, durable WorkflowAgent and chat UI hooks inside your own app, with AI Gateway at provider list prices.

What teams report

Failures and incidents 1

  1. Alipay, per the author's GitHub profile

    With AI SDK v5's useChat calling Mastra's API, assistant messages came back with duplicated parts, reproducible in the official example when messages were sent quickly (GitHub issue, Oct 28, 2025).

    “When using useChat from @ai-sdk/react to call Mastra's API, assistant messages may have duplicate parts.”
    Bo Kou (MrKou47), Developer filing a GitHub issue, Alipay, per the author's GitHub profileGitHub, mastra-ai/mastra, , post

Switched 1

  1. BrainGridOn AI SDK

    BrainGrid migrated its core AI infrastructure from AI SDK v4 to v5 in July 2025 and reports support tickets about a frozen UI falling to zero and tool execution 17% faster.

    “We migrated BrainGrid's core AI infrastructure from AI SDK v4 to v5. Here's how it went.”
    Felipe Cadavid, BrainGrid engineering, BrainGridBrainGrid, , write-up

Evaluated 1

  1. APIClawOn Mastra

    Testing @mastra/core 1.78.0 against a local OpenAI-compatible server, Aman Kumar found an agent stuck in tool calls ending at the default fifth step with empty text and no error, and two retry layers turning one failing upstream into 18 requests (Oct 18, 2026).

    “The agent made five requests, ran the tool five times, and then returned normally. text was an empty string and finishReason was "tool-calls". It didn't throw an error or log a warning.”
    Aman Kumar, Developer building the APIClaw gateway, APIClawDEV Community, , write-up

Adopted 2

  1. ReplitOn Mastra

    Mastra's customer story says the agents Replit Agent 3 generates are Mastra agents, and that durable execution on Inngest raised their workflow success rate from 80% to 96%.

    “Using Mastra's durable execution with Inngest, Replit boosted success rates from 80% to 96%, ensuring workflows complete even if a servers fails mid-execution.”
    Mastra customer story, citing Replit's CTO, Agent 3 team, ReplitMastra, , write-upVendor customer story
  2. openstatusOn AI SDK

    openstatus built its production Slack agent, which reads status pages and drafts status reports a person confirms, on the AI SDK with Claude Sonnet and six tools (Feb 27, 2026).

    “We use the Vercel AI SDK with Claude Sonnet. The agent has 6 tools:…”
    Thibault Le Ouay Ducasse, openstatus engineering, openstatusopenstatus, , write-up

Choosing between Mastra and AI SDK

Choose Mastra if

  • Unattended runs must finish when a server fails mid-run: Mastra workflows on Inngest retry and resume, which Mastra's customer story credits with raising Replit Agent 3's success rate from 80% to 96%.
  • You want workflows, memory, and evals from one framework so you don't have to assemble them, with a local Studio to inspect agents.
  • You want an optional hosted platform with us or eu residency and trace storage.

Choose AI SDK if

  • One model loop with tools inside your own app covers the work, as openstatus's production Slack agent runs on the AI SDK with six tools (Feb 27, 2026).
  • You want fewer packages to pin: one maintainer removed @mastra/core and 69 of its 72 open dependency advisories by moving three research agents to the AI SDK (Oct 16, 2026).
  • Your product is a chat or streaming UI on useChat, with one gateway at provider list prices and no markup on tokens.

Side by side

DimensionMastraAI SDK
What teams reportNamed accounts GILD found. Each team describes its own side, and Kristian, who shipped apps on both, calls the AI SDK the model layer and Mastra the infrastructure layer above it (YouTube, Jun 17, 2026).Mastra's customer story says Replit's Agent 3 generates Mastra agents and durable execution on Inngest lifted their workflow success rate from 80% to 96%. Aman Kumar found an agent ending silently at the fifth step with empty text (Oct 18, 2026), and Bo Kou saw duplicate message parts when useChat called Mastra's API (Oct 28, 2025).1468openstatus runs its production Slack agent on the AI SDK with Claude Sonnet and six tools (Feb 27, 2026), and BrainGrid moved its core AI infrastructure from v4 to v5 in July 2025. Two maintainers moved agents from Mastra to plain AI SDK calls in October 2026, one shedding 69 of 72 open dependency advisories.2357
DesignA framework: agents with tools and memory, typed workflows built with createWorkflow that suspend and resume, subagents, scorers, and a Hono-based server91120A toolkit for AI-powered applications and agents: model calls, tools, and the ToolLoopAgent class, with UI hooks for React, Next.js, Vue, and Svelte2627
License and releasesLatest releases on npm, checked Oct 28, 2026.Apache 2.0 outside ee/ directories; ee/ features are source-available under the Mastra Enterprise Edition License 2.0 (effective Sep 22, 2026) and need a license key in production; @mastra/core 1.80.0, Oct 28, 2026; Node.js 22.13 or later20232425Apache 2.0; ai 7.0.156, Oct 28, 2026; Node.js 22 or later3435
ModelsNo default model: each agent names a provider/model string from 8,187 models and 221 providers, Mastra reads each provider's API key from the environment, and fallbacks switch models on a 500 error, rate limit, or timeout1516AI Gateway is the default global provider, so a plain model string routes through it with an AI Gateway API key or OIDC31
Agent loop limitmaxSteps defaults to 5 sequential LLM calls per agent run; a capped run returns empty text with finishReason tool-calls and no error, as Aman Kumar found on Oct 18, 2026610ToolLoopAgent stops after 20 steps by default; WorkflowAgent applies no default step limit28
DurabilityWorkflows run on the built-in execution engine and suspend and resume; Inngest adds step memoization and retries, and the Temporal runner is labelled experimental1112ToolLoopAgent runs in memory and loses progress on a crash; WorkflowAgent from @ai-sdk/workflow runs durable, resumable agents that survive restarts29
MemoryObservational Memory, working memory, and semantic recall, backed by a storage provider the app must configure13Memory through provider-defined tools, memory providers, or a custom tool, with the storage backend left to the app30
Telemetry and tracingUsage telemetry on by default, off with MASTRA_TELEMETRY_DISABLED=1; traces export to Langfuse, Datadog, Arize, or any OpenTelemetry platform1718OpenTelemetry spans through the @ai-sdk/otel package; once registered, supported calls emit telemetry by default32
Chat UI@mastra/ai-sdk connects Mastra agents to AI SDK UI's useChat(), useCompletion(), and useObject() hooks19AI SDK UI is a framework-agnostic toolkit with useChat, useCompletion, and useObject33
Hosting and gateway priceList prices in US dollars, checked Oct 28, 2026.Your own Node.js host, or Mastra Platform: Starter US$0 a month with 100K events and 24 CPU hours, Teams US$250 a month with 1M events and 250 CPU hours; tokens through Mastra's gateway bill at market rate plus 5.5%2021A free library you host yourself; AI Gateway charges no markup and no platform fee on tokens, at the provider's list price, with US$5 a month included on the free tier3436
Cost at a stated workloadGILD's calculation from published rates, Oct 28, 2026. Inputs are stated, not measured; Mastra does not say how many events one run emits, and egress, memory tokens, and storage are left out.GILD's calculation for 10,000 agent runs a month, each emitting 50 observability events and using 30 CPU-seconds, so 500,000 events and about 83.3 CPU hours, plus US$1,000 of model tokens at list price: Mastra Platform Starter adds about US$61 a month, US$40 for 400K events past the 100K included and US$20.77 for 59.3 CPU hours past the 24 included, or Teams covers it within US$250. Tokens through Mastra's gateway come to US$1,055; on your own provider keys they stay US$1,0002122GILD's calculation for the same 10,000 runs and US$1,000 of model tokens: the library is free and AI Gateway adds no markup, so tokens stay US$1,000; hosting and tracing run on your own infrastructure, which this calculation leaves out3436
When to chooseChoose Mastra if you want workflows, memory, evals, and an optional hosted platform from one TypeScript framework921Choose the AI SDK if you want model calls, tool loops, and chat UI hooks inside your own app, with a gateway at provider list prices2636

What practitioners report, side by side

Each product's figures come from its own practitioners, for the group you pick.

MastraMastra−36 NegativeHow this figure is made
Whose sources to count
Compare Mastra with
  • AI SDK

Overall signal

All practitioners rate AI SDK +36, 50 points above Mastra at −14. Most of the gap is in complaints, with 27 of Mastra's 66 sources negative against 5 of AI SDK's 85.

The score counts the authors from all practitioners that take a side, one vote each with their latest view, and is how far positive votes lead negative ones, per 100 votes, so Mastra's −14 rests on votes split 18 positive, 20 mixed and 27 negative and AI SDK's +36 on 35, 43 and 5.

A lead of a fifth of the votes reads positive and a lead of half strong positive, with the same lines below zero. The dots show each source, positive, mixed, negative. Build one pilot agent to measure the glue code and debugging time the framework adds.

Footprint on the AI Application Platform stack

They differ on four of 9 layers. AI SDK owns one that Mastra does not. Coverage is each product's placement on this stack, as its product page shows it. Core is a job the product owns; Supports and Touches are jobs it helps with. Coverage says nothing about how well a product does them.

Layers where Mastra and AI SDK differ
LayerMastraAI SDK
Build
Tool useSupportsCore
Evaluate
EvaluationSupportsTouches
Operate
Cloud deploymentSupportsTouches
GuardrailsSupportsTouches
The 5 layers where they match
Layers where Mastra and AI SDK match
LayerMastraAI SDK
Model
Model APIsTouchesTouches
Model gatewaySupportsSupports
Build
OrchestrationCoreCore
Data
RetrievalSupportsSupports
Operate
ObservabilitySupportsSupports

What practitioners praise

Among all practitioners, AI SDK alone has four praise themes that reach 5 sources from 3 authors. One API Across Providers and Streaming Chat & Generative UI lead, at 16 of 17 and 10 of 12. Mastra alone has three praise themes that reach 5 sources from 3 authors. Agents in Real Work and TypeScript-First Developer Experience lead, at 15 of 15 and 14 of 14.

What practitioners praise, All practitioners
Praised forMastraAI SDK
Agents in Real Work15 of 15Not a theme in its sources
TypeScript-First Developer Experience14 of 14Not a theme in its sources
Workflows, Memory & Evals Included8 of 8Not a theme in its sources
One API Across ProvidersNot a theme in its sources16 of 17
Streaming Chat & Generative UINot a theme in its sources10 of 12
TypeScript Design & TypesNot a theme in its sources6 of 10
Agent Loop, Tools & ApprovalsNot a theme in its sources4 of 12

Each count is the sources that praise a theme, or raise it as a concern, out of those that discuss it. A row pairs the two products when both carry a theme under the same or an equivalent name.

A count ending in "so far" has under 5 sources from 3 authors among all practitioners. "Not a theme in its sources" means GILD found no theme of that name in that product's sources.

What practitioners raise as concerns

Among all practitioners, Mastra alone has five concern themes that reach 5 sources from 3 authors. Memory, Recovery & Loop Defects and Opinionated Patterns lead, at 17 of 17 and 8 of 8. AI SDK alone has five concern themes that reach 5 sources from 3 authors. Provider Translation Bugs and Breaking Changes Between Majors lead, at 14 of 15 and 9 of 9.

What practitioners raise as concerns, All practitioners
Raised as a concernMastraAI SDK
Memory, Recovery & Loop Defects17 of 17Not a theme in its sources
Opinionated Patterns8 of 8Not a theme in its sources
Builds, Bundles & Hosting Surprises7 of 7Not a theme in its sources
Upgrades, Dependencies & Supply Chain7 of 7Not a theme in its sources
License, Lock-In & Vendor Trust5 of 5Not a theme in its sources
Provider Translation BugsNot a theme in its sources14 of 15
Breaking Changes Between MajorsNot a theme in its sources9 of 9
UI Hook ReliabilityNot a theme in its sources8 of 8
Durability & Production GapsNot a theme in its sources8 of 10
Memory & PerformanceNot a theme in its sources5 of 5

36 sources

  1. Mastra customer story: How Replit's Agent 3 spins up thousands of Mastra agent sandboxes weekly (Sep 24, 2025)Official documentationmastra.ai
  2. openstatus blog: How we built our Slack agent (Feb 27, 2026)Public sourceopenstatus.dev
  3. BrainGrid blog: Migrating to AI SDK v5 (Jul 24, 2025)Public sourcebraingrid.ai
  4. Mastra issue #9370: Mastra with AI SDK v5 may cause duplicate assistant messages (Oct 28, 2025)Public sourcegithub.com
  5. StreamDeckHabitTracker issue 98: drop @mastra/core and port the coach agent to the AI SDK (Oct 13, 2026)Public sourcegithub.com
  6. Aman Kumar on dev.to: Using Mastra agents with a custom OpenAI-compatible API, the silent 5-step limit (Oct 18, 2026)Public sourcedev.to
  7. paulclarke.au pull request 49: research agents moved to the AI SDK, Mastra removed (Oct 16, 2026)Public sourcegithub.com
  8. Kristian: Mastra vs AI SDK, I built production apps with both (YouTube, Jun 17, 2026)Public sourceyoutube.com
  9. Mastra docs: Agents overviewOfficial documentationmastra.ai
  10. Mastra reference: Agent.generate() (maxSteps default 5)Official documentationmastra.ai
  11. Mastra docs: Workflows overviewOfficial documentationmastra.ai
  12. Mastra docs: Workflow runners (Inngest, Temporal)Official documentationmastra.ai
  13. Mastra docs: Memory overviewOfficial documentationmastra.ai
  14. Mastra docs: Evals overview (scorers)Official documentationmastra.ai
  15. Mastra model router (8,187 models from 221 providers)Official documentationmastra.ai
  16. Mastra docs: Installation (provider API keys)Official documentationmastra.ai
  17. Mastra docs: Observability overview (exporters)Official documentationmastra.ai
  18. Mastra reference: CLI, including telemetry and MASTRA_TELEMETRY_DISABLEDOfficial documentationmastra.ai
  19. Mastra integrations: AI SDK UI (useChat, useCompletion, useObject)Official documentationmastra.ai
  20. Mastra docs: Deployment overview (Node.js 22.13, Hono server, deployers)Official documentationmastra.ai
  21. Mastra pricing (Platform Starter, Teams, Enterprise, and Self-Hosted)Official documentationmastra.ai
  22. Mastra docs: Mastra Platform observability (what counts as an event)Official documentationmastra.ai
  23. Mastra LICENSE.md on GitHub (Apache 2.0 outside ee/)Official documentationgithub.com
  24. Mastra Enterprise Edition License 2.0 on GitHub (effective Sep 22, 2026)Official documentationgithub.com
  25. @mastra/core on npm (release history)Official documentationregistry.npmjs.org
  26. AI SDK docs: IntroductionOfficial documentationai-sdk.dev
  27. AI SDK docs: Agents overview (ToolLoopAgent)Official documentationai-sdk.dev
  28. AI SDK docs: Loop control (20-step default)Official documentationai-sdk.dev
  29. AI SDK docs: WorkflowAgent (durable, resumable agents)Official documentationai-sdk.dev
  30. AI SDK docs: Agent memoryOfficial documentationai-sdk.dev
  31. AI SDK docs: Choosing a provider (AI Gateway as the default global provider)Official documentationai-sdk.dev
  32. AI SDK docs: TelemetryOfficial documentationai-sdk.dev
  33. AI SDK docs: AI SDK UI overviewOfficial documentationai-sdk.dev
  34. vercel/ai on GitHub (Apache 2.0, 27,573 stars on Oct 28, 2026)Official documentationgithub.com
  35. ai on npm (7.0.156, Oct 28, 2026)Official documentationregistry.npmjs.org
  36. Vercel docs: AI Gateway pricing (no markup on tokens)Official documentationvercel.com