@mastra/mcp-docs-server 1.2.11 → 1.2.12-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 (257) hide show
  1. package/.docs/docs/agents/using-tools.md +25 -0
  2. package/.docs/guides/build-your-ui/ai-sdk-ui.md +5 -5
  3. package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +8 -8
  4. package/.docs/guides/build-your-ui/copilotkit/overview.md +2 -2
  5. package/.docs/guides/build-your-ui/openui.md +1 -1
  6. package/.docs/guides/concepts/multi-agent-systems.md +5 -5
  7. package/.docs/guides/concepts/streaming.md +9 -9
  8. package/.docs/guides/deployment/amazon-ec2.md +1 -1
  9. package/.docs/guides/deployment/aws-lambda.md +1 -1
  10. package/.docs/guides/deployment/azure-app-services.md +1 -1
  11. package/.docs/guides/deployment/cloudflare.md +1 -1
  12. package/.docs/guides/deployment/inngest.md +6 -6
  13. package/.docs/guides/deployment/temporal.md +1 -1
  14. package/.docs/guides/deployment/vercel.md +1 -1
  15. package/.docs/guides/getting-started/astro.md +1 -1
  16. package/.docs/guides/getting-started/electron.md +1 -1
  17. package/.docs/guides/getting-started/nestjs.md +5 -5
  18. package/.docs/guides/getting-started/vite-react.md +1 -1
  19. package/.docs/guides/guide/chef-michel.md +1 -1
  20. package/.docs/guides/guide/code-review-bot.md +1 -1
  21. package/.docs/guides/guide/coding-agent.md +4 -4
  22. package/.docs/guides/guide/dev-assistant.md +1 -1
  23. package/.docs/guides/guide/docs-manager.md +3 -3
  24. package/.docs/guides/guide/github-actions-pr-description.md +4 -4
  25. package/.docs/guides/guide/research-assistant.md +3 -3
  26. package/.docs/guides/guide/research-coordinator.md +3 -3
  27. package/.docs/guides/guide/slack-assistant.md +1 -1
  28. package/.docs/guides/guide/stock-agent.md +1 -1
  29. package/.docs/guides/index.md +1 -1
  30. package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +1 -1
  31. package/.docs/guides/migrations/mastra-cloud.md +6 -6
  32. package/.docs/guides/migrations/network-to-supervisor.md +9 -9
  33. package/.docs/guides/migrations/upgrade-to-v1/agent.md +5 -5
  34. package/.docs/guides/migrations/upgrade-to-v1/cli.md +1 -1
  35. package/.docs/guides/migrations/upgrade-to-v1/client.md +3 -3
  36. package/.docs/guides/migrations/upgrade-to-v1/evals.md +2 -2
  37. package/.docs/guides/migrations/upgrade-to-v1/memory.md +1 -1
  38. package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
  39. package/.docs/guides/migrations/upgrade-to-v1/processors.md +1 -1
  40. package/.docs/guides/migrations/upgrade-to-v1/storage.md +11 -11
  41. package/.docs/guides/migrations/upgrade-to-v1/tools.md +3 -3
  42. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
  43. package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
  44. package/.docs/guides/migrations/upgrade-to-v1/workflows.md +1 -1
  45. package/.docs/models/environment-variables.md +1 -0
  46. package/.docs/models/index.md +1 -1
  47. package/.docs/models/providers/modal.md +73 -0
  48. package/.docs/models/providers.md +1 -0
  49. package/.docs/reference/acp/acp-agent.md +3 -3
  50. package/.docs/reference/acp/create-acp-tool.md +2 -2
  51. package/.docs/reference/agent-controller/agent-controller-class.md +36 -36
  52. package/.docs/reference/agent-controller/session.md +6 -6
  53. package/.docs/reference/agents/agent.md +7 -7
  54. package/.docs/reference/agents/channels.md +3 -3
  55. package/.docs/reference/agents/durable-agent.md +3 -3
  56. package/.docs/reference/agents/generate.md +3 -3
  57. package/.docs/reference/agents/getDefaultOptions.md +1 -1
  58. package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
  59. package/.docs/reference/agents/listScorers.md +1 -1
  60. package/.docs/reference/agents/listSkills.md +1 -1
  61. package/.docs/reference/agents/listSuspendedRuns.md +2 -2
  62. package/.docs/reference/ai-sdk/chat-route.md +1 -1
  63. package/.docs/reference/ai-sdk/network-route.md +1 -1
  64. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
  65. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
  66. package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
  67. package/.docs/reference/ai-sdk/workflow-route.md +1 -1
  68. package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +2 -2
  69. package/.docs/reference/auth/auth0.md +1 -1
  70. package/.docs/reference/auth/fga.md +2 -2
  71. package/.docs/reference/auth/google.md +2 -2
  72. package/.docs/reference/auth/okta.md +1 -1
  73. package/.docs/reference/auth/workos.md +2 -2
  74. package/.docs/reference/browser/agent-browser.md +2 -2
  75. package/.docs/reference/browser/browser-viewer.md +3 -3
  76. package/.docs/reference/browser/mastra-browser.md +3 -3
  77. package/.docs/reference/browser/stagehand-browser.md +4 -4
  78. package/.docs/reference/channels/slack-provider.md +2 -2
  79. package/.docs/reference/cli/create-mastra.md +1 -1
  80. package/.docs/reference/cli/mastra.md +23 -23
  81. package/.docs/reference/client-js/agents.md +9 -9
  82. package/.docs/reference/client-js/memory.md +2 -2
  83. package/.docs/reference/client-js/workflows.md +1 -1
  84. package/.docs/reference/coding-agent/build-base-prompt.md +2 -2
  85. package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
  86. package/.docs/reference/configuration.md +6 -6
  87. package/.docs/reference/core/getMCPServer.md +1 -1
  88. package/.docs/reference/core/getScorer.md +1 -1
  89. package/.docs/reference/datasets/addItem.md +1 -1
  90. package/.docs/reference/datasets/listItems.md +1 -1
  91. package/.docs/reference/deployer/netlify.md +4 -4
  92. package/.docs/reference/deployer/vercel.md +7 -7
  93. package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
  94. package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +6 -6
  95. package/.docs/reference/editor/agent-builder/builder-models.md +3 -3
  96. package/.docs/reference/editor/blob-store-provider.md +1 -1
  97. package/.docs/reference/editor/browser-provider.md +3 -3
  98. package/.docs/reference/editor/filesystem-provider.md +4 -4
  99. package/.docs/reference/editor/mastra-editor.md +5 -5
  100. package/.docs/reference/editor/processor-provider.md +3 -3
  101. package/.docs/reference/editor/sandbox-provider.md +4 -4
  102. package/.docs/reference/editor/storage-browser-ref.md +6 -6
  103. package/.docs/reference/editor/storage-workspace-ref.md +4 -4
  104. package/.docs/reference/editor/tool-provider.md +1 -1
  105. package/.docs/reference/evals/answer-relevancy.md +4 -4
  106. package/.docs/reference/evals/bias.md +3 -3
  107. package/.docs/reference/evals/checks.md +3 -3
  108. package/.docs/reference/evals/completeness.md +5 -5
  109. package/.docs/reference/evals/content-similarity.md +5 -5
  110. package/.docs/reference/evals/context-precision.md +2 -2
  111. package/.docs/reference/evals/context-recall.md +8 -8
  112. package/.docs/reference/evals/context-relevance.md +4 -4
  113. package/.docs/reference/evals/create-scorer.md +1 -1
  114. package/.docs/reference/evals/faithfulness.md +3 -3
  115. package/.docs/reference/evals/filter-run.md +2 -2
  116. package/.docs/reference/evals/hallucination.md +6 -6
  117. package/.docs/reference/evals/keyword-coverage.md +6 -6
  118. package/.docs/reference/evals/mastra-scorer.md +2 -2
  119. package/.docs/reference/evals/noise-sensitivity.md +5 -5
  120. package/.docs/reference/evals/prompt-alignment.md +5 -5
  121. package/.docs/reference/evals/rubric.md +1 -1
  122. package/.docs/reference/evals/run-evals.md +3 -3
  123. package/.docs/reference/evals/scorer-utils.md +4 -4
  124. package/.docs/reference/evals/textual-difference.md +4 -4
  125. package/.docs/reference/evals/tool-call-accuracy.md +1 -1
  126. package/.docs/reference/evals/toxicity.md +4 -4
  127. package/.docs/reference/evals/trajectory-accuracy.md +10 -10
  128. package/.docs/reference/file-based-agents/instructions.md +2 -2
  129. package/.docs/reference/file-based-agents/logger.md +1 -1
  130. package/.docs/reference/file-based-agents/observability.md +1 -1
  131. package/.docs/reference/file-based-agents/processors.md +1 -1
  132. package/.docs/reference/file-based-agents/skills.md +1 -1
  133. package/.docs/reference/file-based-agents/storage.md +1 -1
  134. package/.docs/reference/file-based-agents/studio.md +1 -1
  135. package/.docs/reference/file-based-agents/subagents.md +1 -1
  136. package/.docs/reference/file-based-agents/tools.md +1 -1
  137. package/.docs/reference/file-based-agents/workspace.md +1 -1
  138. package/.docs/reference/logging/pino-logger.md +3 -3
  139. package/.docs/reference/memory/clone-utilities.md +1 -1
  140. package/.docs/reference/memory/cloneThread.md +3 -3
  141. package/.docs/reference/memory/listThreads.md +1 -1
  142. package/.docs/reference/memory/memory-class.md +1 -1
  143. package/.docs/reference/memory/observational-memory.md +11 -11
  144. package/.docs/reference/memory/recall.md +2 -2
  145. package/.docs/reference/memory/serialized-memory-config.md +4 -4
  146. package/.docs/reference/memory/summarizeConversation.md +3 -3
  147. package/.docs/reference/memory/summarizeThread.md +3 -3
  148. package/.docs/reference/observability/feedback.md +1 -1
  149. package/.docs/reference/observability/metrics/automatic-metrics.md +7 -7
  150. package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
  151. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
  152. package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
  153. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -4
  154. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
  155. package/.docs/reference/observability/tracing/interfaces.md +1 -1
  156. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
  157. package/.docs/reference/observability/tracing/span-filtering.md +1 -1
  158. package/.docs/reference/processors/cost-guard-processor.md +1 -1
  159. package/.docs/reference/processors/pii-detector.md +1 -1
  160. package/.docs/reference/processors/processor-interface.md +12 -12
  161. package/.docs/reference/processors/prompt-injection-detector.md +1 -1
  162. package/.docs/reference/processors/provider-history-compat.md +1 -1
  163. package/.docs/reference/processors/regex-filter-processor.md +1 -1
  164. package/.docs/reference/processors/response-cache.md +8 -8
  165. package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
  166. package/.docs/reference/processors/token-limiter-processor.md +1 -1
  167. package/.docs/reference/processors/tool-search-processor.md +7 -7
  168. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  169. package/.docs/reference/project-structure.md +1 -1
  170. package/.docs/reference/pubsub/base.md +4 -4
  171. package/.docs/reference/pubsub/google-cloud-pubsub.md +2 -2
  172. package/.docs/reference/pubsub/lease-provider.md +4 -4
  173. package/.docs/reference/pubsub/redis-streams.md +1 -1
  174. package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
  175. package/.docs/reference/rag/chunk.md +5 -5
  176. package/.docs/reference/rag/database-config.md +2 -2
  177. package/.docs/reference/rag/metadata-filters.md +2 -2
  178. package/.docs/reference/schedules/overview.md +1 -1
  179. package/.docs/reference/server/register-api-route.md +1 -1
  180. package/.docs/reference/server/routes.md +1 -1
  181. package/.docs/reference/signals/signal-provider.md +8 -8
  182. package/.docs/reference/storage/clickhouse.md +4 -4
  183. package/.docs/reference/storage/cloudflare-d1.md +4 -4
  184. package/.docs/reference/storage/convex.md +4 -4
  185. package/.docs/reference/storage/dsql.md +2 -2
  186. package/.docs/reference/storage/dynamodb.md +7 -7
  187. package/.docs/reference/storage/lance.md +1 -1
  188. package/.docs/reference/storage/mongodb.md +1 -1
  189. package/.docs/reference/storage/mssql.md +1 -1
  190. package/.docs/reference/storage/postgresql.md +1 -1
  191. package/.docs/reference/storage/retention.md +33 -33
  192. package/.docs/reference/storage/spanner.md +8 -8
  193. package/.docs/reference/streaming/ChunkType.md +2 -2
  194. package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
  195. package/.docs/reference/streaming/agents/stream.md +1 -1
  196. package/.docs/reference/streaming/agents/streamUntilIdle.md +2 -2
  197. package/.docs/reference/streaming/workflows/observeStream.md +1 -1
  198. package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
  199. package/.docs/reference/streaming/workflows/stream.md +1 -1
  200. package/.docs/reference/streaming/workflows/timeTravelStream.md +2 -2
  201. package/.docs/reference/templates/overview.md +1 -1
  202. package/.docs/reference/tools/brightdata.md +1 -1
  203. package/.docs/reference/tools/create-tool.md +1 -1
  204. package/.docs/reference/tools/graph-rag-tool.md +1 -1
  205. package/.docs/reference/tools/mcp-client.md +13 -13
  206. package/.docs/reference/tools/mcp-server.md +20 -20
  207. package/.docs/reference/tools/submit-plan-tool.md +1 -1
  208. package/.docs/reference/tools/tavily.md +1 -1
  209. package/.docs/reference/tools/vector-query-tool.md +4 -4
  210. package/.docs/reference/vectors/astra.md +1 -1
  211. package/.docs/reference/vectors/chroma.md +2 -2
  212. package/.docs/reference/vectors/convex.md +2 -2
  213. package/.docs/reference/vectors/couchbase.md +4 -4
  214. package/.docs/reference/vectors/libsql.md +1 -1
  215. package/.docs/reference/vectors/mongodb.md +1 -1
  216. package/.docs/reference/vectors/pg.md +4 -4
  217. package/.docs/reference/vectors/qdrant.md +2 -2
  218. package/.docs/reference/vectors/s3vectors.md +4 -4
  219. package/.docs/reference/vectors/turbopuffer.md +1 -1
  220. package/.docs/reference/voice/aws-nova-sonic.md +1 -1
  221. package/.docs/reference/voice/azure.md +1 -1
  222. package/.docs/reference/voice/google-gemini-live.md +4 -4
  223. package/.docs/reference/voice/inworld-realtime.md +7 -7
  224. package/.docs/reference/voice/livekit.md +13 -13
  225. package/.docs/reference/voice/mistral.md +1 -1
  226. package/.docs/reference/voice/openai-realtime.md +1 -1
  227. package/.docs/reference/voice/sarvam.md +1 -1
  228. package/.docs/reference/voice/voice.addTools.md +1 -1
  229. package/.docs/reference/voice/voice.events.md +1 -1
  230. package/.docs/reference/voice/voice.getSpeakers.md +2 -2
  231. package/.docs/reference/voice/voice.on.md +2 -2
  232. package/.docs/reference/voice/xai-realtime.md +2 -2
  233. package/.docs/reference/workflows/run-methods/cancel.md +1 -1
  234. package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
  235. package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
  236. package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
  237. package/.docs/reference/workflows/workflow-methods/sleep.md +1 -1
  238. package/.docs/reference/workflows/workflow-state-reader.md +2 -2
  239. package/.docs/reference/workspace/apple-container-sandbox.md +2 -2
  240. package/.docs/reference/workspace/daytona-sandbox.md +3 -3
  241. package/.docs/reference/workspace/docker-sandbox.md +2 -2
  242. package/.docs/reference/workspace/e2b-sandbox.md +2 -2
  243. package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
  244. package/.docs/reference/workspace/google-drive-filesystem.md +4 -4
  245. package/.docs/reference/workspace/local-filesystem.md +2 -2
  246. package/.docs/reference/workspace/local-sandbox.md +2 -2
  247. package/.docs/reference/workspace/modal-sandbox.md +1 -1
  248. package/.docs/reference/workspace/platform-filesystem.md +3 -3
  249. package/.docs/reference/workspace/platform-sandbox.md +2 -2
  250. package/.docs/reference/workspace/process-manager.md +1 -1
  251. package/.docs/reference/workspace/railway-sandbox.md +4 -4
  252. package/.docs/reference/workspace/s3-filesystem.md +1 -1
  253. package/.docs/reference/workspace/sandbox.md +1 -1
  254. package/.docs/reference/workspace/vercel-sandbox.md +1 -1
  255. package/.docs/reference/workspace/workspace-class.md +10 -10
  256. package/CHANGELOG.md +7 -0
  257. package/package.json +5 -5
@@ -87,7 +87,7 @@ export const codeSupervisor = new Agent({
87
87
 
88
88
  ## Session lifecycle
89
89
 
90
- Each tool execution creates an ACP connection, starts the configured `command`, initializes the ACP client, creates an ACP session, and sends the `task` with ACP `session/prompt`.
90
+ Each tool execution creates an ACP connection and starts the configured `command`. It initializes the ACP client and creates an ACP session before sending the `task` with ACP `session/prompt`.
91
91
 
92
92
  By default, `persistSession` is `true` for the ACP connection created during tool execution. Set `persistSession: false` when the ACP process should stop as soon as that prompt completes.
93
93
 
@@ -124,7 +124,7 @@ export const codeAgentTool = createACPTool({
124
124
  })
125
125
  ```
126
126
 
127
- Use this callback to enforce local policy, inspect the permission title, or route the decision to your own approval flow.
127
+ Use this callback to enforce local policy or inspect the permission title. It can also route the decision to your own approval flow.
128
128
 
129
129
  ## Extension methods
130
130
 
@@ -4,9 +4,9 @@
4
4
 
5
5
  > **Beta:** The `AgentController` feature is in beta stage and subject to breaking changes in minor versions until it graduates from its beta status.
6
6
 
7
- The `AgentController` class orchestrates multiple agent modes, shared state, memory, and storage. It provides a control layer that a TUI or other UI can drive to manage threads, switch models and modes, send messages, handle tool approvals, and track events.
7
+ The `AgentController` class coordinates agent modes with shared state, memory, and storage. It provides a control layer that a TUI or other UI can drive. The layer manages threads and model or mode switches. It sends messages and handles tool approvals while tracking events.
8
8
 
9
- Per-conversation state identity, the active thread, mode and model selection, run state, grants, and the display snapshot lives on the [`Session`](https://mastra.ai/reference/agent-controller/session), accessed through `agentController.session`.
9
+ Per-conversation state (identity, the active thread, mode and model selection, run state, grants, and the display snapshot) lives on the [`Session`](https://mastra.ai/reference/agent-controller/session), accessed through `agentController.session`.
10
10
 
11
11
  For a conceptual introduction, see the [AgentController overview](https://mastra.ai/docs/agent-controller/overview).
12
12
 
@@ -84,7 +84,7 @@ await agentController.sendMessage({ content: 'Hello!' })
84
84
 
85
85
  **modes.additionalTools** (`ToolsInput`): Tools layered on top of the backing agent's tools. Mutually exclusive with tools.
86
86
 
87
- **modes.availableTools** (`string[]`): Per-mode tool visibility allowlist. When set, only tools whose final exposed names appear in this list are visible to the model and executable during this mode's runs. undefined = all tools visible; \[] = no tools. Per-tool and per-category deny rules take precedence over this list. Workspace tools use the same list reference them by exposed names (view, write\_file, etc.).
87
+ **modes.availableTools** (`string[]`): Per-mode tool visibility allowlist. When set, only tools whose final exposed names appear in this list are visible to the model and executable during this mode's runs. undefined = all tools visible; \[] = no tools. Per-tool and per-category deny rules take precedence over this list. Workspace tools use the same list: reference them by exposed names (view, write\_file, etc.).
88
88
 
89
89
  **modes.agent** (`Agent`): The agent for this mode. Deprecated in favor of the top-level agent config with mode-level overrides.
90
90
 
@@ -164,7 +164,7 @@ await agentController.sendMessage({ content: 'Hello!' })
164
164
 
165
165
  #### `init()`
166
166
 
167
- Initialize the agentController. Loads storage, initializes a static workspace (dynamic factory workspaces are resolved per-session during `createSession`), propagates memory and workspace to mode agents, and starts interval handlers. Call this before using the agentController.
167
+ Initialize the agentController. Loads storage, initializes a static workspace (runtime-defined factory workspaces are resolved per-session during `createSession`), propagates memory and workspace to mode agents, and starts interval handlers. Call this before using the agentController.
168
168
 
169
169
  ```typescript
170
170
  await agentController.init()
@@ -174,11 +174,11 @@ await agentController.init()
174
174
 
175
175
  Create a new, fully-wired `Session` and bring it online. The session starts in the default mode with the seeded model, connects to the AgentController's shared machinery (agent, storage/lock, config catalog), and has a current thread (the most recent thread for the resource, or a freshly created one). Call `init()` once before creating sessions so shared storage is ready.
176
176
 
177
- The AgentController owns no session of its own every consumer creates its own session and drives all work through it. A `resourceId` maps to exactly one session per AgentController (get-or-create): calling `createSession` with the same `resourceId` returns the existing session, so reconnects resume rather than fork the conversation. Different `resourceId`s produce independent sessions with isolated event bus, mode, model, state, and current thread. Use `session.thread.create()` and `session.thread.switch()` to manage multiple conversations within one session.
177
+ The AgentController owns no session of its own: every consumer creates its own session and drives all work through it. A `resourceId` maps to exactly one session per AgentController (get-or-create): calling `createSession` with the same `resourceId` returns the existing session, so reconnects resume rather than fork the conversation. Different `resourceId`s produce independent sessions with isolated event bus, mode, model, state, and current thread. Use `session.thread.create()` and `session.thread.switch()` to manage multiple conversations within one session.
178
178
 
179
- `id` and `ownerId` are required they mirror `SessionRecord.id` and `SessionRecord.ownerId` and are stable for the life of the session. `resourceId` is optional and defaults to `config.resourceId` then `config.id`.
179
+ `id` and `ownerId` are required: they mirror `SessionRecord.id` and `SessionRecord.ownerId` and are stable for the life of the session. `resourceId` is optional and defaults to `config.resourceId` then `config.id`.
180
180
 
181
- Each session owns its own `Workspace` and `Browser` instance. When `workspace` is omitted, the AgentController resolves its configured workspace (a static instance or a dynamic factory) and passes it to the session. Pass a `workspace` override to give a specific session a different workspace than the AgentController default. The workspace is initialized during session creation; `workspace_ready` and `workspace_status_changed` events are emitted on the session bus after `init()` completes, and late subscribers receive a replay of the last workspace status.
181
+ Each session owns its own `Workspace` and `Browser` instance. When `workspace` is omitted, the AgentController resolves its configured workspace (a static instance or a runtime-defined factory) and passes it to the session. Pass a `workspace` override to give a specific session a different workspace than the AgentController default. The workspace is initialized during session creation; `workspace_ready` and `workspace_status_changed` events are emitted on the session bus after `init()` completes, and late subscribers receive a replay of the last workspace status.
182
182
 
183
183
  ```typescript
184
184
  const session = await agentController.createSession({
@@ -270,7 +270,7 @@ const mastra = agentController.getMastra()
270
270
 
271
271
  #### `getWorkspace()`
272
272
 
273
- Return the AgentController-level workspace if it's a static `Workspace` instance. Dynamic factory workspaces aren't resolved here use [`resolveWorkspace()`](#resolveworkspace-session-requestcontext-) to resolve a factory against a session's request context.
273
+ Return the AgentController-level workspace if it's a static `Workspace` instance. Dynamic factory workspaces aren't resolved here: use [`resolveWorkspace()`](#resolveworkspace-session-requestcontext-) to resolve a factory against a session's request context.
274
274
 
275
275
  ```typescript
276
276
  const workspace = agentController.getWorkspace()
@@ -278,7 +278,7 @@ const workspace = agentController.getWorkspace()
278
278
 
279
279
  #### `resolveWorkspace({ session, requestContext? })`
280
280
 
281
- Eagerly resolve and cache the workspace. For dynamic workspaces (factory function), this triggers the factory against the given session's request context and caches the result so `getWorkspace()` returns it. Returns the resolved workspace or `undefined` if none is configured.
281
+ Eagerly resolve and cache the workspace. For runtime-defined workspaces (factory function), this triggers the factory against the session's request context and caches the result so `getWorkspace()` returns it. Returns the resolved workspace or `undefined` if none is configured.
282
282
 
283
283
  ```typescript
284
284
  const workspace = await agentController.resolveWorkspace({ session })
@@ -292,7 +292,7 @@ const workspace = await agentController.resolveWorkspace({ session, requestConte
292
292
 
293
293
  #### `hasWorkspace()`
294
294
 
295
- Whether a workspace is configured on this AgentController (static instance or dynamic factory). Sessions without an explicit workspace override fall back to this.
295
+ Whether a workspace is configured on this AgentController (static instance or runtime-defined factory). Sessions without an explicit workspace override fall back to this.
296
296
 
297
297
  ```typescript
298
298
  if (agentController.hasWorkspace()) {
@@ -346,11 +346,11 @@ const models = await agentController.listAvailableModels()
346
346
 
347
347
  ### Threads
348
348
 
349
- The agentController owns thread lifecycle transitions creating, switching, cloning, renaming, and deleting threads because they coordinate the shared thread lock and emit events. The active thread binding and thread/message reads live on [`session.thread`](https://mastra.ai/reference/agent-controller/session).
349
+ The agentController owns thread lifecycle transitions (creating, switching, cloning, renaming, and deleting threads) because they coordinate the shared thread lock and emit events. The active thread binding and thread/message reads live on [`session.thread`](https://mastra.ai/reference/agent-controller/session).
350
350
 
351
351
  #### `createThread({ title? })`
352
352
 
353
- Create a new thread. Initializes thread metadata, saves it to storage, acquires a thread lock, and emits a `thread_created` event.
353
+ Creates a new thread and initializes its metadata. The method saves it to storage and acquires a thread lock before emitting a `thread_created` event.
354
354
 
355
355
  ```typescript
356
356
  const thread = await agentController.createThread({ title: 'New conversation' })
@@ -358,13 +358,13 @@ const thread = await agentController.createThread({ title: 'New conversation' })
358
358
 
359
359
  #### `switchThread({ threadId })`
360
360
 
361
- Switch to a different thread. Aborts any in-progress operations, acquires a lock on the new thread, releases the lock on the previous thread, loads the thread's metadata, and emits a `thread_changed` event.
361
+ Switch to a different thread. This aborts in-progress operations and acquires a lock on the new thread. It releases the previous thread lock and loads the new thread metadata. It then emits a `thread_changed` event.
362
362
 
363
363
  ```typescript
364
364
  await agentController.switchThread({ threadId: 'thread-abc123' })
365
365
  ```
366
366
 
367
- To list threads from storage, use [`session.thread.list()`](https://mastra.ai/reference/agent-controller/session). By default it returns only threads for the current resource and hides transient [forked subagent](#forked-subagents) threads; pass `includeForkedSubagents: true` to opt back into seeing them e.g. for a debug panel.
367
+ To list threads from storage, use [`session.thread.list()`](https://mastra.ai/reference/agent-controller/session). By default it returns only threads for the current resource and hides transient [forked subagent](#forked-subagents) threads. Pass `includeForkedSubagents: true` to opt back into seeing them: e.g. for a debug panel.
368
368
 
369
369
  #### `renameThread({ title })`
370
370
 
@@ -376,7 +376,7 @@ await agentController.renameThread({ title: 'Updated title' })
376
376
 
377
377
  #### `cloneThread({ sourceThreadId?, title?, resourceId? })`
378
378
 
379
- Clone an existing thread and switch to the clone. Copies all messages, acquires a lock on the new thread, releases the lock on the previous thread, and emits a `thread_created` event. If `sourceThreadId` is omitted, the current thread is cloned. When [Observational Memory](https://mastra.ai/docs/memory/observational-memory) is enabled, OM records are cloned with remapped message IDs.
379
+ Clone an existing thread and switch to the clone. Copies all messages and acquires a lock on the new thread. It then releases the lock on the previous thread and emits a `thread_created` event. If `sourceThreadId` is omitted, the current thread is cloned. When [Observational Memory](https://mastra.ai/docs/memory/observational-memory) is enabled, OM records are cloned with remapped message IDs.
380
380
 
381
381
  ```typescript
382
382
  // Clone the current thread
@@ -432,7 +432,7 @@ Reading messages is owned by [`session.thread`](https://mastra.ai/reference/agen
432
432
 
433
433
  ### Memory
434
434
 
435
- The `memory` property bundles thread management operations into a single namespace. `memory.createThread`, `memory.switchThread`, and `memory.renameThread` delegate to the corresponding AgentController lifecycle methods documented above; `memory.listThreads` delegates to [`session.thread.list()`](https://mastra.ai/reference/agent-controller/session).
435
+ The `memory` property bundles thread management operations into a single namespace. `memory.createThread`, `memory.switchThread`, and `memory.renameThread` delegate to the corresponding AgentController lifecycle methods documented above. `memory.listThreads` delegates to [`session.thread.list()`](https://mastra.ai/reference/agent-controller/session).
436
436
 
437
437
  #### `memory.deleteThread({ threadId })`
438
438
 
@@ -470,7 +470,7 @@ agentController.followUp({ content: 'Now apply those changes' })
470
470
 
471
471
  ### Tool approvals
472
472
 
473
- Responding to a pending tool approval is owned by the session see [`session.respondToToolApproval()`](https://mastra.ai/reference/agent-controller/session). The agentController owns the permission _policy_ that decides when approval is required, documented under [Permissions](#permissions) below.
473
+ Responding to a pending tool approval is owned by the session: see [`session.respondToToolApproval()`](https://mastra.ai/reference/agent-controller/session). The agentController owns the permission _policy_ that decides when approval is required, documented under [Permissions](#permissions) below.
474
474
 
475
475
  ### Tool suspensions and plans
476
476
 
@@ -478,7 +478,7 @@ Responding to a pending tool approval is owned by the session — see [`session.
478
478
 
479
479
  Respond to a pending tool suspension. Interactive built-in tools such as `ask_user` and `request_access` pause through the native tool-suspension primitive, which emits a `tool_suspended` event carrying `toolCallId`, `toolName`, and `suspendPayload`. Pass `resumeData` to resume the suspended tool with the user's response.
480
480
 
481
- Provide `toolCallId` to select which suspension to resume. It's required when more than one tool is suspended at the same time (for example, parallel `ask_user` calls). When omitted, it resolves to the sole pending suspension.
481
+ Provide `toolCallId` to select which suspension to resume. It's required when more than one tool is suspended concurrently (for example, parallel `ask_user` calls). When omitted, it resolves to the sole pending suspension.
482
482
 
483
483
  ```typescript
484
484
  agentController.subscribe(event => {
@@ -558,14 +558,14 @@ The observer/reflector model selection and observation/reflection thresholds liv
558
558
 
559
559
  ### Forked subagents
560
560
 
561
- By default, a subagent runs with a fresh context it doesn't see the parent conversation. **Forked subagents** opt into a different model: the subagent runs on a clone of the parent thread and reuses the parent agent's full configuration. This is useful when the subagent needs the full context of the conversation so far (e.g., recalling earlier user-supplied facts), and when prompt-cache hit rates matter.
561
+ By default, a subagent runs with a fresh context: it doesn't see the parent conversation. **Forked subagents** opt into a different model: the subagent runs on a clone of the parent thread and reuses the parent agent's full configuration. This is useful when the subagent needs the full context of the conversation so far (e.g., recalling earlier user-supplied facts), and when prompt-cache hit rates matter.
562
562
 
563
563
  #### Enabling forked mode
564
564
 
565
565
  Set `forked: true` either on the `AgentControllerSubagent` definition (per-type default) or on each `subagent` tool call (per-invocation override):
566
566
 
567
567
  ```typescript
568
- // Per-type default every call to this subagent forks unless overridden.
568
+ // Per-type default: every call to this subagent forks unless overridden.
569
569
  const subagents: AgentControllerSubagent[] = [
570
570
  {
571
571
  id: 'collaborator',
@@ -577,20 +577,20 @@ const subagents: AgentControllerSubagent[] = [
577
577
  ]
578
578
  ```
579
579
 
580
- The model can also pass `forked: true` (or `forked: false`) per-invocation in the `subagent` tool input; the per-invocation value wins.
580
+ The model can also pass `forked: true` (or `forked: false`) per-invocation in the `subagent` tool input. The per-invocation value wins.
581
581
 
582
582
  #### Semantics and constraints
583
583
 
584
584
  - **Memory required.** Forked mode calls `memory.cloneThread` to create the fork, so the agentController must have `memory` configured and an active parent thread. Calls without those return a structured error rather than throwing.
585
- - **Parent agent reused.** The fork runs through the parent agent's `stream(...)` call. The parent's instructions, tools, model, `maxSteps`, and `stopWhen` apply. The subagent definition's `instructions`, `tools`, `allowedAgentControllerTools`, `allowedWorkspaceTools`, `defaultModelId`, `maxSteps`, and `stopWhen` are ignored in forked mode this is what preserves the prompt-cache prefix.
586
- - **Toolsets inherited, recursive forks blocked at runtime.** Forks inherit the parent's toolsets verbatim (`ask_user`, `submit_plan`, user-configured agentController tools, _including the `subagent` tool itself_) so the LLM request prefix system prompt + tool list + tool schemas + tool descriptions stays byte-identical to the parent's. This is what preserves the prompt cache. The `subagent` entry is kept on the model side but its `execute` is replaced inside the fork with a stub that returns a non-error "tool unavailable inside a forked subagent" message: nested forks are blocked at the runtime layer without perturbing the cached prefix.
585
+ - **Parent agent reused.** The fork runs through the parent agent's `stream(...)` call. The parent's instructions, tools, model, `maxSteps`, and `stopWhen` apply. The subagent definition's `instructions`, `tools`, `allowedAgentControllerTools`, `allowedWorkspaceTools`, `defaultModelId`, `maxSteps`, and `stopWhen` are ignored in forked mode. This preserves the prompt-cache prefix.
586
+ - **Toolsets inherited, recursive forks blocked at runtime.** Forks inherit the parent's toolsets verbatim (`ask_user`, `submit_plan`, user-configured agentController tools, _including the `subagent` tool itself_) so the LLM request prefix, system prompt + tool list + tool schemas + tool descriptions, stays byte-identical to the parent's. This is what preserves the prompt cache. The `subagent` entry is kept on the model side but its `execute` is replaced inside the fork with a stub that returns a non-error "tool unavailable inside a forked subagent" message: nested forks are blocked at the runtime layer without perturbing the cached prefix.
587
587
  - **Fork threads are tagged.** Each fork thread is created with `metadata.forkedSubagent === true` and `metadata.parentThreadId === <parent>`. By default, [`session.thread.list()`](https://mastra.ai/reference/agent-controller/session) hides these so they don't show up in user-facing thread pickers / startup flows. Pass `includeForkedSubagents: true` to see them in admin / debug tooling.
588
- - **Save-queue flushed before clone.** The agent stream batches message saves through a debounced `SaveQueueManager`, so the parent's latest user / assistant turn may not be on disk yet when the subagent tool call fires. The fork tool flushes pending saves first via the `flushMessages` callback on `AgentToolExecutionContext` before cloning, so the fork actually carries the latest turn. Flush failures are non-fatal the clone still runs.
588
+ - **Save-queue flushed before clone.** The agent stream batches message saves through a debounced `SaveQueueManager`, so the parent's latest user / assistant turn may not be on disk yet when the subagent tool call fires. The fork tool flushes pending saves first via the `flushMessages` callback on `AgentToolExecutionContext` before cloning, so the fork actually carries the latest turn. Flush failures are non-fatal: the clone still runs.
589
589
  - **Parent thread untouched.** All subagent activity (messages, OM writes) lands on the fork. The parent thread is never appended to during a forked subagent run.
590
590
 
591
591
  #### When to prefer non-forked mode
592
592
 
593
- Forked mode trades isolation for context inheritance. If the subagent should run with a strictly smaller toolset, a different system prompt, or a cheaper model, use the default (non-forked) mode and pass any required context explicitly in the `task` description.
593
+ Forked mode trades isolation for context inheritance. Use the default (non-forked) mode when the subagent needs a restricted toolset or a different system prompt. The same applies when using a cheaper model. Pass any required context explicitly in the `task` description.
594
594
 
595
595
  ### Events
596
596
 
@@ -598,7 +598,7 @@ Forked mode trades isolation for context inheritance. If the subagent should run
598
598
 
599
599
  Register an event listener. Returns an unsubscribe function.
600
600
 
601
- Use this method for all consumers UI, Server-Sent Events (SSE), terminal UI (TUI), bridge rendering, audit logs, debugging, analytics, and deterministic replay. For display rendering, watch for the `display_state_changed` event and read the latest snapshot from [`session.displayState.get()`](https://mastra.ai/reference/agent-controller/session). After every event the agentController emits `display_state_changed`, so high-frequency events such as `message_update`, `tool_update`, and `tool_input_delta` are coalesced into the next snapshot.
601
+ Use this method for all consumers: UI, Server-Sent Events (SSE), terminal UI (TUI), bridge rendering, audit logs, debugging, analytics, and deterministic replay. For display rendering, watch for the `display_state_changed` event and read the latest snapshot from [`session.displayState.get()`](https://mastra.ai/reference/agent-controller/session). After every event the agentController emits `display_state_changed`, so high-frequency events such as `message_update`, `tool_update`, and `tool_input_delta` are coalesced into the next snapshot.
602
602
 
603
603
  ```typescript
604
604
  // Render from the coalesced display-state snapshot:
@@ -694,21 +694,21 @@ The agentController emits events through registered listeners. The following tab
694
694
  | `shell_output` | A tool emitted shell output (stdout or stderr). |
695
695
  | `display_state_changed` | The canonical `AgentControllerDisplayState` snapshot changed. Read it from [`session.displayState.get()`](https://mastra.ai/reference/agent-controller/session). |
696
696
 
697
- The agentController also emits low-level streaming content chunks `text`, `thinking`, `tool_call`, `tool_result`, `image`, and `file`. These are the raw pieces that get assembled into messages; most UIs render from `message_update` (or read the [`session.displayState`](https://mastra.ai/reference/agent-controller/session) snapshot) rather than subscribing to them directly.
697
+ The agentController also emits low-level streaming content chunks: `text`, `thinking`, `tool_call`, `tool_result`, `image`, and `file`. These are the raw pieces that get assembled into messages. Most UIs render from `message_update` (or read the [`session.displayState`](https://mastra.ai/reference/agent-controller/session) snapshot) rather than subscribing to them directly.
698
698
 
699
699
  ## Built-in tools
700
700
 
701
701
  The agentController provides built-in tools to agents in every mode:
702
702
 
703
- | Tool | Description |
704
- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
705
- | `ask_user` | Ask the user a question and wait for their response. Supports free text, single-select choices, and multi-select choices. |
706
- | `submit_plan` | Submit a plan for user review and approval. |
707
- | `task_write` | Create or replace a structured task list for tracking progress. Assigns task IDs when omitted and returns the structured task list snapshot. |
708
- | `task_update` | Update one tracked task by ID and return the structured task list snapshot. |
709
- | `task_complete` | Mark one tracked task completed by ID and return the structured task list snapshot. |
710
- | `task_check` | Check the completion status of the current task list and return `tasks`, `summary`, `incompleteTasks`, and `isError` fields. |
711
- | `subagent` | Spawn a focused subagent with constrained tools (only available when `subagents` is configured). Pass `forked: true` to inherit the parent conversation see [Forked subagents](#forked-subagents). |
703
+ | Tool | Description |
704
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
705
+ | `ask_user` | Ask the user a question and wait for their response. Supports free text, single-select choices, and multi-select choices. |
706
+ | `submit_plan` | Submit a plan for user review and approval. |
707
+ | `task_write` | Create or replace a structured task list for tracking progress. Assigns task IDs when omitted and returns the structured task list snapshot. |
708
+ | `task_update` | Update one tracked task by ID and return the structured task list snapshot. |
709
+ | `task_complete` | Mark one tracked task completed by ID and return the structured task list snapshot. |
710
+ | `task_check` | Check the completion status of the current task list and return `tasks`, `summary`, `incompleteTasks`, and `isError` fields. |
711
+ | `subagent` | Spawn a focused subagent with constrained tools (only available when `subagents` is configured). Pass `forked: true` to inherit the parent conversation. See [Forked subagents](#forked-subagents). |
712
712
 
713
713
  ### `ask_user` selections
714
714
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  > **Beta:** The `AgentController` feature is in beta stage and subject to breaking changes in minor versions until it graduates from its beta status.
6
6
 
7
- A `Session` owns all the state tied to a single conversation. The [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class) is the shared host agents, storage, config, the thread lock, and the event bus while the `Session` holds everything that's per-conversation: identity, the active thread binding and reads, mode and model selection, run and abort state, the live agent stream, tool suspensions, follow-ups, approvals, permission grants, token usage, and the display-state snapshot.
7
+ A `Session` owns all the state tied to a single conversation. The [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class) is the shared host (agents, storage, config, the thread lock, and the event bus) while the `Session` holds everything that's per-conversation: identity, the active thread binding and reads, mode and model selection, run and abort state, the live agent stream, tool suspensions, follow-ups, approvals, permission grants, token usage, and the display-state snapshot.
8
8
 
9
9
  Access the session through `agentController.session`.
10
10
 
@@ -72,7 +72,7 @@ Returns: `Workspace`
72
72
 
73
73
  ### Permissions
74
74
 
75
- Session-scoped grants auto-approve tools without prompting. Grants are ephemeral they reset when the session restarts and are never persisted.
75
+ Session-scoped grants auto-approve tools without prompting. Grants are ephemeral: they reset when the session restarts and are never persisted.
76
76
 
77
77
  #### `grantCategory(category)`
78
78
 
@@ -123,7 +123,7 @@ const runId = agentController.session.getCurrentRunId()
123
123
 
124
124
  #### `abortRun()`
125
125
 
126
- Abort the in-flight run: aborts the live stream, requests abort on the run, and clears parked tool suspensions.
126
+ Abort the in-flight run: aborts the live stream and requests abort on the run. It also clears parked tool suspensions.
127
127
 
128
128
  ```typescript
129
129
  agentController.session.abortRun()
@@ -278,7 +278,7 @@ const mode = agentController.session.mode.resolve()
278
278
 
279
279
  ### `session.mode.switch({ modeId })`
280
280
 
281
- Switch to a different mode. Aborts any in-progress generation, saves the current model to the outgoing mode, loads the incoming mode's model, and emits `mode_changed` and `model_changed` events.
281
+ Switch to a different mode. Aborts any in-progress generation and saves the current model to the outgoing mode. It then loads the incoming mode's model and emits `mode_changed` and `model_changed` events.
282
282
 
283
283
  ```typescript
284
284
  await agentController.session.mode.switch({ modeId: 'build' })
@@ -374,7 +374,7 @@ const observerModel = agentController.session.om.observer.resolvedModel()
374
374
 
375
375
  ## Permissions
376
376
 
377
- `session.permissions` owns the persisted tool-approval _policy_ the per-category and per-tool rules consulted during approval resolution. These are distinct from the in-memory session _grants_ documented under [Methods → Permissions](#permissions); grants reset each session, whereas these rules are persisted in session state.
377
+ `session.permissions` owns the persisted tool-approval _policy_: the per-category and per-tool rules consulted during approval resolution. These are distinct from the in-memory session _grants_ documented under [Methods → Permissions](#permissions); grants reset each session, whereas these rules are persisted in session state.
378
378
 
379
379
  ### `session.permissions.getRules()`
380
380
 
@@ -559,7 +559,7 @@ After every event the agentController emits `display_state_changed`, so high-fre
559
559
 
560
560
  ## State
561
561
 
562
- `session.state` owns the schema-validated AgentController state for the conversation. It holds the current snapshot, validates updates against the `stateSchema` passed to the AgentController, serializes concurrent writes, and emits a `state_changed` event on every change.
562
+ `session.state` owns the schema-validated AgentController state for the conversation. It holds the current snapshot and validates updates against the `stateSchema` passed to the AgentController. Updates are serialized, and every change emits a `state_changed` event.
563
563
 
564
564
  ### `session.state.get()`
565
565
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Agent class
4
4
 
5
- The `Agent` class is the foundation for creating AI agents in Mastra. It provides methods for generating responses, streaming interactions, and handling voice capabilities.
5
+ The `Agent` class is the foundation for creating AI agents in Mastra. It provides methods for generating responses and streaming interactions. It also handles voice capabilities.
6
6
 
7
7
  ## Usage examples
8
8
 
@@ -229,7 +229,7 @@ agent.sendMessage('Continue with the next step.', {
229
229
  })
230
230
  ```
231
231
 
232
- Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `accepted` resolves at decision-time, once Mastra decides what to do with the message: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the message is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` is the authoritative id of the run that handled the message and is present only on `wake` and `deliver`; for `persist`/`discard` use `result.signal.id` to correlate the stored message. `accepted` resolves for routing a generation error on a `wake` run surfaces through `output.consumeStream()` and rejects only when the message couldn't be routed or started at all (e.g. a misconfigured agent). `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the message to memory. On the `wake` action, `output` is the agent stream for in-process consumption.
232
+ Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `accepted` resolves at decision-time, once Mastra decides what to do with the message: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the message is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` is the authoritative id of the run that handled the message and is present only on `wake` and `deliver`. For `persist`/`discard` use `result.signal.id` to correlate the stored message. `accepted` resolves for routing (a generation error on a `wake` run surfaces through `output.consumeStream()`) and rejects only when the message couldn't be routed or started at all (e.g. a misconfigured agent). `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the message to memory. On the `wake` action, `output` is the agent stream for in-process consumption.
233
233
 
234
234
  ### `queueMessage(message, options)`
235
235
 
@@ -272,7 +272,7 @@ Sends a signal to an active run or memory thread.
272
272
 
273
273
  **options.ifIdle.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the signal when Mastra accepts it while the target thread is idle.
274
274
 
275
- Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `accepted` resolves at decision-time, once Mastra decides what to do with the signal: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `action` mirrors the winning `behavior` from `ifActive`/`ifIdle`. `runId` is the authoritative id of the run that handled the signal and is present only on `wake` and `deliver`; for `persist`/`discard` use `result.signal.id` to correlate the stored signal. `accepted` resolves for routing a generation error on a `wake` run surfaces through `output.consumeStream()` and rejects only when the signal couldn't be routed or started at all (e.g. a misconfigured agent). `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the signal to memory. On the `wake` action, `output` is the agent stream for in-process consumption.
275
+ Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `accepted` resolves at decision-time, once Mastra decides what to do with the signal: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `action` mirrors the winning `behavior` from `ifActive`/`ifIdle`. `runId` is the authoritative id of the run that handled the signal and is present only on `wake` and `deliver`. For `persist`/`discard` use `result.signal.id` to correlate the stored signal. `accepted` resolves for routing (a generation error on a `wake` run surfaces through `output.consumeStream()`) and rejects only when the signal couldn't be routed or started at all (e.g. a misconfigured agent). `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the signal to memory. On the `wake` action, `output` is the agent stream for in-process consumption.
276
276
 
277
277
  In serverless handlers, await `accepted` and pass the `wake` output to your platform's `waitUntil` equivalent so the winning process can drain the stream after the HTTP response returns.
278
278
 
@@ -333,11 +333,11 @@ const result = await agent.sendStateSignal(
333
333
 
334
334
  **options** (`object`): Targeting and delivery behavior for the state signal. Accepts the same options as sendSignal().
335
335
 
336
- Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void>, skipped?: false }` when Mastra accepts new state. Returns `{ skipped: true, reason: 'unchanged' }` when the same `cacheKey` and mode are already current for the state lane. `accepted` resolves at decision-time, once Mastra decides what to do with the signal: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` is the authoritative id of the run that handled the signal and is present only on `wake` and `deliver`; for `persist`/`discard` use `result.signal.id` to correlate the stored signal. On the `wake` action, `output` is the agent stream for in-process consumption.
336
+ Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void>, skipped?: false }` when Mastra accepts new state. Returns `{ skipped: true, reason: 'unchanged' }` when the same `cacheKey` and mode are already current for the state lane. `accepted` resolves at decision-time, once Mastra decides what to do with the signal: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` is the authoritative id of the run that handled the signal and is present only on `wake` and `deliver`. For `persist`/`discard` use `result.signal.id` to correlate the stored signal. On the `wake` action, `output` is the agent stream for in-process consumption.
337
337
 
338
338
  ### `sendNotificationSignal(notification, options)`
339
339
 
340
- Creates or coalesces a notification inbox record, resolves the notification delivery policy, and sends a notification signal when the decision is immediate.
340
+ Creates or coalesces a notification inbox record and resolves the notification delivery policy. It sends a notification signal when the decision is immediate.
341
341
 
342
342
  ```typescript
343
343
  const result = await agent.sendNotificationSignal(
@@ -387,7 +387,7 @@ const result = await agent.sendNotificationSignal(
387
387
 
388
388
  Returns `{ record: NotificationRecord, decision: NotificationDeliveryDecision, runId?: string, signal?: CreatedAgentSignal, persisted?: Promise<void>, accepted?: Promise<SendAgentSignalAccepted> }`. `record` is the stored inbox record. `decision` is the delivery-policy result. `signal` and `runId` are present when ingress emits a signal immediately, including the immediate summary emitted for active high-priority notifications. `persisted` is present when the emitted signal is persisted without waking an idle thread. `accepted` is present when a signal is emitted and resolves at decision-time, once Mastra decides what to do with it: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run, or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` on the accepted result is present only on `wake` and `deliver`. On the `wake` action, `output` is the agent stream for in-process consumption.
389
389
 
390
- Default delivery is priority-aware. `urgent` notifications deliver immediately. `high` notifications deliver immediately when the thread is idle; when the thread is active, Mastra emits a summary immediately and keeps `deliverAt` for later full delivery when the thread is idle. `medium` notifications deliver immediately when idle and batch into summaries when active. `low` notifications batch into summaries in both active and idle threads; idle low-priority summaries reach subscribers without waking the model loop. For the full flow, visit [Signals](https://mastra.ai/docs/long-running-agents/signals).
390
+ Default delivery is priority-aware. `urgent` notifications deliver immediately. `high` notifications deliver immediately when the thread is idle. When the thread is active, Mastra emits a summary immediately and keeps `deliverAt` for later full delivery when the thread is idle. `medium` notifications deliver immediately when idle and batch into summaries when active. `low` notifications batch into summaries in both active and idle threads. Idle low-priority summaries reach subscribers without waking the model loop. For the full flow, visit [Signals](https://mastra.ai/docs/long-running-agents/signals).
391
391
 
392
392
  Configure `notifications.deliveryPolicy` on the agent when some notifications should wait for a different dispatch window or summary rollup:
393
393
 
@@ -417,7 +417,7 @@ export const supportAgent = new Agent({
417
417
 
418
418
  ### `subscribeToThread(options)`
419
419
 
420
- Subscribes to raw stream chunks for a memory thread. Use this before calling `sendMessage()`, `queueMessage()`, or `sendSignal()` when you need to render stream output, observe signal echoes, or abort the active run.
420
+ Subscribes to raw stream chunks for a memory thread. Use this before calling `sendMessage()`, `queueMessage()`, or `sendSignal()`. It lets you render stream output and observe signal echoes, including when a signal aborts the active run.
421
421
 
422
422
  **options** (`object`): Thread subscription target.
423
423
 
@@ -110,7 +110,7 @@ const agent = new Agent({
110
110
 
111
111
  `toolDisplay` controls how tool calls render in chat. The default `'cards'` posts a "Running…" card per tool and edits it with the result, matching the behavior in earlier versions. `'text'` is the same lifecycle but without rich Block Kit, useful for platforms that don't render cards well.
112
112
 
113
- `'timeline'` and `'grouped'` stream tool state as inline `task_update` chunks alongside the agent's text. These modes require `streaming: true` and rely on the chat adapter to render the chunks. Slack supports both natively; other adapters may render a placeholder until they ship support. If `streaming` is disabled, the channel logs a one-time warning and falls back to `'cards'`.
113
+ `'timeline'` and `'grouped'` stream tool state as inline `task_update` chunks alongside the agent's text. These modes require `streaming: true` and rely on the chat adapter to render the chunks. Slack supports both natively; other adapters may render a placeholder until they add support. If `streaming` is disabled, the channel logs a one-time warning and falls back to `'cards'`.
114
114
 
115
115
  `'hidden'` executes tools silently. Only the typing status indicates work in progress.
116
116
 
@@ -272,9 +272,9 @@ The `ResolveResourceIdContext` passed to the function:
272
272
 
273
273
  ## Thread ID resolution
274
274
 
275
- By default a new channel thread gets a random UUID as its internal Mastra thread id. Pass `resolveThreadId` to pick the id yourself for example, give the thread the same id as the session it belongs to, matching how your app names threads it creates itself.
275
+ By default a new channel thread gets a random UUID as its internal Mastra thread id. Pass `resolveThreadId` to pick the id yourself: for example, give the thread the same id as the session it belongs to, matching how your app names threads it creates itself.
276
276
 
277
- The hook runs after `resolveResourceId`, so the resolved owner is available on the context. Like `resolveResourceId` it runs only when a new thread is created: reused threads keep their stored id and never call the hook. The returned id must be unique across the memory store if it already belongs to an existing thread, Mastra logs a warning and uses a generated id instead so the existing thread is never overwritten. Return `ctx.defaultThreadId` to keep the built-in behavior.
277
+ The hook runs after `resolveResourceId`, so the resolved owner is available on the context. Like `resolveResourceId` it runs only when a new thread is created: reused threads keep their stored id and never call the hook. The returned id must be unique across the memory store. If it already belongs to an existing thread, Mastra logs a warning and uses a generated id instead so the existing thread is never overwritten. Return `ctx.defaultThreadId` to keep the built-in behavior.
278
278
 
279
279
  ```typescript
280
280
  import { Agent } from '@mastra/core/agent'
@@ -39,7 +39,7 @@ cleanup()
39
39
 
40
40
  ### Using the `durable` config flag
41
41
 
42
- Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it is attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, or `cleanupTimeoutMs`.
42
+ Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it's attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, or `cleanupTimeoutMs`.
43
43
 
44
44
  ```typescript
45
45
  import { Mastra } from '@mastra/core'
@@ -58,7 +58,7 @@ export const mastra = new Mastra({
58
58
  })
59
59
  ```
60
60
 
61
- `mastra.getAgent('myAgent')` returns the wrapped `DurableAgent`. Standalone agents (constructed but never registered on a `Mastra` instance) do not become durable; the wrapping is applied at registration.
61
+ `mastra.getAgent('myAgent')` returns the wrapped `DurableAgent`. Standalone agents (constructed but never registered on a `Mastra` instance) don't become durable. The wrapping is applied at registration.
62
62
 
63
63
  ## `createDurableAgent(options)`
64
64
 
@@ -176,7 +176,7 @@ await output.text
176
176
 
177
177
  Returns: `Promise<DurableAgentStreamResult>`
178
178
 
179
- > **Warning:** The `cleanup()` returned by `observe()` destroys the run's registry entries and cached events. Only call it when you are done with the run. If the run is suspended and you intend to resume later, don't call `cleanup()` let the auto-cleanup timer handle it after the run finishes or errors. Auto-cleanup doesn't fire on suspended events.
179
+ > **Warning:** The `cleanup()` returned by `observe()` destroys the run's registry entries and cached events. Only call it when you are done with the run. If the run is suspended and you intend to resume later, don't call `cleanup()`. Let the auto-cleanup timer handle it after the run finishes or errors. Auto-cleanup doesn't fire on suspended events.
180
180
 
181
181
  #### `prepare(messages, options?)`
182
182
 
@@ -387,7 +387,7 @@ const limitedResult = await agent.generate('Write a short poem about coding', {
387
387
 
388
388
  ### With memory
389
389
 
390
- Give your agent access to conversation history and persistence by configuring memory options. This allows the agent to remember previous interactions and maintain context across messages.
390
+ Give your agent access to conversation history and persistence by configuring memory options. It allows the agent to remember previous interactions and maintain context across messages.
391
391
 
392
392
  ```ts
393
393
  const memoryResult = await agent.generate('Remember my favorite color is blue', {
@@ -436,7 +436,7 @@ console.log(response.text)
436
436
 
437
437
  ### Using `maxSteps`
438
438
 
439
- The `maxSteps` parameter controls the maximum number of sequential LLM calls an agent can make. Each step includes generating a response, executing any tool calls, and processing the result. Limiting steps helps prevent infinite loops, reduce latency, and control token usage for agents that use tools. The default is 5, but can be increased:
439
+ The `maxSteps` parameter controls the maximum number of sequential LLM calls an agent can make. Each step generates a response and executes any tool calls before processing the result. Limiting steps helps prevent infinite loops and reduce latency. It also controls token usage for agents that use tools. The default is 5, but can be increased:
440
440
 
441
441
  ```typescript
442
442
  const response = await agent.generate('Help me organize my day', {
@@ -462,7 +462,7 @@ const response = await agent.generate('Help me organize my day', {
462
462
 
463
463
  ### Using `onTitleGenerated`
464
464
 
465
- When `generateTitle` is enabled in memory options, title generation runs asynchronously after the response completes. Use `onTitleGenerated` to react when the title is ready for example, to push it to the client via SSE.
465
+ When `generateTitle` is enabled in memory options, title generation runs asynchronously after the response completes. Use `onTitleGenerated` to react when the title is ready, for example by pushing it to the client via SSE.
466
466
 
467
467
  ```typescript
468
468
  const response = await agent.generate('What is quantum computing?', {
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Agent.getDefaultOptions()
4
4
 
5
- Agents can be configured with default options for memory usage, output format, and iteration steps. The `.getDefaultOptions()` method returns these defaults, resolving them if they're functions. These options apply to all `stream()` and `generate()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
5
+ Agents can be configured with default options for memory usage and output format. Iteration steps can also be configured. The `.getDefaultOptions()` method returns these defaults, resolving them if they're functions. These options apply to all `stream()` and `generate()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  > **Warning:** **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.getDefaultOptions()`](https://mastra.ai/reference/agents/getDefaultOptions) method instead.
6
6
 
7
- Agents can be configured with default streaming options for memory usage, output format, and iteration steps. The `.getDefaultStreamOptionsLegacy()` method returns these defaults, resolving them if they're functions. These options apply to all `streamLegacy()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
7
+ Agents can be configured with default streaming options for memory usage and output format. Iteration steps can also be configured. The `.getDefaultStreamOptionsLegacy()` method returns these defaults, resolving them if they're functions. These options apply to all `streamLegacy()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Agent.listScorers()
4
4
 
5
- The `.listScorers()` method retrieves the scoring configuration configured for an agent, resolving it if it's a function. This method provides access to the scoring system used for evaluating agent responses and performance.
5
+ The `.listScorers()` method retrieves the scoring configuration configured for an agent, resolving it if it's a function. The method provides access to the scoring system used for evaluating agent responses and performance.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -46,7 +46,7 @@ interface SkillMetadata {
46
46
 
47
47
  ## Merging behavior
48
48
 
49
- When both agent-level skills and workspace skills are configured, `.listSkills()` returns the merged set. Agent-level skills take precedence on name conflicts if both define a skill named `code-review`, only the agent-level version is returned.
49
+ When both agent-level skills and workspace skills are configured, `.listSkills()` returns the merged set. Agent-level skills take precedence on name conflicts. If both define a skill called `code-review`, only the agent-level version is returned.
50
50
 
51
51
  ## Related
52
52
 
@@ -12,7 +12,7 @@ The filter contract mirrors the workflow run listing APIs (`listWorkflowRuns`),
12
12
 
13
13
  ## Usage example
14
14
 
15
- Discover the pending run for a conversation and continue it. Check `requiresApproval` to pick the right continuation `approveToolCall()` / `declineToolCall()` for approval suspensions, `resumeStream()` with resume data for `suspend()`-based suspensions:
15
+ Discover the pending run for a conversation and continue it. Check `requiresApproval` to pick the right continuation: `approveToolCall()` / `declineToolCall()` for approval suspensions, `resumeStream()` with resume data for `suspend()`-based suspensions:
16
16
 
17
17
  ```typescript
18
18
  const { runs } = await agent.listSuspendedRuns({
@@ -83,7 +83,7 @@ interface AgentRunToolCall {
83
83
 
84
84
  ## Discovery scope
85
85
 
86
- Results are scoped to runs started by the agent you call `listSuspendedRuns()` on: snapshots persist the owning agent's id, so runs started by other agents on the same Mastra instance aren't returned. In [supervisor setups](https://mastra.ai/docs/agents/agent-approval) the supervisor sees its outer run the one to resume while a subagent's inner run is only visible from the subagent itself. Filter by `threadId` and `resourceId` to scope results to one conversation.
86
+ Results are scoped to runs started by the agent you call `listSuspendedRuns()` on: snapshots persist the owning agent's id, so runs started by other agents on the same Mastra instance aren't returned. In [supervisor setups](https://mastra.ai/docs/agents/agent-approval) the supervisor sees its outer run (the one to resume), while a subagent's inner run is only visible from the subagent itself. Filter by `threadId` and `resourceId` to scope results to one conversation.
87
87
 
88
88
  Run snapshots are only persisted while a run is waiting on input and are deleted when it finishes, so suspended runs are the only runs discoverable from storage. Suspended runs only survive restarts when the Mastra instance has a persistent [storage provider](https://mastra.ai/docs/storage/overview) configured. With the default in-memory store, snapshots are lost on restart.
89
89
 
@@ -32,7 +32,7 @@ export const mastra = new Mastra({
32
32
  })
33
33
  ```
34
34
 
35
- You can also use dynamic agent routing based on an `agentId`. The URL `/chat/weatherAgent` will resolve to the agent with the ID `weatherAgent`.
35
+ You can also use runtime-defined agent routing based on an `agentId`. The URL `/chat/weatherAgent` will resolve to the agent with the ID `weatherAgent`.
36
36
 
37
37
  ```typescript
38
38
  import { Mastra } from '@mastra/core'
@@ -30,7 +30,7 @@ export const mastra = new Mastra({
30
30
  })
31
31
  ```
32
32
 
33
- You can also use dynamic agent routing based on an `agentId`. The URL `/network/weatherAgent` will resolve to the agent with the ID `weatherAgent`.
33
+ You can also use runtime-defined agent routing based on an `agentId`. The URL `/network/weatherAgent` will resolve to the agent with the ID `weatherAgent`.
34
34
 
35
35
  ```typescript
36
36
  import { Mastra } from '@mastra/core'
@@ -2,7 +2,7 @@
2
2
 
3
3
  # toAISdkMessages()
4
4
 
5
- Converts messages from various input formats to AI SDK UI message format. `toAISdkMessages()` keeps the existing AI SDK v5/default behavior. If your app is typed against AI SDK v6, pass `version: 'v6'`.
5
+ Converts messages from input formats to AI SDK UI message format. `toAISdkMessages()` keeps the existing AI SDK v5/default behavior. If your app is typed against AI SDK v6, pass `version: 'v6'`.
6
6
 
7
7
  `version: 'v6'` uses the MessageList AI SDK v6 UI output path. MessageList input detection and ingestion remain unchanged.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # toAISdkV4Messages()
4
4
 
5
- Converts messages from various input formats to AI SDK V4 UI message format. This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V4 `UIMessage` format, which is suitable for use with AI SDK UI components like `useChat()`.
5
+ Converts messages from input formats to AI SDK V4 UI message format. This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V4 `UIMessage` format, which is suitable for use with AI SDK UI components like `useChat()`.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # toAISdkV5Messages()
4
4
 
5
- Converts messages from various input formats to AI SDK V5 (and later) UI message format. This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V5+ `UIMessage` format, which is suitable for use with AI SDK UI components like `useChat()`.
5
+ Converts messages from input formats to AI SDK V5 (and later) UI message format. This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V5+ `UIMessage` format, which is suitable for use with AI SDK UI components like `useChat()`.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -32,7 +32,7 @@ export const mastra = new Mastra({
32
32
  })
33
33
  ```
34
34
 
35
- You can also use dynamic workflow routing based on a `workflowId`. The URL `/workflow/weatherWorkflow` will resolve to the workflow with the ID `weatherWorkflow`.
35
+ You can also use runtime-defined workflow routing based on a `workflowId`. The URL `/workflow/weatherWorkflow` will resolve to the workflow with the ID `weatherWorkflow`.
36
36
 
37
37
  ```typescript
38
38
  import { Mastra } from '@mastra/core'
@@ -36,10 +36,10 @@ export async function GET(req: Request) {
36
36
 
37
37
  ## Returns
38
38
 
39
- `ReadableStream` A stream of AI SDK UIMessage data parts containing:
39
+ `ReadableStream`: A stream of AI SDK UIMessage data parts containing:
40
40
 
41
41
  - A `start` marker
42
- - A `WorkflowDataPart` with the overall workflow status and all step summaries
42
+ - A `WorkflowDataPart` with the workflow status and all step summaries
43
43
  - A `WorkflowStepDataPart` for each step with its full output
44
44
  - A `finish` marker
45
45