@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
@@ -53,14 +53,12 @@ const agent = new Agent({
53
53
  id: 'my-agent',
54
54
  name: 'my-agent',
55
55
  model: 'openai/gpt-5-nano',
56
- processors: {
57
- input: [
58
- new RegexFilterProcessor({
59
- presets: ['pii', 'secrets'],
60
- strategy: 'block',
61
- }),
62
- ],
63
- },
56
+ inputProcessors: [
57
+ new RegexFilterProcessor({
58
+ presets: ['pii', 'secrets'],
59
+ strategy: 'block',
60
+ }),
61
+ ],
64
62
  })
65
63
  ```
66
64
 
@@ -80,6 +78,8 @@ const agent = new Agent({
80
78
 
81
79
  **phase** (`'input' | 'output' | 'all'`): Phases to apply the filter. 'input' filters input messages. 'output' filters output stream and result. 'all' filters both. (Default: `'all'`)
82
80
 
81
+ **includeRedactedValues** (`boolean`): Include the text that was redacted in each report entry. Off by default, because the values are the data the processor removes. (Default: `false`)
82
+
83
83
  ## Returns
84
84
 
85
85
  **id** (`'regex-filter'`): Processor identifier.
@@ -106,4 +106,76 @@ When the `block` strategy is active (default), `RegexFilterProcessor` throws a `
106
106
  | --------- | ------------------------------------------------ | ---------------------------------------------- |
107
107
  | `pii` | Emails, phone numbers, SSNs, credit card numbers | `[EMAIL]`, `[PHONE]`, `[SSN]`, `[CREDIT_CARD]` |
108
108
  | `secrets` | API keys, bearer tokens, AWS access keys | `[API_KEY]`, `[BEARER_TOKEN]`, `[AWS_KEY]` |
109
- | `urls` | HTTP/HTTPS URLs | `[URL]` |
109
+ | `urls` | HTTP/HTTPS URLs | `[URL]` |
110
+
111
+ ## Redaction behavior
112
+
113
+ Every rule is matched independently, so two rules can claim text that overlaps. A card number written without separators matches both `phone` and `credit-card`, for example. Overlapping matches are combined into a single region and replaced once, using the replacement of the longest match.
114
+
115
+ ```typescript
116
+ const filter = new RegexFilterProcessor({
117
+ presets: ['pii'],
118
+ strategy: 'redact',
119
+ })
120
+
121
+ // "Charge 4111111111111111 today" becomes "Charge [CREDIT_CARD] today"
122
+ ```
123
+
124
+ A replacement string can reference capture groups with `$1` or `$&`. Those references resolve for a single match whose pattern also matches the matched text on its own. In a combined region, or for a rule anchored on its surroundings with a lookbehind or lookahead, the replacement string is inserted as written. The region is redacted either way.
125
+
126
+ ## Redaction reporting
127
+
128
+ The `redact` strategy rewrites text in place, so nothing downstream can tell what changed. Assign `onViolation` to record it. The processor calls it once per redacted message, message part, or stream chunk, and offsets are relative to that piece of text. Async callbacks are awaited, and errors are caught so an unavailable audit sink can't fail the request.
129
+
130
+ ```typescript
131
+ import { RegexFilterProcessor, type RegexRedactionDetail } from '@mastra/core/processors'
132
+
133
+ const filter = new RegexFilterProcessor({
134
+ presets: ['pii'],
135
+ strategy: 'redact',
136
+ })
137
+
138
+ filter.onViolation = async ({ detail }) => {
139
+ const redaction = detail as RegexRedactionDetail
140
+
141
+ for (const entry of redaction.redactions) {
142
+ await auditLog.write({
143
+ phase: redaction.phase,
144
+ messageId: redaction.messageId,
145
+ rule: entry.rule,
146
+ offset: entry.index,
147
+ length: entry.length,
148
+ })
149
+ }
150
+ }
151
+ ```
152
+
153
+ The callback is awaited, including in `processOutputStream`, where it runs for every chunk that contains a match. Keep the callback fast, or hand the work to a queue, so a slow audit sink doesn't stall a streaming response. With no callback attached, the `redact` path stays synchronous.
154
+
155
+ The `block` strategy reports through the same callback. There the processor runner invokes it when it catches the `TripWire`, so `detail` holds the tripwire metadata described under [Error behavior](#error-behavior) rather than the shape below.
156
+
157
+ `detail` for a redaction is a `RegexRedactionDetail`:
158
+
159
+ **strategy** (`'redact'`): Distinguishes a redaction report from the block strategy payload.
160
+
161
+ **phase** (`'processInput' | 'processOutputStream' | 'processOutputResult'`): Processor method that applied the redactions.
162
+
163
+ **messageId** (`string`): Id of the message the text came from. Absent for stream chunks.
164
+
165
+ **partIndex** (`number`): Index of the redacted part in the message's parts array, which also contains non-text parts. Absent for string content and stream chunks.
166
+
167
+ **redactions** (`RegexRedaction[]`): Redactions in the order they appear in the text.
168
+
169
+ **redactions.rule** (`string`): Name of the rule whose replacement was used.
170
+
171
+ **redactions.index** (`number`): Start offset of the redacted span in the text.
172
+
173
+ **redactions.length** (`number`): Length of the redacted span.
174
+
175
+ **redactions.replacement** (`string`): Text that replaced the span.
176
+
177
+ **redactions.overlappingRules** (`string[]`): Names of all rules that matched this span, set only when more than one overlapped.
178
+
179
+ **redactions.value** (`string`): The text that was redacted. Set only when includeRedactedValues is enabled.
180
+
181
+ Values are left out by default. An audit trail that copies the data it protects widens the exposure it was added to narrow. Set `includeRedactedValues` only when the destination is as protected as the original, and note that the `block` strategy also withholds matched text from its `TripWire` metadata for the same reason.
@@ -44,12 +44,26 @@ const processor = new TokenLimiterProcessor({
44
44
 
45
45
  **processInputStep** (`(args: ProcessInputStepArgs) => Promise<void>`): Prunes messages at each step of the agentic loop (including tool call continuations) to keep the conversation within the token limit. Mutates the messageList directly by removing oldest messages first while preserving system messages.
46
46
 
47
- **processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record<string, any>; abort: (reason?: string) => never }) => Promise<ChunkType | null>`): Processes streaming output parts to limit token count during streaming
47
+ **processOutputStream** (`(args: ProcessOutputStreamArgs) => Promise<ChunkType | null>`): Processes streaming output parts to limit token count during streaming. Only text and object parts count against the limit and can be withheld; lifecycle, reasoning and tool parts always pass through.
48
48
 
49
49
  **processOutputResult** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => Promise<MastraDBMessage[]>`): Processes final output results to limit token count in non-streaming scenarios
50
50
 
51
51
  **getMaxTokens** (`() => number`): Get the maximum token limit
52
52
 
53
+ ## Output stream behavior
54
+
55
+ As an output processor, only parts that carry generated output count against the limit: `text-delta` and `object`. Lifecycle parts (such as `step-start`), reasoning deltas, response metadata, and tool parts (`tool-call`, `tool-result`) are neither counted nor withheld, so tool calls always reach the agentic loop and get executed.
56
+
57
+ With the default `truncate` strategy, the first time output is withheld the processor emits a transient `data-token-limit-reached` part on the stream:
58
+
59
+ ```typescript
60
+ for await (const part of stream.fullStream) {
61
+ if (part.type === 'data-token-limit-reached') {
62
+ console.log('output truncated at', part.data.limit, 'tokens')
63
+ }
64
+ }
65
+ ```
66
+
53
67
  ## Error behavior
54
68
 
55
69
  When used as an input processor (both `processInput` and `processInputStep`), `TokenLimiterProcessor` throws a `TripWire` error in the following cases:
@@ -44,7 +44,7 @@ Mastra recommends organizing your code into the following folders:
44
44
 
45
45
  Mastra has two special folder conventions:
46
46
 
47
- - `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [File-based Agents](https://mastra.ai/docs/getting-started/file-based-agents) docs.
47
+ - `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [File-based Agents](https://mastra.ai/docs/getting-started/develop) docs.
48
48
  - `src/mastra/public`: Contents are copied into the `.build/output` directory during the build process, making them available for serving at runtime.
49
49
 
50
50
  ### Top-level files
@@ -275,5 +275,5 @@ const vectorTool = createVectorQueryTool({
275
275
  ## Related
276
276
 
277
277
  - [createVectorQueryTool()](https://mastra.ai/reference/tools/vector-query-tool)
278
- - [Hybrid Vector Search](https://mastra.ai/docs/rag/retrieval)
278
+ - [Hybrid Vector Search](https://mastra.ai/guides/rag/retrieval)
279
279
  - [Metadata Filters](https://mastra.ai/reference/rag/metadata-filters)
@@ -188,6 +188,8 @@ export const mastra = new Mastra({
188
188
 
189
189
  **default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in domains will use this storage's domains as fallbacks.
190
190
 
191
+ **editor** (`MastraCompositeStore`): Storage adapter for Editor-owned domains, including agents, prompt blocks, scorers, MCP clients and servers, workspaces, and skills. Takes precedence over default storage but not explicit domain overrides.
192
+
191
193
  **disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
192
194
 
193
195
  **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage. Set a domain to false to disable it entirely; a disabled domain does not fall back to editor or default.
@@ -214,7 +214,7 @@ const stream = await agent.stream('message for agent')
214
214
 
215
215
  **options.tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
216
216
 
217
- **options.versions** (`VersionOverrides`): Per-invocation version overrides for sub-agent delegation. Merged on top of Mastra instance-level versions and propagated automatically through sub-agent calls via requestContext. Requires the editor package. See Sub-agent versioning.
217
+ **options.versions** (`VersionOverrides`): Per-invocation version overrides for sub-agent delegation. Merged on top of Mastra instance-level versions and propagated automatically through sub-agent calls via requestContext. Requires the editor package. See Editor versioning.
218
218
 
219
219
  **options.versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors.
220
220
 
@@ -34,7 +34,7 @@ yarn add @mastra/isolated-vm
34
34
  bun add @mastra/isolated-vm
35
35
  ```
36
36
 
37
- `isolated-vm` is a native addon. It ships prebuilt binaries for common platforms, so installation usually needs no extra setup. A C++ toolchain is only needed on platforms without a matching prebuild, where it falls back to compiling from source.
37
+ `isolated-vm` is a native addon. It provides prebuilt binaries for common platforms, so installation usually needs no extra setup. A C++ toolchain is only needed on platforms without a matching prebuild, where it falls back to compiling from source.
38
38
 
39
39
  On Node.js 20 and later, the host process must be started with the `--no-node-snapshot` flag, otherwise creating an isolate crashes the process. The constructor throws an error when the flag is missing. Pass the flag when starting your server, or set it through `NODE_OPTIONS`:
40
40
 
@@ -109,7 +109,7 @@ Waits for an index to become ready after creation. Useful when you need to ensur
109
109
 
110
110
  ### `upsert()`
111
111
 
112
- Adds or updates vectors and their metadata in the collection. On a bring-your-own index this requires `allowWrites: true` at `createIndex()` time BYO collections are read-only by default.
112
+ Adds or updates vectors and their metadata in the collection. On a bring-your-own index, this requires `allowWrites: true` at `createIndex()` time because BYO collections are read-only by default.
113
113
 
114
114
  **indexName** (`string`): Name of the collection to insert into
115
115
 
@@ -148,12 +148,12 @@ Provisions an Atlas Search (BM25/full-text) index on the collection backing an i
148
148
  **Managed vs. bring-your-own collections:**
149
149
 
150
150
  - For a **managed** index (created without `collectionName`), `createIndex()` already provisions a _dynamic_ full-text index named `${collectionName}_search_index` (covering all string fields). `createSearchIndex()` is therefore only needed when you want a **field-restricted** mapping or a **custom index name**.
151
- - For a **bring-your-own** index (created with `collectionName`), `createIndex()` does **not** auto-create any full-text index enabling `textQuery()`/`hybridQuery()` on a caller-owned operational collection is **opt-in**. Call `createSearchIndex()` explicitly to provision the (billable) text index; until you do, `textQuery()`/`hybridQuery()` throw a clear error rather than querying a non-existent index.
151
+ - For a **bring-your-own** index (created with `collectionName`), `createIndex()` doesn't auto-create any full-text index. Enabling `textQuery()`/`hybridQuery()` on a caller-owned operational collection is opt-in. Call `createSearchIndex()` explicitly to provision the (billable) text index. Until you do, `textQuery()`/`hybridQuery()` throw a clear error rather than querying a non-existent index.
152
152
 
153
153
  Naming:
154
154
 
155
- - When `fields` is provided **without** an explicit `searchIndexName`, the field-mapped index is created under a **distinct** default name (`${collectionName}_${indexName}_search_fields_index`, unique per logical index) so it does not collide with — and get silently ignored by — a managed collection's auto-created dynamic index. This distinct index is persisted as the text-search index, so `textQuery()`/`hybridQuery()` use the restricted mapping automatically.
156
- - When `searchIndexName` is provided, that exact name is used and persisted. `textQuery()`/`hybridQuery()` resolve the persisted name automatically; you can also override the name per call via their `searchIndexName` / `textSearchIndexName` parameters.
155
+ - When `fields` is provided **without** an explicit `searchIndexName`, the field-mapped index is created under a **distinct** default name (`${collectionName}_${indexName}_search_fields_index`, unique per logical index) so it doesn't collide with a managed collection's auto-created dynamic index and get silently ignored. This distinct index is persisted as the text-search index, so `textQuery()`/`hybridQuery()` use the restricted mapping automatically.
156
+ - When `searchIndexName` is provided, that exact name is used and persisted. `textQuery()`/`hybridQuery()` resolve the persisted name automatically. You can also override the name per call via their `searchIndexName` / `textSearchIndexName` parameters.
157
157
 
158
158
  **indexName** (`string`): Name of the Mastra index whose collection will have the search index
159
159
 
@@ -170,7 +170,7 @@ await store.createSearchIndex({
170
170
  })
171
171
  ```
172
172
 
173
- > **Note:** 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`).
173
+ 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`).
174
174
 
175
175
  ### `waitForSearchIndexReady()`
176
176
 
@@ -193,7 +193,7 @@ await store.waitForSearchIndexReady({ indexName: 'precedents' })
193
193
 
194
194
  Runs a full-text (BM25) search against an Atlas Search index. By default it targets the text-search index recorded for this index (set by `createSearchIndex()`, or the dynamic `${collectionName}_search_index` auto-created by `createIndex()`). Pass `searchIndexName` to target a specific index for this call.
195
195
 
196
- **Note:** metadata filters here (like `hybridQuery()`) are applied via a `$match` stage. For the vector branch of `hybridQuery()`, filters on fields not declared via `filterFields` at index creation are transparently materialised as candidate `_id`s (the same fallback `query()` uses), so undeclared-field filters do not error.
196
+ Metadata filters here (like `hybridQuery()`) are applied via a `$match` stage. For the vector branch of `hybridQuery()`, filters on fields not declared via `filterFields` at index creation are transparently materialised as candidate `_id`s (the same fallback `query()` uses), so undeclared-field filters don't error.
197
197
 
198
198
  **indexName** (`string`): Name of the Mastra index to search
199
199
 
@@ -220,7 +220,7 @@ const results = await store.textQuery({
220
220
 
221
221
  ### `hybridQuery()`
222
222
 
223
- Runs a hybrid search that fuses vector similarity and full-text results using MongoDB's server-side `$rankFusion` (requires MongoDB >= 8.0; generally available from 8.1, and on 8.0.x it may need a MongoDB support case to enable it runs where enabled, e.g. Atlas 8.0.x). A full-text search index must exist: it is auto-created for managed indexes, but for a bring-your-own collection you must call `createSearchIndex()` first (opt-in).
223
+ Runs a hybrid search that fuses vector similarity and full-text results using MongoDB's server-side `$rankFusion`. It requires MongoDB >= 8.0 and is generally available from 8.1. On 8.0.x, it may need a MongoDB support case to enable, and it runs where enabled, such as Atlas 8.0.x. A full-text search index must exist: it's auto-created for managed indexes, but for a bring-your-own collection you must call `createSearchIndex()` first (opt-in).
224
224
 
225
225
  **indexName** (`string`): Name of the Mastra index to search
226
226
 
@@ -253,7 +253,7 @@ const results = await store.hybridQuery({
253
253
  })
254
254
  ```
255
255
 
256
- **Note:** `hybridQuery()` requires MongoDB >= 8.0 for the `$rankFusion` stage (generally available from 8.1; on 8.0.x it may need a MongoDB support case to enable, and runs where enabled, such as Atlas 8.0.x). If you're running an older version, or `$rankFusion` is not enabled on your 8.0.x deployment, use `query()` and `textQuery()` separately and merge the results client-side.
256
+ `hybridQuery()` requires MongoDB >= 8.0 for the `$rankFusion` stage. The stage is generally available from 8.1. On 8.0.x, it may need a MongoDB support case to enable and runs where enabled, such as Atlas 8.0.x. If you're running an older version, or `$rankFusion` isn't enabled on your 8.0.x deployment, use `query()` and `textQuery()` separately and merge the results client-side.
257
257
 
258
258
  ### `describeIndex()`
259
259
 
@@ -276,15 +276,15 @@ interface IndexStats {
276
276
  Deletes a vector index. Behavior depends on how the index was created:
277
277
 
278
278
  - **Managed index** (created without `collectionName`): drops the entire collection and all its data.
279
- - **Bring-your-own index** (created with `collectionName`): drops the Atlas vectorSearch index **and**, if one was provisioned via `createSearchIndex()`, the companion full-text search index. The caller's operational collection and its documents are **preserved** this store never drops a collection it did not create.
279
+ - **Bring-your-own index** (created with `collectionName`): drops the Atlas vectorSearch index and, if one was provisioned via `createSearchIndex()`, the companion full-text search index. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
280
280
 
281
- The BYO classification is recorded durably when the index is created, so it is 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.
281
+ 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.
282
282
 
283
283
  **indexName** (`string`): Logical name of the index to delete
284
284
 
285
285
  ### `listIndexes()`
286
286
 
287
- Lists the **logical** Mastra index names (the `indexName` values passed to `createIndex`), not physical collection names. For a bring-your-own index whose data lives in an operational collection, the logical index name is returned never the physical collection name so the value can be passed straight back into `deleteIndex()` / `describeIndex()`. Managed indexes created before durable metadata was introduced are still discovered via their `${name}_vector_index` search index. The internal registry collection is never listed.
287
+ Lists the **logical** Mastra index names (the `indexName` values passed to `createIndex`), not physical collection names. For a bring-your-own index whose data lives in an operational collection, the logical index name is returned instead of the physical collection name. The value can be passed straight back into `deleteIndex()` / `describeIndex()`. Managed indexes created before durable metadata was introduced are still discovered via their `${name}_vector_index` search index. The internal registry collection is never listed.
288
288
 
289
289
  Returns: `Promise<string[]>`
290
290
 
@@ -408,12 +408,12 @@ await store.createSearchIndex({ indexName: 'precedents', fields: ['note'] })
408
408
 
409
409
  - The collection must already exist and contain documents with an `embedding` field (or the custom `embeddingFieldPath` you configured)
410
410
  - The collection is never created or dropped when using `collectionName`
411
- - **A BYO index is read-only by default.** `upsert()`, `updateVector()`, `deleteVector()`, and `deleteVectors()` throw a clear error rather than mutating caller-owned operational documents. To let the store write embeddings into (or delete documents from) your collection, opt in explicitly with `createIndex({ ..., allowWrites: true })`. The policy is persisted and survives restarts; entries written by older versions without the flag are treated as read-only (fail closed).
411
+ - **A BYO index is read-only by default.** `upsert()`, `updateVector()`, `deleteVector()`, and `deleteVectors()` throw a clear error rather than mutating caller-owned operational documents. To let the store write embeddings into (or delete documents from) your collection, opt in explicitly with `createIndex({ ..., allowWrites: true })`. The policy is persisted and survives restarts. Entries written by older versions without the flag are treated as read-only (fail closed).
412
412
  - Use `metadataMode: 'document'` when querying to retrieve the full source document as `metadata`
413
413
  - In `'document'` mode the embedding is omitted from `metadata` by default; pass `includeVector: true` to retain it (and also expose it as a top-level `vector`)
414
414
  - **Filtering in `'document'` mode operates on root document fields**, not a nested `metadata.` subdocument. `filter: { lane: 'fraud' }` matches the top-level `lane` field of your operational documents (in the default `'field'` mode, bare fields are rewritten to `metadata.<field>` for managed collections). Both the pushdown and `$match` fallback paths honor this.
415
415
  - **Native `ObjectId` `_id`s are supported.** Operational collections commonly key on `ObjectId`; query results coerce `_id` to a string (the `QueryResult.id` contract), and `deleteVector()`/`updateVector()`/`deleteVectors()` accept that string and match the underlying `ObjectId` document. Managed collections (string `_id`s) are unaffected.
416
- - Full-text and hybrid search on a BYO collection are **opt-in**: no full-text index is auto-created, so call `createSearchIndex()` before `textQuery()`/`hybridQuery()`. The full-text index builds asynchronously call `waitForSearchIndexReady()` (or pass `waitUntilReady: true`) before an immediate text/hybrid query.
416
+ - Full-text and hybrid search on a BYO collection are **opt-in**: no full-text index is auto-created, so call `createSearchIndex()` before `textQuery()`/`hybridQuery()`. The full-text index builds asynchronously. Call `waitForSearchIndexReady()` (or pass `waitUntilReady: true`) before an immediate text/hybrid query.
417
417
  - `deleteIndex()` on a BYO index drops the vector index (and the text index if one was created) but **preserves** the collection and its documents
418
418
 
419
419
  ## Best practices
@@ -4,7 +4,7 @@
4
4
 
5
5
  The `@mastra/livekit` package connects Mastra agents to the LiveKit Agents framework. LiveKit runs the audio pipeline (voice activity detection, speech-to-text, turn detection, text-to-speech, barge-in) and the package bridges reply generation to a Mastra agent's `stream()` call.
6
6
 
7
- See [Realtime voice](https://mastra.ai/docs/voice/realtime-voice) for setup and concepts.
7
+ See [Realtime voice](https://mastra.ai/guides/voice/realtime-voice) for setup and concepts.
8
8
 
9
9
  The package has three entry points:
10
10
 
@@ -148,7 +148,7 @@ Returns: `VoiceTurnMessage[]`, where each entry is `{ role: 'system' | 'user' |
148
148
 
149
149
  ## `MastraLLM`
150
150
 
151
- A standard LiveKit LLM plugin (`llm.LLM`) backed by a Mastra agent. Use it when you build the `voice.AgentSession` yourself and want Mastra in the `llm` slot. [`createLiveKitWorker()`](#createlivekitworker) is the managed alternative. See [Use Mastra as the LLM component](https://mastra.ai/docs/voice/realtime-voice) for how to choose.
151
+ A standard LiveKit LLM plugin (`llm.LLM`) backed by a Mastra agent. Use it when you build the `voice.AgentSession` yourself and want Mastra in the `llm` slot. [`createLiveKitWorker()`](#createlivekitworker) is the managed alternative. See [Use Mastra as the LLM component](https://mastra.ai/guides/voice/realtime-voice) for how to choose.
152
152
 
153
153
  With `remote`, the plugin streams each turn from your Mastra server over HTTP using Server-Sent Events (SSE). The agent loop, tools, and memory run server-side, and interrupting the agent aborts the server-side generation.
154
154
 
@@ -478,5 +478,5 @@ The metadata travels as a JSON string. `liveKitConnectionRoute()` and `dispatchV
478
478
 
479
479
  ## Related
480
480
 
481
- - [Realtime voice](https://mastra.ai/docs/voice/realtime-voice)
481
+ - [Realtime voice](https://mastra.ai/guides/voice/realtime-voice)
482
482
  - [LiveKit Agents docs](https://docs.livekit.io/agents/)
@@ -10,14 +10,14 @@ For usage patterns and deployment topologies, see [Workers](https://mastra.ai/do
10
10
 
11
11
  Controls which workers start in the current process.
12
12
 
13
- | Value | Behavior |
14
- | --------------------------- | --------------------------------------------------------------------- |
15
- | _(not set)_ | Default workers are auto-created based on configuration |
16
- | `"false"` | Disables all event processing. The process only serves HTTP requests. |
17
- | `"orchestration"` | Only the orchestration worker starts |
18
- | `"scheduler"` | Only the scheduler worker starts |
19
- | `"backgroundTasks"` | Only the background task worker starts |
20
- | `"orchestration,scheduler"` | Multiple workers (comma-separated) |
13
+ | Value | Behavior |
14
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | _(not set)_ | Default workers are auto-created based on configuration |
16
+ | `"false"` | Disables worker event processing. The process serves HTTP requests and can still publish events to PubSub (e.g., workflow starts) without consuming them. |
17
+ | `"orchestration"` | Only the orchestration worker starts |
18
+ | `"scheduler"` | Only the scheduler worker starts |
19
+ | `"backgroundTasks"` | Only the background task worker starts |
20
+ | `"orchestration,scheduler"` | Multiple workers (comma-separated) |
21
21
 
22
22
  Use this to run different worker types in separate containers from the same build artifact.
23
23
 
@@ -29,6 +29,8 @@ The base URL of the API server, used by the orchestration worker to execute work
29
29
  MASTRA_STEP_EXECUTION_URL=http://api:4111/api
30
30
  ```
31
31
 
32
+ Use HTTPS URLs in production. See [Security recommendations](https://mastra.ai/docs/server/auth/workers).
33
+
32
34
  The orchestration worker sends step execution requests to:
33
35
 
34
36
  ```text
@@ -4,7 +4,7 @@
4
4
 
5
5
  Stores files in a Mastra Platform workspace bucket. Each Mastra Platform environment can have one bucket, and `PlatformFilesystem` gives agents `read`, `write`, `list`, `delete`, and `move` operations against it.
6
6
 
7
- Use `PlatformFilesystem` when your agent runs on a Mastra Platform deployment and you want the filesystem to be backed by the platform-provisioned bucket. For direct S3 access, see [`S3Filesystem`](https://mastra.ai/reference/workspace/s3-filesystem). For a local directory during development, see [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem).
7
+ Related providers: [`S3Filesystem`](https://mastra.ai/reference/workspace/s3-filesystem) for direct S3 access, [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem) for local directories.
8
8
 
9
9
  > **Info:** For interface details, see [WorkspaceFilesystem interface](https://mastra.ai/reference/workspace/filesystem).
10
10
 
@@ -39,7 +39,7 @@ Configure the platform credentials. The access token, project ID, and bucket nam
39
39
  **.env file**:
40
40
 
41
41
  ```bash
42
- MASTRA_PLATFORM_SECRET_KEY=your-platform-secret-key
42
+ MASTRA_PLATFORM_ACCESS_TOKEN=your-platform-access-token
43
43
  MASTRA_PROJECT_ID=your-project-id
44
44
  MASTRA_PLATFORM_BUCKET_NAME=your-bucket-name
45
45
  ```
@@ -54,7 +54,7 @@ new PlatformFilesystem({
54
54
  })
55
55
  ```
56
56
 
57
- On a Mastra Platform deployment these variables are injected automatically, so the constructor can be called with no options.
57
+ On a Mastra Platform deployment, `MASTRA_PLATFORM_ACCESS_TOKEN`, `MASTRA_PROJECT_ID`, and `MASTRA_PLATFORM_BUCKET_NAME` are injected automatically, so the constructor can be called with no options. For local development, `MASTRA_PLATFORM_ACCESS_TOKEN` can contain an `sk_` API token from your organization's settings page under **API Tokens**.
58
58
 
59
59
  ## Usage
60
60
 
@@ -116,7 +116,7 @@ await fs.writeFile('/analyses/repo.md', 'x') // throws WorkspaceReadOnlyError
116
116
 
117
117
  ## Constructor parameters
118
118
 
119
- **accessToken** (`string`): Platform secret key. Falls back to the MASTRA\_PLATFORM\_SECRET\_KEY environment variable (MASTRA\_PLATFORM\_ACCESS\_TOKEN is a deprecated fallback).
119
+ **accessToken** (`string`): Platform access token. Falls back to the MASTRA\_PLATFORM\_ACCESS\_TOKEN environment variable.
120
120
 
121
121
  **projectId** (`string`): Platform project ID. Falls back to the MASTRA\_PROJECT\_ID environment variable.
122
122
 
@@ -157,7 +157,8 @@ Filesystem-specific errors match the standard workspace error types:
157
157
  Other Platform API failures raise `PlatformApiError`. Structured `{ error: { message, type } }` responses are parsed into `.code` (machine-readable kind) and `.proxyMessage` (human string):
158
158
 
159
159
  ```typescript
160
- import { FileNotFoundError, PlatformApiError } from '@mastra/platform-workspace'
160
+ import { FileNotFoundError } from '@mastra/core/workspace'
161
+ import { PlatformApiError } from '@mastra/platform-workspace'
161
162
 
162
163
  try {
163
164
  await fs.readFile('/missing.txt')
@@ -173,6 +174,8 @@ try {
173
174
  }
174
175
  ```
175
176
 
177
+ `FileNotFoundError`, `FileExistsError`, and `WorkspaceReadOnlyError` are re-exports of the standard workspace error types from `@mastra/core/workspace`. `PlatformApiError` is specific to `@mastra/platform-workspace`.
178
+
176
179
  `code` and `proxyMessage` are `undefined` when the response body isn't JSON, for example an HTML 502 from a load balancer.
177
180
 
178
181
  ## Related
@@ -2,9 +2,11 @@
2
2
 
3
3
  # PlatformSandbox
4
4
 
5
- Executes commands inside a Mastra Platform sandbox tied to a Platform environment. Sandboxes boot from a pre-built recipe checkpoint with Python 3, Node 22, TypeScript, tsx, and common build tooling already installed.
5
+ Client for provisioning sandboxes in a Mastra Platform environment. Each `PlatformSandbox` instance owns one remote sandbox: `start()` provisions it, `executeCommand()` runs against it, and `destroy()` tears it down. Construct additional instances to own additional remote sandboxes. Use `clone()` to derive them from a configured template (see [Cloning](#cloning-for-a-fleet-of-sandboxes)).
6
6
 
7
- Use `PlatformSandbox` when your agent runs on a Mastra Platform deployment and you want the sandbox to be provisioned and managed by the platform. For self-hosted Railway sandboxes, see [`RailwaySandbox`](https://mastra.ai/reference/workspace/railway-sandbox). For a local sandbox during development, see [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox).
7
+ Sandboxes boot from a pre-built recipe checkpoint with Python 3, Node 22, TypeScript, tsx, and common build tooling already installed. Pass a stable `id` to opt into [checkpoint recovery](#checkpoint-recovery) so a new sandbox boots from the previous one's filesystem.
8
+
9
+ Related providers: [`RailwaySandbox`](https://mastra.ai/reference/workspace/railway-sandbox) for self-hosted Railway sandboxes, [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox) for local sandboxes.
8
10
 
9
11
  > **Info:** For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
10
12
 
@@ -39,7 +41,7 @@ Configure the platform credentials. The access token, project ID, and environmen
39
41
  **.env file**:
40
42
 
41
43
  ```bash
42
- MASTRA_PLATFORM_SECRET_KEY=your-platform-secret-key
44
+ MASTRA_PLATFORM_ACCESS_TOKEN=your-platform-access-token
43
45
  MASTRA_PROJECT_ID=your-project-id
44
46
  MASTRA_ENVIRONMENT_ID=your-environment-id
45
47
  ```
@@ -54,7 +56,7 @@ new PlatformSandbox({
54
56
  })
55
57
  ```
56
58
 
57
- On a Mastra Platform deployment these variables are injected automatically, so the constructor can be called with no options.
59
+ On a Mastra Platform deployment, `MASTRA_PLATFORM_ACCESS_TOKEN`, `MASTRA_PROJECT_ID`, and `MASTRA_ENVIRONMENT_ID` are injected automatically, so the constructor can be called with no options. For local development, `MASTRA_PLATFORM_ACCESS_TOKEN` can contain an `sk_` API token from your organization's settings page under **API Tokens**.
58
60
 
59
61
  ## Usage
60
62
 
@@ -103,7 +105,7 @@ The default `ISOLATED` mode allows outbound internet access only, with no privat
103
105
 
104
106
  ### Reattaching to a running sandbox
105
107
 
106
- Pass an existing `sandboxId` to reattach to a live sandbox instead of creating a new one. This is useful for stateful agents that resume between requests:
108
+ Pass an existing `sandboxId` to reattach to a live sandbox instead of creating a new one:
107
109
 
108
110
  ```typescript
109
111
  const sandbox = new PlatformSandbox({
@@ -116,6 +118,42 @@ const result = await sandbox.executeCommand('cat', ['/workspace/state.json'])
116
118
 
117
119
  When `sandboxId` is set, `environmentId` isn't required because the sandbox already exists.
118
120
 
121
+ ### Checkpoint recovery
122
+
123
+ The constructor `id` (explicit or auto-generated) is sent to the platform on `POST /sandbox` as an advisory recovery key:
124
+
125
+ - If the platform recognises the `id` from a previous session, the new sandbox boots from the most recent checkpoint of that earlier sandbox's filesystem instead of the base recipe.
126
+ - If the `id` isn't recognised, the platform starts a fresh sandbox from the base recipe. Auto-generated ids never match, so omitting `id` disables checkpoint recovery.
127
+
128
+ Pass a stable `id` to preserve a sandbox's filesystem across sessions or across a `destroy()`/`start()` cycle:
129
+
130
+ ```typescript
131
+ const sandbox = new PlatformSandbox({
132
+ id: `project-${projectId}`,
133
+ })
134
+ await sandbox.start() // Boots from the most recent checkpoint for this id, or fresh if unknown
135
+ ```
136
+
137
+ Checkpoint recovery is coarser than `sandboxId` reattachment. Reattaching (via `sandboxId`) rejoins the exact live sandbox and its running processes. Checkpoint recovery constructs a brand new sandbox and restores its filesystem from the latest checkpoint the platform captured for the previous sandbox with that `id`. Running processes and any filesystem writes made after the last checkpoint aren't restored.
138
+
139
+ Each `id` maps to one independent filesystem. Reusing the same `id` across unrelated sandboxes causes the platform to boot them from each other's checkpoint.
140
+
141
+ ### Cloning for a fleet of sandboxes
142
+
143
+ `clone()` returns an independent sibling `PlatformSandbox` that inherits credentials and defaults (access token, project, environment, network isolation, timeout, instructions, env, idle timeout) with per-instance overrides. The returned sandbox is unstarted and provisions on its own `start()`, so `clone()` performs no I/O:
144
+
145
+ ```typescript
146
+ const template = new PlatformSandbox({
147
+ networkIsolation: 'PRIVATE',
148
+ idleTimeoutMinutes: 30,
149
+ })
150
+
151
+ const perProject = template.clone({ id: `project-${projectId}` })
152
+ await perProject.start()
153
+ ```
154
+
155
+ Combine `clone()` with a stable `id` per clone to opt each clone into [checkpoint recovery](#checkpoint-recovery) independently.
156
+
119
157
  ### Executing commands
120
158
 
121
159
  `executeCommand` runs a command on the remote sandbox and returns its output. Pass `args` to have arguments safely shell-quoted:
@@ -135,7 +173,7 @@ console.log(result.exitCode)
135
173
 
136
174
  ## Constructor parameters
137
175
 
138
- **accessToken** (`string`): Platform secret key. Falls back to the MASTRA\_PLATFORM\_SECRET\_KEY environment variable (MASTRA\_PLATFORM\_ACCESS\_TOKEN is a deprecated fallback).
176
+ **accessToken** (`string`): Platform access token. Falls back to the MASTRA\_PLATFORM\_ACCESS\_TOKEN environment variable.
139
177
 
140
178
  **projectId** (`string`): Platform project ID. Falls back to the MASTRA\_PROJECT\_ID environment variable.
141
179
 
@@ -153,7 +191,7 @@ console.log(result.exitCode)
153
191
 
154
192
  **instructions** (`string | ((opts: { defaultInstructions: string; requestContext?: RequestContext }) => string)`): Custom instructions returned by getInstructions(). A string fully replaces the defaults; a function receives the defaults and can extend or customize them per-request.
155
193
 
156
- **id** (`string`): Unique identifier for this sandbox instance. (Default: `Auto-generated`)
194
+ **id** (`string`): Unique identifier for this sandbox instance. Sent to the platform as an advisory recovery key: if the platform recognizes the id from a previous sandbox, the new sandbox boots from that sandbox's most recent checkpoint instead of the base recipe. Unknown ids fall through to a fresh sandbox. Auto-generated when omitted, which disables checkpoint recovery. (Default: `Auto-generated`)
157
195
 
158
196
  **fetch** (`typeof fetch`): Custom fetch implementation, mainly for testing.
159
197
 
@@ -169,6 +207,22 @@ console.log(result.exitCode)
169
207
 
170
208
  **processes** (`PlatformProcessManager`): Background process manager. See SandboxProcessManager reference.
171
209
 
210
+ ## Methods
211
+
212
+ **start** (`() => Promise<void>`): Provision the remote sandbox, or reattach when sandboxId was passed to the constructor. Idempotent once the sandbox is running. A destroyed reattach target falls through to a fresh provision.
213
+
214
+ **destroy** (`() => Promise<void>`): Tear down the remote sandbox and clear the cached exec lease. A subsequent start() provisions a fresh sandbox (or restores from checkpoint when a stable id is set).
215
+
216
+ **stop** (`() => Promise<void>`): Alias for destroy().
217
+
218
+ **executeCommand** (`(command: string, args?: string[], options?: ExecuteCommandOptions) => Promise<CommandResult>`): Run a command on the remote sandbox and return its stdout, stderr, exitCode, and executionTimeMs. command is a shell string, args are safely shell-quoted.
219
+
220
+ **clone** (`(options?: SandboxCloneOptions) => PlatformSandbox`): Construct an unstarted sibling PlatformSandbox that inherits credentials and defaults with per-instance overrides (id, sandboxId, env, idleTimeoutMinutes). Performs no I/O. Use to build a fleet of independent sandboxes from one configured template.
221
+
222
+ **getInfo** (`() => Promise<SandboxInfo>`): Return the sandbox's platform id, provider, status, createdAt, and metadata (sandboxId, providerResourceId, platformStatus).
223
+
224
+ **getInstructions** (`(opts?: { requestContext?: RequestContext }) => string`): Return the sandbox instructions the workspace surfaces in tool descriptions. Honors the instructions constructor option; otherwise returns platform-default instructions that include the current remote sandbox id when running.
225
+
172
226
  ## Errors
173
227
 
174
228
  Platform API failures raise `PlatformApiError`. Structured `{ error: { message, type } }` responses are parsed into `.code` (machine-readable kind) and `.proxyMessage` (human string); the raw response body stays available on `.body`:
@@ -192,6 +246,28 @@ try {
192
246
 
193
247
  `code` and `proxyMessage` are `undefined` when the response body isn't JSON, for example an HTML 502 from a load balancer.
194
248
 
249
+ `executeCommand` runs over the direct-exec data plane (a WebSocket to the Railway tcp-proxy) and can also throw two typed sandbox errors on unrecoverable failure:
250
+
251
+ ```typescript
252
+ import { SandboxDestroyedError, SandboxExecTransportError } from '@mastra/platform-workspace'
253
+
254
+ try {
255
+ await sandbox.executeCommand('pytest')
256
+ } catch (err) {
257
+ if (err instanceof SandboxDestroyedError) {
258
+ // /exec-lease returned 410; the sandbox has been destroyed.
259
+ // The cached sandbox id and lease have already been cleared,
260
+ // so reusing the instance will reprovision on the next call.
261
+ } else if (err instanceof SandboxExecTransportError) {
262
+ // Both the initial WebSocket attempt and the built-in retry
263
+ // closed without an exit frame against a live sandbox.
264
+ console.error(err.closeCode, err.closeReason, err.wsEndpoint)
265
+ }
266
+ }
267
+ ```
268
+
269
+ `SandboxExecTransportError` carries diagnostic fields (`opened`, `closeCode`, `closeReason`, `wsEndpoint`, plus `sandboxId`, `command`, and `attempts`) so operators can distinguish a broken Railway data plane from a failed command.
270
+
195
271
  ## Related
196
272
 
197
273
  - [PlatformFilesystem reference](https://mastra.ai/reference/workspace/platform-filesystem)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.2.13-alpha.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`a19e5b7`](https://github.com/mastra-ai/mastra/commit/a19e5b79b76fffa92f9cf17e0e89c3fa714534e8), [`82201f7`](https://github.com/mastra-ai/mastra/commit/82201f75fae8e050a8de2df08b74875ee74c6b83), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`0a6598b`](https://github.com/mastra-ai/mastra/commit/0a6598bde80bde008986ad6616bed9632b9294cb), [`9e1dad8`](https://github.com/mastra-ai/mastra/commit/9e1dad8f7b1cab2bb7ade90e5b7561f24577b88a), [`2f43145`](https://github.com/mastra-ai/mastra/commit/2f4314504c03cbba280414ac81ba3197448ee6b0), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866)]:
8
+ - @mastra/mcp@1.15.1-alpha.1
9
+ - @mastra/core@1.56.0-alpha.6
10
+
11
+ ## 1.2.13-alpha.9
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`db4e6ff`](https://github.com/mastra-ai/mastra/commit/db4e6ff744503112eb64deeaf6c2b54bf26a54c7), [`6d19a65`](https://github.com/mastra-ai/mastra/commit/6d19a6517f5da3911023d446b7e2d5dad8adb1cb)]:
16
+ - @mastra/core@1.56.0-alpha.5
17
+
18
+ ## 1.2.13-alpha.7
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`4844167`](https://github.com/mastra-ai/mastra/commit/4844167cff2d5ec5004e94edd34970833040fa3f), [`5faf93f`](https://github.com/mastra-ai/mastra/commit/5faf93f03e19daea394b9e2a923f2e4f833407f2), [`80ad891`](https://github.com/mastra-ai/mastra/commit/80ad891f8cd10379aa5b5af7510c763783b2ab56), [`c78aa4e`](https://github.com/mastra-ai/mastra/commit/c78aa4ecc422ba70476da73709c3e7d85edc71d6), [`a1cb98d`](https://github.com/mastra-ai/mastra/commit/a1cb98d11990b560b98482292a1f34aa1a2d9092), [`598ad82`](https://github.com/mastra-ai/mastra/commit/598ad82d41c41389a686338a1d0e50b7400e1938), [`1fd6aad`](https://github.com/mastra-ai/mastra/commit/1fd6aad1ea4a9d32f65efa832307c35e981a4c0a)]:
23
+ - @mastra/core@1.56.0-alpha.4
24
+ - @mastra/mcp@1.15.1-alpha.0
25
+
26
+ ## 1.2.13-alpha.5
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [[`594f7b2`](https://github.com/mastra-ai/mastra/commit/594f7b28f5263fb9982fd50d95c471fb971ea984), [`311f943`](https://github.com/mastra-ai/mastra/commit/311f943bee60e8fdf5c84499ea50e884276c936c), [`0c89896`](https://github.com/mastra-ai/mastra/commit/0c8989673fb7d106837098398131e570c6023b68), [`23b4238`](https://github.com/mastra-ai/mastra/commit/23b423844ad0bcf2a502a68dd62866d6160f9f6d), [`e320a76`](https://github.com/mastra-ai/mastra/commit/e320a763feaf65c6be3cebecf746defcbde161b3), [`03b4918`](https://github.com/mastra-ai/mastra/commit/03b4918c80d188ce375334c393e131c6e94bd7eb), [`14ef73a`](https://github.com/mastra-ai/mastra/commit/14ef73a4bbd73e7808414816eb0628ce1d80b5d7), [`1d677d5`](https://github.com/mastra-ai/mastra/commit/1d677d5f99d7db403f7828585e8c25f299f72628), [`93e28ec`](https://github.com/mastra-ai/mastra/commit/93e28ecce9031c02397e0ae8406593e5c7a95883), [`729dab4`](https://github.com/mastra-ai/mastra/commit/729dab408faccfaef0cbb048e5a4338f9172847e), [`484003d`](https://github.com/mastra-ai/mastra/commit/484003d33ff59330c86b19863e4a38732d7e4155), [`933d291`](https://github.com/mastra-ai/mastra/commit/933d291146b789c19442ad206f94da3e4be90c64)]:
31
+ - @mastra/core@1.56.0-alpha.3
32
+
33
+ ## 1.2.13-alpha.4
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [[`322daa6`](https://github.com/mastra-ai/mastra/commit/322daa6d90552909204044790d850958f6745fed), [`cadaa13`](https://github.com/mastra-ai/mastra/commit/cadaa1372e1077c8e85eb64c5499ba8803caa323), [`06000d7`](https://github.com/mastra-ai/mastra/commit/06000d73712911572e913b8a83339270296d0a22), [`3de0188`](https://github.com/mastra-ai/mastra/commit/3de0188bfaf9a9c09c95fe322b53838cf52c70b6)]:
38
+ - @mastra/core@1.56.0-alpha.2
39
+
40
+ ## 1.2.13-alpha.2
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [[`c5e56ff`](https://github.com/mastra-ai/mastra/commit/c5e56ff3bcabdf062708f2d48744fec304df6792), [`4e35a56`](https://github.com/mastra-ai/mastra/commit/4e35a56cdf8d74a5ff6d5eda01f2c1deaf6cc7be)]:
45
+ - @mastra/core@1.56.0-alpha.1
46
+
47
+ ## 1.2.13-alpha.1
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [[`7f4e26d`](https://github.com/mastra-ai/mastra/commit/7f4e26dd57bd9b23c278ea21235ab823a3810a6c), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c)]:
52
+ - @mastra/core@1.56.0-alpha.0
53
+
3
54
  ## 1.2.12
4
55
 
5
56
  ### Patch Changes