@mastra/mcp-docs-server 1.3.6-alpha.1 → 1.3.6-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/.docs/docs/agents/human-in-the-loop.md +5 -3
  2. package/.docs/docs/agents/processors.md +7 -3
  3. package/.docs/docs/agents/tools.md +24 -0
  4. package/.docs/docs/memory/memory-processors.md +2 -5
  5. package/.docs/docs/memory/semantic-recall.md +2 -2
  6. package/.docs/docs/memory/working-memory.md +16 -0
  7. package/.docs/docs/observability/tracing/overview.md +1 -1
  8. package/.docs/docs/subagents.md +10 -8
  9. package/.docs/docs/workflows/control-flow.md +1 -1
  10. package/.docs/docs/workflows/time-travel.md +5 -3
  11. package/.docs/integrations/agentic-ui/ai-sdk-ui.md +60 -0
  12. package/.docs/integrations/deploy/temporal.md +23 -0
  13. package/.docs/models/embeddings.md +1 -1
  14. package/.docs/models/gateways/merge-gateway.md +2 -1
  15. package/.docs/models/gateways/netlify.md +2 -1
  16. package/.docs/models/gateways/openrouter.md +2 -1
  17. package/.docs/models/gateways/vercel.md +3 -5
  18. package/.docs/models/index.md +1 -1
  19. package/.docs/models/providers/alibaba.md +1 -1
  20. package/.docs/models/providers/anthropic.md +4 -3
  21. package/.docs/models/providers/berget.md +1 -1
  22. package/.docs/models/providers/coralbricks.md +1 -2
  23. package/.docs/models/providers/cortecs.md +3 -1
  24. package/.docs/models/providers/crossmodel.md +2 -1
  25. package/.docs/models/providers/edenai.md +5 -3
  26. package/.docs/models/providers/kilo.md +12 -10
  27. package/.docs/models/providers/llmgateway-providers.md +4 -2
  28. package/.docs/models/providers/llmgateway.md +2 -1
  29. package/.docs/models/providers/mistral.md +9 -16
  30. package/.docs/models/providers/nano-gpt.md +29 -29
  31. package/.docs/models/providers/ollama-cloud.md +2 -1
  32. package/.docs/models/providers/opencode-go.md +5 -4
  33. package/.docs/models/providers/opencode.md +2 -1
  34. package/.docs/models/providers/ovhcloud.md +1 -2
  35. package/.docs/models/providers/requesty.md +6 -4
  36. package/.docs/models/providers/vivgrid.md +2 -1
  37. package/.docs/reference/agents/generate.md +1 -1
  38. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +3 -3
  39. package/.docs/reference/classifier/classifier.md +35 -35
  40. package/.docs/reference/client-js/memory.md +13 -1
  41. package/.docs/reference/configuration.md +2 -2
  42. package/.docs/reference/connect/providers.md +118 -112
  43. package/.docs/reference/core/getClassifier.md +1 -1
  44. package/.docs/reference/datasets/updateItem.md +10 -0
  45. package/.docs/reference/deployer/vercel.md +1 -1
  46. package/.docs/reference/deployer.md +7 -14
  47. package/.docs/reference/editor/blob-store-provider.md +2 -1
  48. package/.docs/reference/editor/browser-provider.md +3 -2
  49. package/.docs/reference/editor/filesystem-provider.md +2 -1
  50. package/.docs/reference/editor/processor-provider.md +2 -2
  51. package/.docs/reference/editor/sandbox-provider.md +2 -1
  52. package/.docs/reference/editor/storage-workspace-ref.md +27 -2
  53. package/.docs/reference/evals/answer-relevancy.md +4 -2
  54. package/.docs/reference/evals/answer-similarity.md +1 -1
  55. package/.docs/reference/evals/bias.md +3 -1
  56. package/.docs/reference/evals/content-similarity.md +1 -1
  57. package/.docs/reference/evals/context-recall.md +1 -1
  58. package/.docs/reference/evals/context-relevance.md +6 -6
  59. package/.docs/reference/evals/create-classifier-scorer.md +5 -5
  60. package/.docs/reference/evals/hallucination.md +7 -8
  61. package/.docs/reference/evals/keyword-coverage.md +4 -4
  62. package/.docs/reference/evals/noise-sensitivity.md +6 -6
  63. package/.docs/reference/evals/prompt-alignment.md +1 -1
  64. package/.docs/reference/evals/run-evals.md +1 -1
  65. package/.docs/reference/evals/scorer-utils.md +8 -8
  66. package/.docs/reference/evals/tone-consistency.md +23 -24
  67. package/.docs/reference/evals/tool-call-accuracy.md +19 -15
  68. package/.docs/reference/evals/toxicity.md +3 -1
  69. package/.docs/reference/logging/pino-logger.md +4 -4
  70. package/.docs/reference/memory/deleteMessages.md +1 -1
  71. package/.docs/reference/memory/memory-class.md +2 -2
  72. package/.docs/reference/memory/summarizeConversation.md +1 -1
  73. package/.docs/reference/migrations/ai-sdk-v4-to-v5.md +2 -2
  74. package/.docs/reference/migrations/upgrade-to-v1/mcp.md +2 -0
  75. package/.docs/reference/migrations/upgrade-to-v1/memory.md +1 -1
  76. package/.docs/reference/migrations/upgrade-to-v1/tools.md +1 -1
  77. package/.docs/reference/observability/tracing/configuration.md +10 -1
  78. package/.docs/reference/observability/tracing/instances.md +1 -1
  79. package/.docs/reference/observability/tracing/interfaces.md +1 -1
  80. package/.docs/reference/processors/batch-parts-processor.md +1 -1
  81. package/.docs/reference/processors/classifier-processor.md +6 -6
  82. package/.docs/reference/processors/message-history-processor.md +3 -2
  83. package/.docs/reference/processors/model-selection-processor.md +11 -11
  84. package/.docs/reference/processors/response-cache.md +1 -1
  85. package/.docs/reference/processors/semantic-recall-processor.md +2 -3
  86. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  87. package/.docs/reference/processors/working-memory-processor.md +3 -2
  88. package/.docs/reference/project-structure.md +11 -13
  89. package/.docs/reference/pubsub/unix-socket-pubsub.md +6 -2
  90. package/.docs/reference/rag/chunk.md +2 -2
  91. package/.docs/reference/rag/chunking-and-embedding.md +1 -1
  92. package/.docs/reference/rag/database-config.md +14 -2
  93. package/.docs/reference/rag/document.md +7 -2
  94. package/.docs/reference/rag/extract-params.md +5 -5
  95. package/.docs/reference/rag/graph-rag-guide.md +1 -1
  96. package/.docs/reference/rag/metadata-filters.md +1 -1
  97. package/.docs/reference/rag/rerank.md +5 -4
  98. package/.docs/reference/rag/rerankWithScorer.md +2 -2
  99. package/.docs/reference/rag/retrieval.md +7 -5
  100. package/.docs/reference/rag/vector-databases.md +1 -1
  101. package/.docs/reference/server/mastra-server.md +2 -2
  102. package/.docs/reference/streaming/agents/stream.md +1 -1
  103. package/.docs/reference/workflows/run-methods/restart.md +6 -0
  104. package/.docs/reference/workflows/step.md +1 -1
  105. package/package.json +6 -6
@@ -125,7 +125,7 @@ import { agent } from './agent'
125
125
 
126
126
  const approvalClassifier = new Classifier({
127
127
  id: 'tool-approval-classifier',
128
- model: typeSafeAi.evaluationModel('jev-latest'),
128
+ model: typeSafeAi.decisionModel('jev-latest'),
129
129
  questions: {
130
130
  requiresApproval: {
131
131
  type: 'boolean',
@@ -137,7 +137,7 @@ const approvalClassifier = new Classifier({
137
137
 
138
138
  const stream = await agent.stream('Clean up old records', {
139
139
  requireToolApproval: async ({ toolName, args }) => {
140
- const result = await approvalClassifier.evaluate({
140
+ const result = await approvalClassifier.decide({
141
141
  state: {
142
142
  toolName,
143
143
  argumentNames: Object.keys(args),
@@ -149,7 +149,7 @@ const stream = await agent.stream('Clean up old records', {
149
149
  })
150
150
  ```
151
151
 
152
- The example sends argument names rather than values because the classifier forwards its state to the configured evaluation model. If the decision requires argument values, redact sensitive data first or use an evaluation model and provider that meet the protected tool's data-handling requirements.
152
+ The example sends argument names rather than values because the classifier forwards its state to the configured decision model. If the decision requires argument values, redact sensitive data first or use a decision model and provider that meet the protected tool's data-handling requirements.
153
153
 
154
154
  Returning `true` pauses the tool call for human approval. It doesn't approve or decline the call automatically. Choose a threshold that matches the risk of the tools available to the agent. If this `requireToolApproval` function throws, it defaults to requiring approval.
155
155
 
@@ -260,6 +260,8 @@ const weatherTool = createTool({
260
260
 
261
261
  > **Note:** `suspend()` doesn't throw, return immediately after calling it (e.g. `return await suspend({ ... })`). Code after `await suspend(...)` still runs before the tool pauses.
262
262
 
263
+ Use `suspend()` instead of a tool without `execute` when the tool needs a structured answer from the user and also runs inside a subagent: subagents can't run client tools, but suspension propagates through the supervisor. To resume from AI SDK `useChat()`, see [resuming a suspended tool from `useChat()`](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
264
+
263
265
  ## Tool approval with `generate()`
264
266
 
265
267
  Tool approval also works with `generate()` for non-streaming use cases. When a tool requires approval, `generate()` returns immediately with `finishReason: 'suspended'`, a `suspendPayload` containing the tool call details (`toolCallId`, `toolName`, `args`), and a `runId`:
@@ -572,14 +572,18 @@ Pass `scope: null` to deliberately share entries across all callers. Only use th
572
572
 
573
573
  ### Custom cache backend
574
574
 
575
- `ResponseCache` accepts any `MastraServerCache`. For production, use `RedisCache` from `@mastra/redis`:
575
+ `ResponseCache` accepts any `MastraServerCache`. For production, use `RedisServerCache` from `@mastra/redis`:
576
576
 
577
577
  ```typescript
578
578
  import { Agent } from '@mastra/core/agent'
579
579
  import { ResponseCache } from '@mastra/core/processors'
580
- import { RedisCache } from '@mastra/redis'
580
+ import { RedisServerCache } from '@mastra/redis'
581
+ import { createClient } from 'redis'
581
582
 
582
- const cache = new RedisCache({ url: process.env.REDIS_URL })
583
+ const client = createClient({ url: process.env.REDIS_URL })
584
+ await client.connect()
585
+
586
+ const cache = new RedisServerCache({ client })
583
587
 
584
588
  export const agent = new Agent({
585
589
  id: 'cached-agent',
@@ -300,6 +300,30 @@ export const weatherTool = createTool({
300
300
 
301
301
  `toModelOutput` also works with client-side tools. For tools passed through `clientTools`, the mapping runs on the client after the tool executes, and the transformed output is sent back to the server alongside the raw result. For tools defined on the server without an `execute` function (the browser runs the tool and sends the result back on the next request), the server definition's `toModelOutput` is applied to the incoming result. The model receives the transformed content instead of the raw tool result.
302
302
 
303
+ ## Tools that run on the client
304
+
305
+ A tool without an `execute` function is a client tool: the server can't run it. The agent stops at the step where the model called it. The run ends with `finishReason: 'tool-calls'`, and the model doesn't produce more text until the tool has a result. Pick the pattern that matches what the model needs back:
306
+
307
+ - **The client runs the tool and the model needs its result**: Leave out `execute`. The client runs the tool, adds the result to the conversation, and sends a new request so the agent continues. With AI SDK `useChat()`, see [client tools with `useChat()`](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
308
+ - **The client only renders the call** (for example a product card): Give the tool an `execute` that returns a short acknowledgement. The agent continues in the same run, and the client renders the tool part from its input. Return a small value instead of echoing the input so the model context and stored messages stay small.
309
+ - **The tool needs a structured answer from the user** (for example a confirmed cart write): Call `suspend()` in `execute`, and resume with the user's answer. See [runtime suspension with `suspend()`](https://mastra.ai/docs/agents/human-in-the-loop).
310
+
311
+ ```typescript
312
+ import { createTool } from '@mastra/core/tools'
313
+ import { z } from 'zod'
314
+
315
+ export const showProductTool = createTool({
316
+ id: 'show-product',
317
+ description: 'Shows a product card to the user',
318
+ inputSchema: z.object({
319
+ productId: z.string(),
320
+ }),
321
+ execute: async () => ({ rendered: true }),
322
+ })
323
+ ```
324
+
325
+ Subagents can't run client tools. When a subagent calls a tool without `execute`, its run stops and the supervisor receives the unresolved calls in `subAgentPendingToolCalls` on the delegation result. Give client tools to the supervisor, or use `suspend()` in the subagent's tool. Suspension propagates through the supervisor, see [use `suspend()` in supervisor agents](https://mastra.ai/docs/agents/human-in-the-loop).
326
+
303
327
  ## Transform tool payloads for UI and transcripts
304
328
 
305
329
  Use `transform` when a tool returns raw data your application needs, but browser-facing streams or user-visible transcript messages should receive a smaller or safer shape. `transform` is separate from `toModelOutput`: `toModelOutput` shapes the payload sent back to the model, while `transform` shapes tool input, output, errors, approval payloads, and suspension payloads for `display` and `transcript` targets.
@@ -99,7 +99,7 @@ import { Agent } from '@mastra/core/agent'
99
99
  import { Memory } from '@mastra/memory'
100
100
  import { LibSQLStore } from '@mastra/libsql'
101
101
  import { PineconeVector } from '@mastra/pinecone'
102
- import { OpenAIEmbedder } from '@mastra/openai'
102
+ import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
103
103
  import { openai } from '@ai-sdk/openai'
104
104
 
105
105
  const agent = new Agent({
@@ -115,10 +115,7 @@ const agent = new Agent({
115
115
  id: 'memory-vector',
116
116
  apiKey: process.env.PINECONE_API_KEY!,
117
117
  }),
118
- embedder: new OpenAIEmbedder({
119
- model: 'text-embedding-3-small',
120
- apiKey: process.env.OPENAI_API_KEY!,
121
- }),
118
+ embedder: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
122
119
  semanticRecall: { enabled: true }, // SemanticRecall processor automatically added
123
120
  }),
124
121
  })
@@ -411,11 +411,11 @@ PostgreSQL supports both IVFFlat and HNSW indexes. By default, Mastra creates an
411
411
 
412
412
  ```typescript
413
413
  import { Memory } from '@mastra/memory'
414
- import { PgStore, PgVector } from '@mastra/pg'
414
+ import { PostgresStore, PgVector } from '@mastra/pg'
415
415
 
416
416
  const agent = new Agent({
417
417
  memory: new Memory({
418
- storage: new PgStore({
418
+ storage: new PostgresStore({
419
419
  id: 'agent-storage',
420
420
  connectionString: process.env.DATABASE_URL,
421
421
  }),
@@ -272,6 +272,22 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
272
272
  - **Set a field to `null` to delete it:** This explicitly removes the field from memory
273
273
  - **Arrays are replaced entirely:** When an array field is provided, it replaces the existing array (arrays aren't merged element-by-element)
274
274
 
275
+ ### Concurrent updates
276
+
277
+ With `scope: 'resource'` and a storage adapter that supports atomic merges (currently `@mastra/pg`), each merge runs inside a row-locked database transaction. Concurrent updates to different fields from separate processes are all kept. Other adapters merge in the application, which only serializes writers inside a single process.
278
+
279
+ To merge a partial update from your own code, call `memory.mergeWorkingMemory()`:
280
+
281
+ ```typescript
282
+ await memory.mergeWorkingMemory({
283
+ threadId: 'thread-1',
284
+ resourceId: 'user-123',
285
+ workingMemory: { preferences: { tone: 'formal' } },
286
+ })
287
+ ```
288
+
289
+ It throws if working memory isn't schema-based and resource-scoped, or if the storage adapter doesn't support atomic merges. Check `await memory.supportsAtomicWorkingMemoryMerge()` first if you need to fall back.
290
+
275
291
  ## Choosing between template and schema
276
292
 
277
293
  - Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics**: the agent must provide the complete memory content on each update.
@@ -450,7 +450,7 @@ Span processors transform, filter, or enrich trace data before it's exported. Th
450
450
  You can create custom span processors by implementing the `SpanOutputProcessor` interface. Here's a basic example that converts all input text in spans to lowercase:
451
451
 
452
452
  ```ts
453
- import type { SpanOutputProcessor, AnySpan } from '@mastra/observability'
453
+ import type { SpanOutputProcessor, AnySpan } from '@mastra/core/observability'
454
454
 
455
455
  export class LowercaseInputProcessor implements SpanOutputProcessor {
456
456
  name = 'lowercase-processor'
@@ -163,14 +163,14 @@ const stream = await parentAgent.stream('Research AI trends', {
163
163
 
164
164
  The `context` object includes:
165
165
 
166
- | Property | Description |
167
- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
168
- | `primitiveId` | The ID of the subagent that ran |
169
- | `result` | The subagent's response, including `text`, `usage`, `finishReason`, `subAgentToolResults`, `subAgentThreadId`, and `subAgentResourceId` when available |
170
- | `success` | Whether the delegation succeeded |
171
- | `error` | The original error if the delegation failed |
172
- | `messages` | The collected subagent transcript, including partial messages when available |
173
- | `bail()` | Function to stop the parent agent's loop |
166
+ | Property | Description |
167
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
168
+ | `primitiveId` | The ID of the subagent that ran |
169
+ | `result` | The subagent's response, including `text`, `usage`, `finishReason`, `subAgentToolResults`, `subAgentPendingToolCalls`, `subAgentThreadId`, and `subAgentResourceId` when available |
170
+ | `success` | Whether the delegation succeeded |
171
+ | `error` | The original error if the delegation failed |
172
+ | `messages` | The collected subagent transcript, including partial messages when available |
173
+ | `bail()` | Function to stop the parent agent's loop |
174
174
 
175
175
  #### Failed delegations
176
176
 
@@ -261,6 +261,8 @@ Application code and UI integrations can still inspect `subAgentToolResults` and
261
261
 
262
262
  This keeps debugging and display data available without sending nested tool arguments or outputs back into the parent agent's next model call.
263
263
 
264
+ Subagents can't run client tools (tools without an `execute` function). If a subagent calls one, its run stops at that step with `finishReason: 'tool-calls'`. The delegation result lists the unresolved calls in `subAgentPendingToolCalls`, the parent agent's model is told which tools were never run, and Mastra logs a warning. Give client tools to the parent agent, or use [`suspend()`](https://mastra.ai/docs/agents/human-in-the-loop) in the subagent's tool when it needs input from the user.
265
+
264
266
  Set `includeSubAgentToolResultsInModelContext` to include the full subagent result, including nested tool results and subagent metadata, in the parent agent's model context.
265
267
 
266
268
  ```typescript
@@ -261,7 +261,7 @@ import { z } from 'zod'
261
261
 
262
262
  const router = new Classifier({
263
263
  id: 'ticket-router',
264
- model: typeSafeAi.evaluationModel('jev-latest'),
264
+ model: typeSafeAi.decisionModel('jev-latest'),
265
265
  questions: {
266
266
  route: {
267
267
  type: 'choice',
@@ -104,7 +104,7 @@ const result = await run.timeTravel({
104
104
 
105
105
  The context object contains step results keyed by step ID. Each step result includes:
106
106
 
107
- - `status`: The step's execution status (`success`, `failed`, `suspended`)
107
+ - `status`: The step's execution status. Commonly `success`, `failed`, or `suspended`, but any workflow run status is accepted: `running`, `success`, `failed`, `tripwire`, `suspended`, `waiting`, `pending`, `canceled`, `bailed`, `paused`, or `skipped`
108
108
  - `payload`: The input data passed to the step
109
109
  - `output`: The step's output data (for successful steps)
110
110
  - `startedAt`: Timestamp when the step started
@@ -213,16 +213,18 @@ try {
213
213
 
214
214
  ### Invalid step ID
215
215
 
216
- Time travel throws if the target step doesn't exist in the workflow:
216
+ Time travel throws if the target step doesn't exist in the current workflow definition:
217
217
 
218
218
  ```typescript
219
219
  try {
220
220
  await run.timeTravel({ step: 'nonExistentStep' })
221
221
  } catch (error) {
222
- // "Time travel target step not found in execution graph: 'nonExistentStep'. Verify the step id/path."
222
+ // "Cannot time travel to step 'nonExistentStep': the step does not exist in the current execution graph. ..."
223
223
  }
224
224
  ```
225
225
 
226
+ The error also lists up to 10 of the step IDs recorded in the run's snapshot (with a count of any remaining IDs), and confirms that the stored snapshot wasn't modified. If the run has no recorded step results, the error reads `Time travel target step not found in execution graph: 'nonExistentStep'. Verify the step id/path.` instead.
227
+
226
228
  ### Invalid input data
227
229
 
228
230
  When `validateInputs` is enabled, time travel validates the input data against the step's schema:
@@ -243,6 +243,66 @@ export default function Chat() {
243
243
 
244
244
  Use [`prepareSendMessagesRequest`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat#transport.default-chat-transport.prepare-send-messages-request) to customize the request sent to the chat route, for example to pass additional configuration to the agent.
245
245
 
246
+ ### Client tools with `useChat()`
247
+
248
+ A tool without an `execute` function runs on the client. When the model calls it, the agent's run ends at that step and the stream finishes with a `tool-{toolKey}` part in the `input-available` state. To let the agent continue, run the tool in the browser, add its result with `addToolOutput()`, and send the conversation back. `sendAutomaticallyWhen` sends the next request once every tool call in the last assistant message has a result:
249
+
250
+ ```tsx
251
+ import { useChat } from '@ai-sdk/react'
252
+ import { DefaultChatTransport, lastAssistantMessageIsCompleteWithToolCalls } from 'ai'
253
+
254
+ export default function Chat() {
255
+ const { messages, sendMessage, addToolOutput } = useChat({
256
+ transport: new DefaultChatTransport({
257
+ api: 'http://localhost:4111/chat',
258
+ }),
259
+ sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
260
+ async onToolCall({ toolCall }) {
261
+ if (toolCall.toolName === 'addToCart') {
262
+ const input = toolCall.input as { productId: string }
263
+ const cart = await addToCartInBrowser(input.productId)
264
+
265
+ // Don't await addToolOutput inside onToolCall to avoid deadlocks
266
+ addToolOutput({ tool: 'addToCart', toolCallId: toolCall.toolCallId, output: cart })
267
+ }
268
+ },
269
+ })
270
+
271
+ // ...render messages and call sendMessage()
272
+ }
273
+ ```
274
+
275
+ If the client only needs to render the tool call and the model doesn't need a result, give the tool an `execute` that returns a short acknowledgement instead. The agent then keeps generating in the same request. See [tools that run on the client](https://mastra.ai/docs/agents/tools).
276
+
277
+ Subagents can't run client tools: the browser never sees a subagent's tool calls. Define client tools on the agent the chat route talks to.
278
+
279
+ ### Resuming a suspended tool from `useChat()`
280
+
281
+ When a tool calls `suspend()`, the stream includes a `data-tool-call-suspended` part with the `runId`, `toolCallId`, and `suspendPayload`. To resume, send `resumeData` (matching the tool's `resumeSchema`) and the `runId` in the request body. `handleChatStream()` and `chatRoute()` then call `agent.resumeStream()` instead of starting a new run:
282
+
283
+ ```tsx
284
+ const { messages, sendMessage } = useChat({
285
+ transport: new DefaultChatTransport({
286
+ api: 'http://localhost:4111/chat',
287
+ prepareSendMessagesRequest: ({ messages, body }) => {
288
+ const resume = body?.resume as { runId: string; resumeData: unknown } | undefined
289
+ if (resume) {
290
+ return { body: { messages, runId: resume.runId, resumeData: resume.resumeData } }
291
+ }
292
+ return { body: { messages } }
293
+ },
294
+ }),
295
+ })
296
+
297
+ // When the user confirms the suspended tool call:
298
+ sendMessage(
299
+ { text: 'Confirmed' },
300
+ { body: { resume: { runId: suspended.runId, resumeData: { confirmed: true } } } },
301
+ )
302
+ ```
303
+
304
+ `suspended` is the `data` of the latest `data-tool-call-suspended` part in `messages`.
305
+
246
306
  ## Using Mastra Memory
247
307
 
248
308
  When your agent has [memory](https://mastra.ai/docs/memory/overview) configured, Mastra loads conversation history from storage on the server. Send only the new message from the client instead of the full conversation history.
@@ -71,6 +71,29 @@ export const { createWorkflow, createStep } = init({
71
71
 
72
72
  `loadClientConnectConfig()` reads standard Temporal environment variables such as `TEMPORAL_ADDRESS`, `TEMPORAL_NAMESPACE`, and mTLS settings. See the [Temporal envconfig docs](https://docs.temporal.io/develop/typescript/temporal-clients) for the full list.
73
73
 
74
+ ### Configure activity retries
75
+
76
+ Pass `retry` to `init()` to set a Temporal activity retry policy for workflows created by these helpers. For example, add the following options to the initialization above to limit a failing activity to five total attempts:
77
+
78
+ ```ts
79
+ export const { createWorkflow, createStep } = init({
80
+ client,
81
+ taskQueue: 'mastra',
82
+ startToCloseTimeout: '5 minutes',
83
+ retry: {
84
+ initialInterval: '5 seconds',
85
+ backoffCoefficient: 2,
86
+ maximumInterval: '5 minutes',
87
+ maximumAttempts: 5,
88
+ nonRetryableErrorTypes: ['ValidationError'],
89
+ },
90
+ })
91
+ ```
92
+
93
+ The policy applies to all generated activities, including steps, mappings, and conditions. Set `maximumAttempts: 1` to disable retries. Omitting `retry` preserves Temporal's default policy, which allows unlimited attempts. Mastra's workflow `retryConfig` doesn't configure Temporal activity retries.
94
+
95
+ Keep retry options in the statically analyzable `init()` configuration so the worker build can include them. Inline object literal spreads are supported. Spreads of variables or function results are skipped during activity option extraction, so `retry` and `startToCloseTimeout` inside those spreads aren't forwarded to the generated workflow. Provide these options directly in `init()` or in an inline object literal spread instead. Rebuild and restart the worker after changing the policy.
96
+
74
97
  ### Creating steps
75
98
 
76
99
  Define the individual steps that will compose your workflow. Each step becomes a Temporal activity.
@@ -242,7 +242,7 @@ await vectorStore.upsert(
242
242
  The model router provides full TypeScript autocomplete for embedding model IDs:
243
243
 
244
244
  ```typescript
245
- import type { EmbeddingModelId } from '@mastra/core'
245
+ import type { EmbeddingModelId } from '@mastra/core/llm'
246
246
 
247
247
  // Type-safe embedding model selection
248
248
  const modelId: EmbeddingModelId = 'openai/text-embedding-3-small'
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![Merge Gateway logo](https://models.dev/logos/merge-gateway.svg)Merge Gateway
6
6
 
7
- Merge Gateway aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 195 models through Mastra's model router.
7
+ Merge Gateway aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 196 models through Mastra's model router.
8
8
 
9
9
  Learn more in the [Merge Gateway documentation](https://docs.merge.dev/merge-gateway).
10
10
 
@@ -42,6 +42,7 @@ ANTHROPIC_API_KEY=ant-...
42
42
  | `anthropic/claude-fable-5` |
43
43
  | `anthropic/claude-fable-5-1` |
44
44
  | `anthropic/claude-haiku-4-5-20251001` |
45
+ | `anthropic/claude-haiku-5-5` |
45
46
  | `anthropic/claude-opus-4-1-20250805` |
46
47
  | `anthropic/claude-opus-4-20250514` |
47
48
  | `anthropic/claude-opus-4-5-20251101` |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Netlify
6
6
 
7
- Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 271 models through Mastra's model router.
7
+ Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 272 models through Mastra's model router.
8
8
 
9
9
  Learn more in the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/).
10
10
 
@@ -43,6 +43,7 @@ ANTHROPIC_API_KEY=ant-...
43
43
  | `anthropic/claude-fable-5-1` |
44
44
  | `anthropic/claude-haiku-4-5` |
45
45
  | `anthropic/claude-haiku-4-5-20251001` |
46
+ | `anthropic/claude-haiku-5-5` |
46
47
  | `anthropic/claude-opus-4-5` |
47
48
  | `anthropic/claude-opus-4-5-20251101` |
48
49
  | `anthropic/claude-opus-4-6` |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![OpenRouter logo](https://models.dev/logos/openrouter.svg)OpenRouter
6
6
 
7
- OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 389 models through Mastra's model router.
7
+ OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 390 models through Mastra's model router.
8
8
 
9
9
  Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
10
10
 
@@ -71,6 +71,7 @@ ANTHROPIC_API_KEY=ant-...
71
71
  | `anthropic/claude-fable-5` |
72
72
  | `anthropic/claude-fable-5.1` |
73
73
  | `anthropic/claude-haiku-4.5` |
74
+ | `anthropic/claude-haiku-5.5` |
74
75
  | `anthropic/claude-opus-4.1` |
75
76
  | `anthropic/claude-opus-4.5` |
76
77
  | `anthropic/claude-opus-4.6` |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![Vercel logo](https://models.dev/logos/vercel.svg)Vercel
6
6
 
7
- Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 409 models through Mastra's model router.
7
+ Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 407 models through Mastra's model router.
8
8
 
9
9
  Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers).
10
10
 
@@ -92,6 +92,7 @@ ANTHROPIC_API_KEY=ant-...
92
92
  | `anthropic/claude-fable-5` |
93
93
  | `anthropic/claude-fable-5.1` |
94
94
  | `anthropic/claude-haiku-4.5` |
95
+ | `anthropic/claude-haiku-5.5` |
95
96
  | `anthropic/claude-opus-4` |
96
97
  | `anthropic/claude-opus-4.5` |
97
98
  | `anthropic/claude-opus-4.6` |
@@ -143,7 +144,6 @@ ANTHROPIC_API_KEY=ant-...
143
144
  | `cohere/rerank-v4-pro` |
144
145
  | `deepseek/deepseek-r1` |
145
146
  | `deepseek/deepseek-v3.1` |
146
- | `deepseek/deepseek-v3.1-terminus` |
147
147
  | `deepseek/deepseek-v3.2` |
148
148
  | `deepseek/deepseek-v3.2-thinking` |
149
149
  | `deepseek/deepseek-v4-flash` |
@@ -152,7 +152,6 @@ ANTHROPIC_API_KEY=ant-...
152
152
  | `deepseek/deepseek-v4-pro` |
153
153
  | `deepseek/deepseek-v4-pro-0813` |
154
154
  | `deepseek/deepseek-v4.1-flash` |
155
- | `deepseek/deepseek-v4.1-flash-fast` |
156
155
  | `fireworks/ember-1` |
157
156
  | `fish-audio/s1` |
158
157
  | `fish-audio/s2-pro` |
@@ -255,7 +254,6 @@ ANTHROPIC_API_KEY=ant-...
255
254
  | `mistral/mistral-small` |
256
255
  | `mixedbread/toast-1` |
257
256
  | `moonshotai/kimi-k2` |
258
- | `moonshotai/kimi-k2-thinking` |
259
257
  | `moonshotai/kimi-k2.5` |
260
258
  | `moonshotai/kimi-k2.6` |
261
259
  | `moonshotai/kimi-k2.7-code` |
@@ -398,7 +396,7 @@ ANTHROPIC_API_KEY=ant-...
398
396
  | `spacexai/grok-tts` |
399
397
  | `spacexai/grok-voice-think-fast-1.0` |
400
398
  | `spacexai/grok-voice-think-fast-2.0` |
401
- | `stepfun/step-3.5-flash` |
399
+ | `stealth/glyph-cluster` |
402
400
  | `stepfun/step-3.7-flash` |
403
401
  | `stepfun/step-5-preview` |
404
402
  | `tencent/hy-mt2-lite` |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Model Providers
6
6
 
7
- Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 7794 models from 213 providers through a single API.
7
+ Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 7817 models from 213 providers through a single API.
8
8
 
9
9
  ## Features
10
10
 
@@ -52,7 +52,7 @@ for await (const chunk of stream) {
52
52
  | `alibaba/qwen-plus-character-ja` | 8K | | | | | | $0.50 | $1 |
53
53
  | `alibaba/qwen-turbo` | 1.0M | | | | | | $0.05 | $0.20 |
54
54
  | `alibaba/qwen-vl-max` | 131K | | | | | | $0.80 | $3 |
55
- | `alibaba/qwen-vl-ocr` | 34K | | | | | | $0.72 | $0.72 |
55
+ | `alibaba/qwen-vl-ocr` | 34K | | | | | | $0.07 | $0.16 |
56
56
  | `alibaba/qwen-vl-plus` | 131K | | | | | | $0.21 | $0.63 |
57
57
  | `alibaba/qwen2-5-14b-instruct` | 131K | | | | | | $0.35 | $1 |
58
58
  | `alibaba/qwen2-5-32b-instruct` | 131K | | | | | | $0.70 | $3 |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![Anthropic logo](https://models.dev/logos/anthropic.svg)Anthropic
6
6
 
7
- Access 16 Anthropic models through Mastra's model router. Authentication is handled automatically using the `ANTHROPIC_API_KEY` environment variable.
7
+ Access 17 Anthropic models through Mastra's model router. Authentication is handled automatically using the `ANTHROPIC_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [Anthropic documentation](https://docs.anthropic.com/en/docs/about-claude/models).
10
10
 
@@ -40,6 +40,7 @@ for await (const chunk of stream) {
40
40
  | `anthropic/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
41
41
  | `anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
42
42
  | `anthropic/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
43
+ | `anthropic/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
43
44
  | `anthropic/claude-opus-4-5` | 200K | | | | | | $5 | $25 |
44
45
  | `anthropic/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 |
45
46
  | `anthropic/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
@@ -47,8 +48,8 @@ for await (const chunk of stream) {
47
48
  | `anthropic/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
48
49
  | `anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
49
50
  | `anthropic/claude-opus-5-5` | 1.0M | | | | | | $4 | $20 |
50
- | `anthropic/claude-sonnet-4-5` | 1.0M | | | | | | $3 | $15 |
51
- | `anthropic/claude-sonnet-4-5-20250929` | 1.0M | | | | | | $3 | $15 |
51
+ | `anthropic/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 |
52
+ | `anthropic/claude-sonnet-4-5-20250929` | 200K | | | | | | $3 | $15 |
52
53
  | `anthropic/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
53
54
  | `anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
54
55
  | `anthropic/claude-sonnet-5-5` | 1.0M | | | | | | $2 | $10 |
@@ -43,7 +43,7 @@ for await (const chunk of stream) {
43
43
  | `berget/moonshotai/Kimi-K3` | 328K | | | | | | $3 | $15 |
44
44
  | `berget/Qwen/Qwen3.8-27B-FP8` | 262K | | | | | | $0.46 | $3 |
45
45
  | `berget/zai-org/GLM-5.2` | 524K | | | | | | $2 | $5 |
46
- | `berget/zai-org/GLM-5.3-Flash` | 524K | | | | | | $0.29 | $0.58 |
46
+ | `berget/zai-org/GLM-5.3-Flash` | 1.0M | | | | | | $0.29 | $0.58 |
47
47
 
48
48
  Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
49
49
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![CoralBricks logo](https://models.dev/logos/coralbricks.svg)CoralBricks
6
6
 
7
- Access 5 CoralBricks models through Mastra's model router. Authentication is handled automatically using the `CORAL_API_KEY` environment variable.
7
+ Access 4 CoralBricks models through Mastra's model router. Authentication is handled automatically using the `CORAL_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [CoralBricks documentation](https://www.coralbricks.ai/docs).
10
10
 
@@ -41,7 +41,6 @@ for await (const chunk of stream) {
41
41
  | `coralbricks/deepseek-v4.1-flash-fast` | 1.0M | | | | | | $0.30 | $1 |
42
42
  | `coralbricks/deepseek-v4.1-flash-fast-fp4` | 1.0M | | | | | | $0.30 | $1 |
43
43
  | `coralbricks/glm-5.3-fast` | 1.0M | | | | | | $1 | $4 |
44
- | `coralbricks/glm-5.3-flash-fp4` | 1.0M | | | | | | $0.15 | $0.50 |
45
44
  | `coralbricks/glm-5.3-fp4` | 1.0M | | | | | | $1 | $4 |
46
45
 
47
46
  Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![Cortecs logo](https://models.dev/logos/cortecs.svg)Cortecs
6
6
 
7
- Access 103 Cortecs models through Mastra's model router. Authentication is handled automatically using the `CORTECS_API_KEY` environment variable.
7
+ Access 105 Cortecs models through Mastra's model router. Authentication is handled automatically using the `CORTECS_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [Cortecs documentation](https://cortecs.ai).
10
10
 
@@ -50,6 +50,7 @@ for await (const chunk of stream) {
50
50
  | `cortecs/claude-opus4-8` | 1.0M | | | | | | $5 | $27 |
51
51
  | `cortecs/claude-sonnet-4` | 200K | | | | | | $3 | $15 |
52
52
  | `cortecs/claude-sonnet-5` | 1.0M | | | | | | $2 | $11 |
53
+ | `cortecs/claude-sonnet-5.5` | 1.0M | | | | | | $2 | $11 |
53
54
  | `cortecs/codestral-2508` | 256K | | | | | | $0.37 | $1 |
54
55
  | `cortecs/deepseek-v3.2` | 164K | | | | | | $0.50 | $1 |
55
56
  | `cortecs/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.09 | $0.17 |
@@ -110,6 +111,7 @@ for await (const chunk of stream) {
110
111
  | `cortecs/mistral-7b-instruct-v0.3` | 127K | | | | | | $0.11 | $0.11 |
111
112
  | `cortecs/mistral-large-2402` | 32K | | | | | | $4 | $13 |
112
113
  | `cortecs/mistral-large-2512` | 256K | | | | | | $0.61 | $2 |
114
+ | `cortecs/mistral-large-4-0` | 1.0M | | | | | | $0.77 | $2 |
113
115
  | `cortecs/mistral-medium-3.5` | 256K | | | | | | $2 | $8 |
114
116
  | `cortecs/mistral-nemo-instruct-2407` | 128K | | | | | | $0.14 | $0.14 |
115
117
  | `cortecs/mistral-small-2503` | 128K | | | | | | $0.11 | $0.33 |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![CrossModel logo](https://models.dev/logos/crossmodel.svg)CrossModel
6
6
 
7
- Access 68 CrossModel models through Mastra's model router. Authentication is handled automatically using the `CROSSMODEL_API_KEY` environment variable.
7
+ Access 69 CrossModel models through Mastra's model router. Authentication is handled automatically using the `CROSSMODEL_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [CrossModel documentation](https://www.crossmodel.ai/docs).
10
10
 
@@ -41,6 +41,7 @@ for await (const chunk of stream) {
41
41
  | `crossmodel/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
42
42
  | `crossmodel/anthropic/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
43
43
  | `crossmodel/anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
44
+ | `crossmodel/anthropic/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
44
45
  | `crossmodel/anthropic/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
45
46
  | `crossmodel/anthropic/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
46
47
  | `crossmodel/anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![Eden AI logo](https://models.dev/logos/edenai.svg)Eden AI
6
6
 
7
- Access 294 Eden AI models through Mastra's model router. Authentication is handled automatically using the `EDENAI_API_KEY` environment variable.
7
+ Access 296 Eden AI models through Mastra's model router. Authentication is handled automatically using the `EDENAI_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [Eden AI documentation](https://docs.edenai.co).
10
10
 
@@ -65,6 +65,7 @@ for await (const chunk of stream) {
65
65
  | `edenai/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
66
66
  | `edenai/anthropic/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
67
67
  | `edenai/anthropic/claude-fable-latest` | 1.0M | | | | | | $10 | $50 |
68
+ | `edenai/anthropic/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
68
69
  | `edenai/anthropic/claude-opus-4-5` | 200K | | | | | | $5 | $25 |
69
70
  | `edenai/anthropic/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 |
70
71
  | `edenai/anthropic/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
@@ -175,6 +176,7 @@ for await (const chunk of stream) {
175
176
  | `edenai/minimax/MiniMax-M2.5` | 205K | | | | | | $0.30 | $1 |
176
177
  | `edenai/minimax/MiniMax-M2.7` | 205K | | | | | | $0.30 | $1 |
177
178
  | `edenai/minimax/MiniMax-M3` | 524K | | | | | | $0.30 | $1 |
179
+ | `edenai/mistral/codestral-2508` | 256K | | | | | | $0.30 | $0.90 |
178
180
  | `edenai/mistral/codestral-latest` | 256K | | | | | | $0.30 | $0.90 |
179
181
  | `edenai/mistral/devstral-2512` | 262K | | | | | | $0.40 | $2 |
180
182
  | `edenai/mistral/devstral-medium-latest` | 262K | | | | | | $0.40 | $2 |
@@ -270,9 +272,9 @@ for await (const chunk of stream) {
270
272
  | `edenai/qwen/qwen3.8-max-0902` | 1.0M | | | | | | $2 | $6 |
271
273
  | `edenai/qwen/qwen3.8-omni-flash` | 1.0M | | | | | | $0.15 | $0.47 |
272
274
  | `edenai/qwen/qwq-plus` | 131K | | | | | | $0.80 | $2 |
273
- | `edenai/scaleway/deepseek-v4-flash-0731` | 256K | | | | | | $0.45 | $0.90 |
275
+ | `edenai/scaleway/deepseek-v4-flash-0731` | 256K | | | | | | $0.45 | $0.89 |
274
276
  | `edenai/scaleway/gemma-3-27b-it` | 40K | | | | | | $0.29 | $0.57 |
275
- | `edenai/scaleway/gpt-oss-120b` | 128K | | | | | | $0.17 | $0.68 |
277
+ | `edenai/scaleway/gpt-oss-120b` | 128K | | | | | | $0.17 | $0.67 |
276
278
  | `edenai/scaleway/llama-3.3-70b-instruct` | 128K | | | | | | $1 | $1 |
277
279
  | `edenai/tencent/deepseek-v4-pro-0813` | 1.0M | | | | | | $0.66 | $2 |
278
280
  | `edenai/tencent/hy3` | 256K | | | | | | $0.13 | $0.53 |