@mastra/mcp-docs-server 1.1.42-alpha.8 → 1.1.43-alpha.0

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 (159) hide show
  1. package/.docs/docs/agent-builder/memory.md +1 -1
  2. package/.docs/docs/agents/a2a.md +1 -1
  3. package/.docs/docs/agents/acp.md +23 -160
  4. package/.docs/docs/agents/adding-voice.md +7 -7
  5. package/.docs/docs/agents/agent-approval.md +1 -1
  6. package/.docs/docs/agents/background-tasks.md +2 -2
  7. package/.docs/docs/agents/channels.md +1 -1
  8. package/.docs/docs/agents/code-mode.md +3 -3
  9. package/.docs/docs/agents/guardrails.md +2 -2
  10. package/.docs/docs/agents/networks.md +1 -1
  11. package/.docs/docs/agents/overview.md +1 -1
  12. package/.docs/docs/agents/processors.md +146 -3
  13. package/.docs/docs/agents/sdk-agents.md +261 -0
  14. package/.docs/docs/agents/signals.md +230 -10
  15. package/.docs/docs/agents/structured-output.md +5 -5
  16. package/.docs/docs/agents/supervisor-agents.md +2 -2
  17. package/.docs/docs/agents/using-tools.md +5 -5
  18. package/.docs/docs/browser/agent-browser.md +1 -1
  19. package/.docs/docs/browser/browser-viewer.md +1 -1
  20. package/.docs/docs/browser/overview.md +1 -1
  21. package/.docs/docs/browser/stagehand.md +5 -5
  22. package/.docs/docs/build-with-ai/skills.md +3 -3
  23. package/.docs/docs/editor/overview.md +12 -11
  24. package/.docs/docs/evals/custom-scorers.md +1 -1
  25. package/.docs/docs/evals/datasets/running-experiments.md +1 -1
  26. package/.docs/docs/evals/overview.md +2 -2
  27. package/.docs/docs/getting-started/build-with-ai.md +37 -0
  28. package/.docs/docs/mastra-platform/observability.md +4 -4
  29. package/.docs/docs/mcp/mcp-apps.md +3 -3
  30. package/.docs/docs/mcp/overview.md +1 -1
  31. package/.docs/docs/memory/memory-processors.md +6 -6
  32. package/.docs/docs/memory/multi-user-threads.md +2 -2
  33. package/.docs/docs/memory/semantic-recall.md +1 -1
  34. package/.docs/docs/memory/storage.md +2 -1
  35. package/.docs/docs/memory/working-memory.md +28 -1
  36. package/.docs/docs/observability/metrics/querying.md +1 -1
  37. package/.docs/docs/observability/tracing/exporters/langfuse.md +1 -1
  38. package/.docs/docs/observability/tracing/exporters/langsmith.md +2 -2
  39. package/.docs/docs/rag/graph-rag.md +2 -2
  40. package/.docs/docs/rag/retrieval.md +12 -12
  41. package/.docs/docs/server/auth/fga.md +2 -0
  42. package/.docs/docs/server/mastra-client.md +1 -1
  43. package/.docs/docs/server/pubsub.md +124 -0
  44. package/.docs/docs/server/request-context.md +3 -3
  45. package/.docs/docs/streaming/overview.md +1 -1
  46. package/.docs/docs/streaming/tool-streaming.md +1 -1
  47. package/.docs/docs/studio/auth.md +20 -0
  48. package/.docs/docs/voice/overview.md +25 -25
  49. package/.docs/docs/voice/speech-to-speech.md +4 -4
  50. package/.docs/docs/voice/speech-to-text.md +1 -1
  51. package/.docs/docs/voice/text-to-speech.md +1 -1
  52. package/.docs/docs/workspace/filesystem.md +2 -2
  53. package/.docs/docs/workspace/overview.md +1 -1
  54. package/.docs/docs/workspace/sandbox.md +1 -1
  55. package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -1
  56. package/.docs/guides/guide/ai-recruiter.md +1 -1
  57. package/.docs/guides/guide/chef-michel.md +1 -1
  58. package/.docs/guides/guide/code-review-bot.md +1 -1
  59. package/.docs/guides/guide/dev-assistant.md +1 -1
  60. package/.docs/guides/guide/docs-manager.md +1 -1
  61. package/.docs/guides/guide/firecrawl.md +1 -1
  62. package/.docs/guides/guide/github-actions-pr-description.md +1 -1
  63. package/.docs/guides/guide/research-assistant.md +1 -1
  64. package/.docs/guides/guide/research-coordinator.md +2 -2
  65. package/.docs/guides/guide/slack-assistant.md +1 -1
  66. package/.docs/guides/guide/stock-agent.md +2 -2
  67. package/.docs/guides/guide/whatsapp-chat-bot.md +2 -2
  68. package/.docs/guides/migrations/agentnetwork.md +4 -4
  69. package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
  70. package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
  71. package/.docs/reference/acp/acp-agent.md +228 -0
  72. package/.docs/reference/acp/create-acp-tool.md +131 -0
  73. package/.docs/reference/agents/agent.md +55 -5
  74. package/.docs/reference/agents/channels.md +47 -5
  75. package/.docs/reference/agents/durable-agent.md +239 -0
  76. package/.docs/reference/agents/generateLegacy.md +1 -1
  77. package/.docs/reference/agents/getLLM.md +2 -2
  78. package/.docs/reference/agents/getMetadata.md +2 -2
  79. package/.docs/reference/agents/network.md +1 -1
  80. package/.docs/reference/browser/agent-browser.md +1 -1
  81. package/.docs/reference/browser/browser-viewer.md +1 -1
  82. package/.docs/reference/browser/mastra-browser.md +1 -1
  83. package/.docs/reference/browser/stagehand-browser.md +5 -5
  84. package/.docs/reference/cli/mastra.md +5 -5
  85. package/.docs/reference/client-js/agents.md +41 -7
  86. package/.docs/reference/configuration.md +1 -1
  87. package/.docs/reference/evals/answer-relevancy.md +1 -1
  88. package/.docs/reference/evals/answer-similarity.md +1 -1
  89. package/.docs/reference/evals/bias.md +1 -1
  90. package/.docs/reference/evals/context-precision.md +3 -3
  91. package/.docs/reference/evals/context-relevance.md +11 -11
  92. package/.docs/reference/evals/faithfulness.md +1 -1
  93. package/.docs/reference/evals/hallucination.md +5 -5
  94. package/.docs/reference/evals/noise-sensitivity.md +11 -11
  95. package/.docs/reference/evals/prompt-alignment.md +15 -15
  96. package/.docs/reference/evals/tool-call-accuracy.md +3 -3
  97. package/.docs/reference/evals/toxicity.md +1 -1
  98. package/.docs/reference/index.md +9 -0
  99. package/.docs/reference/memory/memory-class.md +3 -3
  100. package/.docs/reference/memory/observational-memory.md +4 -4
  101. package/.docs/reference/observability/tracing/exporters/langfuse.md +1 -1
  102. package/.docs/reference/processors/batch-parts-processor.md +1 -1
  103. package/.docs/reference/processors/cost-guard-processor.md +1 -1
  104. package/.docs/reference/processors/language-detector.md +1 -1
  105. package/.docs/reference/processors/message-history-processor.md +1 -1
  106. package/.docs/reference/processors/moderation-processor.md +2 -2
  107. package/.docs/reference/processors/pii-detector.md +2 -2
  108. package/.docs/reference/processors/prefill-error-handler.md +2 -2
  109. package/.docs/reference/processors/processor-interface.md +2 -2
  110. package/.docs/reference/processors/prompt-injection-detector.md +1 -1
  111. package/.docs/reference/processors/regex-filter-processor.md +1 -1
  112. package/.docs/reference/processors/response-cache.md +2 -2
  113. package/.docs/reference/processors/semantic-recall-processor.md +1 -1
  114. package/.docs/reference/processors/skill-search-processor.md +1 -1
  115. package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
  116. package/.docs/reference/processors/token-limiter-processor.md +3 -3
  117. package/.docs/reference/processors/tool-call-filter.md +2 -2
  118. package/.docs/reference/processors/tool-search-processor.md +2 -2
  119. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  120. package/.docs/reference/processors/working-memory-processor.md +1 -1
  121. package/.docs/reference/pubsub/base.md +168 -0
  122. package/.docs/reference/pubsub/caching-pubsub.md +102 -0
  123. package/.docs/reference/pubsub/event-emitter.md +72 -0
  124. package/.docs/reference/pubsub/google-cloud-pubsub.md +94 -0
  125. package/.docs/reference/pubsub/redis-streams.md +108 -0
  126. package/.docs/reference/pubsub/unix-socket-pubsub.md +52 -0
  127. package/.docs/reference/rag/rerank.md +1 -1
  128. package/.docs/reference/server/nestjs-adapter.md +1 -1
  129. package/.docs/reference/storage/dsql.md +1 -1
  130. package/.docs/reference/storage/libsql.md +6 -0
  131. package/.docs/reference/storage/mongodb.md +4 -1
  132. package/.docs/reference/storage/postgresql.md +4 -1
  133. package/.docs/reference/storage/redis.md +1 -1
  134. package/.docs/reference/storage/spanner.md +5 -0
  135. package/.docs/reference/storage/upstash.md +1 -1
  136. package/.docs/reference/streaming/agents/stream.md +1 -1
  137. package/.docs/reference/templates/overview.md +1 -1
  138. package/.docs/reference/tools/mcp-client.md +2 -2
  139. package/.docs/reference/tools/mcp-server.md +33 -1
  140. package/.docs/reference/tools/vector-query-tool.md +1 -1
  141. package/.docs/reference/vectors/libsql.md +1 -1
  142. package/.docs/reference/vectors/mongodb.md +1 -1
  143. package/.docs/reference/vectors/pg.md +1 -1
  144. package/.docs/reference/vectors/upstash.md +1 -1
  145. package/.docs/reference/voice/voice.addInstructions.md +1 -1
  146. package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
  147. package/.docs/reference/workspace/azure-blob-filesystem.md +1 -1
  148. package/.docs/reference/workspace/docker-sandbox.md +1 -1
  149. package/.docs/reference/workspace/e2b-sandbox.md +9 -5
  150. package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
  151. package/.docs/reference/workspace/gcs-filesystem.md +1 -1
  152. package/.docs/reference/workspace/google-drive-filesystem.md +1 -1
  153. package/.docs/reference/workspace/local-filesystem.md +1 -1
  154. package/.docs/reference/workspace/local-sandbox.md +1 -1
  155. package/.docs/reference/workspace/modal-sandbox.md +1 -1
  156. package/.docs/reference/workspace/s3-filesystem.md +1 -1
  157. package/CHANGELOG.md +38 -0
  158. package/package.json +6 -6
  159. package/.docs/docs/agents/response-caching.md +0 -150
@@ -37,7 +37,7 @@ new MastraEditor({
37
37
  agent: {
38
38
  memory: {
39
39
  observationalMemory: {
40
- model: 'openai/gpt-5.4',
40
+ model: 'openai/gpt-5.5',
41
41
  },
42
42
  },
43
43
  },
@@ -81,7 +81,7 @@ export const supportAgent = new Agent({
81
81
  id: 'support-agent',
82
82
  name: 'Support Agent',
83
83
  instructions: 'Answer user questions and delegate weather questions when needed.',
84
- model: 'openai/gpt-5.4',
84
+ model: 'openai/gpt-5.5',
85
85
  agents: {
86
86
  remoteWeatherAgent,
87
87
  },
@@ -1,8 +1,8 @@
1
- # ACP (Agent Client Protocol)
1
+ # Agent Client Protocol
2
2
 
3
3
  Mastra supports the [Agent Client Protocol (ACP)](https://agentclientprotocol.com/overview/introduction) for running ACP-compatible coding agents from a Mastra agent. Use `@mastra/acp` to wrap a coding agent process as a Mastra tool or as a subagent.
4
4
 
5
- ACP is useful for coding agents such as Claude Code, Amp, Codex, or any other executable that implements the Agent Client Protocol over standard input and output.
5
+ ACP is useful for coding agents such as Claude Code, Amp, Codex, or any other executable that implements ACP over standard input and output.
6
6
 
7
7
  ## When to use ACP
8
8
 
@@ -23,14 +23,14 @@ The flow is:
23
23
  3. The client sends ACP `initialize` and `session/new` requests.
24
24
  4. Mastra sends the user task to the ACP agent with `session/prompt`.
25
25
  5. The ACP agent streams session updates and message chunks back to Mastra.
26
- 6. Mastra returns the buffered output, emits streaming chunks, or suspends for permission input.
27
- 7. The ACP process stays alive by default, or stops after the prompt when `persistSession` is `false`.
26
+ 6. Mastra returns the buffered output, emits streaming chunks, or handles permission input.
27
+ 7. The ACP connection stops the process after the prompt when `persistSession` is `false`; `AcpAgent` can keep a reusable process alive across calls by default.
28
28
 
29
29
  During execution, the ACP client also handles permission requests and file operations. File reads and writes go through Mastra's `Workspace`, so the ACP agent operates inside the workspace you provide.
30
30
 
31
31
  ## Getting started
32
32
 
33
- Install `@mastra/acp` in a project that already uses `@mastra/core`:
33
+ Install `@mastra/acp` in a project that already uses `@mastra/core`. The package requires `@mastra/core` version `1.34.0` or later.
34
34
 
35
35
  **npm**:
36
36
 
@@ -58,14 +58,12 @@ bun add @mastra/acp
58
58
 
59
59
  `@mastra/acp` exports two APIs:
60
60
 
61
- - `createACPTool`: Create a Mastra tool that sends a `task` string to an ACP agent and returns an `output` string.
62
- - `AcpAgent`: Wrap an ACP agent as a Mastra subagent with `generate()` and `stream()` support.
63
-
64
- The package requires `@mastra/core` version `1.34.0` or later.
61
+ - [`createACPTool()`](https://mastra.ai/reference/acp/create-acp-tool): Create a Mastra tool that sends a `task` string to an ACP agent and returns an `output` string.
62
+ - [`AcpAgent`](https://mastra.ai/reference/acp/acp-agent): Wrap an ACP agent as a Mastra subagent with `generate()` and `stream()` support.
65
63
 
66
64
  ## Use ACP as a subagent
67
65
 
68
- Use `AcpAgent` when a parent Mastra agent should delegate directly to an ACP-compatible coding agent as a subagent. Create the ACP agent, then register it in the parent agent's `agents` map.
66
+ Use `AcpAgent` when a parent Mastra agent should delegate directly to an ACP-compatible coding agent as a subagent.
69
67
 
70
68
  ```typescript
71
69
  import { AcpAgent } from '@mastra/acp'
@@ -84,18 +82,18 @@ export const codeSupervisor = new Agent({
84
82
  id: 'code-supervisor',
85
83
  name: 'Code Supervisor',
86
84
  instructions: 'Delegate code editing tasks to the code-agent subagent.',
87
- model: 'openai/gpt-5.4',
85
+ model: 'openai/gpt-5.5',
88
86
  agents: {
89
87
  codeAgent,
90
88
  },
91
89
  })
92
90
  ```
93
91
 
94
- `AcpAgent.generate()` buffers the ACP response and returns it as text. `AcpAgent.stream()` emits Mastra `text-delta` chunks as ACP `agent_message_chunk` updates arrive.
92
+ See the [AcpAgent reference](https://mastra.ai/reference/acp/acp-agent) for all options, methods, and configuration.
95
93
 
96
94
  ## Use ACP as a tool
97
95
 
98
- Use `createACPTool` when the parent Mastra agent should decide when to call the ACP agent as a tool. The following example creates a code editing tool and registers it on a parent agent:
96
+ Use `createACPTool()` when the parent Mastra agent should decide when to call the ACP agent as a tool.
99
97
 
100
98
  ```typescript
101
99
  import { createACPTool } from '@mastra/acp'
@@ -113,178 +111,43 @@ export const codeSupervisor = new Agent({
113
111
  id: 'code-supervisor',
114
112
  name: 'Code Supervisor',
115
113
  instructions: 'Use the code-agent tool when a task requires repository inspection or code edits.',
116
- model: 'openai/gpt-5.4',
114
+ model: 'openai/gpt-5.5',
117
115
  tools: {
118
116
  codeAgentTool,
119
117
  },
120
118
  })
121
119
  ```
122
120
 
123
- Use the `command` and `args` required by the ACP-compatible agent you run. The tool input schema has a single `task` string, and the output schema returns the final ACP response as `output`.
124
-
125
- If the ACP agent requests permission, the tool can suspend and resume through Mastra's tool suspension flow. Use `onPermissionRequest` when you need custom permission behavior.
126
-
127
- ## Options reference
128
-
129
- `createACPTool` and `AcpAgent` accept the same ACP connection options. `AcpAgent` also accepts `name` to set the display name used during agent delegation.
130
-
131
- | Option | Type | Description |
132
- | --------------------- | -------------------------------- | --------------------------------------------------------------------------------------- |
133
- | `id` | `string` | Unique tool or subagent identifier. |
134
- | `description` | `string` | Description shown to the model when it can call the tool or delegate to the subagent. |
135
- | `command` | `string` | ACP agent executable to spawn. |
136
- | `args` | `string[]` | Arguments passed to the ACP agent executable. |
137
- | `env` | `Record<string, string>` | Environment variables to merge with the current process environment. |
138
- | `cwd` | `string` | Working directory for the ACP process, ACP session, and default workspace. |
139
- | `session` | `Partial<NewSessionRequest>` | ACP session creation options. Defaults to `cwd` or `process.cwd()` and no MCP servers. |
140
- | `initialize` | `Partial<InitializeRequest>` | ACP initialization options. Defaults to Mastra client information and protocol version. |
141
- | `authMethodId` | `string` | ACP authentication method ID to invoke after initialization. |
142
- | `persistSession` | `boolean` | Keep the ACP process alive after execution. Defaults to `true`. |
143
- | `onPermissionRequest` | `(request) => Promise<Response>` | Callback for ACP permission requests. Defaults to selecting the first option. |
144
- | `workspace` | `Workspace` | Workspace used for ACP file reads and writes. |
145
- | `model` | `string` | Model ID to select after session creation via the ACP `session/set_model` method. |
121
+ See the [createACPTool() reference](https://mastra.ai/reference/acp/create-acp-tool) for all options and configuration.
146
122
 
147
123
  ## Model selection
148
124
 
149
- ACP agents may expose selectable models. Instead of setting an environment variable like `ANTHROPIC_MODEL`, you can pass a `model` ID directly in the configuration.
150
-
151
- ### Discover available models
152
-
153
- Call `getAvailableModels()` to see which models the ACP agent supports. This starts the agent process and returns the model list from the session:
154
-
155
- ```typescript
156
- import { AcpAgent } from '@mastra/acp'
157
-
158
- const codeAgent = new AcpAgent({
159
- id: 'code-agent',
160
- description: 'An ACP-compatible coding agent',
161
- command: 'claude',
162
- args: ['--acp'],
163
- })
164
-
165
- const models = await codeAgent.getAvailableModels()
166
- // [{ modelId: 'claude-sonnet-4-20250514', name: 'Claude Sonnet' }, ...]
167
- ```
168
-
169
- ### Set the model
125
+ ACP agents may expose selectable models. Pass `model` in the ACP configuration to select a model after session creation, or use `AcpAgent.getAvailableModels()` and `AcpAgent.setModel()` to manage models at runtime.
170
126
 
171
- Pass the `model` option to select a model at connection time:
172
-
173
- ```typescript
174
- import { AcpAgent } from '@mastra/acp'
175
-
176
- export const codeAgent = new AcpAgent({
177
- id: 'code-agent',
178
- description: 'An ACP-compatible coding agent',
179
- command: 'claude',
180
- args: ['--acp'],
181
- model: '__AI_SDK_ANTHROPIC_MODEL_SONNET__',
182
- })
183
- ```
184
-
185
- You can also change the model at runtime with `setModel()`:
186
-
187
- ```typescript
188
- await codeAgent.setModel('__AI_SDK_ANTHROPIC_MODEL_SONNET__')
189
- ```
190
-
191
- If the ACP agent advertises available models and your model ID doesn't match any of them, Mastra throws an error listing the valid options:
192
-
193
- ```text
194
- Model "bad-model-id" is not available. Available models: claude-sonnet-4-20250514, claude-haiku-4-20250514
195
- ```
196
-
197
- If the agent doesn't advertise a model list, the value is passed through without validation.
127
+ See the [AcpAgent model management methods](https://mastra.ai/reference/acp/acp-agent) for examples.
198
128
 
199
129
  ## Session lifecycle
200
130
 
201
- `createACPTool` and `AcpAgent` start the configured command on first use and create an ACP session. By default, `persistSession` is `true`, so the child process stays alive across calls.
202
-
203
- Use the default persistent session when:
204
-
205
- - The ACP agent benefits from keeping conversation or repository context.
206
- - Startup is expensive and repeated calls should reuse the same process.
207
- - A parent agent may delegate several related tasks to the same coding agent.
131
+ `AcpAgent` starts the configured command on first use and creates an ACP session. By default, `persistSession` is `true`, so the child process stays alive across calls. Set `persistSession: false` when each prompt should run in an isolated process.
208
132
 
209
- Set `persistSession: false` when each prompt should run in an isolated process:
210
-
211
- ```typescript
212
- import { AcpAgent } from '@mastra/acp'
213
-
214
- export const codeAgent = new AcpAgent({
215
- id: 'code-agent',
216
- description: 'Run one isolated ACP coding task',
217
- command: 'acp-agent',
218
- args: ['--stdio'],
219
- cwd: process.cwd(),
220
- persistSession: false,
221
- })
222
- ```
223
-
224
- With `persistSession: false`, `@mastra/acp` stops the ACP process after each prompt completes.
133
+ See the [AcpAgent session lifecycle](https://mastra.ai/reference/acp/acp-agent) section for details.
225
134
 
226
135
  ## Permission handling
227
136
 
228
- ACP agents may ask the client to choose a permission option before they continue. By default, `@mastra/acp` selects the first option returned by the ACP agent.
229
-
230
- Pass `onPermissionRequest` to inspect the request and return the selected option yourself:
231
-
232
- ```typescript
233
- import { createACPTool } from '@mastra/acp'
234
-
235
- export const codeAgentTool = createACPTool({
236
- id: 'code-agent',
237
- description: 'Use an ACP-compatible coding agent',
238
- command: 'acp-agent',
239
- args: ['--stdio'],
240
- async onPermissionRequest(request) {
241
- const allowOption = request.options.find(option => option.name === 'Allow')
242
-
243
- if (!allowOption) {
244
- return { outcome: { outcome: 'cancelled' } }
245
- }
246
-
247
- return {
248
- outcome: {
249
- outcome: 'selected',
250
- optionId: allowOption.optionId,
251
- },
252
- }
253
- },
254
- })
255
- ```
137
+ ACP agents may ask the client to choose a permission option before they continue. By default, `@mastra/acp` selects the first option returned by the ACP agent. Pass `onPermissionRequest` when you need custom permission behavior.
256
138
 
257
- Use this callback to enforce local policy, inspect the permission title, or route the decision to your own approval flow.
139
+ See the [createACPTool() permission handling](https://mastra.ai/reference/acp/create-acp-tool) section for a complete example.
258
140
 
259
141
  ## Workspace integration
260
142
 
261
- ACP file operations go through Mastra's workspace abstraction. If you don't pass `workspace`, `@mastra/acp` creates a `Workspace` backed by `LocalFilesystem` and uses `cwd` as the filesystem root.
262
-
263
- Pass a custom `Workspace` when the ACP agent should read and write through a specific filesystem implementation:
264
-
265
- ```typescript
266
- import { AcpAgent } from '@mastra/acp'
267
- import { LocalFilesystem, Workspace } from '@mastra/core/workspace'
268
-
269
- const workspace = new Workspace({
270
- filesystem: new LocalFilesystem({
271
- root: process.cwd(),
272
- }),
273
- })
274
-
275
- export const codeAgent = new AcpAgent({
276
- id: 'code-agent',
277
- description: 'Run coding tasks in a controlled workspace',
278
- command: 'acp-agent',
279
- args: ['--stdio'],
280
- workspace,
281
- })
282
- ```
143
+ ACP file operations go through Mastra's workspace abstraction. `AcpAgent` can use a `workspace` option, and `createACPTool()` uses the current Mastra workspace from the tool execution context when one is available. Without a workspace, `@mastra/acp` falls back to a `Workspace` backed by `LocalFilesystem` at `cwd` or `process.cwd()`.
283
144
 
284
- Use `cwd` and `workspace` together when the ACP process should start in one directory but file operations should use an explicitly configured workspace root.
145
+ See the [AcpAgent workspace integration](https://mastra.ai/reference/acp/acp-agent) section for custom workspace examples.
285
146
 
286
147
  ## Related
287
148
 
149
+ - [AcpAgent reference](https://mastra.ai/reference/acp/acp-agent)
150
+ - [createACPTool() reference](https://mastra.ai/reference/acp/create-acp-tool)
288
151
  - [Agent reference](https://mastra.ai/reference/agents/agent)
289
152
  - [Subagents](https://mastra.ai/docs/agents/supervisor-agents)
290
153
  - [Agent Client Protocol introduction](https://agentclientprotocol.com/overview/introduction)
@@ -20,7 +20,7 @@ export const agent = new Agent({
20
20
  id: 'voice-agent',
21
21
  name: 'Voice Agent',
22
22
  instructions: `You are a helpful assistant with both STT and TTS capabilities.`,
23
- model: 'openai/gpt-5.4',
23
+ model: 'openai/gpt-5.5',
24
24
  voice,
25
25
  })
26
26
 
@@ -109,7 +109,7 @@ export const agent = new Agent({
109
109
  id: 'speech-to-speech-agent',
110
110
  name: 'Speech-to-Speech Agent',
111
111
  instructions: `You are a helpful assistant with speech-to-speech capabilities.`,
112
- model: 'openai/gpt-5.4',
112
+ model: 'openai/gpt-5.5',
113
113
  tools: {
114
114
  // Tools configured on Agent are passed to voice provider
115
115
  search,
@@ -146,7 +146,7 @@ export const agent = new Agent({
146
146
  id: 'support-line',
147
147
  name: 'Support Line',
148
148
  instructions: ({ requestContext }) => `Help user ${requestContext.get('user')}.`,
149
- model: 'openai/gpt-5.4',
149
+ model: 'openai/gpt-5.5',
150
150
  voice: ({ requestContext }) => new OpenAIRealtimeVoice({ apiKey: requestContext.get('apiKey') }),
151
151
  })
152
152
 
@@ -240,7 +240,7 @@ export const convertToText = async (input: string | NodeJS.ReadableStream): Prom
240
240
  export const hybridVoiceAgent = new Agent({
241
241
  id: 'hybrid-voice-agent',
242
242
  name: 'Hybrid Voice Agent',
243
- model: 'openai/gpt-5.4',
243
+ model: 'openai/gpt-5.5',
244
244
  instructions: 'You can speak and listen using different providers.',
245
245
  voice: new CompositeVoice({
246
246
  input: new OpenAIVoice(),
@@ -252,7 +252,7 @@ export const unifiedVoiceAgent = new Agent({
252
252
  id: 'unified-voice-agent',
253
253
  name: 'Unified Voice Agent',
254
254
  instructions: 'You are an agent with both STT and TTS capabilities.',
255
- model: 'openai/gpt-5.4',
255
+ model: 'openai/gpt-5.5',
256
256
  voice: new OpenAIVoice(),
257
257
  })
258
258
 
@@ -294,7 +294,7 @@ export const agent = new Agent({
294
294
  id: 'voice-agent',
295
295
  name: 'Voice Agent',
296
296
  instructions: `You are a helpful assistant with both STT and TTS capabilities.`,
297
- model: 'openai/gpt-5.4',
297
+ model: 'openai/gpt-5.5',
298
298
 
299
299
  // Create a composite voice using OpenAI for listening and PlayAI for speaking
300
300
  voice: new CompositeVoice({
@@ -319,7 +319,7 @@ export const agent = new Agent({
319
319
  id: 'aisdk-voice-agent',
320
320
  name: 'AI SDK Voice Agent',
321
321
  instructions: `You are a helpful assistant with voice capabilities.`,
322
- model: 'openai/gpt-5.4',
322
+ model: 'openai/gpt-5.5',
323
323
 
324
324
  // Pass AI SDK models directly to CompositeVoice
325
325
  voice: new CompositeVoice({
@@ -412,7 +412,7 @@ const supervisorAgent = new Agent({
412
412
  name: 'Supervisor Agent',
413
413
  instructions: `You coordinate data retrieval tasks.
414
414
  Delegate to data-agent for user lookups.`,
415
- model: 'openai/gpt-5.4',
415
+ model: 'openai/gpt-5.5',
416
416
  agents: { dataAgent },
417
417
  memory: new Memory(),
418
418
  })
@@ -80,7 +80,7 @@ import { Agent } from '@mastra/core/agent'
80
80
  export const researcher = new Agent({
81
81
  id: 'researcher',
82
82
  instructions: 'You research topics and answer questions.',
83
- model: 'openai/gpt-5.4',
83
+ model: 'openai/gpt-5.5',
84
84
  tools: { researchTool, summarizeTool },
85
85
  backgroundTasks: {
86
86
  tools: {
@@ -175,7 +175,7 @@ import { Agent } from '@mastra/core/agent'
175
175
  const supervisor = new Agent({
176
176
  id: 'supervisor',
177
177
  instructions: 'Coordinate research and writing using the available agents.',
178
- model: 'openai/gpt-5.4',
178
+ model: 'openai/gpt-5.5',
179
179
  agents: { researchAgent, writingAgent },
180
180
  backgroundTasks: {
181
181
  tools: {
@@ -23,7 +23,7 @@ export const supportAgent = new Agent({
23
23
  id: 'support-agent',
24
24
  name: 'Support Agent',
25
25
  instructions: 'You are a helpful support assistant.',
26
- model: 'openai/gpt-5.4',
26
+ model: 'openai/gpt-5.5',
27
27
  channels: {
28
28
  adapters: {
29
29
  slack: createSlackAdapter(),
@@ -1,6 +1,6 @@
1
1
  # Code mode
2
2
 
3
- > **Experimental:** This feature is experimental. Breaking changes may occur without a major version bump until the API is stable.
3
+ > **Alpha:** This feature is in alpha. Breaking changes may occur without a major version bump until the API is stable.
4
4
 
5
5
  Code mode gives an agent a single tool that runs a short TypeScript program in a sandbox. Instead of calling tools one at a time, the model writes a program that orchestrates your existing tools as `external_*` functions, batching calls with `Promise.all`, aggregating with `reduce`, branching, and doing math in a real runtime, then returns a single result.
6
6
 
@@ -56,7 +56,7 @@ const { tool, instructions } = createCodeMode({
56
56
  const agent = new Agent({
57
57
  name: 'shop-assistant',
58
58
  instructions: ['You are a helpful shopping assistant.', instructions],
59
- model: 'openai/gpt-5.4',
59
+ model: 'openai/gpt-5.5',
60
60
  tools: { execute_typescript: tool },
61
61
  })
62
62
  ```
@@ -144,7 +144,7 @@ const inventory = createCodeMode({
144
144
  const agent = new Agent({
145
145
  name: 'ops-assistant',
146
146
  instructions: ['You are an ops assistant.', sales.instructions, inventory.instructions],
147
- model: 'openai/gpt-5.4',
147
+ model: 'openai/gpt-5.5',
148
148
  tools: { sales_code: sales.tool, inventory_code: inventory.tool },
149
149
  })
150
150
  ```
@@ -246,7 +246,7 @@ costGuard.onViolation = ({ processorId, message, detail }) => {
246
246
 
247
247
  // Log moderation violations
248
248
  const moderation = new ModerationProcessor({
249
- model: '__OPENAI_MODEL_NANO__',
249
+ model: 'openai/gpt-5-nano',
250
250
  strategy: 'block',
251
251
  })
252
252
 
@@ -360,7 +360,7 @@ See [workflows as processors](https://mastra.ai/docs/agents/processors) for more
360
360
  Guardrail processors don't need your primary model. Use a small, fast model for classification tasks:
361
361
 
362
362
  ```typescript
363
- const GUARDRAIL_MODEL = '__OPENAI_MODEL_NANO__'
363
+ const GUARDRAIL_MODEL = 'openai/gpt-5-nano'
364
364
 
365
365
  new ModerationProcessor({ model: GUARDRAIL_MODEL })
366
366
  new PIIDetector({ model: GUARDRAIL_MODEL })
@@ -27,7 +27,7 @@ export const routingAgent = new Agent({
27
27
  name: 'Routing Agent',
28
28
  instructions: `
29
29
  You are a network of writers and researchers. The user will ask you to research a topic. Always respond with a complete report—no bullet points. Write in full paragraphs, like a blog post. Do not answer with incomplete or uncertain information.`,
30
- model: 'openai/gpt-5.4',
30
+ model: 'openai/gpt-5.5',
31
31
  agents: {
32
32
  researchAgent,
33
33
  writingAgent,
@@ -19,7 +19,7 @@ export const testAgent = new Agent({
19
19
  id: 'test-agent',
20
20
  name: 'Test Agent',
21
21
  instructions: 'You are a helpful assistant.',
22
- model: 'openai/gpt-5.4',
22
+ model: 'openai/gpt-5.5',
23
23
  })
24
24
  ```
25
25
 
@@ -382,7 +382,7 @@ import { TokenLimiter } from '@mastra/core/processors'
382
382
 
383
383
  const agent = new Agent({
384
384
  name: 'my-agent',
385
- model: 'openai/gpt-5.4',
385
+ model: 'openai/gpt-5.5',
386
386
  inputProcessors: [new TokenLimiter(127000)],
387
387
  })
388
388
  ```
@@ -425,6 +425,149 @@ Add `ProviderHistoryCompat` explicitly when you need provider history compatibil
425
425
 
426
426
  See the [`ProviderHistoryCompat` reference](https://mastra.ai/reference/processors/provider-history-compat) for setup, built-in rules, and custom rule options.
427
427
 
428
+ ## Response caching
429
+
430
+ > **Alpha:** This feature is in alpha. Breaking changes may occur without a major version bump until the API is stable.
431
+
432
+ Response caching skips the LLM call and replays a previously cached response when an agent receives an identical request. Use it to reduce latency and avoid paying for repeated calls.
433
+
434
+ Caching is implemented as the [`ResponseCache`](https://mastra.ai/reference/processors/response-cache) input processor. Mastra doesn't provide an agent-level option. To enable caching, register the processor explicitly. This keeps the API surface small while Mastra collects feedback; per-call overrides flow through `RequestContext`.
435
+
436
+ ### When to use response caching
437
+
438
+ Reach for it when the same request shape repeats across users or sessions, for example prompt templates, suggested-prompt buttons, agentic search re-asks, or guardrail LLMs that classify the same input over and over. Skip it when calls trigger external side effects through tools, since cache hits replay tool calls without re-executing them.
439
+
440
+ ### Quickstart
441
+
442
+ Add a `ResponseCache` to the agent's `inputProcessors` and pass any `MastraServerCache` as the backend. For development, `InMemoryServerCache` works out of the box:
443
+
444
+ ```typescript
445
+ import { Agent } from '@mastra/core/agent'
446
+ import { InMemoryServerCache } from '@mastra/core/cache'
447
+ import { ResponseCache } from '@mastra/core/processors'
448
+
449
+ const cache = new InMemoryServerCache()
450
+
451
+ export const searchAgent = new Agent({
452
+ name: 'Search Agent',
453
+ instructions: 'You answer questions concisely.',
454
+ model: 'openai/gpt-5',
455
+ inputProcessors: [new ResponseCache({ cache, ttl: 600 })], // 10 minutes
456
+ })
457
+ ```
458
+
459
+ The first call runs the LLM normally and writes the response to the cache. Subsequent calls with an identical resolved prompt return the cached response without invoking the LLM.
460
+
461
+ ### Per-call overrides via RequestContext
462
+
463
+ Per-call config flows through `RequestContext`. Use `ResponseCache.context()` to build a fresh context, or `ResponseCache.applyContext()` to merge into one you already have:
464
+
465
+ ```typescript
466
+ import { ResponseCache } from '@mastra/core/processors'
467
+ import { RequestContext } from '@mastra/core/request-context'
468
+
469
+ // Fresh context with the override
470
+ await agent.stream('hello', {
471
+ requestContext: ResponseCache.context({ key: 'custom-key', bust: true }),
472
+ })
473
+
474
+ // Or merge into an existing context
475
+ const ctx = new RequestContext()
476
+ ctx.set('caller-meta', { userId: 'u-123' })
477
+ ResponseCache.applyContext(ctx, { bust: true })
478
+ await agent.stream('hello', { requestContext: ctx })
479
+ ```
480
+
481
+ Three fields are overridable per call:
482
+
483
+ - `key`: String or function. Overrides the auto-derived cache key for this request only.
484
+ - `scope`: String or `null`. Overrides the tenant/user scope for this request only. `null` opts out of scoping.
485
+ - `bust`: Boolean. Skips the cache read but still writes on completion (useful for "force refresh" buttons).
486
+
487
+ `cache`, `ttl`, and `agentId` stay on the constructor. They're instance-level concerns and not safe to vary per call.
488
+
489
+ ### Tenant scoping
490
+
491
+ By default, `ResponseCache` looks up `MASTRA_RESOURCE_ID_KEY` on the request context and uses it as the cache scope. This means an agent that already populates the resource id (e.g. via memory) gets per-user isolation automatically. Two users never see each other's cached responses.
492
+
493
+ Override explicitly when you need a different scope:
494
+
495
+ ```typescript
496
+ new Agent({
497
+ // ...
498
+ inputProcessors: [
499
+ new ResponseCache({
500
+ cache,
501
+ scope: 'org-123', // explicit tenant scope
502
+ }),
503
+ ],
504
+ })
505
+ ```
506
+
507
+ Pass `scope: null` to deliberately share entries across all callers. Only use this for known-public, non-personalized content.
508
+
509
+ ### Custom cache backend
510
+
511
+ `ResponseCache` accepts any `MastraServerCache`. For production, use `RedisCache` from `@mastra/redis`:
512
+
513
+ ```typescript
514
+ import { Agent } from '@mastra/core/agent'
515
+ import { ResponseCache } from '@mastra/core/processors'
516
+ import { RedisCache } from '@mastra/redis'
517
+
518
+ const cache = new RedisCache({ url: process.env.REDIS_URL })
519
+
520
+ export const agent = new Agent({
521
+ name: 'Cached Agent',
522
+ instructions: '...',
523
+ model: 'openai/gpt-5',
524
+ inputProcessors: [new ResponseCache({ cache })],
525
+ })
526
+ ```
527
+
528
+ For a custom backend, extend `MastraServerCache` and implement its abstract methods (the processor only calls `get` and `set`).
529
+
530
+ ### How caching is implemented
531
+
532
+ `ResponseCache` hooks into `processLLMRequest` (cache lookup, short-circuits on hit) and `processLLMResponse` (cache write on completion). Both run inside the agentic loop _after_ memory has loaded and earlier input processors have transformed the prompt.
533
+
534
+ This means the cache key is derived from the resolved `LanguageModelV2Prompt` Mastra is about to send to the model. The key is created _after_ memory has loaded and earlier input processors have run, and each step in an agentic tool loop is independently cached.
535
+
536
+ ### What's in the cache key
537
+
538
+ When you don't supply `key`, the processor derives one deterministically from the inputs that change the LLM's response at this step: `agentId`, `stepNumber` (so each step in a tool loop has its own cache entry), `scope`, model identity (`provider`, `modelId`, spec version), and the resolved `prompt` (post-memory + post-processors). Any change to these inputs automatically invalidates the cache.
539
+
540
+ #### Customize the cache key
541
+
542
+ Pass `key` as a function on the constructor or per-call to derive your own cache key from any subset of those inputs. The function receives the same inputs the deterministic hash would have consumed and returns a string (or a `Promise<string>`):
543
+
544
+ ```typescript
545
+ import { ResponseCache, buildResponseCacheKey } from '@mastra/core/processors'
546
+
547
+ await agent.stream(input, {
548
+ requestContext: ResponseCache.context({
549
+ // Cache only on the model id and the resolved prompt tail — ignore
550
+ // step number, scope, etc.
551
+ key: ({ model, prompt }) => `qa:${model.modelId}:${JSON.stringify(prompt).slice(-200)}`,
552
+ }),
553
+ })
554
+
555
+ // Or reuse the deterministic helper while overriding individual fields:
556
+ await agent.stream(input, {
557
+ requestContext: ResponseCache.context({
558
+ key: inputs => buildResponseCacheKey({ ...inputs, scope: 'global' }),
559
+ }),
560
+ })
561
+ ```
562
+
563
+ If the function throws, the processor falls back to the default key derivation so the call still benefits from caching.
564
+
565
+ ### How cache hits work
566
+
567
+ When the processor finds a cache hit, it short-circuits the LLM call by returning the cached chunks from `processLLMRequest`. The agentic loop synthesizes a stream from those chunks instead of calling the model. `agent.generate()` collects them into a `FullOutput`; `agent.stream()` returns a `MastraModelOutput` whose chunks come from the cached buffer, so consumers iterating `fullStream` or awaiting `text`, `usage`, and `finishReason` see the cached values.
568
+
569
+ Cache writes happen after the response completes. Failed runs (errors, tripwire activations) aren't cached, so the next call retries cleanly.
570
+
428
571
  ## Advanced patterns
429
572
 
430
573
  ### Ensure a final response with `maxSteps`
@@ -647,7 +790,7 @@ const moderationWorkflow = createWorkflow({
647
790
  const agent = new Agent({
648
791
  id: 'moderated-agent',
649
792
  name: 'Moderated Agent',
650
- model: 'openai/gpt-5.4',
793
+ model: 'openai/gpt-5.5',
651
794
  inputProcessors: [moderationWorkflow],
652
795
  })
653
796
  ```
@@ -686,7 +829,7 @@ export class QualityChecker implements Processor {
686
829
  const agent = new Agent({
687
830
  id: 'quality-agent',
688
831
  name: 'Quality Agent',
689
- model: 'openai/gpt-5.4',
832
+ model: 'openai/gpt-5.5',
690
833
  outputProcessors: [new QualityChecker()],
691
834
  maxProcessorRetries: 3, // Maximum retry attempts. If unset, retries are disabled (unless errorProcessors are configured, in which case it defaults to 10).
692
835
  })