@mastra/mcp-docs-server 1.3.10-alpha.7 → 1.3.10-alpha.9

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 (76) hide show
  1. package/.docs/docs/channels.md +15 -0
  2. package/.docs/docs/harness/durable-agents.md +1 -1
  3. package/.docs/docs/harness/schedules.md +2 -0
  4. package/.docs/docs/mastra-platform/server.md +10 -6
  5. package/.docs/docs/mastra-platform/studio.md +1 -1
  6. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +2 -1
  7. package/.docs/docs/signals/thread-streams.md +34 -3
  8. package/.docs/docs/workflows/agents-and-tools.md +6 -1
  9. package/.docs/docs/workflows/scheduled-workflows.md +6 -2
  10. package/.docs/integrations/observability/opentelemetry.md +27 -4
  11. package/.docs/integrations/voice/speechify.md +23 -10
  12. package/.docs/models/gateways/merge-gateway.md +2 -1
  13. package/.docs/models/gateways/neon.md +2 -1
  14. package/.docs/models/gateways/netlify.md +1 -2
  15. package/.docs/models/gateways/openrouter.md +2 -2
  16. package/.docs/models/gateways/vercel.md +3 -1
  17. package/.docs/models/index.md +1 -1
  18. package/.docs/models/providers/aimlapi.md +2 -1
  19. package/.docs/models/providers/commandcode.md +2 -1
  20. package/.docs/models/providers/edenai.md +3 -1
  21. package/.docs/models/providers/empiriolabs.md +4 -4
  22. package/.docs/models/providers/huggingface.md +2 -1
  23. package/.docs/models/providers/inceptron.md +2 -2
  24. package/.docs/models/providers/kilo.md +11 -11
  25. package/.docs/models/providers/llmgateway-providers.md +4 -5
  26. package/.docs/models/providers/llmgateway.md +2 -2
  27. package/.docs/models/providers/lowrouter.md +2 -1
  28. package/.docs/models/providers/nano-gpt.md +15 -12
  29. package/.docs/models/providers/nearai.md +2 -1
  30. package/.docs/models/providers/openai.md +2 -1
  31. package/.docs/models/providers/requesty.md +3 -1
  32. package/.docs/models/providers/wandb.md +2 -2
  33. package/.docs/reference/agents/agent.md +3 -1
  34. package/.docs/reference/agents/channels.md +3 -1
  35. package/.docs/reference/agents/durable-agent.md +17 -9
  36. package/.docs/reference/channels/slack-provider.md +2 -0
  37. package/.docs/reference/client-js/agents.md +2 -0
  38. package/.docs/reference/client-js/observability.md +13 -14
  39. package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
  40. package/.docs/reference/core/mastra-model-gateway.md +5 -0
  41. package/.docs/reference/observability/metrics/automatic-metrics.md +10 -8
  42. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -0
  43. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +4 -0
  44. package/.docs/reference/observability/tracing/interfaces.md +21 -1
  45. package/.docs/reference/processors/classifier-processor.md +1 -1
  46. package/.docs/reference/processors/processor-interface.md +1 -1
  47. package/.docs/reference/processors/provider-history-compat.md +13 -13
  48. package/.docs/reference/processors/stream-error-retry-processor.md +9 -5
  49. package/.docs/reference/schedules/overview.md +16 -0
  50. package/.docs/reference/storage/overview.md +26 -9
  51. package/.docs/reference/streaming/ChunkType.md +18 -0
  52. package/.docs/reference/streaming/agents/streamLegacy.md +1 -1
  53. package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
  54. package/.docs/reference/tools/document-chunker-tool.md +1 -1
  55. package/.docs/reference/vectors/astra.md +2 -0
  56. package/.docs/reference/vectors/azure-ai-search.md +1 -1
  57. package/.docs/reference/vectors/convex.md +1 -1
  58. package/.docs/reference/vectors/couchbase.md +12 -5
  59. package/.docs/reference/vectors/duckdb.md +5 -5
  60. package/.docs/reference/vectors/mongodb.md +5 -5
  61. package/.docs/reference/vectors/pinecone.md +1 -1
  62. package/.docs/reference/vectors/qdrant.md +1 -1
  63. package/.docs/reference/vectors/s3vectors.md +3 -0
  64. package/.docs/reference/vectors/upstash.md +8 -4
  65. package/.docs/reference/vectors/vectorize.md +4 -2
  66. package/.docs/reference/vectors/weaviate.md +1 -1
  67. package/.docs/reference/voice/voice.send.md +1 -1
  68. package/.docs/reference/workflows/run-methods/restart.md +1 -1
  69. package/.docs/reference/workflows/run-methods/resume.md +1 -1
  70. package/.docs/reference/workflows/run-methods/start.md +1 -1
  71. package/.docs/reference/workflows/run.md +2 -2
  72. package/.docs/reference/workflows/workflow-methods/dountil.md +1 -1
  73. package/.docs/reference/workspace/local-sandbox.md +3 -3
  74. package/.docs/reference/workspace/platform-sandbox.md +4 -2
  75. package/.docs/reference/workspace/workspace-class.md +11 -11
  76. package/package.json +5 -5
@@ -62,7 +62,7 @@ const { controller } = await mountAgentControllerOnMastra({ mastra })
62
62
 
63
63
  **modes** (`AgentControllerMode[]`): Override agent modes (model ids, colors, which modes exist). (Default: `build/plan/fast`)
64
64
 
65
- **subagents** (`AgentControllerSubagent[]`): Override or extend subagent definitions. (Default: `explore/plan/execute`)
65
+ **subagents** (`AgentControllerSubagent[]`): Subagent definitions to register. None are registered by default. Pass \[...builtinSubagents] (exported from @mastra/code-sdk) to enable the explore, plan, and execute subagents. (Default: `[]`)
66
66
 
67
67
  **extraTools** (`Record<string, ToolAction> | (ctx) => Record<string, ToolAction>`): Extra tools merged into the dynamic tool set.
68
68
 
@@ -198,6 +198,11 @@ Examples:
198
198
 
199
199
  - Gateway with `id = 'custom'`: `'custom/my-provider/model-1'`
200
200
 
201
+ Two-part IDs are also accepted:
202
+
203
+ - `[gateway-id]/[model]`: for gateways whose provider ID is the same as the gateway ID, such as `amazon-bedrock`. The provider ID resolves to the gateway ID, so `'custom/model-1'` resolves to provider `custom` and model `model-1`. The model segment can't be empty.
204
+ - `azure-openai/[deployment]`: Azure OpenAI uses the deployment name in place of a provider and model.
205
+
201
206
  ## Built-in implementations
202
207
 
203
208
  - **NetlifyGateway** - Netlify AI Gateway integration
@@ -39,14 +39,16 @@ Token metrics are emitted from `MODEL_GENERATION` and `CLASSIFIER_EVALUATION` sp
39
39
 
40
40
  ### Input token metrics
41
41
 
42
- | Metric name | Description |
43
- | --------------------------------------- | ---------------------------------------------- |
44
- | `mastra_model_total_input_tokens` | Total input tokens |
45
- | `mastra_model_input_text_tokens` | Text tokens in the input prompt |
46
- | `mastra_model_input_cache_read_tokens` | Tokens read from prompt cache (e.g. Anthropic) |
47
- | `mastra_model_input_cache_write_tokens` | Tokens written to prompt cache |
48
- | `mastra_model_input_audio_tokens` | Audio tokens in the input (multimodal models) |
49
- | `mastra_model_input_image_tokens` | Image tokens in the input (vision models) |
42
+ | Metric name | Description |
43
+ | ------------------------------------------ | ------------------------------------------------------------------- |
44
+ | `mastra_model_total_input_tokens` | Total input tokens |
45
+ | `mastra_model_input_text_tokens` | Text tokens in the input prompt |
46
+ | `mastra_model_input_cache_read_tokens` | Tokens read from prompt cache (e.g. Anthropic) |
47
+ | `mastra_model_input_cache_write_tokens` | Tokens written to prompt cache |
48
+ | `mastra_model_input_cache_write_5m_tokens` | Tokens written to prompt cache with a 5-minute TTL (e.g. Anthropic) |
49
+ | `mastra_model_input_cache_write_1h_tokens` | Tokens written to prompt cache with a 1-hour TTL (e.g. Anthropic) |
50
+ | `mastra_model_input_audio_tokens` | Audio tokens in the input (multimodal models) |
51
+ | `mastra_model_input_image_tokens` | Image tokens in the input (vision models) |
50
52
 
51
53
  ### Output token metrics
52
54
 
@@ -10,6 +10,10 @@ Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform
10
10
 
11
11
  > **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it's deprecated and will be removed in a future major version. New code should use `MastraPlatformExporter`.
12
12
 
13
+ ## Span previews
14
+
15
+ `MastraPlatformExporter` automatically generates short, readable `inputPreview`, `outputPreview`, and `errorPreview` summaries based on the span type. Each preview contains up to 100 characters plus an ellipsis when truncated. Full payloads remain available separately.
16
+
13
17
  ## Constructor
14
18
 
15
19
  ```typescript
@@ -8,6 +8,10 @@ Persists traces to Mastra's configured storage with automatic batching and retry
8
8
 
9
9
  > **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it's deprecated and will be removed in a future major version. New code should use `MastraStorageExporter`.
10
10
 
11
+ ## Span previews
12
+
13
+ `MastraStorageExporter` automatically generates short, readable `inputPreview`, `outputPreview`, and `errorPreview` summaries based on the span type. Each preview contains up to 100 characters plus an ellipsis when truncated. Full payloads remain available separately.
14
+
11
15
  ## Constructor
12
16
 
13
17
  ```typescript
@@ -362,7 +362,7 @@ Structured event emitted when the exporter pipeline drops observability events.
362
362
  ```typescript
363
363
  type ObservabilityDropSignal = 'tracing' | 'log' | 'metric' | 'score' | 'feedback'
364
364
 
365
- type ObservabilityDropReason = 'unsupported-storage' | 'retry-exhausted'
365
+ type ObservabilityDropReason = 'unsupported-storage' | 'retry-exhausted' | 'span-not-updatable'
366
366
 
367
367
  interface ObservabilityDropEvent {
368
368
  type: 'drop'
@@ -543,6 +543,16 @@ interface AgentRunAttributes {
543
543
  /** Maximum steps allowed */
544
544
  maxSteps?: number
545
545
 
546
+ /**
547
+ * Model the run was configured with, resolved at run preparation (call-time
548
+ * override, then agent config). The first enabled candidate of a fallback list.
549
+ * Never updated by later steps; see MODEL_STEP `model` for what each step ran.
550
+ */
551
+ model?: string
552
+
553
+ /** Provider of `model`, taken from the same model object */
554
+ provider?: string
555
+
546
556
  /** When the run's model streamed its first chunk, copied from the agent's own first generation */
547
557
  completionStartTime?: Date
548
558
  }
@@ -631,6 +641,16 @@ interface ModelStepAttributes {
631
641
  /** Index of this step in the generation (0, 1, 2, ...) */
632
642
  stepIndex?: number
633
643
 
644
+ /**
645
+ * Model actually invoked for this step, after per-step overrides (input
646
+ * processors, fallback). Recorded at invocation, so a failed provider call
647
+ * still carries it. Absent when no model was invoked, e.g. a cached response.
648
+ */
649
+ model?: string
650
+
651
+ /** Provider of `model`, taken from the same model object */
652
+ provider?: string
653
+
634
654
  /** Token usage statistics */
635
655
  usage?: UsageStats
636
656
 
@@ -72,7 +72,7 @@ inputProcessors: [
72
72
 
73
73
  **options.lastMessageOnly** (`boolean`): When true, only the last message is classified in the input and output phases.
74
74
 
75
- **options.chunkWindow** (`number`): Non-negative integer number of trailing stream chunks to classify together, including the current text-delta chunk. A value of 0 classifies only the current chunk. Each text chunk triggers a classifier call, so larger windows increase cost.
75
+ **options.chunkWindow** (`number`): Non-negative integer number of trailing stream chunks to classify together, including the current text-delta chunk. A value of 0 classifies only the current chunk. Each text chunk triggers a classifier call unless the windowed text is whitespace-only, so larger windows increase cost.
76
76
 
77
77
  **options.maxInputLength** (`number`): Non-negative integer maximum number of characters sent to the classifier. Longer text is truncated.
78
78
 
@@ -1212,7 +1212,7 @@ await agent.stream('Summarize this', {
1212
1212
  })
1213
1213
  ```
1214
1214
 
1215
- `maxProcessorRetries` passed on the call overrides the agent default. If neither is set, processor-requested retries are treated as aborts.
1215
+ `maxProcessorRetries` passed on the call overrides the agent default. If neither is set, retries requested by input and output processors are treated as aborts, while error processors (such as [`StreamErrorRetryProcessor`](https://mastra.ai/reference/processors/stream-error-retry-processor)) are capped at 3 retries.
1216
1216
 
1217
1217
  ## Related
1218
1218
 
@@ -54,19 +54,19 @@ Registering in `errorProcessors` alone, as the example above does, covers both h
54
54
 
55
55
  `ProviderHistoryCompat` includes these built-in compatibility rules:
56
56
 
57
- | Rule | Provider | Timing | Behavior |
58
- | ------------------------------------------------ | ---------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
59
- | `strip-foreign-provider-executed-tools` | Anthropic, OpenAI, Azure OpenAI, Google/Vertex | Preemptive prompt rewrite | Removes provider-executed tool calls and their paired results from the outbound prompt when they came from a different provider family, since the receiving provider can't resolve another provider's tool IDs. Persisted history is left untouched. |
60
- | `anthropic-tool-id-format` | Anthropic | Preemptive prompt rewrite | Rewrites tool call IDs that contain characters outside `[a-zA-Z0-9_-]` in the outbound prompt, on both the call and its result. A sanitized ID that would collide with one already in the prompt gets a `_2`, `_3`, … suffix. The provider's rejection never fires, and persisted history keeps the original IDs. A reactive fallback covers providers the preemptive check doesn't recognize, such as Vertex-hosted Claude. |
61
- | `cerebras-strip-reasoning-content` | Cerebras | Preemptive prompt rewrite | Removes assistant `reasoning` parts from the outbound prompt so they're not serialized as unsupported `reasoning_content` fields. |
62
- | `anthropic-strip-empty-signed-reasoning-content` | Anthropic | Preemptive prompt rewrite | Removes assistant `reasoning` parts that carry an Anthropic signature but have empty text, which legacy records can contain. Anthropic signs the exact thinking text, so the mismatched pair would be rejected. |
63
- | `anthropic-strip-foreign-reasoning-content` | Anthropic | Preemptive prompt rewrite | Removes non-Anthropic assistant `reasoning` parts from the outbound prompt. Anthropic-native thinking history is preserved. |
64
- | `anthropic-strip-foreign-signed-reasoning` | Anthropic-compatible | Preemptive prompt rewrite | Drops signed thinking from the outbound prompt when its origin turn was stamped with a different provider (for example Kimi For Coding ↔ `anthropic/claude-sonnet-5-5`), since the receiving provider can't verify another provider's signature. Turns emptied of all content by the drop are removed from the prompt. Unstamped history is left untouched. |
65
- | `azure-system-reminder-transform` | Azure OpenAI | Preemptive prompt rewrite | Renames `<system-reminder>` wrappers in user text and system instructions to `<memory-context>` for the outbound request. Stored history remains unchanged. |
66
- | `openai-orphan-item-id` | OpenAI, Azure OpenAI (Responses) | Reactive API error recovery | Recovers history that OpenAI rejects with `Item 'msg_…' of type 'message' was provided without its required 'reasoning' item`. Drops the Responses `itemId` from every item-bearing part of an assistant message that carries one but has no `reasoning` part, and retries. The message then replays by value instead of as an unsatisfiable `item_reference`. The repair is applied to the in-memory list for the current turn. |
67
- | `anthropic-orphaned-thinking-step` | Anthropic | Reactive API error recovery | Recovers history that Anthropic rejects because `thinking` or `redacted_thinking` blocks in the latest assistant message can't be modified. Removes steps that contain only reasoning when more assistant content follows them, and retries. Covers history saved by older `@mastra/memory` releases ([#22798](https://github.com/mastra-ai/mastra/issues/22798)). |
68
- | `tool-call-empty-input` | All providers | Preemptive prompt rewrite | Sends an assistant tool call whose stored input is missing (`undefined` or `null`) as `{}` in the outbound prompt, because providers reject a tool call without input (Anthropic: `tool_use.input: Field required`). A call whose arguments couldn't be parsed is stored this way. The call keeps its paired error result, and persisted history is left untouched. An empty-string input is a real stored value and is sent as is. |
69
- | `ensure-user-first-turn` | Amazon Bedrock, Google/Vertex Gemini | Preemptive prompt rewrite | Inserts a minimal user turn (`.`) before a leading assistant turn, because these providers reject conversations whose first non-system turn is the assistant's. This happens when an agent greets first or `lastMessages` cuts into a thread. Runs last, so it sees the prompt after other rules have dropped emptied turns. |
57
+ | Rule | Provider | Timing | Behavior |
58
+ | ------------------------------------------------ | ---------------------------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
59
+ | `strip-foreign-provider-executed-tools` | Anthropic, OpenAI, Azure OpenAI, Google/Vertex | Preemptive prompt rewrite | Removes provider-executed tool calls and their paired results from the outbound prompt when they came from a different provider family, since the receiving provider can't resolve another provider's tool IDs. Persisted history is left untouched. |
60
+ | `anthropic-tool-id-format` | Anthropic | Preemptive prompt rewrite | Rewrites tool call IDs that contain characters outside `[a-zA-Z0-9_-]` in the outbound prompt, on both the call and its result. A sanitized ID that would collide with one already in the prompt gets a `_2`, `_3`, … suffix. The provider's rejection never fires, and persisted history keeps the original IDs. A reactive fallback covers providers the preemptive check doesn't recognize, such as Vertex-hosted Claude. |
61
+ | `cerebras-strip-reasoning-content` | Cerebras | Preemptive prompt rewrite | Removes assistant `reasoning` parts from the outbound prompt so they're not serialized as unsupported `reasoning_content` fields. |
62
+ | `anthropic-strip-empty-signed-reasoning-content` | Anthropic | Reactive (matches Anthropic's 400 rejecting modified thinking blocks) | Removes assistant `reasoning` parts that carry an Anthropic signature but have empty text, which legacy records can contain, from earlier messages. Runs only after Anthropic rejects the history, because Claude 5.x returns empty-text signed blocks as normal output and they must be replayed unchanged to keep prompt caching. |
63
+ | `anthropic-strip-foreign-reasoning-content` | Anthropic | Preemptive prompt rewrite | Removes non-Anthropic assistant `reasoning` parts from the outbound prompt. Anthropic-native thinking history is preserved. |
64
+ | `anthropic-strip-foreign-signed-reasoning` | Anthropic-compatible | Preemptive prompt rewrite | Drops signed thinking from the outbound prompt when its origin turn was stamped with a different provider (for example Kimi For Coding ↔ `anthropic/claude-sonnet-5-5`), since the receiving provider can't verify another provider's signature. Turns emptied of all content by the drop are removed from the prompt. Unstamped history is left untouched. |
65
+ | `azure-system-reminder-transform` | Azure OpenAI | Preemptive prompt rewrite | Renames `<system-reminder>` wrappers in user text and system instructions to `<memory-context>` for the outbound request. Stored history remains unchanged. |
66
+ | `openai-orphan-item-id` | OpenAI, Azure OpenAI (Responses) | Reactive API error recovery | Recovers history that OpenAI rejects with `Item 'msg_…' of type 'message' was provided without its required 'reasoning' item`. Drops the Responses `itemId` from every item-bearing part of an assistant message that carries one but has no `reasoning` part, and retries. The message then replays by value instead of as an unsatisfiable `item_reference`. The repair is applied to the in-memory list for the current turn. |
67
+ | `anthropic-orphaned-thinking-step` | Anthropic | Reactive API error recovery | Recovers history that Anthropic rejects because `thinking` or `redacted_thinking` blocks in the latest assistant message can't be modified. Removes steps that contain only reasoning when more assistant content follows them, and retries. Covers history saved by older `@mastra/memory` releases ([#22798](https://github.com/mastra-ai/mastra/issues/22798)). |
68
+ | `tool-call-empty-input` | All providers | Preemptive prompt rewrite | Sends an assistant tool call whose stored input is missing (`undefined` or `null`) as `{}` in the outbound prompt, because providers reject a tool call without input (Anthropic: `tool_use.input: Field required`). A call whose arguments couldn't be parsed is stored this way. The call keeps its paired error result, and persisted history is left untouched. An empty-string input is a real stored value and is sent as is. |
69
+ | `ensure-user-first-turn` | Amazon Bedrock, Google/Vertex Gemini | Preemptive prompt rewrite | Inserts a minimal user turn (`.`) before a leading assistant turn, because these providers reject conversations whose first non-system turn is the assistant's. This happens when an agent greets first or `lastMessages` cuts into a thread. Runs last, so it sees the prompt after other rules have dropped emptied turns. |
70
70
 
71
71
  Preemptive rules run through `processLLMRequest` after Mastra converts messages to the model prompt format and before the prompt is sent to the provider. These rewrites affect only the current provider call. Persisted history is never changed, so the IDs and content in memory and in the Studio stay exactly as written.
72
72
 
@@ -32,14 +32,18 @@ To run only the processors you configure, with none of the defaults merged in, s
32
32
 
33
33
  ## How it works
34
34
 
35
- The processor checks the error and its cause chain for:
35
+ The processor checks the error and its cause chain, in this order, for:
36
36
 
37
- - Provider retry metadata: `isRetryable === true`
38
- - Built-in OpenAI Responses stream error matching
39
37
  - Matcher results: Any configured matcher that returns `true`
38
+ - Built-in OpenAI Responses stream error matching
39
+ - Provider retry metadata: `isRetryable === true`
40
+
41
+ The first match decides the retry policy, so a configured matcher's `maxRetries`, `delayMs` and `onRetry` apply even when the built-in matcher would also match.
40
42
 
41
43
  When the error is retryable, the processor returns `{ retry: true }`. It doesn't mutate messages.
42
44
 
45
+ Unless one of your own matchers matches it, the processor never retries a credential or quota refusal, even when provider metadata marks it retryable. The AI SDK marks every `429` retryable, including an exhausted quota.
46
+
43
47
  When `delayMs` is set, the processor waits before signaling a retry. This is useful for transient network errors like `ECONNRESET` where immediately retrying is likely to fail again. The delay can be a fixed number of milliseconds or a function evaluated with the error args (for example, to implement exponential backoff).
44
48
 
45
49
  ### Retry limits
@@ -56,7 +60,7 @@ For retryable errors with a `Retry-After` response header, the processor reads c
56
60
 
57
61
  ## Retry unknown errors
58
62
 
59
- Set `retryUnknownErrors` to retry errors that don't match provider metadata or the built-in OpenAI matcher, including a custom matcher. Unknown-error retries use the processor-level `maxRetries` and `delayMs` values. Known authorization failures, including HTTP `401` and `403` responses, aren't retried:
63
+ Set `retryUnknownErrors` to retry errors that don't match provider metadata or the built-in OpenAI matcher, including a custom matcher. Unknown-error retries use the processor-level `maxRetries` and `delayMs` values. Known credential and quota refusals, including HTTP `401` and `403` responses, aren't retried:
60
64
 
61
65
  ```typescript
62
66
  import { Agent } from '@mastra/core/agent'
@@ -112,7 +116,7 @@ export const agent = new Agent({
112
116
 
113
117
  ## Default OpenAI Responses matcher
114
118
 
115
- `isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It retries known transient OpenAI error codes. As a fallback, it retries errors with explicit retry guidance such as `You can retry your request`.
119
+ `isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It reads each chunk with the shared provider-failure reader from `@mastra/core/error` and retries chunks that report a rate limit, a provider outage, or a timeout. As a fallback, it retries errors with explicit retry guidance such as `You can retry your request`. It never retries a credential or quota refusal.
116
120
 
117
121
  `StreamErrorRetryProcessor` includes this matcher by default. You can also import it and reuse it in custom retry logic.
118
122
 
@@ -10,6 +10,22 @@
10
10
 
11
11
  For usage patterns and concepts, see [Schedules](https://mastra.ai/docs/harness/schedules).
12
12
 
13
+ ## Delivery guarantees
14
+
15
+ Scheduled publication is best-effort, not at-least-once delivery. The scheduler atomically claims an occurrence and advances `nextFireAt` before publishing the agent or workflow start event. An exhausted cron schedule is marked `completed` in that claim. Completion means there are no remaining occurrences, not that the target started or succeeded.
16
+
17
+ The scheduler makes up to three publication attempts for the same claimed occurrence, waiting 100 ms and then 200 ms between attempts. A transport can accept an event before returning an error, so retries can publish duplicates with the same run ID.
18
+
19
+ After all three attempts fail, the scheduler logs the schedule ID, run ID, scheduled fire time, `publicationOutcome: 'unknown'`, and `automaticReplay: false`. It invokes the configured `scheduler.onError` hook and attempts to record a trigger with outcome `failed`. This failure describes the publication attempts. It doesn't prove that the target never started.
20
+
21
+ Once those attempts are exhausted, the scheduler doesn't replay the occurrence. Recurring schedules remain active and can fire at their next scheduled time. Terminal schedules remain completed with any recorded failure details in trigger history.
22
+
23
+ After a successful claim, an info-level `Claimed schedule occurrence` log identifies the schedule ID, run ID, and scheduled fire time. A matching `Published schedule occurrence` log reports transport acceptance. If neither that success log nor the final failure log follows a claim, publication is unconfirmed. These logs aren't durable state: a crash between the claim commit and logging, or before logs are flushed, can leave no log record.
24
+
25
+ If a publisher process dies after the claim commits, or confirmation is lost, that occurrence may be skipped without a failed trigger. A replacement scheduler can't distinguish an unpublished event from one accepted before the crash using claim metadata or missing trigger history. It doesn't replay the occurrence or block later recurring fires. A publication acknowledgement also doesn't guarantee target execution, and transport redelivery can produce duplicates.
26
+
27
+ Before manually rerunning missed work, check target execution and transport records independently. Missing trigger history or a failed publication attempt alone isn't evidence that rerunning is safe.
28
+
13
29
  ## Usage example
14
30
 
15
31
  Create an agent schedule:
@@ -12,15 +12,32 @@ Mastra storage is organized into domains. Each domain owns a set of tables or co
12
12
 
13
13
  Not every storage adapter implements every domain. Composite storage lets you mix adapters per domain when the adapter packages export the corresponding domain classes.
14
14
 
15
- | Domain | Description |
16
- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
17
- | `memory` | Conversation persistence: messages, threads, and resources (including working memory). |
18
- | `workflows` | Workflow run snapshots used for suspend and resume. |
19
- | `workflowDefinitions` | Persisted [dynamic workflow](https://mastra.ai/docs/workflows/dynamic-workflows) definitions (beta). Loaded and live-registered on boot. |
20
- | `scores` | Evaluation score records from eval runs. |
21
- | `observability` | Traces and spans used by observability exporters and Studio. |
22
- | `datasets` | Dataset records, versioned items, and dataset versions used by experiments. |
23
- | `experiments` | Experiment runs and per-item experiment results. |
15
+ | Domain | Description |
16
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | `memory` | Conversation persistence: messages, threads, and resources (including working memory). |
18
+ | `workflows` | Workflow run snapshots used for suspend and resume. |
19
+ | `workflowDefinitions` | Persisted [dynamic workflow](https://mastra.ai/docs/workflows/dynamic-workflows) definitions (beta). Loaded and live-registered on boot. |
20
+ | `scores` | Evaluation score records from eval runs. |
21
+ | `observability` | Traces and spans used by observability exporters and Studio. |
22
+ | `datasets` | Dataset records, versioned items, and dataset versions used by experiments. |
23
+ | `experiments` | Experiment runs and per-item experiment results. |
24
+ | `agents` | Stored agent definitions and their versions, used by the Mastra Editor. |
25
+ | `promptBlocks` | Stored prompt blocks and their versions, used by the Mastra Editor. |
26
+ | `scorerDefinitions` | Stored scorer definitions, used by the Mastra Editor. |
27
+ | `mcpClients` | Stored MCP client configurations, used by the Mastra Editor. |
28
+ | `mcpServers` | Stored MCP server configurations, used by the Mastra Editor. |
29
+ | `workspaces` | Stored workspace configurations, used by the Mastra Editor. |
30
+ | `skills` | Stored skills and their versions, used by the Mastra Editor. |
31
+ | `favorites` | Per-user favorites on stored entities. |
32
+ | `blobs` | Content-addressable blobs keyed by SHA-256 hash. Stores file contents for skill versioning. |
33
+ | `backgroundTasks` | Background task state: creation, status updates, and cleanup. |
34
+ | `schedules` | Schedules polled by the scheduler to trigger workflow and agent runs. |
35
+ | `channels` | Channel installations and configuration for multi-platform integrations. |
36
+ | `harness` | Harness session records. |
37
+ | `toolProviderConnections` | User-assigned names for tool provider connections. |
38
+ | `notifications` | Notification records. |
39
+ | `threadState` | Durable per-thread state, such as task lists and goals. |
40
+ | `knowledge` | Knowledge graph nodes and records (experimental). |
24
41
 
25
42
  The schema definitions below cover the built-in database-backed tables documented for `memory`, `workflows`, `scores`, and `observability`. Other domains, and non-database adapters, use implementation-specific storage structures.
26
43
 
@@ -764,8 +764,26 @@ The stored history of a thread, emitted at the start of a thread subscription.
764
764
 
765
765
  **payload.hasMore** (`boolean`): Whether older messages exist beyond this page.
766
766
 
767
+ **payload.activeRunId** (`string | null`): Run holding thread ownership during hydration, or null when idle. Use thread-run-status for the outcome.
768
+
767
769
  For queue-count events on the same thread, see the [Thread events reference](https://mastra.ai/reference/signals/thread-events).
768
770
 
771
+ ### thread-run-status
772
+
773
+ `ThreadRunStatusChunk` reports a run's outcome independently of stored-message replay. It's exported from `@mastra/core/stream` and emitted only when `subscribeToThread()` receives `withRunStatus: true`. The option defaults to `false`.
774
+
775
+ Live output precedes its status. `success`, `failed`, and `aborted` are final outcomes. `suspended` is resumable, so the same run can later emit more output and a final outcome. A status doesn't close the subscription.
776
+
777
+ **type** (`"thread-run-status"`): Chunk type identifier.
778
+
779
+ **runId** (`string`): ID of the run whose outcome is reported.
780
+
781
+ **from** (`ChunkFrom`): Always AGENT for thread run outcomes.
782
+
783
+ **payload** (`{ status: "success" | "failed" | "aborted" | "suspended" }`): Run outcome. Suspended runs can resume.
784
+
785
+ With `withInitialHistory`, `thread-history` arrives first. Opted-in late subscribers then receive one outcome per still-retained finished run, including runs outside that history page. Final outcomes are deduplicated within a subscription. Suspensions are deduplicated per execution segment. Reconnecting can redeliver outcomes. Recovery depends on PubSub retention and isn't a permanent audit log. See [Thread streams](https://mastra.ai/docs/signals/thread-streams).
786
+
769
787
  ## Usage example
770
788
 
771
789
  ```typescript
@@ -54,7 +54,7 @@ await agent.streamLegacy('message for agent')
54
54
 
55
55
  **options.onFinish** (`StreamTextOnFinishCallback<any> | StreamObjectOnFinishCallback<OUTPUT>`): Callback function called when streaming completes. Receives the final result.
56
56
 
57
- **options.onStepFinish** (`StreamTextOnStepFinishCallback<any> | never`): Callback function called after each execution step. Receives step details as a JSON string. Unavailable for structured output
57
+ **options.onStepFinish** (`StreamTextOnStepFinishCallback<any> | never`): Callback function called after each execution step. Receives the step result (text, tool calls, tool results, usage, finish reason) plus the runId. Unavailable for structured output
58
58
 
59
59
  **options.resourceId** (`string`): \*\*Deprecated.\*\* Use memory.resource instead. Identifier for the user or resource interacting with the agent. Must be provided if threadId is provided.
60
60
 
@@ -60,7 +60,7 @@ if (result!.status === 'suspended') {
60
60
 
61
61
  **stream.status** (`Promise<RunStatus>`): A promise that resolves to the current workflow run status
62
62
 
63
- **stream.result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the final workflow result
63
+ **stream.result** (`Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>`): A promise that resolves to the final workflow result
64
64
 
65
65
  **stream.usage** (`Promise<{ inputTokens: number; outputTokens: number; totalTokens: number, reasoningTokens?: number, cacheInputTokens?: number }>`): A promise that resolves to token usage statistics
66
66
 
@@ -37,7 +37,7 @@ const { chunks } = await chunker.execute()
37
37
 
38
38
  ### `ChunkParams`
39
39
 
40
- **strategy** (`'recursive'`): The chunking strategy to use (Default: `'recursive'`)
40
+ **strategy** (`'character' | 'recursive' | 'token' | 'markdown' | 'html' | 'json' | 'latex' | 'sentence' | 'semantic-markdown'`): The chunking strategy to use (Default: `'recursive'`)
41
41
 
42
42
  **maxSize** (`number`): Maximum size of each chunk in tokens/characters (Default: `512`)
43
43
 
@@ -8,6 +8,8 @@ The AstraVector class provides vector search using [DataStax Astra DB](https://w
8
8
 
9
9
  ## Constructor options
10
10
 
11
+ **id** (`string`): Unique identifier for this vector store instance
12
+
11
13
  **token** (`string`): Astra DB API token
12
14
 
13
15
  **endpoint** (`string`): Astra DB API endpoint
@@ -16,7 +16,7 @@ The `AzureAISearchVector` class provides vector search using [Azure AI Search](h
16
16
 
17
17
  **apiVersion** (`string`): Azure AI Search REST API version to use. Defaults to the SDK default.
18
18
 
19
- **clientOptions** (`SearchClientOptions`): Additional options passed to the underlying SearchClient/SearchIndexClient, such as additionalPolicies for proxies, custom headers, or retry behavior.
19
+ **clientOptions** (`Omit<SearchClientOptions, 'apiVersion'>`): Additional options passed to the underlying SearchClient/SearchIndexClient, such as additionalPolicies for proxies, custom headers, or retry behavior.
20
20
 
21
21
  **autoIndexMetadata** (`boolean`): Add a filterable field to the index the first time a top-level string, number, or boolean metadata key is seen in upsert() or updateVector(). Azure AI Search can only filter on declared fields, so this is required for Memory semantic recall (which filters by thread_id and resource_id) unless you declare those keys via metadataIndexes. Set to false to manage the schema yourself. (Default: `true`)
22
22
 
@@ -346,7 +346,7 @@ Query results are returned in this format:
346
346
  interface QueryResult {
347
347
  id: string
348
348
  score: number
349
- metadata: Record<string, any>
349
+ metadata?: Record<string, any>
350
350
  vector?: number[] // Only included if includeVector is true
351
351
  }
352
352
  ```
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Couchbase vector store
6
6
 
7
- The `CouchbaseVector` class provides vector search using [Couchbase Vector Search](https://docs.couchbase.com/server/current/vector-search/vector-search.html). It enables efficient similarity search and metadata filtering within your Couchbase collections.
7
+ The `CouchbaseVector` class provides vector search using [Couchbase Vector Search](https://docs.couchbase.com/server/current/vector-search/vector-search.html). It enables efficient similarity search within your Couchbase collections.
8
8
 
9
9
  ## Requirements
10
10
 
@@ -137,7 +137,7 @@ Deletes the Search index. Documents stored in the collection aren't deleted.
137
137
 
138
138
  ### `listIndexes()`
139
139
 
140
- Lists all vector indexes in the Couchbase bucket.
140
+ Lists the names of all Search indexes in the configured scope.
141
141
 
142
142
  Returns: `Promise<string[]>`
143
143
 
@@ -161,11 +161,17 @@ Deletes a single vector by its ID from the index.
161
161
 
162
162
  ### `deleteVectors()`
163
163
 
164
- Deletes multiple vectors by their IDs. Filter-based deletion isn't yet implemented for Couchbase.
164
+ Deletes vectors by ID from the configured Couchbase collection. Pass a non-empty `ids` array to remove multiple documents. Missing IDs are ignored. Filter-based deletion isn't supported and throws a `MastraError`. Providing an empty `ids` array, both `ids` and `filter`, or neither, also throws.
165
+
166
+ ```typescript
167
+ await store.deleteVectors({ indexName: 'my_index', ids: ['vec_1', 'vec_2'] })
168
+ ```
165
169
 
166
170
  **indexName** (`string`): Name of the index containing the vectors to delete
167
171
 
168
- **ids** (`string[]`): Array of vector IDs to delete
172
+ **ids** (`string[]`): IDs of the vectors to delete (required for Couchbase)
173
+
174
+ **filter** (`VectorFilter`): Not supported for Couchbase. Passing a filter throws an error
169
175
 
170
176
  ### `disconnect()`
171
177
 
@@ -217,7 +223,8 @@ try {
217
223
  ## Limitations
218
224
 
219
225
  - Index creation delays may impact immediate querying after creation.
220
- - No hard enforcement of vector dimension at ingest time (dimension mismatches will error at query time).
226
+ - Vector dimension is enforced at ingest only after `createIndex()` creates a new index on the same `CouchbaseVector` instance. Calling `createIndex()` for an index that already exists doesn't turn on the ingest check. When the check is on, `upsert()` and `updateVector()` throw on a dimension mismatch. `query()` always checks the query vector against the index dimension.
227
+ - `deleteVectors()` supports deletion by ID only. Metadata-filter deletion isn't supported.
221
228
  - Vector insertion and index updates are eventually consistent. Strong consistency isn't guaranteed immediately after writes.
222
229
 
223
230
  ## Related
@@ -245,11 +245,11 @@ const results = await store.query({
245
245
 
246
246
  ## Distance metrics
247
247
 
248
- | Metric | Description | Score Interpretation | Best For |
249
- | ------------ | ----------------- | ---------------------- | ----------------------------------- |
250
- | `cosine` | Cosine similarity | 0-1 (1 = most similar) | Text embeddings, normalized vectors |
251
- | `euclidean` | L2 distance | 0-∞ (0 = most similar) | Image embeddings, spatial data |
252
- | `dotproduct` | Inner product | Higher = more similar | When vector magnitude matters |
248
+ | Metric | Description | Score Interpretation | Best For |
249
+ | ------------ | ----------------- | ------------------------------------------------------------- | ----------------------------------- |
250
+ | `cosine` | Cosine similarity | -1 to 1, computed as `1 - cosine distance` (1 = most similar) | Text embeddings, normalized vectors |
251
+ | `euclidean` | L2 distance | 0-1, computed as `1 / (1 + distance)` (1 = most similar) | Image embeddings, spatial data |
252
+ | `dotproduct` | Inner product | Higher = more similar | When vector magnitude matters |
253
253
 
254
254
  ## Error handling
255
255
 
@@ -178,7 +178,7 @@ await store.createSearchIndex({
178
178
  })
179
179
  ```
180
180
 
181
- The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes. Recreating the _same_ logical index with different `fields` still requires dropping the existing index first (`IndexAlreadyExists`).
181
+ The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes. Calling `createSearchIndex()` again for the _same_ logical index with different `fields` updates the existing text index definition in place. You don't need to drop it first.
182
182
 
183
183
  ### `waitForSearchIndexReady()`
184
184
 
@@ -279,18 +279,18 @@ Returns:
279
279
  interface IndexStats {
280
280
  dimension: number
281
281
  count: number
282
- metric: 'cosine' | 'euclidean' | 'dotproduct'
282
+ metric?: 'cosine' | 'euclidean' | 'dotproduct'
283
283
  }
284
284
  ```
285
285
 
286
- On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
286
+ On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `metric` is omitted when the `autoEmbed` index doesn't specify a similarity. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
287
287
 
288
288
  ### `deleteIndex()`
289
289
 
290
290
  Deletes a vector index. Behavior depends on how the index was created:
291
291
 
292
292
  - **Managed index** (created without `collectionName`): drops the entire collection and all its data.
293
- - **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
293
+ - **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. A vectorSearch or full-text index that another logical index on the same collection still references is kept for that index. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
294
294
 
295
295
  The BYO classification is recorded durably when the index is created, so it's applied correctly even by a different process (e.g. an index created by a setup job and later deleted by a long-lived service). Always pass the **logical index name** (the `indexName` used at `createIndex`), not the physical collection name.
296
296
 
@@ -350,7 +350,7 @@ Query results are returned in this format:
350
350
  interface QueryResult {
351
351
  id: string
352
352
  score: number
353
- metadata: Record<string, any>
353
+ metadata?: Record<string, any>
354
354
  vector?: number[] // Only included if includeVector is true
355
355
  document?: string // Source text stored with the vector, when available
356
356
  }
@@ -78,7 +78,7 @@ Returns:
78
78
  interface IndexStats {
79
79
  dimension: number
80
80
  count: number
81
- metric: 'cosine' | 'euclidean' | 'dotproduct'
81
+ metric?: 'cosine' | 'euclidean' | 'dotproduct'
82
82
  }
83
83
  ```
84
84
 
@@ -113,7 +113,7 @@ Returns:
113
113
  interface IndexStats {
114
114
  dimension: number
115
115
  count: number
116
- metric: 'cosine' | 'euclidean' | 'dotproduct'
116
+ metric?: 'cosine' | 'euclidean' | 'dotproduct'
117
117
  }
118
118
  ```
119
119
 
@@ -40,6 +40,7 @@ bun add @mastra/s3vectors@latest
40
40
  import { S3Vectors } from '@mastra/s3vectors'
41
41
 
42
42
  const store = new S3Vectors({
43
+ id: 's3-vectors',
43
44
  vectorBucketName: process.env.S3_VECTORS_BUCKET_NAME!, // e.g. "my-vector-bucket"
44
45
  clientConfig: {
45
46
  region: process.env.AWS_REGION!, // credentials use the default AWS provider chain
@@ -88,6 +89,8 @@ await store.disconnect()
88
89
 
89
90
  ## Constructor options
90
91
 
92
+ **id** (`string`): Unique identifier for this vector store instance
93
+
91
94
  **vectorBucketName** (`string`): Target S3 Vectors vector bucket name.
92
95
 
93
96
  **clientConfig** (`S3VectorsClientConfig`): AWS SDK v3 client options (e.g., region, credentials).
@@ -18,13 +18,13 @@ The UpstashVector class provides vector search using [Upstash Vector](https://up
18
18
 
19
19
  ### `createIndex()`
20
20
 
21
- Note: This method is a no-op for Upstash as indexes are created automatically.
21
+ Note: This method is a no-op for Upstash. Indexes (Upstash namespaces) are created automatically on first write, and the parameters below are ignored.
22
22
 
23
23
  **indexName** (`string`): Name of the index to create
24
24
 
25
25
  **dimension** (`number`): Vector dimension (must match your embedding model)
26
26
 
27
- **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
27
+ **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Ignored. The metric is set on the Upstash index itself.
28
28
 
29
29
  ### `upsert()`
30
30
 
@@ -70,7 +70,7 @@ Returns:
70
70
  interface IndexStats {
71
71
  dimension: number
72
72
  count: number
73
- metric: 'cosine' | 'euclidean' | 'dotproduct'
73
+ metric?: 'cosine' | 'euclidean' | 'dotproduct'
74
74
  }
75
75
  ```
76
76
 
@@ -82,10 +82,14 @@ interface IndexStats {
82
82
 
83
83
  **indexName** (`string`): Name of the index to update
84
84
 
85
- **id** (`string`): ID of the item to update
85
+ **id** (`string`): ID of the item to update. Mutually exclusive with filter.
86
+
87
+ **filter** (`Record<string, any>`): Metadata filter matching up to 1,000 items to update. Mutually exclusive with id. Must not be empty.
86
88
 
87
89
  **update** (`object`): Update object containing vector, sparse vector, and/or metadata
88
90
 
91
+ Provide exactly one of `id` or `filter`.
92
+
89
93
  The `update` object can have the following properties:
90
94
 
91
95
  - `vector` (optional): An array of numbers representing the new dense vector.