@mastra/mcp-docs-server 1.2.13-alpha.0 → 1.2.13-alpha.11

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 (131) hide show
  1. package/.docs/docs/agents/agent-approval.md +72 -0
  2. package/.docs/docs/agents/overview.md +1 -1
  3. package/.docs/docs/agents/supervisor-agents.md +2 -2
  4. package/.docs/docs/agents/using-tools.md +61 -33
  5. package/.docs/docs/{evals/datasets → datasets}/overview.md +3 -3
  6. package/.docs/docs/{evals/datasets → datasets}/running-experiments.md +57 -9
  7. package/.docs/docs/deployment/workers.md +14 -14
  8. package/.docs/docs/editor/overview.md +201 -206
  9. package/.docs/docs/evals/evals-with-memory.md +1 -1
  10. package/.docs/docs/getting-started/develop.md +196 -0
  11. package/.docs/docs/index.md +78 -1
  12. package/.docs/docs/long-running-agents/durable-agents.md +2 -2
  13. package/.docs/docs/mastra-platform/overview.md +1 -1
  14. package/.docs/docs/mastra-platform/workspaces.md +152 -0
  15. package/.docs/docs/memory/observational-memory.md +53 -13
  16. package/.docs/docs/memory/overview.md +14 -0
  17. package/.docs/docs/server/auth/workers.md +7 -5
  18. package/.docs/docs/server/mastra-client.md +60 -0
  19. package/.docs/docs/server/pubsub.md +2 -2
  20. package/.docs/docs/studio/observability.md +4 -0
  21. package/.docs/docs/studio/overview.md +2 -2
  22. package/.docs/docs/workflows/overview.md +1 -1
  23. package/.docs/docs/workflows/scheduled-workflows.md +1 -0
  24. package/.docs/docs/workspace/search.md +1 -1
  25. package/.docs/guides/deployment/kubernetes.md +2 -0
  26. package/.docs/guides/deployment/mastra-workers.md +350 -6
  27. package/.docs/guides/deployment/vercel.md +2 -0
  28. package/.docs/guides/getting-started/quickstart.md +3 -3
  29. package/.docs/{docs → guides}/rag/chunking-and-embedding.md +1 -1
  30. package/.docs/{docs → guides}/rag/graph-rag.md +1 -1
  31. package/.docs/{docs → guides}/rag/overview.md +2 -2
  32. package/.docs/{docs → guides}/rag/retrieval.md +1 -1
  33. package/.docs/{docs → guides}/voice/overview.md +4 -4
  34. package/.docs/{docs → guides}/voice/realtime-voice.md +2 -2
  35. package/.docs/{docs → guides}/voice/speech-to-speech.md +1 -1
  36. package/.docs/{docs → guides}/voice/speech-to-text.md +1 -1
  37. package/.docs/{docs → guides}/voice/text-to-speech.md +2 -2
  38. package/.docs/models/embeddings.md +63 -65
  39. package/.docs/models/environment-variables.md +2 -1
  40. package/.docs/models/gateways/openrouter.md +3 -6
  41. package/.docs/models/gateways/vercel.md +4 -1
  42. package/.docs/models/index.md +1 -1
  43. package/.docs/models/providers/cortecs.md +2 -1
  44. package/.docs/models/providers/crof.md +2 -1
  45. package/.docs/models/providers/crossmodel.md +4 -3
  46. package/.docs/models/providers/empiriolabs.md +2 -1
  47. package/.docs/models/providers/greenpt.md +98 -0
  48. package/.docs/models/providers/huggingface.md +3 -1
  49. package/.docs/models/providers/hyper.md +10 -7
  50. package/.docs/models/providers/llmgateway.md +5 -4
  51. package/.docs/models/providers/minimax.md +1 -1
  52. package/.docs/models/providers/neuralwatt.md +3 -1
  53. package/.docs/models/providers/openai.md +2 -2
  54. package/.docs/models/providers/opencode-go.md +2 -1
  55. package/.docs/models/providers/opencode.md +1 -1
  56. package/.docs/models/providers/perplexity-agent.md +3 -1
  57. package/.docs/models/providers/scaleway.md +1 -3
  58. package/.docs/models/providers/the-grid-ai.md +3 -3
  59. package/.docs/models/providers/zai-coding-plan.md +11 -13
  60. package/.docs/models/providers/zhipuai-coding-plan.md +12 -12
  61. package/.docs/models/providers.md +1 -0
  62. package/.docs/reference/agents/agent.md +1 -1
  63. package/.docs/reference/agents/durable-agent.md +12 -1
  64. package/.docs/reference/agents/generate.md +1 -1
  65. package/.docs/reference/agents/getVoice.md +1 -1
  66. package/.docs/{docs/getting-started → reference}/build-with-ai.md +5 -110
  67. package/.docs/reference/cli/create-mastra.md +2 -0
  68. package/.docs/reference/cli/mastra.md +36 -16
  69. package/.docs/reference/client-js/agents.md +1 -1
  70. package/.docs/reference/configuration.md +2 -2
  71. package/.docs/reference/core/getEditor.md +1 -1
  72. package/.docs/reference/core/getVector.md +2 -2
  73. package/.docs/reference/core/listVectors.md +2 -2
  74. package/.docs/reference/core/mastra-class.md +2 -2
  75. package/.docs/reference/datasets/startExperiment.md +8 -0
  76. package/.docs/reference/datasets/startExperimentAsync.md +4 -0
  77. package/.docs/reference/editor/browser-provider.md +2 -2
  78. package/.docs/reference/editor/filesystem-provider.md +1 -1
  79. package/.docs/reference/editor/mastra-editor.md +31 -18
  80. package/.docs/reference/editor/prompt-blocks.md +137 -0
  81. package/.docs/reference/editor/sandbox-provider.md +1 -1
  82. package/.docs/reference/editor/storage-browser-ref.md +3 -3
  83. package/.docs/reference/editor/storage-workspace-ref.md +3 -3
  84. package/.docs/reference/editor/tool-provider.md +44 -10
  85. package/.docs/reference/editor/tools.md +100 -0
  86. package/.docs/reference/editor/versioning.md +130 -0
  87. package/.docs/reference/evals/mastra-scorer.md +68 -8
  88. package/.docs/reference/evals/summarization.md +203 -0
  89. package/.docs/reference/file-based-agents/config.md +39 -1
  90. package/.docs/reference/index.md +4 -4
  91. package/.docs/reference/memory/observational-memory.md +76 -24
  92. package/.docs/reference/memory/serialized-memory-config.md +3 -3
  93. package/.docs/reference/observability/tracing/interfaces.md +6 -1
  94. package/.docs/reference/processors/processor-interface.md +14 -2
  95. package/.docs/reference/processors/regex-filter-processor.md +81 -9
  96. package/.docs/reference/processors/token-limiter-processor.md +15 -1
  97. package/.docs/reference/project-structure.md +1 -1
  98. package/.docs/reference/rag/database-config.md +1 -1
  99. package/.docs/reference/storage/composite.md +2 -0
  100. package/.docs/reference/streaming/agents/stream.md +1 -1
  101. package/.docs/reference/tools/isolated-vm-transport.md +1 -1
  102. package/.docs/reference/vectors/mongodb.md +13 -13
  103. package/.docs/reference/voice/livekit.md +3 -3
  104. package/.docs/reference/workers/overview.md +10 -8
  105. package/.docs/reference/workspace/platform-filesystem.md +8 -5
  106. package/.docs/reference/workspace/platform-sandbox.md +83 -7
  107. package/CHANGELOG.md +51 -0
  108. package/README.md +1 -1
  109. package/package.json +5 -5
  110. package/.docs/docs/agent-builder/access-control.md +0 -99
  111. package/.docs/docs/agent-builder/browser.md +0 -63
  112. package/.docs/docs/agent-builder/channels.md +0 -78
  113. package/.docs/docs/agent-builder/configuration.md +0 -132
  114. package/.docs/docs/agent-builder/deploying.md +0 -124
  115. package/.docs/docs/agent-builder/integrations.md +0 -115
  116. package/.docs/docs/agent-builder/memory.md +0 -69
  117. package/.docs/docs/agent-builder/model-policy.md +0 -50
  118. package/.docs/docs/agent-builder/overview.md +0 -114
  119. package/.docs/docs/agent-builder/skill-registries.md +0 -31
  120. package/.docs/docs/agent-builder/workspace.md +0 -62
  121. package/.docs/docs/editor/prompts.md +0 -140
  122. package/.docs/docs/editor/tools.md +0 -148
  123. package/.docs/docs/getting-started/file-based-agents.md +0 -121
  124. package/.docs/docs/mastra-platform/workspace.md +0 -111
  125. package/.docs/docs/what-is-mastra.md +0 -161
  126. package/.docs/reference/client-js/agent-builder.md +0 -163
  127. package/.docs/reference/editor/agent-builder/agent-builder-options.md +0 -76
  128. package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +0 -79
  129. package/.docs/reference/editor/agent-builder/builder-models.md +0 -66
  130. /package/.docs/{docs → guides}/getting-started/manual-install.md +0 -0
  131. /package/.docs/{docs → guides}/rag/vector-databases.md +0 -0
@@ -0,0 +1,203 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Summarization scorer
4
+
5
+ The `createSummarizationScorer()` function creates a scorer that evaluates a summary on two axes: whether every claim it makes is supported by the source text, and whether it preserves the information the source states. The final score is the lower of the two, so a summary can't pass by being faithful but empty, or thorough but wrong.
6
+
7
+ The summary is the agent's last message that carries text, and the source text defaults to the first user message of the run input. Pass `source` or `sourceExtractor` when the text being summarized lives somewhere else, such as a tool result.
8
+
9
+ ## Usage example
10
+
11
+ Score a summary against the document it condenses.
12
+
13
+ ```typescript
14
+ import { createSummarizationScorer } from '@mastra/evals/scorers/prebuilt'
15
+
16
+ const scorer = createSummarizationScorer({
17
+ model: 'openai/gpt-5.6-sol',
18
+ })
19
+
20
+ const result = await scorer.run({
21
+ input: {
22
+ inputMessages: [{ id: '1', role: 'user', content: sourceDocument }],
23
+ },
24
+ output: [{ id: '2', role: 'assistant', content: summary }],
25
+ })
26
+
27
+ console.log(result.score)
28
+ console.log(result.reason)
29
+ ```
30
+
31
+ ## Summarization evaluation
32
+
33
+ Use this scorer when an agent condenses text:
34
+
35
+ - Document and transcript summarization
36
+ - Support thread and email digests
37
+ - Any step that compresses a long input into a short output
38
+
39
+ ## Parameters
40
+
41
+ **model** (`MastraModelConfig`): The language model to use for judging claims and coverage questions
42
+
43
+ **options** (`SummarizationMetricOptions`): Configuration options for the scorer
44
+
45
+ **options.source** (`string`): Text the summary is judged against. Defaults to the user message of the run input
46
+
47
+ **options.sourceExtractor** (`(input, output) => string`): Function to derive the source text from the run input and output. Takes precedence over source
48
+
49
+ **options.maxQuestions** (`number`): Upper bound on the coverage questions drawn from the source (default: 10)
50
+
51
+ **options.scale** (`number`): Scale factor to multiply the final score (default: 1)
52
+
53
+ ## `.run()` returns
54
+
55
+ **score** (`number`): Summarization score between 0 and scale (default 0-1), the lower of the alignment and coverage scores
56
+
57
+ **reason** (`string`): Human-readable explanation naming the axis that produced the score and the claims or questions behind it. Both axis scores appear in the text
58
+
59
+ **preprocessStepResult** (`object`): The alignment verdicts and the questions drawn from the source
60
+
61
+ **preprocessStepResult.alignment** (`{ claim: string; supported: boolean; reason: string }[]`): One verdict per claim the summary makes
62
+
63
+ **preprocessStepResult.questions** (`string[]`): The coverage questions drawn from the source text
64
+
65
+ **analyzeStepResult** (`object`): The coverage verdicts
66
+
67
+ **analyzeStepResult.coverage** (`{ question: string; answered: boolean; reason: string }[]`): One verdict per question, answered from the summary alone
68
+
69
+ The axis scores are derived from these verdicts rather than stored: alignment is the share of `alignment` entries with `supported: true`, and coverage is the share of `questions` whose `coverage` entry has `answered: true`.
70
+
71
+ ## Scoring details
72
+
73
+ ### Two-axis evaluation
74
+
75
+ The scorer runs a three-step pipeline:
76
+
77
+ 1. **Source judgement**: the claims the summary makes are extracted and checked against the source, and closed-ended questions are drawn from the source. Every question is written so the source answers it "yes".
78
+ 2. **Coverage**: each question is answered using the summary alone.
79
+ 3. **Scoring**: the two ratios are computed and the lower one becomes the score.
80
+
81
+ The coverage step runs as a separate model call that never receives the source text. A judge that could see the source would answer questions from it rather than from the summary, which would hide the omissions this axis exists to measure.
82
+
83
+ ### Scoring formula
84
+
85
+ ```text
86
+ Alignment = supported_claims / total_claims
87
+ Coverage = answered_questions / total_questions
88
+ Summarization = min(Alignment, Coverage) × scale
89
+ ```
90
+
91
+ The score is 0 when the summary yields no claims or the source yields no questions.
92
+
93
+ ### Score interpretation
94
+
95
+ These ranges assume the default `scale` of 1. When using a custom scale, multiply accordingly.
96
+
97
+ - **0.9-1.0**: Excellent summary, faithful to the source and covering its main points
98
+ - **0.7-0.8**: Good summary with a small omission or an unsupported detail
99
+ - **0.4-0.6**: Moderate summary, either missing important information or drifting from the source
100
+ - **0.1-0.3**: Poor summary, most of the source is lost or contradicted
101
+ - **0.0**: The summary produced nothing to judge, or it failed to support any claims. A summary that answers no questions also receives this score
102
+
103
+ ### Reading the two axes
104
+
105
+ Both axes leave their verdicts on the run result: the alignment verdicts on the preprocess step, and the coverage verdicts on the analyze step. Each verdict carries the claim or question it belongs to and the reason behind it. A low alignment score has a different meaning from a low coverage score:
106
+
107
+ - A low alignment score with high coverage means the summary invents or distorts detail
108
+ - A low coverage score with high alignment means the summary is accurate but leaves too much out
109
+
110
+ The reason field names whichever axis produced the score.
111
+
112
+ ### What the score leaves out
113
+
114
+ Length plays no part in the score. A summary that repeats the source word for word supports every claim and answers every question, so it scores 1. Add a length check of your own when compression is part of what you're testing.
115
+
116
+ ### Cost
117
+
118
+ Each evaluation makes three model calls. `maxQuestions` bounds the coverage half of the work, which otherwise grows with source length. Raise it for long documents where ten questions can't represent the content.
119
+
120
+ ## Scorer configuration
121
+
122
+ ### Summarizing the run input
123
+
124
+ ```typescript
125
+ const scorer = createSummarizationScorer({
126
+ model: 'openai/gpt-5.6-sol',
127
+ })
128
+ ```
129
+
130
+ ### Summarizing a document from elsewhere
131
+
132
+ ```typescript
133
+ import { extractToolResults } from '@mastra/evals/scorers/utils'
134
+
135
+ const scorer = createSummarizationScorer({
136
+ model: 'openai/gpt-5.6-sol',
137
+ options: {
138
+ sourceExtractor: (input, output) => {
139
+ return extractToolResults(output)
140
+ .filter(({ toolName }) => toolName === 'fetchDocument')
141
+ .map(({ result }) => String(result))
142
+ .join('\n\n')
143
+ },
144
+ maxQuestions: 20,
145
+ },
146
+ })
147
+ ```
148
+
149
+ ## Example
150
+
151
+ Evaluate a summarization agent against a set of documents:
152
+
153
+ ```typescript
154
+ import { runEvals } from '@mastra/core/evals'
155
+ import { createSummarizationScorer } from '@mastra/evals/scorers/prebuilt'
156
+ import { summarizerAgent } from './agent'
157
+
158
+ const scorer = createSummarizationScorer({
159
+ model: 'openai/gpt-5.6-sol',
160
+ options: { maxQuestions: 10 },
161
+ })
162
+
163
+ const result = await runEvals({
164
+ target: summarizerAgent,
165
+ scorers: [scorer],
166
+ data: [
167
+ {
168
+ input:
169
+ 'The company was founded in 1995 by John Smith. It started with 10 employees and grew to 500 by 2020. The company is based in Seattle.',
170
+ },
171
+ ],
172
+ onItemComplete: ({ scorerResults }) => {
173
+ console.log({
174
+ score: scorerResults[scorer.id].score,
175
+ reason: scorerResults[scorer.id].reason,
176
+ })
177
+ },
178
+ })
179
+
180
+ console.log(result.scores)
181
+ ```
182
+
183
+ For more details on `runEvals`, see the [runEvals reference](https://mastra.ai/reference/evals/run-evals).
184
+
185
+ To add this scorer to an agent, see the [Scorers overview](https://mastra.ai/docs/evals/overview) guide.
186
+
187
+ ## Comparison with faithfulness
188
+
189
+ | Use case | Summarization | Faithfulness |
190
+ | ------------------------- | ------------------------------- | --------------------------------- |
191
+ | **What it measures** | Support and coverage together | Support only |
192
+ | **Judged against** | The source text being condensed | Retrieved context or tool results |
193
+ | **Catches omission** | Yes | No |
194
+ | **Needs the full source** | Yes | No, context alone is enough |
195
+
196
+ Use `faithfulness` when the question is whether an answer stays grounded in retrieved context. Use `summarization` when the output is meant to stand in for a longer text.
197
+
198
+ ## Related
199
+
200
+ - [Faithfulness Scorer](https://mastra.ai/reference/evals/faithfulness): Measures answer groundedness in context
201
+ - [Completeness Scorer](https://mastra.ai/reference/evals/completeness): Compares element coverage without a model
202
+ - [Content Similarity Scorer](https://mastra.ai/reference/evals/content-similarity): Compares text similarity without a model
203
+ - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers): Creating your own evaluation metrics
@@ -94,4 +94,42 @@ Keep `config.ts` focused on runtime options. Use sibling files for concerns that
94
94
  | Memory | `config.memory` | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | `config.memory` |
95
95
  | Workspace | `config.workspace` | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | `config.workspace` |
96
96
 
97
- Missing both `instructions.md` and `config.instructions` fails the build. Missing both `config.memory` and `memory.ts` leaves the agent without memory.
97
+ Missing both `instructions.md` and `config.instructions` fails the build. Missing both `config.memory` and `memory.ts` leaves the agent without memory.
98
+
99
+ ## Discovery lifecycle
100
+
101
+ File-based primitives are discovered by the Mastra bundler under `mastra dev` and `mastra build`. During discovery, Mastra reads supported files under `src/mastra/`, imports TypeScript and JavaScript modules, reads markdown instructions and skills, copies workspace seed files, and registers the assembled primitives with your Mastra app.
102
+
103
+ After discovery, a file-based agent runs as a normal [`Agent`](https://mastra.ai/reference/agents/agent). Calling it from the Agent API, Studio, workflows, or your application code uses the same runtime as a code-defined agent.
104
+
105
+ Discovery is source-based and conservative.
106
+
107
+ It skips symlinks, test files, and directories that aren't agent directories. Workflows and singleton project files are file-routed only when they have a default export.
108
+
109
+ Start your app through the Mastra CLI so discovery runs:
110
+
111
+ **npm**:
112
+
113
+ ```bash
114
+ npx mastra dev
115
+ ```
116
+
117
+ **pnpm**:
118
+
119
+ ```bash
120
+ pnpm dlx mastra dev
121
+ ```
122
+
123
+ **Yarn**:
124
+
125
+ ```bash
126
+ yarn dlx mastra dev
127
+ ```
128
+
129
+ **Bun**:
130
+
131
+ ```bash
132
+ bun x mastra dev
133
+ ```
134
+
135
+ If you import your `mastra` instance directly, `agents/<name>/` directories and the other conventions aren't discovered. When you consume Mastra as a library, register those primitives in code instead.
@@ -65,7 +65,6 @@ The Reference section provides documentation of Mastra's API, including paramete
65
65
  - [SlackProvider](https://mastra.ai/reference/channels/slack-provider)
66
66
  - [create-mastra](https://mastra.ai/reference/cli/create-mastra)
67
67
  - [mastra](https://mastra.ai/reference/cli/mastra)
68
- - [Agent Builder API](https://mastra.ai/reference/client-js/agent-builder)
69
68
  - [Agents API](https://mastra.ai/reference/client-js/agents)
70
69
  - [Conversations API](https://mastra.ai/reference/client-js/conversations)
71
70
  - [Error Handling](https://mastra.ai/reference/client-js/error-handling)
@@ -123,10 +122,10 @@ The Reference section provides documentation of Mastra's API, including paramete
123
122
  - [BlobStoreProvider](https://mastra.ai/reference/editor/blob-store-provider)
124
123
  - [MastraEditor Class](https://mastra.ai/reference/editor/mastra-editor)
125
124
  - [ProcessorProvider](https://mastra.ai/reference/editor/processor-provider)
125
+ - [Prompt blocks](https://mastra.ai/reference/editor/prompt-blocks)
126
+ - [Tool configuration](https://mastra.ai/reference/editor/tools)
126
127
  - [ToolProvider](https://mastra.ai/reference/editor/tool-provider)
127
- - [AgentBuilderOptions](https://mastra.ai/reference/editor/agent-builder/agent-builder-options)
128
- - [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults)
129
- - [Models default](https://mastra.ai/reference/editor/agent-builder/builder-models)
128
+ - [Versioning](https://mastra.ai/reference/editor/versioning)
130
129
  - [BrowserProvider](https://mastra.ai/reference/editor/browser-provider)
131
130
  - [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref)
132
131
  - [FilesystemProvider](https://mastra.ai/reference/editor/filesystem-provider)
@@ -152,6 +151,7 @@ The Reference section provides documentation of Mastra's API, including paramete
152
151
  - [Noise Sensitivity Scorer](https://mastra.ai/reference/evals/noise-sensitivity)
153
152
  - [Prompt Alignment Scorer](https://mastra.ai/reference/evals/prompt-alignment)
154
153
  - [Rubric Scorer](https://mastra.ai/reference/evals/rubric)
154
+ - [Summarization Scorer](https://mastra.ai/reference/evals/summarization)
155
155
  - [Textual Difference Scorer](https://mastra.ai/reference/evals/textual-difference)
156
156
  - [Tone Consistency Scorer](https://mastra.ai/reference/evals/tone-consistency)
157
157
  - [Tool Call Accuracy Scorers](https://mastra.ai/reference/evals/tool-call-accuracy)
@@ -27,7 +27,7 @@ export const agent = new Agent({
27
27
 
28
28
  ## Configuration
29
29
 
30
- The `observationalMemory` option accepts `true`, a configuration object, or `false`. Setting `true` enables OM with `google/gemini-2.5-flash` as the default model. When passing a config object, a `model` must be explicitly set: either at the top level or on `observation.model` and/or `reflection.model`.
30
+ The `observationalMemory` option accepts `true`, a configuration object, or `false`. Setting `true` enables OM with `google/gemini-2.5-flash` as the default model. When passing a config object, set `model` at the top level or on `observation.model` and/or `reflection.model`; when all model fields are omitted, OM falls back to `google/gemini-2.5-flash`.
31
31
 
32
32
  Observer input is multimodal-aware. OM keeps text placeholders like `[Image #1: screenshot.png]` in the transcript it builds for the Observer, and also sends the underlying image parts when possible. This applies to both single-thread observation and batched multi-thread observation. Non-image files appear as placeholders only.
33
33
 
@@ -35,7 +35,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
35
35
 
36
36
  **enabled** (`boolean`): Enable or disable Observational Memory. When omitted from a config object, defaults to true. Only enabled: false explicitly disables it. (Default: `true`)
37
37
 
38
- **model** (`string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Sets the model for both at once. Cannot be used together with observation.model or reflection.model — an error will be thrown if both are set. When using observationalMemory: true, defaults to google/gemini-2.5-flash. When passing a config object, this or observation.model/reflection.model must be set. Use "default" to explicitly use the default model (google/gemini-2.5-flash). (Default: `'google/gemini-2.5-flash' (when using observationalMemory: true)`)
38
+ **model** (`string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Sets the model for both at once. Cannot be used together with observation.model or reflection.model — an error will be thrown if both are set. When this and observation.model/reflection.model are all omitted, OM falls back to google/gemini-2.5-flash. Use "default" to explicitly use the default model (google/gemini-2.5-flash). (Default: `'google/gemini-2.5-flash'`)
39
39
 
40
40
  **scope** (`'resource' | 'thread'`): Memory scope for observations. 'thread' keeps observations per-thread. 'resource' (experimental) shares observations across all threads for a resource, enabling cross-conversation memory. (Default: `'thread'`)
41
41
 
@@ -47,7 +47,9 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
47
47
 
48
48
  **temporalMarkers** (`boolean`): Insert temporal-gap reminder markers before new user messages when the previous message in the thread is at least 10 minutes older. The marker is persisted in memory, emitted as an inline reminder event so clients can render it specially, and shown to the observer so it can anchor observations to when events occurred. (Default: `false`)
49
49
 
50
- **retrieval** (`boolean | { vector?: boolean; scope?: 'thread' | 'resource' }`): Enable retrieval-mode observation groups as durable pointers to raw message history. true enables cross-thread browsing by default. { vector: true } also enables semantic search using Memory's vector store and embedder. { scope: 'thread' } restricts the recall tool to the current thread only. Default scope is 'resource'. (Default: `false`)
50
+ **retrieval** (`boolean | { vector?: boolean; scope?: 'thread' | 'resource'; instructions?: string }`): Let the agent look up the raw message history behind its observations. Observation groups keep durable pointers to the original messages, and a recall tool is registered so the agent can browse them. true enables cross-thread browsing by default. { vector: true } also enables semantic search using Memory's vector store and embedder. { scope: 'thread' } restricts the recall tool to the current thread only. Default scope is 'resource'. { instructions: '...' } appends application-specific recall guidance after Mastra's built-in retrieval instructions. (Default: `false`)
51
+
52
+ **hooks** (`ObserveHooks`): Lifecycle hooks fired for every observation/reflection cycle — the manual observe()/reflect() APIs, turn-driven synchronous observation, and fire-and-forget async buffering. Callbacks receive threadId/resourceId/trigger call context ('manual' | 'turn-sync' | 'async-buffer'), and the end hooks (onObservationEnd/onReflectionEnd) additionally receive the OM model call's token usage and providerMetadata (where providers such as the AI Gateway report per-call cost), so apps can account for OM model spend without wrapping the observer/reflector models in middleware. Failed async-buffered cycles never throw; they report through the end hook's error field. Errors thrown by these hooks are caught and logged — they never fail the cycle.
51
53
 
52
54
  **observation** (`ObservationalMemoryObservationConfig`): Configuration for the observation step. Controls when the Observer agent runs and how it behaves.
53
55
 
@@ -59,29 +61,33 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
59
61
 
60
62
  **observation.extract** (`Extractor[]`): Custom values to extract after observation. Schema-less extractors are requested inline in the Observer output. Schema-backed extractors run as a follow-up structured output call and are stored in thread OM metadata.
61
63
 
62
- **observation.observeAttachments** (`boolean | string[]`): Controls which image/file attachments are forwarded to the Observer model alongside their placeholder text lines. true (default) forwards all attachments. false drops all attachments while keeping placeholders visible. An array is a case-insensitive mimeType allowlist supporting exact matches ('application/pdf'), wildcard subtypes ('image/\*'), and bare '\*' for everything. Useful when the Observer model is text-only (e.g. some DeepSeek endpoints) while the main agent uses a multimodal model. Tool-result attachments are filtered using the same rule.
64
+ **observation.manageWorkingMemory** (`boolean`): Let the Observer manage working memory through OM extraction. Adds WorkingMemoryExtractor, defaults workingMemory.agentManaged to false, and defaults workingMemory.useStateSignals to true. See Working memory updates.
65
+
66
+ **observation.observeAttachments** (`'auto' | boolean | string[]`): Controls which image/file attachments are forwarded to the Observer model alongside their placeholder text lines. true (default) forwards all attachments. false drops all attachments while keeping placeholders visible. 'auto' uses the provider capabilities registry to decide: attachments are forwarded when the Observer model supports multimodal input, dropped otherwise, and forwarded when no capability data is available for the model. An array is a case-insensitive mimeType allowlist supporting exact matches ('application/pdf'), wildcard subtypes ('image/\*'), and bare '\*' for everything. Useful when the Observer model is text-only (e.g. some DeepSeek endpoints) while the main agent uses a multimodal model. Tool-result attachments are filtered using the same rule.
63
67
 
64
68
  **observation.messageTokens** (`number`): Token count of unobserved messages that triggers observation. When unobserved message tokens exceed this threshold, the Observer agent is called. Text is estimated locally with tokenx. Image parts are included with model-aware heuristics when possible, with deterministic fallbacks when image metadata is incomplete. Image-like file parts are counted the same way when uploads are normalized as files.
65
69
 
66
70
  **observation.maxTokensPerBatch** (`number`): Maximum tokens per batch when observing multiple threads in resource scope. Threads are chunked into batches of this size and processed in parallel. Lower values mean more parallelism but more API calls.
67
71
 
68
- **observation.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Observer agent.
72
+ **observation.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Observer agent. The maxOutputTokens: 100\_000 default is only applied with default model selection (no model set, "default", or a ModelByInputTokens selector). Custom models get no maxOutputTokens default.
69
73
 
70
74
  **observation.modelSettings.temperature** (`number`): Temperature for generation. Lower values produce more consistent output.
71
75
 
72
- **observation.modelSettings.maxOutputTokens** (`number`): Maximum output tokens. Set high to prevent truncation of observations.
76
+ **observation.modelSettings.maxOutputTokens** (`number`): Maximum output tokens. Set high to prevent truncation of observations. The 100000 default is only applied with default model selection; custom models get no default.
73
77
 
74
- **observation.bufferTokens** (`number | false`): Token interval for async background observation buffering. Can be an absolute token count (e.g. 5000) or a fraction of messageTokens (e.g. 0.25 = buffer every 25% of threshold). When set, observations run in the background at this interval, storing results in a buffer. When the main messageTokens threshold is reached, buffered observations activate instantly without a blocking LLM call. Must resolve to less than messageTokens. Set to false to explicitly disable all async buffering (both observation and reflection).
78
+ **observation.providerOptions** (`ProviderOptions`): Provider-specific options passed to the Observer agent, such as Google thinking configuration.
79
+
80
+ **observation.bufferTokens** (`number | false`): How often background observation buffering runs. Values between 0 and 1 are fractions of messageTokens: 0.25 buffers every 25% of the threshold (7.5k tokens with the default 30k). Values of 1 or more are absolute token counts: 5000 buffers every 5k tokens. Buffered observations are stored until the messageTokens threshold is reached, then activate instantly without a blocking LLM call. Must resolve to less than messageTokens. Set to false to disable all async buffering (both observation and reflection).
75
81
 
76
82
  **observation.bufferOnIdle** (`boolean`): Run background observation buffering when an agent turn ends and the agent becomes idle. This is separate from bufferTokens, which controls step-time async buffering. Set this to true to buffer short idle turns without waiting for the next turn or the messageTokens threshold.
77
83
 
78
- **observation.bufferActivation** (`number`): Controls how much of the message window to retain after activation. Accepts a ratio (0-1) or an absolute token count (≥ 1000). For example, 0.8 means: activate enough buffers to remove 80% of messageTokens and leave 20% as active message history. An absolute token count like 4000 targets a goal of keeping \~4k message tokens remaining after activation. Higher values remove more message history per activation when using a ratio. Higher values keep more message history when using a token count.
84
+ **observation.bufferActivation** (`number`): How much of the message window to clear when buffered observations activate. Values between 0 and 1 are the fraction of messageTokens to remove: 0.8 removes \~80% of the message history and keeps \~20% (6k tokens with the default 30k). Values of 1000 or more are the token count to keep: 4000 keeps \~4k message tokens after activation. Note the direction flips: a higher ratio removes more history, while a higher token count keeps more.
79
85
 
80
- **observation.activateAfterIdle** (`number | string | false | "auto"`): Time before buffered observations are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, or false. If unset, the top-level activateAfterIdle value is used for observations. Set false to disable the top-level idle setting for observations.
86
+ **observation.activateAfterIdle** (`number | string | false | "auto"`): Time before buffered observations are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, or false. If unset, the top-level activateAfterIdle value is used for observations. Set false to disable the top-level idle setting for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateAfterIdle only.
81
87
 
82
- **observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level activateOnProviderChange value is used for observations.
88
+ **observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level activateOnProviderChange value is used for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateOnProviderChange only.
83
89
 
84
- **observation.blockAfter** (`number`): Token threshold above which synchronous (blocking) observation is forced. Between messageTokens and blockAfter, only async buffering/activation is used. Above blockAfter, a synchronous observation runs as a last resort, while buffered activation still preserves a minimum remaining context (min(1000, retention floor)). Accepts a multiplier (1 < value < 2, multiplied by messageTokens) or an absolute token count ( 2, must be greater than messageTokens). Only relevant when bufferTokens is set. Defaults to 1.2 when async buffering is enabled.
90
+ **observation.blockAfter** (`number`): Safety net that forces a synchronous (blocking) observation when background buffering can't keep up. Values from 1 up to (but not including) 100 are multipliers of messageTokens: 1.2 forces a blocking observation at 120% of the threshold (36k tokens with the default 30k). Values of 100 or more are absolute token counts and must be greater than messageTokens. Between messageTokens and blockAfter, only async buffering and activation run; buffered activation still preserves a minimum remaining context (the smaller of 1000 tokens or the retention floor). Only relevant when bufferTokens is set. Defaults to 1.2 when async buffering is enabled.
85
91
 
86
92
  **observation.previousObserverTokens** (`number | false`): Optional token budget for the observer's previous-observations context. When set to a number, the observations passed to the Observer agent are tail-truncated to fit within this budget while keeping the newest observations and preserving highlighted 🔴 items when possible. When a buffered reflection is pending, the already-reflected observation lines are automatically replaced with the reflection summary before truncation. Set to 0 to omit previous observations entirely, or false to disable truncation explicitly.
87
93
 
@@ -95,19 +101,21 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
95
101
 
96
102
  **reflection.observationTokens** (`number`): Token count of observations that triggers reflection. When observation tokens exceed this threshold, the Reflector agent is called to condense them.
97
103
 
98
- **reflection.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Reflector agent.
104
+ **reflection.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Reflector agent. The maxOutputTokens: 100\_000 default is only applied with default model selection (no model set, "default", or a ModelByInputTokens selector). Custom models get no maxOutputTokens default.
99
105
 
100
106
  **reflection.modelSettings.temperature** (`number`): Temperature for generation. Lower values produce more consistent output.
101
107
 
102
- **reflection.modelSettings.maxOutputTokens** (`number`): Maximum output tokens. Set high to prevent truncation of observations.
108
+ **reflection.modelSettings.maxOutputTokens** (`number`): Maximum output tokens. Set high to prevent truncation of observations. The 100000 default is only applied with default model selection; custom models get no default.
109
+
110
+ **reflection.providerOptions** (`ProviderOptions`): Provider-specific options passed to the Reflector agent, such as Google thinking configuration.
103
111
 
104
- **reflection.bufferActivation** (`number`): Ratio (0-1) controlling when async reflection buffering starts. When observation tokens reach observationTokens \* bufferActivation, reflection runs in the background. On activation at the full threshold, the buffered reflection replaces the observations it covers, preserving any new observations appended after that range.
112
+ **reflection.bufferActivation** (`number`): When background reflection starts, as a ratio (0-1) of observationTokens: 0.5 starts reflecting in the background once observations reach 50% of the threshold (20k tokens with the default 40k). When the full threshold is reached, the buffered reflection replaces the observations it covers, preserving any new observations appended after that range.
105
113
 
106
- **reflection.activateAfterIdle** (`number | string | false | "auto"`): Time before buffered reflections are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, or false. Reflections do not inherit top-level activateAfterIdle; set this explicitly to opt reflections into idle activation.
114
+ **reflection.activateAfterIdle** (`number | string | false | "auto"`): Time before buffered reflections are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, or false. Reflections do not inherit top-level activateAfterIdle; set this explicitly to opt reflections into idle activation. Currently only applied when using the standalone ObservationalMemory class; this setting has no effect through new Memory(...).
107
115
 
108
- **reflection.activateOnProviderChange** (`boolean`): Force buffered reflections to activate when the actor provider or model changes. Reflections do not inherit top-level activateOnProviderChange; set this explicitly to opt reflections into provider-change activation.
116
+ **reflection.activateOnProviderChange** (`boolean`): Force buffered reflections to activate when the actor provider or model changes. Reflections do not inherit top-level activateOnProviderChange; set this explicitly to opt reflections into provider-change activation. Currently only applied when using the standalone ObservationalMemory class; this setting has no effect through new Memory(...).
109
117
 
110
- **reflection.blockAfter** (`number`): Token threshold above which synchronous (blocking) reflection is forced. Between observationTokens and blockAfter, only async buffering/activation is used. Above blockAfter, a synchronous reflection runs as a last resort. Accepts a multiplier (1 < value < 2, multiplied by observationTokens) or an absolute token count (≥ 2, must be greater than observationTokens). Only relevant when bufferActivation is set. Defaults to 1.2 when async reflection is enabled.
118
+ **reflection.blockAfter** (`number`): Safety net that forces a synchronous (blocking) reflection when background reflection can't keep up. Values from 1 up to (but not including) 100 are multipliers of observationTokens: 1.2 forces a blocking reflection at 120% of the threshold (48k tokens with the default 40k). Values of 100 or more are absolute token counts and must be greater than observationTokens. Between observationTokens and blockAfter, only async buffering and activation run. Only relevant when bufferActivation is set. Defaults to 1.2 when async reflection is enabled.
111
119
 
112
120
  ### Token estimate metadata cache
113
121
 
@@ -150,7 +158,7 @@ const memory = new Memory({
150
158
 
151
159
  **name** (`string`): Human-readable extractor name. OM slugifies this value into the extractor slug. Names must be unique after slug generation.
152
160
 
153
- **slug** (`string`): Generated stable identifier for persisted values and XML tags. Slugs use lowercase letters, numbers, and hyphens. Built-in slugs and reserved XML tags cannot be used by custom extractors.
161
+ **slug** (`string`): Read-only property derived from name — not a constructor option. Generated stable identifier for persisted values and XML tags. Slugs use lowercase letters, numbers, and hyphens. Built-in slugs and reserved XML tags cannot be used by custom extractors.
154
162
 
155
163
  **instructions** (`string | (context) => string`): Instructions for what to extract and when to update the value. Use a function to derive instructions from runtime context.
156
164
 
@@ -158,6 +166,8 @@ const memory = new Memory({
158
166
 
159
167
  **includePreviousExtraction** (`boolean`): Controls whether the previous extraction is shown to the extractor on future OM runs. Set to false for values that should only come from the current OM run. (Default: `true`)
160
168
 
169
+ **metadataKeyPath** (`string | false`): Dot-separated OM metadata path used to persist the extracted value. Set to false to skip OM metadata persistence entirely. (Default: `'extracted.<slug>'`)
170
+
161
171
  **onExtracted** (`(context) => T | void | Promise<T | void>`): Optional hook called after a custom extractor returns a value and before metadata is persisted. Returning a value replaces the extracted value. Throwing records an extraction failure.
162
172
 
163
173
  ### Extraction behavior
@@ -663,18 +673,45 @@ Emitted when buffered observations or reflections are activated (moved into the
663
673
 
664
674
  **observations** (`string`): The activated observations text.
665
675
 
676
+ **triggeredBy** (`'threshold' | 'ttl' | 'provider_change'`): Whether activation was triggered by threshold crossing, activateAfterIdle expiry, or a model/provider change.
677
+
678
+ **lastActivityAt** (`number`): Unix-ms timestamp of the last assistant message part used for TTL checks.
679
+
680
+ **ttlExpiredMs** (`number`): How long activateAfterIdle had been exceeded when activation fired.
681
+
682
+ **previousModel** (`string`): Previous assistant model identifier that triggered activation (e.g. openai/gpt-4o).
683
+
684
+ **currentModel** (`string`): Current actor model identifier that triggered activation.
685
+
666
686
  **recordId** (`string`): The OM record ID.
667
687
 
668
688
  **threadId** (`string`): This thread's ID.
669
689
 
670
690
  **config** (`ObservationMarkerConfig`): Snapshot of config at activation time.
671
691
 
692
+ ### `data-om-thread-update`
693
+
694
+ Emitted when the Observer updates the thread title. Only emitted when `observation.threadTitle` is enabled.
695
+
696
+ **cycleId** (`string`): Unique ID for this observation cycle — shared with observation markers.
697
+
698
+ **threadId** (`string`): The thread ID that was updated.
699
+
700
+ **oldTitle** (`string`): The previous thread title. Undefined if the thread had no title.
701
+
702
+ **newTitle** (`string`): The new thread title.
703
+
704
+ **timestamp** (`string`): When this update occurred.
705
+
672
706
  ## Standalone usage
673
707
 
674
708
  Most users should use the `Memory` class above. Using `ObservationalMemory` directly is mainly useful for benchmarking, experimentation, or when you need to control processor ordering with other processors (like [guardrails](https://mastra.ai/docs/agents/guardrails)).
675
709
 
710
+ The `ObservationalMemory` class is the engine; to attach it to an agent, wrap it in an `ObservationalMemoryProcessor`, which needs a `Memory` instance for loading and persisting messages. Note that `stores.memory` is typed as optional on storage adapters, so a non-null assertion (or a runtime check) is needed:
711
+
676
712
  ```typescript
677
- import { ObservationalMemory } from '@mastra/memory/processors'
713
+ import { ObservationalMemory, ObservationalMemoryProcessor } from '@mastra/memory/processors'
714
+ import { Memory } from '@mastra/memory'
678
715
  import { Agent } from '@mastra/core/agent'
679
716
  import { LibSQLStore } from '@mastra/libsql'
680
717
 
@@ -683,8 +720,11 @@ const storage = new LibSQLStore({
683
720
  url: 'file:./memory.db',
684
721
  })
685
722
 
723
+ const memory = new Memory({ storage })
724
+
686
725
  const om = new ObservationalMemory({
687
- storage: storage.stores.memory,
726
+ storage: storage.stores.memory!,
727
+ memory,
688
728
  model: 'google/gemini-2.5-flash',
689
729
  scope: 'resource',
690
730
  observation: {
@@ -695,13 +735,15 @@ const om = new ObservationalMemory({
695
735
  },
696
736
  })
697
737
 
738
+ const omProcessor = new ObservationalMemoryProcessor(om, memory)
739
+
698
740
  export const agent = new Agent({
699
741
  id: 'my-agent',
700
742
  name: 'my-agent',
701
743
  instructions: 'You are a helpful assistant.',
702
744
  model: 'openai/gpt-5-mini',
703
- inputProcessors: [om],
704
- outputProcessors: [om],
745
+ inputProcessors: [omProcessor],
746
+ outputProcessors: [omProcessor],
705
747
  })
706
748
  ```
707
749
 
@@ -719,15 +761,19 @@ The standalone `ObservationalMemory` class accepts all the same options as the `
719
761
 
720
762
  When `retrieval` is set (any truthy value), a `recall` tool is registered so the agent can page through raw messages behind observation group ranges. By default (scope `'resource'`), the tool supports listing threads (`mode: "threads"`), browsing other threads (`threadId`), and cross-thread search. With `retrieval: { vector: true }`, semantic search is available (`mode: "search"`). Set `scope: 'thread'` to restrict the tool to the current thread only. The tool is automatically added to the agent's tool list.
721
763
 
764
+ Mastra also injects scope-aware usage instructions into the agent's context. For resource scope with `vector: true`, these cover routing between `search`, `threads`, and `messages`, including fallback to thread discovery when search results are unsuitable. Without `vector: true`, the instructions only cover `threads` and `messages` browsing, so the agent isn't steered toward a search mode that isn't configured. Resource-scoped instructions are injected even before any observation group exists, so the agent can browse other threads from the first message. Use `retrieval: { instructions: '...' }` to append application-specific guidance after the built-in instructions.
765
+
722
766
  ### Parameters
723
767
 
724
768
  **mode** (`'messages' | 'threads' | 'search'`): What to retrieve. "messages" (default) pages through message history. "threads" lists all threads for the current user. "search" finds messages by semantic similarity across all threads (requires vector store and embedder). (Default: `'messages'`)
725
769
 
726
770
  **query** (`string`): Search query for mode: "search". Finds messages semantically similar to this text across all threads for the current user.
727
771
 
728
- **cursor** (`string`): A message ID to anchor the recall query. Required for mode: "messages" when browsing the current thread. Extract the start or end ID from an observation group range (e.g. from \_range: \startId:endId\\\_, use either startId or endId). If a range string is passed directly, the tool returns a hint explaining how to extract the correct ID. Can be omitted when threadId is provided to start reading from the beginning of that thread.
772
+ **cursor** (`string`): A message ID to anchor the recall query. Extract the start or end ID from an observation group range (e.g. from \_range: \startId:endId\\\_, use either startId or endId). If a range string is passed directly, the tool returns a hint explaining how to extract the correct ID. When both cursor and threadId are omitted for mode: "messages", the tool browses the current thread from the position set by anchor.
773
+
774
+ **threadId** (`string`): Browse a different thread by its ID, or pass "current" for the active thread. Use mode: "threads" first to discover thread IDs. When provided without a cursor, reading starts from the beginning of the thread.
729
775
 
730
- **threadId** (`string`): Browse a different thread by its ID. Use mode: "threads" first to discover thread IDs. When provided without a cursor, reading starts from the beginning of the thread.
776
+ **anchor** (`'start' | 'end'`): For mode: "messages" without a cursor, page from the start (oldest-first) or end (newest-first) of the thread. (Default: `'start'`)
731
777
 
732
778
  **page** (`number`): Pagination offset. For messages: positive values page forward from cursor, negative values page backward. For threads: page number (0-indexed). 0 is treated as 1 for messages. (Default: `1`)
733
779
 
@@ -735,6 +781,10 @@ When `retrieval` is set (any truthy value), a `recall` tool is registered so the
735
781
 
736
782
  **detail** (`'low' | 'high'`): Controls how much content is shown per message part. 'low' shows truncated text and tool names with positional indices (\[p0], \[p1]). 'high' shows full content including tool arguments and results, clamped to one part per call with continuation hints. (Default: `'low'`)
737
783
 
784
+ **partType** (`'text' | 'tool-call' | 'tool-result' | 'reasoning' | 'image' | 'file'`): Filter results to only include message parts of this type. Only applies to mode: "messages".
785
+
786
+ **toolName** (`string`): Filter results to only include tool-call and tool-result parts matching this tool name. Only applies to mode: "messages".
787
+
738
788
  **partIndex** (`number`): Fetch a single message part at full detail by its positional index. Use this when a low-detail recall shows an interesting part at \[p1] — call again with partIndex: 1 to see the full content without loading every part.
739
789
 
740
790
  **before** (`string`): For mode: "threads" only. Filter to threads created before this date. Accepts ISO 8601 format (e.g. "2026-03-15", "2026-03-10T00:00:00Z").
@@ -753,6 +803,8 @@ When `retrieval` is set (any truthy value), a `recall` tool is registered so the
753
803
 
754
804
  **limit** (`number`): The limit used for this query.
755
805
 
806
+ **detail** (`'low' | 'high'`): The detail level used for this query.
807
+
756
808
  **hasNextPage** (`boolean`): Whether more messages exist after this page.
757
809
 
758
810
  **hasPrevPage** (`boolean`): Whether more messages exist before this page.
@@ -4,7 +4,7 @@
4
4
 
5
5
  `SerializedMemoryConfig` is the JSON-serializable subset of [`Memory`](https://mastra.ai/reference/memory/memory-class) configuration that lives on a stored agent record. The runtime hydrates it back into a `Memory` instance by resolving the vector and embedder IDs against the configured `Mastra` instance.
6
6
 
7
- It's the type used by [`BuilderAgentDefaults.memory`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) and by `EditorAgentNamespace.create({ memory })`.
7
+ It's the type used by [`BuilderAgentDefaults.memory`](https://agent-builder.mastra.ai/reference/builder-agent-defaults) and by `EditorAgentNamespace.create({ memory })`.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -70,5 +70,5 @@ new MastraEditor({
70
70
 
71
71
  - [Memory class](https://mastra.ai/reference/memory/memory-class): The runtime type this config hydrates into.
72
72
  - [Observational memory](https://mastra.ai/reference/memory/observational-memory): Full observational memory reference.
73
- - [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults): Where this type is pinned as the Builder default.
74
- - [Agent Builder: Memory](https://mastra.ai/docs/agent-builder/memory): Concept and worked examples.
73
+ - [BuilderAgentDefaults](https://agent-builder.mastra.ai/reference/builder-agent-defaults): Where this type is pinned as the Builder default.
74
+ - [Agent Builder: Memory](https://agent-builder.mastra.ai/memory): Concept and worked examples.
@@ -319,7 +319,9 @@ enum SpanType {
319
319
  * Provider-executed (server-side) tool span. Reconstructed from
320
320
  * tool-call and tool-result stream chunks for tools the model
321
321
  * provider executes (e.g. Anthropic code execution, server-side
322
- * web search). Opened on tool-call chunk, closed on tool-result.
322
+ * web search). Created on the tool-result chunk under the model
323
+ * step that delivered it, with the start time backdated to the
324
+ * tool-call chunk.
323
325
  */
324
326
  PROVIDER_TOOL_CALL = 'provider_tool_call',
325
327
 
@@ -473,6 +475,7 @@ interface ToolCallAttributes {
473
475
  toolId?: string
474
476
  toolType?: string
475
477
  toolDescription?: string
478
+ toolCallId?: string
476
479
  success?: boolean
477
480
  }
478
481
  ```
@@ -495,6 +498,8 @@ interface MCPToolCallAttributes {
495
498
  /** Tool description */
496
499
  toolDescription?: string
497
500
 
501
+ toolCallId?: string
502
+
498
503
  /** Whether tool execution was successful */
499
504
  success?: boolean
500
505
  }
@@ -399,7 +399,7 @@ processLLMRequest?(
399
399
 
400
400
  **tracingContext** (`TracingContext`): Tracing context for observability.
401
401
 
402
- **writer** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks during streaming. Use writer.custom() to send transient UI signals.
402
+ **writer** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks during streaming. Call writer.custom() to emit a data-\* chunk.
403
403
 
404
404
  **abortSignal** (`AbortSignal`): Signal for cancelling the operation.
405
405
 
@@ -504,7 +504,7 @@ processAPIError?(args: ProcessAPIErrorArgs): Promise<ProcessAPIErrorResult | voi
504
504
 
505
505
  **abort** (`(reason?: string, options?: { retry?: boolean; metadata?: unknown }) => never`): Function to abort processing.
506
506
 
507
- **writer** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks during streaming. Use writer.custom() to send transient UI signals.
507
+ **writer** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks during streaming. Call writer.custom() to emit a data-\* chunk.
508
508
 
509
509
  **requestContext** (`RequestContext`): Request context passed through from the agent call.
510
510
 
@@ -961,6 +961,18 @@ await writer.custom({
961
961
  })
962
962
  ```
963
963
 
964
+ When memory is configured, custom `data-*` chunks emitted from `processOutputStream` or `processOutputResult` are saved as parts of the assistant message. Set `transient: true` on the chunk object to stream it without saving it to memory:
965
+
966
+ ```typescript
967
+ await writer.custom({
968
+ type: 'data-progress',
969
+ data: { status: 'Processing' },
970
+ transient: true,
971
+ })
972
+ ```
973
+
974
+ Pass `transient` as a property of the chunk, not as the second argument to `writer.custom()`. The second argument contains writer options such as `messageId`.
975
+
964
976
  By default, processors **don't** see `data-*` chunks in `processOutputStream` so they don't accidentally process tool telemetry or their own output. Opt in by setting `processDataParts: true` on the processor:
965
977
 
966
978
  ```typescript