@mastra/mcp-docs-server 1.2.8-alpha.0 → 1.2.8-alpha.19

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 (157) hide show
  1. package/.docs/docs/agent-builder/deploying.md +1 -0
  2. package/.docs/docs/agent-builder/integrations.md +1 -3
  3. package/.docs/docs/agent-builder/overview.md +1 -1
  4. package/.docs/docs/agent-controller/overview.md +1 -1
  5. package/.docs/docs/agents/overview.md +17 -13
  6. package/.docs/docs/agents/skills.md +1 -3
  7. package/.docs/docs/agents/structured-output.md +14 -7
  8. package/.docs/docs/agents/using-tools.md +80 -26
  9. package/.docs/docs/browser/agent-browser.md +1 -0
  10. package/.docs/docs/browser/firecrawl.md +129 -0
  11. package/.docs/docs/browser/overview.md +16 -2
  12. package/.docs/docs/capabilities/channels/other-adapters.md +1 -1
  13. package/.docs/docs/capabilities/channels/overview.md +1 -0
  14. package/.docs/docs/capabilities/channels/slack.md +113 -3
  15. package/.docs/docs/deployment/mastra-server.md +35 -0
  16. package/.docs/docs/deployment/monorepo.md +2 -0
  17. package/.docs/docs/deployment/overview.md +6 -0
  18. package/.docs/docs/deployment/sandbox.md +277 -0
  19. package/.docs/docs/editor/overview.md +2 -6
  20. package/.docs/docs/editor/tools.md +2 -6
  21. package/.docs/docs/evals/multi-turn.md +178 -0
  22. package/.docs/docs/evals/overview.md +1 -0
  23. package/.docs/docs/evals/running-in-ci.md +3 -9
  24. package/.docs/docs/getting-started/file-based-agents.md +2 -2
  25. package/.docs/docs/index.md +17 -13
  26. package/.docs/docs/long-running-agents/background-tasks.md +2 -2
  27. package/.docs/docs/long-running-agents/durable-agents.md +2 -1
  28. package/.docs/docs/long-running-agents/schedules.md +2 -2
  29. package/.docs/docs/mastra-platform/database.md +13 -6
  30. package/.docs/docs/mastra-platform/deploy.md +17 -8
  31. package/.docs/docs/mastra-platform/environments.md +5 -4
  32. package/.docs/docs/mastra-platform/overview.md +1 -1
  33. package/.docs/docs/mastra-platform/regions.md +73 -0
  34. package/.docs/docs/mastra-platform/workspace.md +111 -0
  35. package/.docs/docs/mcp/overview.md +1 -1
  36. package/.docs/docs/memory/multi-user-threads.md +4 -4
  37. package/.docs/docs/memory/observational-memory.md +78 -3
  38. package/.docs/docs/memory/overview.md +4 -0
  39. package/.docs/docs/memory/working-memory.md +1 -1
  40. package/.docs/docs/observability/integrations/bridges/otel.md +1 -3
  41. package/.docs/docs/observability/integrations/exporters/braintrust.md +34 -2
  42. package/.docs/docs/observability/integrations/exporters/otel.md +1 -3
  43. package/.docs/docs/server/auth/simple-auth.md +1 -3
  44. package/.docs/docs/server/request-context.md +2 -0
  45. package/.docs/docs/studio/overview.md +2 -0
  46. package/.docs/docs/voice/livekit.md +1 -1
  47. package/.docs/docs/workflows/control-flow.md +1 -3
  48. package/.docs/docs/workspace/filesystem.md +1 -0
  49. package/.docs/docs/workspace/sandbox.md +1 -0
  50. package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -0
  51. package/.docs/guides/guide/signal-provider.md +2 -0
  52. package/.docs/guides/migrations/vnext-to-standard-apis.md +1 -3
  53. package/.docs/models/environment-variables.md +1 -0
  54. package/.docs/models/gateways/openrouter.md +340 -345
  55. package/.docs/models/gateways/vercel.md +6 -5
  56. package/.docs/models/index.md +1 -1
  57. package/.docs/models/providers/alibaba-token-plan-cn.md +22 -21
  58. package/.docs/models/providers/alibaba-token-plan.md +22 -21
  59. package/.docs/models/providers/ambient.md +12 -10
  60. package/.docs/models/providers/baseten.md +3 -2
  61. package/.docs/models/providers/crossmodel.md +2 -1
  62. package/.docs/models/providers/deepinfra.md +4 -7
  63. package/.docs/models/providers/empiriolabs.md +2 -1
  64. package/.docs/models/providers/evroc.md +3 -2
  65. package/.docs/models/providers/google.md +2 -2
  66. package/.docs/models/providers/kilo.md +1 -1
  67. package/.docs/models/providers/kimi-for-coding.md +10 -11
  68. package/.docs/models/providers/llmgateway.md +3 -8
  69. package/.docs/models/providers/moonshotai-cn.md +3 -2
  70. package/.docs/models/providers/moonshotai.md +3 -2
  71. package/.docs/models/providers/nebius.md +3 -1
  72. package/.docs/models/providers/novita-ai.md +3 -1
  73. package/.docs/models/providers/ollama-cloud.md +25 -42
  74. package/.docs/models/providers/opencode-go.md +5 -3
  75. package/.docs/models/providers/orcarouter.md +1 -1
  76. package/.docs/models/providers/privatemode-ai.md +10 -10
  77. package/.docs/models/providers/thinkingmachines.md +73 -0
  78. package/.docs/models/providers/togetherai.md +2 -6
  79. package/.docs/models/providers/zenmux.md +3 -1
  80. package/.docs/models/providers.md +1 -0
  81. package/.docs/reference/acp/acp-agent.md +2 -0
  82. package/.docs/reference/acp/create-acp-tool.md +28 -0
  83. package/.docs/reference/agent-controller/agent-controller-class.md +1 -1
  84. package/.docs/reference/agent-controller/session.md +15 -0
  85. package/.docs/reference/agents/agent.md +14 -2
  86. package/.docs/reference/agents/durable-agent.md +23 -0
  87. package/.docs/reference/agents/generate.md +19 -1
  88. package/.docs/reference/browser/firecrawl-browser.md +71 -0
  89. package/.docs/reference/cli/mastra.md +14 -6
  90. package/.docs/reference/code-sdk/mount-agent-controller.md +1 -3
  91. package/.docs/reference/core/getMCPServer.md +1 -3
  92. package/.docs/reference/core/getMCPServerById.md +1 -3
  93. package/.docs/reference/core/getTool.md +33 -0
  94. package/.docs/reference/core/getToolById.md +48 -0
  95. package/.docs/reference/core/getWorkflow.md +1 -3
  96. package/.docs/reference/core/listMCPServers.md +2 -6
  97. package/.docs/reference/core/listTools.md +38 -0
  98. package/.docs/reference/core/mastra-class.md +1 -1
  99. package/.docs/reference/datasets/addItem.md +1 -3
  100. package/.docs/reference/datasets/addItems.md +1 -3
  101. package/.docs/reference/datasets/compareExperiments.md +1 -3
  102. package/.docs/reference/datasets/create.md +1 -3
  103. package/.docs/reference/datasets/dataset.md +2 -6
  104. package/.docs/reference/datasets/datasets-manager.md +5 -15
  105. package/.docs/reference/datasets/delete.md +1 -3
  106. package/.docs/reference/datasets/deleteExperiment.md +1 -3
  107. package/.docs/reference/datasets/deleteItem.md +1 -3
  108. package/.docs/reference/datasets/deleteItems.md +1 -3
  109. package/.docs/reference/datasets/get.md +1 -3
  110. package/.docs/reference/datasets/getDetails.md +1 -3
  111. package/.docs/reference/datasets/getExperiment.md +1 -3
  112. package/.docs/reference/datasets/getItem.md +1 -3
  113. package/.docs/reference/datasets/getItemHistory.md +1 -3
  114. package/.docs/reference/datasets/list.md +1 -3
  115. package/.docs/reference/datasets/listExperimentResults.md +1 -3
  116. package/.docs/reference/datasets/listExperiments.md +1 -3
  117. package/.docs/reference/datasets/listItems.md +1 -3
  118. package/.docs/reference/datasets/listVersions.md +1 -3
  119. package/.docs/reference/datasets/startExperiment.md +1 -3
  120. package/.docs/reference/datasets/startExperimentAsync.md +1 -3
  121. package/.docs/reference/datasets/update.md +1 -3
  122. package/.docs/reference/datasets/updateItem.md +1 -3
  123. package/.docs/reference/editor/mastra-editor.md +1 -3
  124. package/.docs/reference/evals/context-recall.md +205 -0
  125. package/.docs/reference/evals/create-scorer.md +4 -10
  126. package/.docs/reference/evals/mastra-scorer.md +1 -3
  127. package/.docs/reference/evals/run-evals.md +94 -2
  128. package/.docs/reference/file-based-agents/logger.md +1 -1
  129. package/.docs/reference/file-based-agents/tools.md +7 -6
  130. package/.docs/reference/index.md +8 -0
  131. package/.docs/reference/memory/observational-memory.md +21 -0
  132. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -3
  133. package/.docs/reference/processors/token-limiter-processor.md +1 -3
  134. package/.docs/reference/rag/database-config.md +12 -0
  135. package/.docs/reference/storage/clickhouse.md +1 -1
  136. package/.docs/reference/storage/convex.md +17 -10
  137. package/.docs/reference/storage/retention.md +1 -1
  138. package/.docs/reference/streaming/agents/stream.md +3 -1
  139. package/.docs/reference/tools/create-tool.md +78 -52
  140. package/.docs/reference/tools/mcp-client.md +104 -24
  141. package/.docs/reference/tools/mcp-server.md +143 -44
  142. package/.docs/reference/tools/task-tools.md +2 -2
  143. package/.docs/reference/tools/tavily.md +1 -1
  144. package/.docs/reference/tools/vector-query-tool.md +22 -0
  145. package/.docs/reference/vectors/mongodb.md +2 -0
  146. package/.docs/reference/vectors/turbopuffer.md +4 -0
  147. package/.docs/reference/voice/mistral.md +127 -0
  148. package/.docs/reference/workspace/daytona-sandbox.md +2 -6
  149. package/.docs/reference/workspace/platform-filesystem.md +182 -0
  150. package/.docs/reference/workspace/platform-sandbox.md +200 -0
  151. package/CHANGELOG.md +71 -0
  152. package/dist/{chunk-GLPCVXXO.js → chunk-HGADBLKG.js} +2 -2
  153. package/dist/{chunk-GLPCVXXO.js.map → chunk-HGADBLKG.js.map} +1 -1
  154. package/dist/index.js +1 -1
  155. package/dist/stdio.js +1 -1
  156. package/dist/tools/docs.d.ts.map +1 -1
  157. package/package.json +8 -8
@@ -0,0 +1,111 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Workspace
4
+
5
+ A workspace gives an environment two things your agents can use at runtime:
6
+
7
+ - A **bucket** for filesystem storage, exposed to your code as [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem).
8
+ - A **sandbox** for executing commands, exposed as [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox).
9
+
10
+ Workspaces are provisioned per [environment](https://mastra.ai/docs/mastra-platform/environments), so `production` and `staging` each get their own bucket and sandbox. The platform manages provisioning, credentials, and lifecycle; your deploy code only needs to construct the providers.
11
+
12
+ ## When workspaces are provisioned
13
+
14
+ New projects have workspaces enabled by default. When you create an environment, the platform provisions a bucket for it automatically. The sandbox base image is warmed in the background so the first `PlatformSandbox` call starts quickly.
15
+
16
+ Existing projects that haven't opted in show an **Enable workspaces** action in the Workspaces tab. Enabling provisions a bucket for every environment on the project.
17
+
18
+ If provisioning fails for an environment — for example while Railway is under load — the Workspaces tab shows the failure and offers a retry. The environment itself is still created; only the workspace is unavailable until you retry.
19
+
20
+ ## Use the workspace from your code
21
+
22
+ Install the provider package:
23
+
24
+ **npm**:
25
+
26
+ ```bash
27
+ npm install @mastra/platform-workspace
28
+ ```
29
+
30
+ **pnpm**:
31
+
32
+ ```bash
33
+ pnpm add @mastra/platform-workspace
34
+ ```
35
+
36
+ **Yarn**:
37
+
38
+ ```bash
39
+ yarn add @mastra/platform-workspace
40
+ ```
41
+
42
+ **Bun**:
43
+
44
+ ```bash
45
+ bun add @mastra/platform-workspace
46
+ ```
47
+
48
+ Compose the providers into a workspace and register it with Mastra:
49
+
50
+ ```typescript
51
+ import { Workspace } from '@mastra/core/workspace'
52
+ import { PlatformFilesystem, PlatformSandbox } from '@mastra/platform-workspace'
53
+
54
+ export const workspace = new Workspace({
55
+ filesystem: new PlatformFilesystem(),
56
+ sandbox: new PlatformSandbox(),
57
+ })
58
+ ```
59
+
60
+ ```typescript
61
+ import { Mastra } from '@mastra/core'
62
+ import { workspace } from './workspace'
63
+
64
+ export const mastra = new Mastra({
65
+ workspace,
66
+ })
67
+ ```
68
+
69
+ `PlatformFilesystem` and `PlatformSandbox` read their credentials from environment variables the platform injects at deploy time, so you don't pass any options on the platform.
70
+
71
+ ## Injected environment variables
72
+
73
+ Every deploy that runs on a platform environment with a workspace receives these variables:
74
+
75
+ | Variable | Contents |
76
+ | ------------------------------ | ---------------------------------------------------------------------------------------------------- |
77
+ | `MASTRA_PLATFORM_ACCESS_TOKEN` | Access token scoped to the deploy. Used by the workspace providers to authenticate. |
78
+ | `MASTRA_PROJECT_ID` | Project the deploy belongs to. |
79
+ | `MASTRA_ENVIRONMENT_ID` | Environment the deploy belongs to. Selects which sandbox pool the platform uses. |
80
+ | `MASTRA_PLATFORM_BUCKET_NAME` | Bucket name attached to the environment. Selects which bucket `PlatformFilesystem` reads and writes. |
81
+
82
+ These names are reserved. If your project sets any of them explicitly, the platform-managed values take precedence.
83
+
84
+ ## Local development
85
+
86
+ Reuse the same providers locally by putting the four variables in your `.env` file. Get the values from your project's Workspaces tab:
87
+
88
+ ```bash
89
+ MASTRA_PLATFORM_ACCESS_TOKEN=your-access-token
90
+ MASTRA_PROJECT_ID=your-project-id
91
+ MASTRA_ENVIRONMENT_ID=your-environment-id
92
+ MASTRA_PLATFORM_BUCKET_NAME=your-bucket-name
93
+ ```
94
+
95
+ `PlatformFilesystem` and `PlatformSandbox` behave the same locally as on the platform — they connect to the same bucket and sandbox pool for that environment. Use a `staging` or `preview` environment's variables for local runs if you want to keep production data isolated.
96
+
97
+ For a purely offline loop that never touches the platform, swap the providers for [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem) and [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox) in a local build.
98
+
99
+ ## Inspect the workspace
100
+
101
+ The Workspaces tab in your platform project shows, per environment:
102
+
103
+ - Bucket status and its contents, with upload, download, and delete actions.
104
+ - Recent sandbox sessions with their command, exit code, and duration.
105
+ - Provisioning failures with a **Retry** action.
106
+
107
+ ## See also
108
+
109
+ - [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem) — reference for the filesystem provider.
110
+ - [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox) — reference for the sandbox provider.
111
+ - [Environments](https://mastra.ai/docs/mastra-platform/environments) — how environments scope workspaces, variables, and databases.
@@ -64,7 +64,7 @@ export const testMcpClient = new MCPClient({
64
64
 
65
65
  Visit [MCPClient](https://mastra.ai/reference/tools/mcp-client) for a full list of configuration options.
66
66
 
67
- > **Authentication:** For connecting to OAuth-protected MCP servers, see the [OAuth Authentication](https://mastra.ai/reference/tools/mcp-client) section.
67
+ > **Authentication:** For connecting to OAuth-protected MCP servers — including completing the browser-based authorization flow with `authenticate()` — see the [OAuth Authentication](https://mastra.ai/reference/tools/mcp-client) section.
68
68
 
69
69
  ## Using `MCPClient` with an agent
70
70
 
@@ -58,7 +58,7 @@ import { Memory } from '@mastra/memory'
58
58
  import { LibSQLStore } from '@mastra/libsql'
59
59
 
60
60
  const memory = new Memory({
61
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
61
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
62
62
  options: {
63
63
  lastMessages: 20,
64
64
  },
@@ -128,7 +128,7 @@ import { Memory } from '@mastra/memory'
128
128
  import { LibSQLStore } from '@mastra/libsql'
129
129
 
130
130
  const memory = new Memory({
131
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
131
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
132
132
  options: {
133
133
  lastMessages: 20,
134
134
  },
@@ -148,7 +148,7 @@ import { Memory } from '@mastra/memory'
148
148
  import { LibSQLStore } from '@mastra/libsql'
149
149
 
150
150
  const memory = new Memory({
151
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
151
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
152
152
  options: {
153
153
  lastMessages: 20,
154
154
  observationalMemory: true,
@@ -171,7 +171,7 @@ import { Memory } from '@mastra/memory'
171
171
  import { LibSQLStore } from '@mastra/libsql'
172
172
 
173
173
  const memory = new Memory({
174
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
174
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
175
175
  options: {
176
176
  lastMessages: 20,
177
177
  workingMemory: {
@@ -8,7 +8,7 @@ Observational Memory (OM) is Mastra's memory system for long-context agentic mem
8
8
 
9
9
  ## Quickstart
10
10
 
11
- Enable `observationalMemory` in the memory options when creating your agent:
11
+ Ensure you have `@mastra/memory` installed in your project. Set `observationalMemory: true` in your Memory config to enable Observational Memory.
12
12
 
13
13
  ```typescript
14
14
  import { Memory } from '@mastra/memory'
@@ -27,7 +27,54 @@ export const agent = new Agent({
27
27
  })
28
28
  ```
29
29
 
30
- That's it. The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses `google/gemini-2.5-flash` by default. Config objects also use this model unless you set a different one. To use a different model, pass it in the config object:
30
+ **For AI agents:** Using Observational Memory requires a storage provider! You either need to set it on the Mastra instance at `src/mastra/index.ts` or pass it to the Agent constructor.
31
+
32
+ The following script creates a local LibSQL database, enables Observational Memory, and uses one resource and thread across two agent calls:
33
+
34
+ ```typescript
35
+ import { Agent } from '@mastra/core/agent'
36
+ import { LibSQLStore } from '@mastra/libsql'
37
+ import { Memory } from '@mastra/memory'
38
+
39
+ const memory = new Memory({
40
+ storage: new LibSQLStore({
41
+ id: 'memory-storage',
42
+ url: 'file:./memory.db',
43
+ }),
44
+ options: {
45
+ observationalMemory: {
46
+ model: 'openai/gpt-5-mini',
47
+ },
48
+ },
49
+ })
50
+
51
+ const agent = new Agent({
52
+ id: 'memory-agent',
53
+ name: 'Memory Agent',
54
+ instructions: 'You are a helpful assistant.',
55
+ model: 'openai/gpt-5-mini',
56
+ memory,
57
+ })
58
+
59
+ const memoryOptions = {
60
+ resource: 'user-123',
61
+ thread: 'conversation-123',
62
+ }
63
+
64
+ const firstResponse = await agent.generate('Remember that my favorite color is blue.', {
65
+ memory: memoryOptions,
66
+ })
67
+ console.log(firstResponse.text)
68
+
69
+ const secondResponse = await agent.generate('What is my favorite color?', {
70
+ memory: memoryOptions,
71
+ })
72
+ console.log(secondResponse.text)
73
+ ```
74
+
75
+ The `resource` identifies the user or entity, while the `thread` identifies the conversation. Reuse both values to continue the same conversation. Observational Memory processes the stored history as it grows and replaces older messages with observations when its activation conditions are met.
76
+
77
+ The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses `google/gemini-2.5-flash` by default. To use a different model, pass it in the config object:
31
78
 
32
79
  ```typescript
33
80
  const memory = new Memory({
@@ -47,7 +94,7 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
47
94
  >
48
95
  > For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/guides/build-your-ui/ai-sdk-ui).
49
96
 
50
- > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, and `@mastra/mongodb` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
97
+ > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mongodb`, and `@mastra/convex` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
51
98
 
52
99
  ## Temporal gap markers
53
100
 
@@ -237,6 +284,34 @@ new Extractor({
237
284
  })
238
285
  ```
239
286
 
287
+ #### Read extracted values from a stream
288
+
289
+ Extractor results are emitted when OM completes an observation or reflection. Read both completion data parts from the stream:
290
+
291
+ ```typescript
292
+ const stream = await agent.stream('Remember that I prefer dark mode.')
293
+
294
+ for await (const chunk of stream.fullStream) {
295
+ if (chunk.type === 'data-om-observation-end' || chunk.type === 'data-om-buffering-end') {
296
+ const { operationType, extractedValues = {}, extractionFailures = [] } = chunk.data
297
+
298
+ for (const [slug, value] of Object.entries(extractedValues)) {
299
+ console.log(`${operationType} extractor ${slug}:`, value)
300
+ }
301
+
302
+ for (const failure of extractionFailures) {
303
+ console.error(`Extractor ${failure.slug} failed:`, failure.error)
304
+ }
305
+ }
306
+ }
307
+ ```
308
+
309
+ `extractedValues` uses each extractor's slug as its key. Both result fields are optional, and a failed extractor doesn't remove values from successful extractors.
310
+
311
+ `data-om-observation-end` reports a synchronous completion. `data-om-buffering-end` reports completed background work. Its extractor metadata is persisted immediately, but the buffered content remains inactive until activation. Check `operationType` to determine whether the completed work was an observation or reflection.
312
+
313
+ See the [`data-om-observation-end`](https://mastra.ai/reference/memory/observational-memory) and [`data-om-buffering-end`](https://mastra.ai/reference/memory/observational-memory) reference tables for the complete payloads.
314
+
240
315
  ### Working memory updates
241
316
 
242
317
  Use `observationalMemory.observation.manageWorkingMemory` to let the Observer manage working memory automatically. The main agent no longer needs to call the working memory tool while it handles the user request, so working memory updates don't depend on the agent remembering to make them.
@@ -81,6 +81,8 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
81
81
 
82
82
  3. Add the storage provider to your main Mastra instance to enable memory across all configured agents.
83
83
 
84
+ **For AI agents:** Important: Add `id` to `LibSQLStore`.
85
+
84
86
  ```typescript
85
87
  import { Mastra } from '@mastra/core'
86
88
  import { LibSQLStore } from '@mastra/libsql'
@@ -151,6 +153,8 @@ To list all threads for a resource, or retrieve a specific thread, [use the memo
151
153
 
152
154
  For long-running conversations, raw message history grows until it fills the context window, degrading agent performance. [Observational Memory](https://mastra.ai/docs/memory/observational-memory) solves this by running background agents that compress old messages into dense observations, keeping the context window small while preserving long-term memory.
153
155
 
156
+ **For AI agents:** Using Observational Memory requires a storage provider! You either need to set it on the Mastra instance at `src/mastra/index.ts` or pass it to the Agent constructor.
157
+
154
158
  ```typescript
155
159
  import { Agent } from '@mastra/core/agent'
156
160
  import { Memory } from '@mastra/memory'
@@ -403,7 +403,7 @@ By default, working memory reaches the model as part of the system message. You
403
403
 
404
404
  ```typescript
405
405
  const memory = new Memory({
406
- storage: new LibSQLStore({ url: 'file:./mastra.db' }),
406
+ storage: new LibSQLStore({ id: 'mastra-storage', url: 'file:./mastra.db' }),
407
407
  options: {
408
408
  workingMemory: {
409
409
  enabled: true,
@@ -126,9 +126,7 @@ export const mastra = new Mastra({
126
126
  },
127
127
  },
128
128
  }),
129
- agents: {
130
- /* your agents */
131
- },
129
+ agents: {/* your agents */},
132
130
  })
133
131
  ```
134
132
 
@@ -109,10 +109,38 @@ new BraintrustExporter({
109
109
 
110
110
  ## Attach traces to Braintrust evals
111
111
 
112
+ Install the Braintrust SDK directly when your application uses `Eval()`, `logger.traced()`, or `currentSpan`:
113
+
114
+ **npm**:
115
+
116
+ ```bash
117
+ npm install braintrust@latest
118
+ ```
119
+
120
+ **pnpm**:
121
+
122
+ ```bash
123
+ pnpm add braintrust@latest
124
+ ```
125
+
126
+ **Yarn**:
127
+
128
+ ```bash
129
+ yarn add braintrust@latest
130
+ ```
131
+
132
+ **Bun**:
133
+
134
+ ```bash
135
+ bun add braintrust@latest
136
+ ```
137
+
112
138
  When you run Mastra inside Braintrust `Eval()` or `logger.traced()`, pass the Braintrust logger and `currentSpan` resolver to the exporter. Import `currentSpan` from the same `braintrust` package instance that creates the eval or traced span.
113
139
 
114
140
  This helps Mastra attach its spans under the active Braintrust span when your app and `@mastra/braintrust` resolve different installed copies of the Braintrust SDK.
115
141
 
142
+ The exporter accepts compatible logger and span objects from Braintrust SDK v2 and v3. Your application's Braintrust SDK version doesn't need to match the version installed by `@mastra/braintrust`.
143
+
116
144
  ```typescript
117
145
  import { currentSpan, initLogger } from 'braintrust'
118
146
  import { BraintrustExporter } from '@mastra/braintrust'
@@ -144,15 +172,19 @@ await Eval('my-project', {
144
172
  })
145
173
  ```
146
174
 
175
+ If your application upgrades its direct Braintrust dependency from v2 to v3 and uses Nunjucks prompt templates, follow the [Braintrust v2 to v3 migration guide](https://www.braintrust.dev/docs/sdks/typescript/migrations/v2-to-v3).
176
+
147
177
  ## Querying Braintrust with returned `spanId`
148
178
 
149
- For Braintrust, use `spanId` as the root span identifier when searching for traces because Braintrust root-span queries are typically faster than trace-id queries.
179
+ Mastra uses its returned `spanId` as both the Braintrust row ID and span ID. Use it to find the corresponding Braintrust span by `id` or `span_id`.
180
+
181
+ Braintrust v3 stores a separate W3C trace ID in `root_span_id`, so the returned Mastra `spanId` isn't the Braintrust `root_span_id`.
150
182
 
151
183
  ```typescript
152
184
  const result = await agent.stream('Summarize this ticket')
153
185
 
154
186
  console.log('Mastra trace ID:', result.traceId)
155
- console.log('Braintrust root span ID:', result.spanId)
187
+ console.log('Braintrust row and span ID:', result.spanId)
156
188
 
157
189
  // Use result.spanId in your Braintrust lookup/query path
158
190
  ```
@@ -425,9 +425,7 @@ To disable a signal, set the `signals` option:
425
425
 
426
426
  ```typescript
427
427
  new OtelExporter({
428
- provider: {
429
- /* ... */
430
- },
428
+ provider: {/* ... */},
431
429
  signals: {
432
430
  traces: true, // default
433
431
  logs: false, // disable log export
@@ -74,9 +74,7 @@ Add custom headers using the `headers` option:
74
74
 
75
75
  ```typescript
76
76
  new SimpleAuth({
77
- tokens: {
78
- /* ... */
79
- },
77
+ tokens: {/* ... */},
80
78
  headers: ['X-API-Key', 'X-Custom-Auth'],
81
79
  })
82
80
  ```
@@ -247,6 +247,8 @@ auth: {
247
247
  }
248
248
  ```
249
249
 
250
+ When the resource ID is derived this way, clients can omit `memory.resource` from agent generate and stream request bodies — the server-derived value is used instead (and always takes precedence over any client-provided value). If a request uses memory and neither the body nor the request context provides a resource ID, the server responds with a 400 error.
251
+
250
252
  You can also set these keys manually in middleware:
251
253
 
252
254
  ```typescript
@@ -91,6 +91,8 @@ See [request context](https://mastra.ai/docs/server/request-context) for configu
91
91
 
92
92
  ## Evaluation
93
93
 
94
+ Use the date filter to limit score metrics to a preset or custom time range.
95
+
94
96
  ### Scorers
95
97
 
96
98
  The Scorers tab displays the results of your agent's scorers as they run. When messages pass through your agent, the defined scorers evaluate each output asynchronously and render their results here. This allows you to understand how your scorers respond to different interactions, compare performance across test cases, and identify areas for improvement.
@@ -360,7 +360,7 @@ import { LibSQLStore } from '@mastra/libsql'
360
360
  import { Observability, MastraStorageExporter } from '@mastra/observability'
361
361
 
362
362
  export const mastra = new Mastra({
363
- storage: new LibSQLStore({ url: 'file:./voice-agent.db' }),
363
+ storage: new LibSQLStore({ id: 'voice-agent-storage', url: 'file:./voice-agent.db' }),
364
364
  observability: new Observability({
365
365
  configs: {
366
366
  default: {
@@ -591,9 +591,7 @@ const embedStep = createStep({
591
591
  inputSchema: z.object({ chunk: z.string() }),
592
592
  outputSchema: z.object({ embedding: z.array(z.number()) }),
593
593
  execute: async ({ inputData }) => ({
594
- embedding: [
595
- /* vector embedding */
596
- ],
594
+ embedding: [/* vector embedding */],
597
595
  }),
598
596
  })
599
597
 
@@ -23,6 +23,7 @@ Available providers:
23
23
  - [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem): Stores files in a directory on disk
24
24
  - [`S3Filesystem`](https://mastra.ai/reference/workspace/s3-filesystem): Stores files in Amazon S3 or S3-compatible storage (R2, MinIO, Tigris)
25
25
  - [`GCSFilesystem`](https://mastra.ai/reference/workspace/gcs-filesystem): Stores files in Google Cloud Storage
26
+ - [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem): Stores files in a Mastra Platform workspace bucket
26
27
  - [`GoogleDriveFilesystem`](https://mastra.ai/reference/workspace/google-drive-filesystem): Stores files inside a Google Drive folder
27
28
  - [`AzureBlobFilesystem`](https://mastra.ai/reference/workspace/azure-blob-filesystem): Stores files in Azure Blob Storage
28
29
  - [`FilesSDKFilesystem`](https://mastra.ai/reference/workspace/files-sdk-filesystem): Stores files in any [FilesSDK](https://files-sdk.dev) adapter (S3, R2, GCS, Azure Blob, Vercel Blob, local filesystem, and more) — useful when you want one provider that can target multiple backends
@@ -26,6 +26,7 @@ A sandbox provider executes commands in a controlled environment:
26
26
  - [`DaytonaSandbox`](https://mastra.ai/reference/workspace/daytona-sandbox): Executes commands in isolated Daytona cloud sandboxes
27
27
  - [`E2BSandbox`](https://mastra.ai/reference/workspace/e2b-sandbox): Executes commands in isolated E2B cloud sandboxes
28
28
  - [`ModalSandbox`](https://mastra.ai/reference/workspace/modal-sandbox): Executes commands in isolated Modal cloud sandboxes
29
+ - [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox): Executes commands in a sandbox tied to a Mastra Platform environment
29
30
  - [`RailwaySandbox`](https://mastra.ai/reference/workspace/railway-sandbox): Executes commands in ephemeral, isolated Railway cloud sandboxes
30
31
 
31
32
  ## Basic usage
@@ -1134,6 +1134,7 @@ import { LibSQLStore } from '@mastra/libsql'
1134
1134
  export const mastra = new Mastra({
1135
1135
  workflows: { approvalWorkflow },
1136
1136
  storage: new LibSQLStore({
1137
+ id: 'mastra-storage',
1137
1138
  url: 'file:../mastra.db',
1138
1139
  }),
1139
1140
  server: {
@@ -26,6 +26,7 @@ import { LibSQLStore } from '@mastra/libsql'
26
26
 
27
27
  export const mastra = new Mastra({
28
28
  storage: new LibSQLStore({
29
+ id: 'mastra-storage',
29
30
  url: 'file:./mastra.db',
30
31
  }),
31
32
  })
@@ -133,6 +134,7 @@ import { devAgent } from './agents/dev-agent'
133
134
  export const mastra = new Mastra({
134
135
  agents: { devAgent },
135
136
  storage: new LibSQLStore({
137
+ id: 'mastra-storage',
136
138
  url: 'file:./mastra.db',
137
139
  }),
138
140
  })
@@ -245,9 +245,7 @@ The following options are available in the standard `.stream()` and `generate()`
245
245
  const result = await agent.stream(messages, {
246
246
  prepareStep: ({ step, state }) => {
247
247
  console.log('About to execute step:', step)
248
- return {
249
- /* modified state */
250
- }
248
+ return {/* modified state */}
251
249
  },
252
250
  })
253
251
  ```
@@ -132,6 +132,7 @@ List of required environment variables for each model provider and gateway suppo
132
132
  | [Tencent Token Plan](https://mastra.ai/models/providers/tencent-token-plan) | `tencent-token-plan/*` | `TENCENT_TOKEN_PLAN_API_KEY` |
133
133
  | [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub) | `tencent-tokenhub/*` | `TENCENT_TOKENHUB_API_KEY` |
134
134
  | [The Grid AI](https://mastra.ai/models/providers/the-grid-ai) | `the-grid-ai/*` | `THEGRIDAI_API_KEY` |
135
+ | [Thinking Machines](https://mastra.ai/models/providers/thinkingmachines) | `thinkingmachines/*` | `TINKER_API_KEY` |
135
136
  | [Tinfoil](https://mastra.ai/models/providers/tinfoil) | `tinfoil/*` | `TINFOIL_API_KEY` |
136
137
  | [Together AI](https://mastra.ai/models/providers/togetherai) | `togetherai/*` | `TOGETHER_API_KEY` |
137
138
  | [TrustedRouter](https://mastra.ai/models/providers/trustedrouter) | `trustedrouter/*` | `TRUSTEDROUTER_API_KEY` |