@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
@@ -0,0 +1,261 @@
1
+ # SDK agents
2
+
3
+ SDK agents let you use other agent SDK frameworks inside Mastra. Use them to register SDK-backed agents in a Mastra project while the provider SDK keeps its own runtime, tools, permissions, and agent loop.
4
+
5
+ ## When to use SDK agents
6
+
7
+ - A vendor SDK already owns the agent loop, tools, permissions, or local runtime.
8
+ - You want to register that SDK-backed agent in a Mastra project.
9
+ - You need Mastra-compatible `generate()` and `stream()` outputs.
10
+ - You want usage, cost, and tool activity from the SDK run to appear in Mastra observability.
11
+
12
+ ## Supported SDK agents
13
+
14
+ - [Claude Agent SDK](#claude-agent-sdk): Use `@mastra/claude` to register a Claude SDK agent and call it with Mastra `generate()` and `stream()`.
15
+ - [Cursor Agent SDK](#cursor-agent-sdk): Use `@mastra/cursor` to register a Cursor SDK agent and call it with Mastra `generate()` and `stream()`.
16
+
17
+ ## Claude Agent SDK
18
+
19
+ Use `@mastra/claude` for Claude Code runtime configuration, permissions, tools, and agent-loop behavior.
20
+
21
+ ### Install Claude packages
22
+
23
+ Install the Mastra package and the Claude Agent SDK peer dependency:
24
+
25
+ **npm**:
26
+
27
+ ```bash
28
+ npm install @mastra/claude @anthropic-ai/claude-agent-sdk
29
+ ```
30
+
31
+ **pnpm**:
32
+
33
+ ```bash
34
+ pnpm add @mastra/claude @anthropic-ai/claude-agent-sdk
35
+ ```
36
+
37
+ **Yarn**:
38
+
39
+ ```bash
40
+ yarn add @mastra/claude @anthropic-ai/claude-agent-sdk
41
+ ```
42
+
43
+ **Bun**:
44
+
45
+ ```bash
46
+ bun add @mastra/claude @anthropic-ai/claude-agent-sdk
47
+ ```
48
+
49
+ Set the Claude SDK credential:
50
+
51
+ ```bash
52
+ export ANTHROPIC_API_KEY="..."
53
+ ```
54
+
55
+ ### Create a Claude SDK agent
56
+
57
+ Configure Claude Agent SDK through `sdkOptions`.
58
+
59
+ ```typescript
60
+ import { ClaudeSDKAgent } from '@mastra/claude'
61
+
62
+ export const claudeSDKAgent = new ClaudeSDKAgent({
63
+ id: 'claude-sdk-agent',
64
+ name: 'Claude SDK Agent',
65
+ description: 'Use Claude Agent SDK through Mastra.',
66
+ sdkOptions: {
67
+ model: 'claude-sonnet-4-6',
68
+ cwd: process.cwd(),
69
+ },
70
+ })
71
+ ```
72
+
73
+ ### Add Claude SDK tools
74
+
75
+ Claude Agent SDK tools are provided through Claude SDK Model Context Protocol (MCP) servers. Create the server with the Claude SDK, then pass it through `sdkOptions.mcpServers`.
76
+
77
+ ```typescript
78
+ import { createSdkMcpServer } from '@anthropic-ai/claude-agent-sdk'
79
+ import { ClaudeSDKAgent } from '@mastra/claude'
80
+ import { getTemperature } from '../tools/get-temperature'
81
+
82
+ const weatherServer = createSdkMcpServer({
83
+ name: 'weather',
84
+ version: '1.0.0',
85
+ tools: [getTemperature],
86
+ })
87
+
88
+ export const claudeSDKAgent = new ClaudeSDKAgent({
89
+ id: 'claude-sdk-agent',
90
+ name: 'Claude SDK Agent',
91
+ description: 'Use Claude Agent SDK through Mastra.',
92
+ sdkOptions: {
93
+ model: 'claude-sonnet-4-6',
94
+ cwd: process.cwd(),
95
+ mcpServers: {
96
+ weather: weatherServer,
97
+ },
98
+ allowedTools: ['mcp__weather__get_temperature'],
99
+ },
100
+ })
101
+ ```
102
+
103
+ The `allowedTools` value uses Claude Agent SDK MCP tool naming: `mcp__<server name>__<tool name>`.
104
+
105
+ ## Cursor Agent SDK
106
+
107
+ Use `@mastra/cursor` to register a Cursor SDK agent in Mastra while keeping Cursor-specific setup in Cursor SDK options.
108
+
109
+ ### Install Cursor packages
110
+
111
+ Install the Mastra package and the Cursor SDK peer dependency:
112
+
113
+ **npm**:
114
+
115
+ ```bash
116
+ npm install @mastra/cursor @cursor/sdk
117
+ ```
118
+
119
+ **pnpm**:
120
+
121
+ ```bash
122
+ pnpm add @mastra/cursor @cursor/sdk
123
+ ```
124
+
125
+ **Yarn**:
126
+
127
+ ```bash
128
+ yarn add @mastra/cursor @cursor/sdk
129
+ ```
130
+
131
+ **Bun**:
132
+
133
+ ```bash
134
+ bun add @mastra/cursor @cursor/sdk
135
+ ```
136
+
137
+ Set the Cursor SDK credential:
138
+
139
+ ```bash
140
+ export CURSOR_API_KEY="..."
141
+ ```
142
+
143
+ ### Create a Cursor SDK agent
144
+
145
+ Configure Cursor Agent SDK through `sdkOptions`.
146
+
147
+ ```typescript
148
+ import { CursorSDKAgent } from '@mastra/cursor'
149
+
150
+ export const cursorSDKAgent = new CursorSDKAgent({
151
+ id: 'cursor-sdk-agent',
152
+ name: 'Cursor SDK Agent',
153
+ description: 'Use Cursor Agent SDK through Mastra.',
154
+ sdkOptions: {
155
+ apiKey: process.env.CURSOR_API_KEY,
156
+ model: {
157
+ id: 'gpt-5.5',
158
+ },
159
+ local: {
160
+ cwd: process.cwd(),
161
+ },
162
+ },
163
+ })
164
+ ```
165
+
166
+ Cursor local agents require an explicit model. Set it in `sdkOptions.model`.
167
+
168
+ ### Use an existing Cursor SDK agent
169
+
170
+ If your app already creates a Cursor SDK agent, pass that agent to `CursorSDKAgent` instead:
171
+
172
+ ```typescript
173
+ import { Agent as CursorAgent } from '@cursor/sdk'
174
+ import { CursorSDKAgent } from '@mastra/cursor'
175
+
176
+ const cursorAgent = CursorAgent.create({
177
+ apiKey: process.env.CURSOR_API_KEY,
178
+ model: {
179
+ id: 'gpt-5.5',
180
+ },
181
+ local: {
182
+ cwd: process.cwd(),
183
+ },
184
+ })
185
+
186
+ export const cursorSDKAgent = new CursorSDKAgent({
187
+ id: 'cursor-sdk-agent',
188
+ name: 'Cursor SDK Agent',
189
+ description: 'Use Cursor Agent SDK through Mastra.',
190
+ agent: cursorAgent,
191
+ })
192
+ ```
193
+
194
+ ### Add Cursor SDK tools
195
+
196
+ Cursor Agent SDK tools are configured with Cursor SDK options. Pass Model Context Protocol (MCP) servers through `sdkOptions.mcpServers`:
197
+
198
+ ```typescript
199
+ import { CursorSDKAgent } from '@mastra/cursor'
200
+ import { mcpServers } from '../mcp/cursor'
201
+
202
+ export const cursorSDKAgent = new CursorSDKAgent({
203
+ id: 'cursor-sdk-agent',
204
+ name: 'Cursor SDK Agent',
205
+ description: 'Use Cursor Agent SDK through Mastra.',
206
+ sdkOptions: {
207
+ apiKey: process.env.CURSOR_API_KEY,
208
+ model: {
209
+ id: 'gpt-5.5',
210
+ },
211
+ local: {
212
+ cwd: process.cwd(),
213
+ },
214
+ mcpServers,
215
+ },
216
+ })
217
+ ```
218
+
219
+ ## Register SDK agents
220
+
221
+ Register SDK agents in the Mastra instance like other agents:
222
+
223
+ ```typescript
224
+ import { Mastra } from '@mastra/core'
225
+ import { claudeSDKAgent } from './agents/claude-sdk-agent'
226
+ import { cursorSDKAgent } from './agents/cursor-sdk-agent'
227
+
228
+ export const mastra = new Mastra({
229
+ agents: {
230
+ claudeSDKAgent,
231
+ cursorSDKAgent,
232
+ },
233
+ })
234
+ ```
235
+
236
+ After registration, call them with `mastra.getAgentById()`:
237
+
238
+ ```typescript
239
+ import { mastra } from './index'
240
+
241
+ const agent = mastra.getAgentById('cursor-sdk-agent')
242
+ const stream = await agent.stream('Inspect this project and describe the test setup.')
243
+
244
+ for await (const chunk of stream.textStream) {
245
+ process.stdout.write(chunk)
246
+ }
247
+ ```
248
+
249
+ ## Observability
250
+
251
+ SDK agents create Mastra agent and model spans for `generate()` and `stream()` calls. Mastra records SDK-provided usage, tool activity, and provider metadata when the vendor SDK exposes those events.
252
+
253
+ Claude SDK runs can include SDK-estimated cost from the Claude result message. Cursor SDK runs include token usage from Cursor interaction updates.
254
+
255
+ For storage and dashboard setup, see [Observability](https://mastra.ai/docs/observability/overview).
256
+
257
+ ## Related
258
+
259
+ - [Agents overview](https://mastra.ai/docs/agents/overview)
260
+ - [Tools](https://mastra.ai/docs/agents/using-tools)
261
+ - [Observability](https://mastra.ai/docs/observability/overview)
@@ -1,6 +1,6 @@
1
1
  # Signals
2
2
 
3
- > **Experimental:** This feature is in alpha. 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
  Signals are a way to interact with an agent through a thread. Instead of starting every interaction with `agent.stream()`, subscribe to a thread and send messages or signals. Mastra either wakes the agent when the thread is idle, drops input into the running agent loop, or queues input for the next turn.
6
6
 
@@ -97,7 +97,7 @@ The behavior options are:
97
97
  - `ifIdle.behavior: 'persist'`: Save the signal or message to memory without starting a stream.
98
98
  - `ifIdle.behavior: 'discard'`: Ignore the signal or message while the thread is idle.
99
99
 
100
- Pass `ifIdle.streamOptions` when the idle wake-up stream needs options such as model settings, tools, or runtime context. You do not need to repeat `memory.resource` or `memory.thread`; Mastra uses the top-level `resourceId` and `threadId` for the thread.
100
+ Pass `ifIdle.streamOptions` when the idle wake-up stream needs options such as model settings, tools, or runtime context. You don't need to repeat `memory.resource` or `memory.thread`; Mastra uses the top-level `resourceId` and `threadId` for the thread.
101
101
 
102
102
  ```typescript
103
103
  agent.sendMessage('Continue with the next step.', {
@@ -143,6 +143,10 @@ The model receives the signal as context like this:
143
143
 
144
144
  Use XML-safe `tagName` and attribute names. They can contain letters, numbers, underscores, periods, and hyphens. They must start with a letter or underscore.
145
145
 
146
+ ### Storage support
147
+
148
+ Notification inbox storage is available in the storage adapters that support richer memory and signal workflows: [libSQL](https://mastra.ai/reference/storage/libsql), [PostgreSQL](https://mastra.ai/reference/storage/postgresql), and [MongoDB](https://mastra.ai/reference/storage/mongodb). These adapters expose notification records through `getStore('notifications')`.
149
+
146
150
  ## Send processor context
147
151
 
148
152
  Processors can send reactive signals during a run. A processor should inspect the chat history, react to a specific trigger, and avoid sending the same context more than once.
@@ -220,7 +224,224 @@ When the agent is idle:
220
224
  <user source="chat" delivery="new-message">Also cover the edge cases.</user>
221
225
  ```
222
226
 
223
- Top-level `attributes` always apply. The selected branch's `attributes` are merged into them at delivery time. The `delivery` name shown above is not a special Mastra API field. It is a custom attribute name used for this example, you can add any attribute names that suit your use case.
227
+ Top-level `attributes` always apply. The selected branch's `attributes` are merged into them at delivery time. The `delivery` name shown above isn't a special Mastra API field. It's a custom attribute name used for this example. Add any attribute names that suit your use case.
228
+
229
+ ## State signals
230
+
231
+ State signals expose named, thread-scoped context lanes. Use them for durable context that changes over time, such as browser state, editor state, or a background watcher result.
232
+
233
+ Each state signal needs:
234
+
235
+ - `id`: The state lane name, such as `browser`.
236
+ - `cacheKey`: A producer-owned key for deduping the current state.
237
+ - `mode`: `snapshot` for an authoritative state copy, or `delta` for a change event.
238
+
239
+ Use `sendStateSignal()` when an external producer detects a state change.
240
+
241
+ ```typescript
242
+ await agent.sendStateSignal(
243
+ {
244
+ id: 'browser',
245
+ mode: 'snapshot',
246
+ cacheKey: 'browser:https://example.com:3-tabs',
247
+ contents: 'Browser is open on https://example.com with 3 tabs.',
248
+ value: {
249
+ activeUrl: 'https://example.com',
250
+ tabCount: 3,
251
+ open: true,
252
+ },
253
+ },
254
+ {
255
+ resourceId: 'user_123',
256
+ threadId: 'thread_456',
257
+ },
258
+ )
259
+ ```
260
+
261
+ When Mastra accepts a state signal, it stores compact tracking metadata on the thread. The metadata records the lane's current `cacheKey`, current mode, version, last signal id, and last snapshot signal id. If a producer sends the same `cacheKey` and mode again while that state is still current, Mastra skips the duplicate.
262
+
263
+ State signal fields have separate roles:
264
+
265
+ - `contents`: The representation the model reads.
266
+ - `value`: The structured snapshot for `mode: 'snapshot'`.
267
+ - `delta`: The structured change for `mode: 'delta'`.
268
+ - `metadata.state`: The runtime tracking envelope with `id`, `mode`, `cacheKey`, `version`, and `threadId`.
269
+
270
+ Use `computeStateSignal()` when a processor owns a state lane. Mastra calls it once per model input step after `processInputStep()`. If the processor omits `id`, Mastra uses the processor id as the state lane id. Set `stateId` when the public state lane should differ from the processor id.
271
+
272
+ ```typescript
273
+ import type { ComputeStateSignalArgs, Processor } from '@mastra/core/processors'
274
+
275
+ export const browserStateProcessor: Processor = {
276
+ id: 'browser-state',
277
+ stateId: 'browser',
278
+ computeStateSignal(args: ComputeStateSignalArgs) {
279
+ const browser = readCurrentBrowserState()
280
+ const previous = readMostRecentBrowserState(args.activeStateSignals)
281
+ const changed = previous ? diffBrowserState(previous, browser) : browser
282
+ const shouldRefreshSnapshot = Boolean(args.lastSnapshot && !args.contextWindow.hasSnapshot)
283
+
284
+ if (previous && Object.keys(changed).length === 0 && !shouldRefreshSnapshot) {
285
+ return
286
+ }
287
+
288
+ const isDelta = Boolean(previous && !shouldRefreshSnapshot)
289
+
290
+ return {
291
+ mode: isDelta ? 'delta' : 'snapshot',
292
+ cacheKey: stableBrowserStateCacheKey(browser),
293
+ contents: isDelta ? describeBrowserDelta(changed) : describeBrowserSnapshot(browser),
294
+ value: browser,
295
+ ...(isDelta ? { delta: changed } : {}),
296
+ }
297
+ },
298
+ }
299
+ ```
300
+
301
+ Mastra passes `lastSnapshot` and `deltasSinceSnapshot` into `computeStateSignal()`. It resolves them from message history when the current message list doesn't contain the latest snapshot. The processor still owns merge and diff logic.
302
+
303
+ `contextWindow.hasSnapshot` tells the processor whether the active message window already contains a snapshot for this state lane. If it's `false`, return a fresh `snapshot` so the model sees the current state even after older state messages are trimmed from the context window.
304
+
305
+ The built-in browser context processor emits state under the `browser` id with snapshot and delta modes.
306
+
307
+ ## Notification signals
308
+
309
+ Notification signals represent external events such as GitHub activity, email, Slack mentions, CI status, incidents, recordings, or direct messages. Use `agent.sendNotificationSignal()` when the event should create a durable inbox record.
310
+
311
+ Notification delivery has two phases:
312
+
313
+ - **Ingress**: `agent.sendNotificationSignal()` stores a notification record, then resolves the agent's delivery policy.
314
+ - **Dispatch**: Mastra consumes due records stamped with `deliverAt` or `summaryAt` and emits full notification or summary signals.
315
+
316
+ A notification record stores the source, kind, priority, summary, payload, resource id, thread id, agent id, coalescing keys, and delivery metadata. The delivery decision controls what happens after ingress:
317
+
318
+ - `deliver` or `queue`: Emit a full `<notification>` signal and mark the record `delivered`.
319
+ - `defer`: Keep the record `pending` with `deliverAt`.
320
+ - `summarize`: Keep the record `pending` with `summaryAt`, or emit an immediate summary when the policy requests it.
321
+ - `persist`: Keep the record `pending` in the inbox without scheduled delivery.
322
+ - `discard`: Mark the record `discarded` and emit no signal.
323
+
324
+ The default delivery policy is priority-aware:
325
+
326
+ | Priority | Active thread | Idle thread |
327
+ | -------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
328
+ | `urgent` | Deliver a full notification immediately | Deliver a full notification immediately |
329
+ | `high` | Emit a summary immediately, keep `deliverAt`, then deliver the full notification when the thread is idle | Deliver a full notification immediately |
330
+ | `medium` | Batch with `summaryAt` and later deliver one notification summary | Deliver a full notification immediately |
331
+ | `low` | Batch with `summaryAt` and later deliver one notification summary | Batch with `summaryAt` and later deliver one notification summary without waking the model loop |
332
+
333
+ ```typescript
334
+ await agent.sendNotificationSignal(
335
+ {
336
+ source: 'github',
337
+ kind: 'ci-status',
338
+ priority: 'high',
339
+ summary: 'CI failed on main: 3 tests failed.',
340
+ payload: {
341
+ repository: 'acme/app',
342
+ branch: 'main',
343
+ },
344
+ dedupeKey: 'github:acme/app:main:ci',
345
+ },
346
+ {
347
+ resourceId: 'user_123',
348
+ threadId: 'thread_456',
349
+ },
350
+ )
351
+ ```
352
+
353
+ The model receives full notifications as context:
354
+
355
+ ```xml
356
+ <notification source="github" type="ci-status" priority="high" status="delivered">CI failed on main: 3 tests failed.</notification>
357
+ ```
358
+
359
+ Notification summaries tell the model that inbox records are waiting:
360
+
361
+ ```xml
362
+ <notification-summary pending="10">github: 3, email: 5, slack: 2</notification-summary>
363
+ ```
364
+
365
+ When Mastra emits a summary, it clears `summaryAt` and sets `summarySignalId` on each summarized record. The records stay pending and readable. When Mastra emits a full notification, it sets `deliveredSignalId` and marks the record `delivered`. If the inbox tool reads a notification first, it can inject the full notification signal and mark the record `seen`, which prevents duplicate full delivery.
366
+
367
+ Configure a delivery policy on the agent when some notifications should wait for a different dispatch window or summary rollup.
368
+
369
+ ```typescript
370
+ export const supportAgent = new Agent({
371
+ id: 'support-agent',
372
+ name: 'Support Agent',
373
+ instructions: 'Help the user triage updates.',
374
+ model: 'openai/gpt-5.5',
375
+ notifications: {
376
+ deliveryPolicy: {
377
+ priorities: {
378
+ urgent: 'deliver',
379
+ },
380
+ decide: ({ record }) => {
381
+ if (record.priority === 'low') {
382
+ return {
383
+ action: 'summarize',
384
+ summaryAt: new Date(Date.now() + 30 * 60 * 1000),
385
+ }
386
+ }
387
+ },
388
+ },
389
+ },
390
+ })
391
+ ```
392
+
393
+ Enable scheduled dispatch at the Mastra level so deferred notifications and summary rollups are delivered through the existing workflow scheduler.
394
+
395
+ ```typescript
396
+ export const mastra = new Mastra({
397
+ agents: { supportAgent },
398
+ storage,
399
+ notifications: {
400
+ dispatch: {
401
+ enabled: true,
402
+ cron: '*/1 * * * *',
403
+ batchSize: 100,
404
+ },
405
+ },
406
+ })
407
+ ```
408
+
409
+ `notifications.dispatch.enabled` registers an internal workflow with the default cron `*/1 * * * *`. The dispatcher reads due notification records from storage, groups summaries by `agentId`, `resourceId`, and `threadId`, and emits signals through the Agent thread runtime. It isn't a user-facing entrypoint.
410
+
411
+ ### Notification inbox tool
412
+
413
+ Use `createNotificationInboxTool()` to give agents one tool for inbox actions instead of many CRUD tools.
414
+
415
+ ```typescript
416
+ import { createNotificationInboxTool } from '@mastra/core/notifications'
417
+
418
+ const notificationsStorage = await storage.getStore('notifications')
419
+
420
+ export const supportAgent = new Agent({
421
+ id: 'support-agent',
422
+ name: 'Support Agent',
423
+ instructions: 'Help the user triage updates.',
424
+ model: 'openai/gpt-5.5',
425
+ tools: {
426
+ notificationInbox: createNotificationInboxTool({ storage: notificationsStorage }),
427
+ },
428
+ })
429
+ ```
430
+
431
+ The tool id is `notification-inbox`. It supports these actions:
432
+
433
+ - `list`: List notifications for the current thread.
434
+ - `read`: Deliver readable full notification signals into the chat when possible, then mark records `seen`.
435
+ - `markSeen`: Mark one record `seen`.
436
+ - `dismiss`: Mark one record `dismissed`.
437
+ - `archive`: Mark one record `archived`.
438
+ - `search`: Search notification summaries in the current thread.
439
+
440
+ The tool uses the current `threadId` from the tool execution context unless one is provided. Use `read` after a `<notification-summary>` signal when the agent needs the full records behind the summary. The `read` result reports how many notifications will be delivered; it doesn't use normal tool output as the main context channel for the notification contents.
441
+
442
+ `sendNotificationSignal()` requires a storage domain with `notifications` support. LibSQL supports notifications. Other storage adapters need matching notification domain support before they can store notification records.
443
+
444
+ Use `sendSignal({ type: 'notification' })` only for lower-level notification-shaped context that should bypass inbox storage.
224
445
 
225
446
  ## Compatibility
226
447
 
@@ -229,7 +450,7 @@ Mastra still accepts legacy signal payloads such as `type: 'user-message'` and `
229
450
  - `type: 'user-message'`: Normalizes to `type: 'user'` and `tagName: 'user'`
230
451
  - `type: 'system-reminder'`: Normalizes to `type: 'reactive'` and `tagName: 'system-reminder'`
231
452
 
232
- Existing stored signal rows and older clients continue to load through the compatibility layer.
453
+ Existing stored signal rows and older clients continue to load through the compatibility layer. New clients call the message routes when the server supports them; React's thread signal path falls back to the legacy `/signals` route when it detects an older server.
233
454
 
234
455
  > **Note:** Visit [Agent signals reference](https://mastra.ai/reference/agents/agent) for the full message, signal, and subscription types.
235
456
 
@@ -264,11 +485,8 @@ const subscription = await agent.subscribeToThread({
264
485
  threadId: 'thread_456',
265
486
  })
266
487
 
267
- await agent.sendSignal({
268
- signal: {
269
- type: 'user-message',
270
- contents: 'Show the shorter version.',
271
- },
488
+ await agent.sendMessage({
489
+ message: 'Show the shorter version.',
272
490
  resourceId: 'user_123',
273
491
  threadId: 'thread_456',
274
492
  })
@@ -307,7 +525,9 @@ Use heartbeats together with client-side reconnect logic. Heartbeats reduce idle
307
525
  - [`Agent.queueMessage()`](https://mastra.ai/reference/agents/agent)
308
526
  - [`Agent.sendSignal()`](https://mastra.ai/reference/agents/agent)
309
527
  - [`Agent.subscribeToThread()`](https://mastra.ai/reference/agents/agent)
310
- - [Server agent routes](https://mastra.ai/reference/server/routes)
528
+ - [`client.getAgent().sendMessage()`](https://mastra.ai/reference/client-js/agents)
529
+ - [`client.getAgent().queueMessage()`](https://mastra.ai/reference/client-js/agents)
311
530
  - [`client.getAgent().sendSignal()`](https://mastra.ai/reference/client-js/agents)
531
+ - [Server agent routes](https://mastra.ai/reference/server/routes)
312
532
  - [`client.getAgent().subscribeToThread()`](https://mastra.ai/reference/client-js/agents)
313
533
  - [`client.getAgent().sendToolApproval()`](https://mastra.ai/reference/client-js/agents)
@@ -178,7 +178,7 @@ const response = await testAgent.generate('Analyze the TypeScript programming la
178
178
  differentiators: z.array(z.string()),
179
179
  }),
180
180
  }),
181
- model: 'openai/gpt-5.4',
181
+ model: 'openai/gpt-5.5',
182
182
  },
183
183
  })
184
184
 
@@ -248,7 +248,7 @@ When `model` is provided to the `structuredOutput` property, Mastra uses a separ
248
248
  const response = await testAgent.generate('Tell me about TypeScript.', {
249
249
  structuredOutput: {
250
250
  schema: yourSchema,
251
- model: 'openai/gpt-5.4',
251
+ model: 'openai/gpt-5.5',
252
252
  },
253
253
  })
254
254
  ```
@@ -267,7 +267,7 @@ const response = await testAgent.generate('Return my profile as structured data.
267
267
  hometown: z.string(),
268
268
  petName: z.string(),
269
269
  }),
270
- model: 'openai/gpt-5.4',
270
+ model: 'openai/gpt-5.5',
271
271
  useAgent: true,
272
272
  },
273
273
  })
@@ -284,7 +284,7 @@ const result = await agent.stream('weather in vancouver?', {
284
284
  prepareStep: async ({ stepNumber }) => {
285
285
  if (stepNumber === 0) {
286
286
  return {
287
- model: 'openai/gpt-5.4',
287
+ model: 'openai/gpt-5.5',
288
288
  tools: {
289
289
  weatherTool,
290
290
  },
@@ -292,7 +292,7 @@ const result = await agent.stream('weather in vancouver?', {
292
292
  }
293
293
  }
294
294
  return {
295
- model: 'openai/gpt-5.4',
295
+ model: 'openai/gpt-5.5',
296
296
  tools: undefined,
297
297
  structuredOutput: {
298
298
  schema: z.object({
@@ -41,7 +41,7 @@ const supervisor = new Agent({
41
41
  id: 'supervisor',
42
42
  instructions: `You coordinate research and writing using specialized agents.
43
43
  Delegate to research-agent for facts, then writing-agent for content.`,
44
- model: 'openai/gpt-5.4',
44
+ model: 'openai/gpt-5.5',
45
45
  agents: { researchAgent, writingAgent },
46
46
  memory: new Memory({
47
47
  storage: new LibSQLStore({ id: 'storage', url: 'file:mastra.db' }),
@@ -326,7 +326,7 @@ Enable the [backgroundTasks manager](https://mastra.ai/reference/configuration)
326
326
  const supervisor = new Agent({
327
327
  id: 'supervisor',
328
328
  instructions: 'Coordinate research and writing using the available agents.',
329
- model: 'openai/gpt-5.4',
329
+ model: 'openai/gpt-5.5',
330
330
  agents: { researchAgent, writingAgent },
331
331
  backgroundTasks: {
332
332
  tools: {
@@ -52,7 +52,7 @@ export const weatherAgent = new Agent({
52
52
  instructions: `
53
53
  You are a helpful weather assistant.
54
54
  Use the weatherTool to fetch current weather data.`,
55
- model: 'openai/gpt-5.4',
55
+ model: 'openai/gpt-5.5',
56
56
  tools: { weatherTool },
57
57
  })
58
58
  ```
@@ -145,7 +145,7 @@ export const weatherAgent = new Agent({
145
145
  You are a helpful weather assistant.
146
146
  Use the weatherTool to fetch current weather data.
147
147
  Use the hazardsTool to provide information about potential weather hazards.`,
148
- model: 'openai/gpt-5.4',
148
+ model: 'openai/gpt-5.5',
149
149
  tools: { weatherTool, hazardsTool },
150
150
  })
151
151
  ```
@@ -162,14 +162,14 @@ const writer = new Agent({
162
162
  name: 'Writer',
163
163
  description: 'Drafts and edits written content',
164
164
  instructions: 'You are a skilled writer.',
165
- model: 'openai/gpt-5.4',
165
+ model: 'openai/gpt-5.5',
166
166
  })
167
167
 
168
168
  export const supervisor = new Agent({
169
169
  id: 'supervisor',
170
170
  name: 'Supervisor',
171
171
  instructions: 'Coordinate the writer to produce content.',
172
- model: 'openai/gpt-5.4',
172
+ model: 'openai/gpt-5.5',
173
173
  agents: { writer },
174
174
  })
175
175
  ```
@@ -186,7 +186,7 @@ export const researchAgent = new Agent({
186
186
  id: 'research-agent',
187
187
  name: 'Research Agent',
188
188
  instructions: 'You are a research assistant.',
189
- model: 'openai/gpt-5.4',
189
+ model: 'openai/gpt-5.5',
190
190
  workflows: { researchWorkflow },
191
191
  })
192
192
  ```
@@ -52,7 +52,7 @@ const browser = new AgentBrowser({
52
52
  export const browserAgent = new Agent({
53
53
  id: 'browser-agent',
54
54
  name: 'Browser Agent',
55
- model: 'openai/gpt-5.4',
55
+ model: 'openai/gpt-5.5',
56
56
  browser,
57
57
  instructions: `You are a web automation assistant.
58
58
 
@@ -73,7 +73,7 @@ const workspace = new Workspace({
73
73
 
74
74
  const browserAgent = new Agent({
75
75
  id: 'browser-agent',
76
- model: 'openai/gpt-5.4',
76
+ model: 'openai/gpt-5.5',
77
77
  workspace,
78
78
  instructions: `You are a web automation assistant.
79
79
  Use browser-use commands to navigate and interact with websites.`,
@@ -72,7 +72,7 @@ export const webAgent = new Agent({
72
72
  id: 'web-agent',
73
73
  name: 'Web Agent',
74
74
  description: 'A web automation assistant that can navigate websites and complete tasks.',
75
- model: 'openai/gpt-5.4',
75
+ model: 'openai/gpt-5.5',
76
76
  browser,
77
77
  instructions:
78
78
  'You are a web automation assistant. Use browser tools to navigate websites and complete tasks.',