@mastra/mcp-docs-server 1.2.23-alpha.1 → 1.2.23-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/.docs/docs/agents/code-mode.md +1 -1
  2. package/.docs/docs/agents/human-in-the-loop.md +1 -1
  3. package/.docs/docs/agents/networks.md +1 -1
  4. package/.docs/docs/agents/processors.md +1 -1
  5. package/.docs/docs/agents/structured-output.md +1 -1
  6. package/.docs/docs/auth/fga.md +16 -16
  7. package/.docs/docs/channels.md +2 -2
  8. package/.docs/docs/connections/mcp.md +1 -1
  9. package/.docs/docs/datasets/running-experiments.md +1 -1
  10. package/.docs/docs/deployment/sandbox.md +2 -2
  11. package/.docs/docs/deployment/workers.md +2 -2
  12. package/.docs/docs/evals/custom-scorers.md +3 -4
  13. package/.docs/docs/evals/multi-turn.md +1 -1
  14. package/.docs/docs/evals/overview.md +11 -11
  15. package/.docs/docs/evals/quick-checks.md +1 -1
  16. package/.docs/docs/evals/vitest-integration.md +136 -0
  17. package/.docs/docs/guides/context-engineering.md +1 -1
  18. package/.docs/docs/guides/multi-agent-systems.md +1 -1
  19. package/.docs/docs/guides/streaming.md +72 -52
  20. package/.docs/docs/harness/agent-controller.md +49 -1
  21. package/.docs/docs/harness/background-tasks.md +1 -1
  22. package/.docs/docs/harness/durable-agents.md +1 -1
  23. package/.docs/docs/harness/overview.md +10 -11
  24. package/.docs/docs/harness/schedules.md +1 -1
  25. package/.docs/docs/harness/signal-providers.md +1 -1
  26. package/.docs/docs/harness/signals.md +1 -1
  27. package/.docs/docs/index.md +1 -1
  28. package/.docs/docs/mastra-platform/deploy.md +15 -15
  29. package/.docs/docs/mastra-platform/environments.md +2 -2
  30. package/.docs/docs/mastra-platform/github.md +2 -2
  31. package/.docs/docs/mastra-platform/regions.md +1 -1
  32. package/.docs/docs/mastra-platform/server.md +4 -4
  33. package/.docs/docs/mastra-platform/studio.md +1 -1
  34. package/.docs/docs/mastra-platform/trace-intelligence.md +1 -1
  35. package/.docs/docs/mastra-platform/workspaces.md +1 -1
  36. package/.docs/docs/memory/message-history.md +3 -3
  37. package/.docs/docs/memory/observational-memory.md +18 -18
  38. package/.docs/docs/memory/overview.md +1 -1
  39. package/.docs/docs/memory/semantic-recall.md +0 -2
  40. package/.docs/docs/memory/working-memory.md +1 -1
  41. package/.docs/docs/observability/feedback.md +2 -2
  42. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -1
  43. package/.docs/docs/observability/logging.md +1 -1
  44. package/.docs/docs/observability/metrics/overview.md +1 -1
  45. package/.docs/docs/observability/overview.md +13 -11
  46. package/.docs/docs/observability/tracing/overview.md +13 -13
  47. package/.docs/docs/sandbox/lsp.md +1 -1
  48. package/.docs/docs/sandbox/overview.md +1 -1
  49. package/.docs/docs/server/mastra-client.md +1 -1
  50. package/.docs/docs/server/overview.md +1 -1
  51. package/.docs/docs/server/pubsub.md +1 -1
  52. package/.docs/docs/server/request-context.md +2 -2
  53. package/.docs/docs/server/server-adapters.md +1 -1
  54. package/.docs/docs/skills.md +1 -1
  55. package/.docs/docs/studio/deployment.md +1 -1
  56. package/.docs/docs/studio/editor.md +1 -1
  57. package/.docs/docs/studio/observability.md +2 -2
  58. package/.docs/docs/studio/overview.md +1 -1
  59. package/.docs/docs/subagents.md +2 -2
  60. package/.docs/docs/workflows/agents-and-tools.md +0 -4
  61. package/.docs/docs/workflows/control-flow.md +1 -3
  62. package/.docs/docs/workflows/overview.md +1 -1
  63. package/.docs/docs/workflows/scheduled-workflows.md +1 -1
  64. package/.docs/docs/workflows/suspend-and-resume.md +2 -2
  65. package/.docs/integrations/sandboxes/agentcore.md +2 -0
  66. package/.docs/integrations/sandboxes/apple-container.md +5 -3
  67. package/.docs/integrations/sandboxes/blaxel.md +2 -0
  68. package/.docs/integrations/sandboxes/cloudflare-sandbox.md +1 -1
  69. package/.docs/integrations/sandboxes/daytona.md +2 -0
  70. package/.docs/integrations/sandboxes/docker.md +3 -1
  71. package/.docs/integrations/sandboxes/e2b.md +4 -0
  72. package/.docs/integrations/sandboxes/modal.md +3 -1
  73. package/.docs/integrations/sandboxes/railway.md +2 -0
  74. package/.docs/integrations/sandboxes/vercel.md +4 -0
  75. package/.docs/integrations/voice/livekit.md +51 -1
  76. package/.docs/models/environment-variables.md +5 -0
  77. package/.docs/models/gateways/merge-gateway.md +2 -1
  78. package/.docs/models/gateways/netlify.md +6 -2
  79. package/.docs/models/gateways/openrouter.md +3 -5
  80. package/.docs/models/gateways/vercel.md +4 -1
  81. package/.docs/models/index.md +1 -1
  82. package/.docs/models/providers/abliteration-ai.md +7 -6
  83. package/.docs/models/providers/above.md +83 -0
  84. package/.docs/models/providers/aiand.md +4 -2
  85. package/.docs/models/providers/anthropic.md +2 -1
  86. package/.docs/models/providers/berget.md +4 -2
  87. package/.docs/models/providers/bothub.md +76 -0
  88. package/.docs/models/providers/chutes.md +1 -1
  89. package/.docs/models/providers/coralbricks.md +4 -4
  90. package/.docs/models/providers/cortecs.md +3 -3
  91. package/.docs/models/providers/crossmodel.md +4 -3
  92. package/.docs/models/providers/edenai.md +8 -6
  93. package/.docs/models/providers/empiriolabs.md +1 -2
  94. package/.docs/models/providers/fireworks-ai.md +2 -1
  95. package/.docs/models/providers/friendli.md +3 -2
  96. package/.docs/models/providers/google.md +1 -2
  97. package/.docs/models/providers/groq.md +2 -1
  98. package/.docs/models/providers/hyper.md +8 -6
  99. package/.docs/models/providers/iteracompute.md +8 -7
  100. package/.docs/models/providers/kilo.md +29 -32
  101. package/.docs/models/providers/klokintegration.md +77 -0
  102. package/.docs/models/providers/llmgateway-providers.md +2 -26
  103. package/.docs/models/providers/llmgateway.md +3 -14
  104. package/.docs/models/providers/nano-gpt.md +75 -92
  105. package/.docs/models/providers/neuralwatt.md +2 -1
  106. package/.docs/models/providers/ollama-cloud.md +2 -1
  107. package/.docs/models/providers/opencode-go.md +1 -1
  108. package/.docs/models/providers/opencode.md +2 -2
  109. package/.docs/models/providers/orcarouter.md +3 -2
  110. package/.docs/models/providers/requesty.md +5 -7
  111. package/.docs/models/providers/sensenova.md +77 -0
  112. package/.docs/models/providers/synthetic.md +3 -2
  113. package/.docs/models/providers/tokenrouter.md +75 -0
  114. package/.docs/models/providers/trustedrouter.md +13 -13
  115. package/.docs/models/providers/vancine.md +13 -11
  116. package/.docs/models/providers.md +5 -0
  117. package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
  118. package/.docs/reference/agent-controller/session.md +3 -3
  119. package/.docs/reference/agents/durable-agent.md +77 -9
  120. package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
  121. package/.docs/reference/agents/listSuspendedRuns.md +2 -2
  122. package/.docs/reference/ai-sdk/chat-route.md +1 -1
  123. package/.docs/reference/ai-sdk/network-route.md +1 -1
  124. package/.docs/reference/ai-sdk/workflow-route.md +1 -1
  125. package/.docs/reference/browser/browser-viewer.md +1 -1
  126. package/.docs/reference/cli/mastra.md +4 -4
  127. package/.docs/reference/core/mastra-class.md +1 -1
  128. package/.docs/reference/datasets/createExperiment.md +1 -1
  129. package/.docs/reference/editor/tool-provider.md +1 -1
  130. package/.docs/reference/editor/versioning.md +1 -1
  131. package/.docs/reference/evals/multi-turn-judge.md +1 -1
  132. package/.docs/reference/evals/rubric.md +1 -1
  133. package/.docs/reference/file-based-agents/schedules.md +2 -2
  134. package/.docs/reference/file-based-agents/workspace.md +1 -1
  135. package/.docs/reference/manual-install.md +3 -3
  136. package/.docs/reference/memory/observational-memory.md +4 -4
  137. package/.docs/reference/memory/settled.md +1 -1
  138. package/.docs/reference/migrations/mastra-cloud.md +9 -9
  139. package/.docs/reference/migrations/upgrade-to-v1/overview.md +1 -1
  140. package/.docs/reference/observability/tracing/configuration.md +2 -2
  141. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +1 -1
  142. package/.docs/reference/processors/processor-interface.md +1 -1
  143. package/.docs/reference/processors/regex-filter-processor.md +3 -3
  144. package/.docs/reference/processors/token-cost-control.md +2 -2
  145. package/.docs/reference/processors/token-limiter-processor.md +1 -1
  146. package/.docs/reference/processors/tool-search-processor.md +1 -1
  147. package/.docs/reference/processors/working-memory-processor.md +1 -1
  148. package/.docs/reference/pubsub/base.md +2 -2
  149. package/.docs/reference/pubsub/lease-provider.md +2 -2
  150. package/.docs/reference/rag/vector-databases.md +33 -33
  151. package/.docs/reference/server/create-route.md +1 -1
  152. package/.docs/reference/signals/task-signal-provider.md +1 -1
  153. package/.docs/reference/storage/composite.md +1 -1
  154. package/.docs/reference/storage/retention.md +4 -4
  155. package/.docs/reference/streaming/ChunkType.md +1 -1
  156. package/.docs/reference/tools/isolated-vm-transport.md +1 -1
  157. package/.docs/reference/tools/mcp-client.md +2 -2
  158. package/.docs/reference/vectors/couchbase.md +1 -1
  159. package/.docs/reference/vectors/mongodb.md +2 -2
  160. package/.docs/reference/voice/overview.md +1 -1
  161. package/.docs/reference/workflows/workflow-methods/agent.md +4 -4
  162. package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
  163. package/.docs/reference/workflows/workflow-methods/tool.md +2 -2
  164. package/.docs/reference/workspace/platform-sandbox.md +6 -2
  165. package/.docs/reference/workspace/process-manager.md +1 -1
  166. package/.docs/reference/workspace/sandbox.md +20 -3
  167. package/.docs/reference/workspace/workspace-class.md +3 -3
  168. package/package.json +5 -6
  169. package/CHANGELOG.md +0 -5929
@@ -8,14 +8,11 @@ Mastra supports real-time, incremental responses from agents and workflows, allo
8
8
 
9
9
  ## Getting started
10
10
 
11
- Mastra's streaming API adapts based on your model version:
12
-
13
- - **`.stream()`**: For V2 models, supports **AI SDK v5** and later (`LanguageModelV2`).
14
- - **`.streamLegacy()`**: For V1 models, supports **AI SDK v4** (`LanguageModelV1`).
11
+ [`Agent.stream()`](https://mastra.ai/reference/streaming/agents/stream) is the standard streaming API for agents. It returns a `MastraModelOutput` that exposes `textStream` for progressive text and promises such as `text`, `steps`, and `usage` that resolve when the stream finishes.
15
12
 
16
13
  ## Streaming with agents
17
14
 
18
- You can pass a single string for basic prompts, an array of strings when providing multiple pieces of context, or an array of message objects with `role` and `content` for precise control over roles and conversational flows.
15
+ Pass a single string for a basic prompt. When providing multiple pieces of context, use an array of strings. An array of message objects with `role` and `content` gives you precise control over roles and conversational flow.
19
16
 
20
17
  ### Using `Agent.stream()`
21
18
 
@@ -33,7 +30,7 @@ for await (const chunk of stream.textStream) {
33
30
 
34
31
  Visit [Agent.stream()](https://mastra.ai/reference/streaming/agents/stream) for more information.
35
32
 
36
- > **Tip:** For agents that dispatch [background tasks](https://mastra.ai/docs/harness/background-tasks), use [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) to keep the stream open until those tasks complete and the agent has had a chance to respond to their results.
33
+ > **Tip:** For agents that dispatch [background tasks](https://mastra.ai/docs/harness/background-tasks), use `stream()` with the [`untilIdle` option](https://mastra.ai/reference/streaming/agents/stream), such as `untilIdle: true`, to keep the stream open until those tasks complete and the agent has had a chance to respond to their results. This option requires agent memory.
37
34
 
38
35
  ### Output from `Agent.stream()`
39
36
 
@@ -51,54 +48,58 @@ Here are some questions to consider:
51
48
  An agent stream provides access to these response properties:
52
49
 
53
50
  - **`stream.textStream`**: A readable stream that emits text chunks.
54
- - **`stream.text`**: Promise that resolves to the full text response.
55
- - **`stream.finishReason`**: The reason the agent stopped streaming.
56
- - **`stream.usage`**: Token usage information.
51
+ - **`stream.text`**: A promise that resolves to the full text response.
52
+ - **`stream.steps`**: A promise that resolves to the completed model steps.
53
+ - **`stream.finishReason`**: A promise that resolves to the reason the agent stopped streaming.
54
+ - **`stream.usage`**: A promise that resolves to token usage information.
55
+ - **`stream.objectStream`** and **`stream.object`**: Partial and final structured output when `structuredOutput` is passed.
57
56
 
58
- ### AI SDK v5+ Compatibility
57
+ See the [`MastraModelOutput` reference](https://mastra.ai/reference/streaming/agents/MastraModelOutput) for the complete set of properties.
59
58
 
60
- AI SDK v5 (and later) uses `LanguageModelV2` for the model providers. If you are getting an error that you are using an AI SDK v4 model you will need to upgrade your model package to the next major version.
59
+ ### AI SDK integration
61
60
 
62
- For integration with AI SDK v5+, use the `toAISdkV5Stream()` utility from `@mastra/ai-sdk` to convert Mastra streams to AI SDK-compatible format:
61
+ Use `toAISdkStream()` and `toAISdkMessages()` to convert Mastra streams and stored messages to AI SDK-compatible formats. The converters default to AI SDK v5 for backward compatibility. Pass the version that matches your installed AI SDK, such as `version: 'v7'` for AI SDK v7.
63
62
 
64
63
  ```typescript
65
- import { toAISdkV5Stream } from '@mastra/ai-sdk'
64
+ import { toAISdkStream } from '@mastra/ai-sdk'
66
65
 
67
66
  const testAgent = mastra.getAgent('testAgent')
68
-
69
67
  const stream = await testAgent.stream([{ role: 'user', content: 'Help me organize my day' }])
70
68
 
71
- // Convert to AI SDK v5+ compatible stream
72
- const aiSDKStream = toAISdkV5Stream(stream, { from: 'agent' })
69
+ const aiSDKStream = toAISdkStream(stream, {
70
+ from: 'agent',
71
+ version: 'v7',
72
+ })
73
73
  ```
74
74
 
75
- For converting messages to AI SDK v5+ format, use the `toAISdkV5Messages()` utility from `@mastra/ai-sdk/ui`:
75
+ Convert stored messages for `useChat()`'s `initialMessages` with `toAISdkMessages()`:
76
76
 
77
77
  ```typescript
78
- import { toAISdkV5Messages } from '@mastra/ai-sdk/ui'
78
+ import { toAISdkMessages } from '@mastra/ai-sdk/ui'
79
79
 
80
- const messages = [{ role: 'user', content: 'Hello' }]
81
- const aiSDKMessages = toAISdkV5Messages(messages)
80
+ const initialMessages = toAISdkMessages([{ role: 'user', content: 'Hello' }], { version: 'v7' })
82
81
  ```
83
82
 
83
+ For route handlers, see [AI SDK UI](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui), which covers `handleChatStream()`, `handleWorkflowStream()`, and `handleNetworkStream()`. Pass the version that matches your installed AI SDK to these handlers too. See the [`toAISdkStream()`](https://mastra.ai/reference/ai-sdk/to-ai-sdk-stream) and [`toAISdkMessages()`](https://mastra.ai/reference/ai-sdk/to-ai-sdk-messages) references for all options.
84
+
84
85
  ## Streaming with workflows
85
86
 
86
87
  Streaming from a workflow returns a sequence of structured events describing the run lifecycle, rather than incremental text chunks. This event-based format makes it possible to track and respond to workflow progress in real time once a run is created using `.createRun()`.
87
88
 
88
89
  ### Using `Run.stream()`
89
90
 
90
- The `stream()` method returns a `ReadableStream` of events directly.
91
+ The `stream()` method returns a `WorkflowRunOutput`. Its `fullStream` property is a `ReadableStream` of workflow events.
91
92
 
92
93
  ```typescript
93
94
  const run = await testWorkflow.createRun()
94
95
 
95
- const stream = await run.stream({
96
+ const stream = run.stream({
96
97
  inputData: {
97
98
  value: 'initial data',
98
99
  },
99
100
  })
100
101
 
101
- for await (const chunk of stream) {
102
+ for await (const chunk of stream.fullStream) {
102
103
  console.log(chunk)
103
104
  }
104
105
  ```
@@ -115,11 +116,7 @@ The event structure includes `runId` and `from` at the top level, making it easi
115
116
  runId: '1eeaf01a-d2bf-4e3f-8d1b-027795ccd3df',
116
117
  from: 'WORKFLOW',
117
118
  payload: {
118
- stepName: 'step-1',
119
- args: { value: 'initial data' },
120
- stepCallId: '8e15e618-be0e-4215-a5d6-08e58c152068',
121
- startedAt: 1755121710066,
122
- status: 'running'
119
+ workflowId: 'testWorkflow'
123
120
  }
124
121
  }
125
122
  ```
@@ -138,26 +135,45 @@ Events emitted from agents or workflows represent different stages of generation
138
135
 
139
136
  ## Event types
140
137
 
141
- Below is a complete list of events emitted from `.stream()`. Depending on whether you’re streaming from an **agent** or a **workflow**, only a subset of these events will occur:
138
+ Agent and workflow streams emit different event types during execution.
139
+
140
+ ### Agent events
141
+
142
+ Common agent events include:
143
+
144
+ - **`start`**: The agent run begins.
145
+ - **`text-start`**, **`text-delta`**, and **`text-end`**: The start and end events mark text generation boundaries. Delta events carry incremental text.
146
+ - **`reasoning-start`**, **`reasoning-delta`**, and **`reasoning-end`**: The start and end events mark reasoning generation boundaries. Delta events carry incremental reasoning.
147
+ - **`tool-call`** and **`tool-result`**: A tool is called and returns a result.
148
+ - **`step-start`** and **`step-finish`**: A model step begins and ends.
149
+ - **`finish`**: The agent run completes.
150
+
151
+ This list isn't exhaustive. See the [`ChunkType` reference](https://mastra.ai/reference/streaming/ChunkType) for all agent chunk types and payloads.
152
+
153
+ ### Workflow events
154
+
155
+ Workflow events include:
142
156
 
143
- - **start**: Marks the beginning of an agent or workflow run.
144
- - **step-start**: Indicates a workflow step has begun execution.
145
- - **text-delta**: Incremental text chunks as they're generated by the LLM.
146
- - **tool-call**: When the agent decides to use a tool, including the tool name and arguments.
147
- - **tool-result**: The result returned from tool execution.
148
- - **step-finish**: Confirms that a specific step has fully finalized, and may include metadata like the finish reason for that step.
149
- - **finish**: When the agent or workflow completes, including usage statistics.
157
+ - **`workflow-start`**: The workflow run begins.
158
+ - **`workflow-step-start`**: A workflow step begins.
159
+ - **`workflow-step-output`**: A step emits custom output.
160
+ - **`workflow-step-progress`**: A step reports progress.
161
+ - **`workflow-step-result`**: A step completes with a result.
162
+ - **`workflow-finish`**: The workflow run completes.
163
+ - **`workflow-paused`**, **`workflow-step-suspended`**, and **`workflow-canceled`**: The workflow run is interrupted.
164
+
165
+ See the [`Run.stream()` reference](https://mastra.ai/reference/streaming/workflows/stream) for workflow event details.
150
166
 
151
167
  ## Inspecting agent streams
152
168
 
153
- Iterate over the `stream` with a `for await` loop to inspect all emitted event chunks.
169
+ Iterate over `stream.fullStream` with a `for await` loop to inspect all emitted event chunks.
154
170
 
155
171
  ```typescript
156
172
  const testAgent = mastra.getAgent('testAgent')
157
173
 
158
174
  const stream = await testAgent.stream([{ role: 'user', content: 'Help me organize my day' }])
159
175
 
160
- for await (const chunk of stream) {
176
+ for await (const chunk of stream.fullStream) {
161
177
  console.log(chunk)
162
178
  }
163
179
  ```
@@ -295,27 +311,31 @@ The `writer` argument is passed to a workflow step's `execute` function and can
295
311
  > **Warning:** You must `await` the call to `writer.write(...)` or else you will lock the stream and get a `WritableStream is locked` error.
296
312
 
297
313
  ```typescript
298
- import { createStep } from "@mastra/core/workflows";
314
+ import { createStep } from '@mastra/core/workflows'
315
+ import { z } from 'zod'
299
316
 
300
317
  export const testStep = createStep({
318
+ id: 'test-step',
319
+ inputSchema: z.object({ url: z.url() }),
320
+ outputSchema: z.object({ status: z.number() }),
301
321
  execute: async ({ inputData, writer }) => {
302
- const { value } = inputData;
322
+ const { url } = inputData
303
323
 
304
- await writer?.write({
305
- type: "custom-event",
306
- status: "pending"
307
- });
324
+ await writer.write({
325
+ type: 'custom-event',
326
+ status: 'pending',
327
+ })
308
328
 
309
- const response = await fetch(...);
329
+ const response = await fetch(url)
310
330
 
311
- await writer?.write({
312
- type: "custom-event",
313
- status: "success"
314
- });
331
+ await writer.write({
332
+ type: 'custom-event',
333
+ status: 'success',
334
+ })
315
335
 
316
336
  return {
317
- value: ""
318
- };
337
+ status: response.status,
338
+ }
319
339
  },
320
- });
340
+ })
321
341
  ```
@@ -369,7 +369,7 @@ channels: {
369
369
  }
370
370
  ```
371
371
 
372
- Create the session under `thread.resourceId`. A session can only bind threads it owns, so use `resolveResourceId` if you want a different owner for the mapped thread. Sessions are get-or-create per `resourceId` and `scope`, so pass `scope` when one thread needs separate sessions per install or principal.
372
+ Create the session under `thread.resourceId`. Because a session can bind only threads it owns, use `resolveResourceId` to assign a different owner to the mapped thread. Sessions are get-or-create for each `resourceId` and `scope` combination. Pass `scope` when one thread needs separate sessions for each installation or principal.
373
373
 
374
374
  Failures that aren't refusals (a storage outage, a bug in your resolver's dependencies) still post an error to the thread, so a broken bot doesn't look like a silent one. If you need to tell them apart in your own code, a refusal is a `ChannelSessionRejectedError` with the original error as its `cause`.
375
375
 
@@ -396,6 +396,10 @@ See [Channels](https://mastra.ai/docs/channels) for adapter setup and platform-s
396
396
 
397
397
  ## Connect a UI
398
398
 
399
+ How you connect depends on where the UI runs. A terminal UI or a server that owns the controller holds the `Session` object and subscribes to it directly. A browser UI runs in a different process, so it reaches the same session over the controller's HTTP routes with [`@mastra/client-js`](https://mastra.ai/reference/client-js/mastra-client).
400
+
401
+ ### Server-side sessions
402
+
399
403
  Subscribe to Session events for incremental updates. Read the reduced display state with [`session.displayState.get()`](https://mastra.ai/reference/agent-controller/session) when the UI needs a complete render snapshot:
400
404
 
401
405
  ```typescript
@@ -413,6 +417,50 @@ unsubscribe()
413
417
 
414
418
  Subscriptions are isolated by Session. Events from another Session on the same controller aren't delivered to this listener. Read the [Building a coding agent](https://mastra.ai/blog/building-a-coding-agent) guide for a complete TUI example.
415
419
 
420
+ ### Client-side sessions
421
+
422
+ `client.getAgentController(id).session(resourceId, scope?)` returns a session client bound to one resource. Sessions are get-or-create on the server, so `create()` resumes an existing conversation instead of forking it. Pass `scope` when one resource needs independent sessions, such as one per git worktree:
423
+
424
+ ```typescript
425
+ import { MastraClient } from '@mastra/client-js'
426
+
427
+ const client = new MastraClient({ baseUrl: 'http://localhost:4111' })
428
+ const session = client.getAgentController('coding-controller').session('user-123')
429
+
430
+ await session.create()
431
+
432
+ const subscription = await session.subscribe({
433
+ onEvent: event => handleEvent(event),
434
+ onError: error => showDisconnected(error),
435
+ onReconnect: async () => resync(await session.state()),
436
+ reconnect: true,
437
+ })
438
+
439
+ // Call when the UI disconnects.
440
+ subscription.unsubscribe()
441
+ ```
442
+
443
+ `subscribe()` takes an options object and is async, unlike the in-process listener. Its promise resolves once the stream is established and rejects when it can't connect, so a rejected call leaves nothing running in the background. `reconnect: true` re-establishes a stream that drops after it was established, with exponential backoff.
444
+
445
+ The server doesn't replay events missed while the stream was down, so read `session.state()` from `onReconnect` for the current mode, model, and thread. The client surface has no `session.displayState.get()`.
446
+
447
+ Send work with `session.sendMessage(content)`, or `session.sendMessage({ content, files })` to attach base64-encoded files. The reply arrives as `message_*` events on the subscription, not as the return value of the call. Answer a `tool_approval_required` event with `session.approveTool(toolCallId, approved)`, and a `tool_suspended` event with `session.respondToToolSuspension(toolCallId, resumeData)`.
448
+
449
+ `onEvent` receives every event the session emits, discriminated by `event.type`:
450
+
451
+ | Group | Events |
452
+ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
453
+ | Run | `agent_start`, `agent_end`, `usage_update`, `goal_evaluation`, `follow_up_queued` |
454
+ | Messages | `message_start`, `message_update`, `message_end` |
455
+ | Tools | `tool_input_start`, `tool_input_delta`, `tool_input_end`, `tool_start`, `tool_update`, `tool_end`, `shell_output`, `command_exit`, `tool_approval_required`, `tool_suspended`, `tool_suspension_cancelled`, `task_updated` |
456
+ | Session | `state_changed`, `display_state_changed`, `mode_changed`, `model_changed`, `thread_changed`, `thread_created`, `thread_deleted`, `thread_title_updated` |
457
+ | Subagents | `subagent_start`, `subagent_text_delta`, `subagent_tool_start`, `subagent_tool_end`, `subagent_end`, `subagent_model_changed` |
458
+ | Memory | `om_observation_start`, `om_observation_end`, `om_observation_failed`, `om_reflection_start`, `om_reflection_end`, `om_reflection_failed`, `om_buffering_start`, `om_buffering_end`, `om_buffering_failed`, `om_model_changed`, `om_activation`, `om_status`, `om_thread_title_updated` |
459
+ | Workspace | `workspace_ready`, `workspace_error`, `workspace_status_changed` |
460
+ | Notification | `notification`, `notification_summary`, `info`, `error` |
461
+
462
+ A controller can also emit events the SDK doesn't type, so comparing `event.type` to a literal doesn't narrow the union. Narrow with `isKnownAgentControllerEvent(event)` to get a typed payload.
463
+
416
464
  ## Related
417
465
 
418
466
  - [Agents](https://mastra.ai/docs/agents/overview)
@@ -275,7 +275,7 @@ await mastra.backgroundTaskManager?.resume(taskId, {
275
275
 
276
276
  ### What happens to the agent loop
277
277
 
278
- When a task suspends mid-`stream()` with `untilIdle`, the wrapper treats it as terminal for the current iteration and closes. To continue the agent immediately when the resume payload is in hand, call `agent.resumeStream(resumeData, { runId, toolCallId, memory, untilIdle: true })`: the resumed bg task runs to completion and adds its result to the message list. The agent then runs a follow-up turn, all on the same SSE connection. If you'd rather drive the resume out-of-band, call `mastra.backgroundTaskManager.resume(taskId, resumeData)` directly and the result still writes into the thread for the next user turn to pick up.
278
+ When a task suspends mid-`stream()` with `untilIdle`, the wrapper treats it as terminal for the current iteration and closes. Once the resume payload is available, call `agent.resumeStream(resumeData, { runId, toolCallId, memory, untilIdle: true })` to continue immediately. The resumed background task completes and adds its result to the message list before the agent runs a follow-up turn on the same SSE connection. To drive the resume out of band, call `mastra.backgroundTaskManager.resume(taskId, resumeData)` directly. Its result is still written into the thread for the next user turn.
279
279
 
280
280
  ### Re-registering the executor on resume
281
281
 
@@ -70,7 +70,7 @@ A durable agent adds three layers on top of a regular agent:
70
70
 
71
71
  1. **Workflow execution**: `stream()` serializes the messages and options into a workflow input, then triggers the agentic loop inside a durable workflow. The workflow runs the same loop as `Agent.stream()` but each step can be memoized and replayed.
72
72
 
73
- 2. **PubSub streaming**: As the loop runs, chunks are published to a PubSub topic keyed by the run ID. The caller subscribes to this topic and pipes chunks into a `ReadableStream`. If the caller disconnects and reconnects, missed chunks are replayed from the cache.
73
+ 2. **PubSub streaming**: The loop publishes chunks to a PubSub topic keyed by the run ID. The caller subscribes to that topic and pipes the chunks into a `ReadableStream`, while the cache replays any chunks missed during a disconnect.
74
74
 
75
75
  3. **Cache layer**: An optional cache (in-memory by default, Redis or another backend in production) stores published events so that a late subscriber can catch up.
76
76
 
@@ -14,14 +14,13 @@ In Mastra, harness refers to a set of capabilities for managing an agent beyond
14
14
 
15
15
  Choose a starting point based on what the agent needs. You may use one capability or several.
16
16
 
17
- | If you want to | Start here | Why |
18
- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
19
- | Keep a run available through client disconnects or server restarts | [Durable Agents](https://mastra.ai/docs/harness/durable-agents) | Persist run state and let clients reconnect to its stream. |
20
- | Run slow tools, workflows, or subagents without blocking | [Background Tasks](https://mastra.ai/docs/harness/background-tasks) | Finish work asynchronously and return its result to the agent. |
21
- | Keep an agent working until it reaches an objective | [Goals](https://mastra.ai/docs/harness/goals) | Evaluate a thread-scoped objective until it's complete or reaches its run budget. |
22
- | Start work automatically at recurring times | [Schedules](https://mastra.ai/docs/harness/schedules) | Start isolated runs or send prompts into an existing thread on a cron schedule. |
23
- | Add context, redirect active work, or wake an idle thread | [Signals](https://mastra.ai/docs/harness/signals) | Deliver input now or hold it for the next turn. |
24
- | React to changes in GitHub, Slack, continuous integration, or another external system | [Signal Providers](https://mastra.ai/docs/harness/signal-providers) | Track subscriptions and forward matching events to agent threads. |
25
- | Build an interactive product with sessions, modes, state, approvals, and events | [AgentController](https://mastra.ai/docs/harness/agent-controller) | Host isolated sessions around a shared agent runtime. |
26
- | Let users steer, queue follow-up work, or stop an interactive run | [AgentController](https://mastra.ai/docs/harness/agent-controller) | Expose run controls through each session. |
27
- | Give an agent files, a shell, and the defaults a coding agent needs | [`createCodingAgent()`](https://mastra.ai/reference/coding-agent/create-coding-agent) | Build a standard agent with a workspace, task tracking, and retries already configured. |
17
+ | If you want to | Start here | Why |
18
+ | ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
19
+ | Keep a run available through client disconnects or server restarts | [Durable Agents](https://mastra.ai/docs/harness/durable-agents) | Persist run state and let clients reconnect to its stream. |
20
+ | Run slow tools, workflows, or subagents without blocking | [Background Tasks](https://mastra.ai/docs/harness/background-tasks) | Finish work asynchronously and return its result to the agent. |
21
+ | Keep an agent working until it reaches an objective | [Goals](https://mastra.ai/docs/harness/goals) | Evaluate a thread-scoped objective until it's complete or reaches its run budget. |
22
+ | Start work automatically at recurring times | [Schedules](https://mastra.ai/docs/harness/schedules) | Start isolated runs or send prompts into an existing thread on a cron schedule. |
23
+ | Add context, redirect active work, or wake an idle thread | [Signals](https://mastra.ai/docs/harness/signals) | Deliver input now or hold it for the next turn. |
24
+ | React to changes in GitHub, Slack, continuous integration, or another external system | [Signal Providers](https://mastra.ai/docs/harness/signal-providers) | Track subscriptions and forward matching events to agent threads. |
25
+ | Build an interactive product with sessions, modes, state, approvals, and events, or let users steer, queue follow-up work, and stop a run | [AgentController](https://mastra.ai/docs/harness/agent-controller) | Host isolated sessions around a shared agent runtime, each with its own run controls. |
26
+ | Give an agent files, a shell, and the defaults a coding agent needs | [`createCodingAgent()`](https://mastra.ai/reference/coding-agent/create-coding-agent) | Build a standard agent with a workspace, task tracking, and retries already configured. |
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
10
10
 
11
- A schedule runs an agent on a cron cadence. On each fire, Mastra sends a prompt to the agent, either as a [signal](https://mastra.ai/docs/harness/signals) into a thread or as a threadless [`agent.generate()`](https://mastra.ai/reference/agents/generate) run. Use schedules for recurring agent work such as daily summaries, periodic checks, or scheduled nudges into a conversation.
11
+ A schedule runs an agent on a cron cadence. On each fire, Mastra sends a prompt either as a [signal](https://mastra.ai/docs/harness/signals) into a thread or as a threadless [`agent.generate()`](https://mastra.ai/reference/agents/generate) run. Use schedules for recurring work such as daily summaries and periodic checks, including scheduled nudges into a conversation.
12
12
 
13
13
  Schedules are persisted, so they survive restarts and redeploys. Manage them at runtime through [`mastra.schedules`](https://mastra.ai/reference/schedules/overview), the canonical create, read, update, and delete (CRUD) surface. The same surface also manages [workflow schedules](https://mastra.ai/docs/workflows/scheduled-workflows) (pass `workflowId` instead of `agentId` to schedule a workflow).
14
14
 
@@ -130,7 +130,7 @@ Mastra calls `poll()` on the `pollInterval` with all active subscriptions. It sk
130
130
 
131
131
  Use polling when the external source doesn't push events to your app. Set `pollInterval` and override `poll(subscriptions)`. Each subscription includes the thread target and the external resource id to inspect.
132
132
 
133
- Use webhooks when the external source can call your app. Override `handleWebhook(request)`, parse the payload, find matching subscriptions, and call `notify()` for each match.
133
+ Use webhooks when the external source can call your app. Override `handleWebhook(request)` to parse the payload, then find matching subscriptions and call `notify()` for every match.
134
134
 
135
135
  ```typescript
136
136
  import { SignalProvider } from '@mastra/core/signals'
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
10
10
 
11
- 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 or drops input into the running agent loop, or alternatively queues input for the next turn.
11
+ Signals let you 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 wakes an idle agent or delivers input to its running loop; alternatively, it queues the input for the next turn.
12
12
 
13
13
  Use message APIs for user-authored input. Use `sendSignal()` for lower-level system context, such as background task notifications, policy reminders, or processor-generated context.
14
14
 
@@ -239,7 +239,7 @@ Templates: [GitHub PR Code Review](https://mastra.ai/templates/github-pr-code-re
239
239
  <details>
240
240
  **Sales and go-to-market workflows**
241
241
 
242
- Turn customer conversations into structured tasks, generate investment memos, or automate outreach sequences.
242
+ Turn customer conversations into structured tasks or generate investment memos. You can also automate outreach sequences.
243
243
 
244
244
  Used by [Kestral](https://mastra.ai/blog/kestral), [Orange Collective](https://mastra.ai/blog/orange-collective-vc-operating-system), [WorkOS](https://mastra.ai/blog/workos-teaching-mastra)
245
245
 
@@ -42,17 +42,17 @@ A local `.env` file is optional. Environment variables stored on the platform ar
42
42
  Preflight needs TURSO_DATABASE_URL for the production environment. Create a managed turso database now and attach it? (Y/n)
43
43
  ```
44
44
 
45
- Accept the prompt and provisioning takes a few seconds — the database's connection variables are injected into your deploys automatically, with nothing to copy into an `.env` file. Decline it, or run in a non-interactive shell (CI, `--yes`), and the CLI falls back to the previous behavior: it prints the exact command to run yourself.
45
+ Accept the prompt, and provisioning takes a few seconds. The database's connection variables are injected into your deploys automatically, so you don't need to copy them into an `.env` file. If you decline the prompt or use a non-interactive shell (CI, `--yes`), the CLI falls back to printing the exact command for you to run.
46
46
 
47
47
  ```bash
48
48
  mastra env db create production --kind turso
49
49
  ```
50
50
 
51
- The environment slug (`production` above) matches the environment the CLI would have deployed to — this is important because `mastra env db create` requires an environment argument in non-interactive shells when the project has more than one environment.
51
+ The environment slug (`production` above) matches the environment the CLI would have deployed to. The `mastra env db create` command requires an environment argument in non-interactive shells when the project has more than one environment.
52
52
 
53
- Preflight also catches database URLs that point at your local machine. A `.env` file with `REDIS_URL=redis://localhost:6379` works during development, but the deployed server can't reach your laptop — so the CLI warns and offers the same managed provisioning. If you decline, the deploy continues with your value as-is; if you accept, the managed database's connection variables take precedence at deploy time while your local `.env` keeps working for development.
53
+ Preflight also catches database URLs that point at your local machine. A `.env` file with `REDIS_URL=redis://localhost:6379` works during development, but the deployed server can't reach your laptop. The CLI therefore warns and offers the same managed provisioning. If you decline, the deploy continues with your value as-is; if you accept, the managed database's connection variables take precedence at deploy time while your local `.env` keeps working for development.
54
54
 
55
- > **Note:** If preflight reports a hard-coded local path instead (`Build contains a host-local storage URL`), it can't offer the inline fix — guard the path with an environment variable first so the file is only used during local development:
55
+ > **Note:** If preflight reports a hard-coded local path instead (`Build contains a host-local storage URL`), it can't offer the inline fix. Guard the path with an environment variable first so the file is only used during local development:
56
56
  >
57
57
  > ```ts
58
58
  > new LibSQLStore({
@@ -69,7 +69,7 @@ A local `.env` file is optional. Environment variables stored on the platform ar
69
69
 
70
70
  > **Warning:** Set up [authentication](https://mastra.ai/docs/auth/overview) before exposing your endpoints publicly.
71
71
 
72
- Each deploy replaces the running server process, which affects agent turns that are still streaming when the new version goes live. Because Mastra Platform doesn't currently provide a configurable or guaranteed termination grace period, don't rely on a raised `server.drainTimeout` for turns that may run longer than the default drain window. Use [durable agents](https://mastra.ai/docs/harness/durable-agents) with persistent storage and cache when turns must survive a deploy, or handle an interrupted stream in the client. See [graceful shutdown and rolling deploys](https://mastra.ai/docs/deployment/mastra-server) for the available strategies.
72
+ Replacing the running server process during each deploy can interrupt agent turns that are still streaming when the new version goes live because Mastra Platform doesn't currently let you configure or rely on guaranteed extra time before termination. Don't rely on a raised `server.drainTimeout` for turns that may outlast the default drain window. Use [durable agents](https://mastra.ai/docs/harness/durable-agents) with persistent storage and cache when turns must survive a deploy, or handle an interrupted stream in the client. The available strategies are documented in [graceful shutdown and rolling deploys](https://mastra.ai/docs/deployment/mastra-server).
73
73
 
74
74
  The first deploy writes a `.mastra-project.json` file linking your directory to the platform project. Commit it so later deploys, CI runs, and [`mastra env`](https://mastra.ai/docs/mastra-platform/environments) commands target the same project without extra flags.
75
75
 
@@ -93,7 +93,7 @@ Pass `--region` when a deploy creates a new environment to control where it runs
93
93
  mastra deploy --env production --region eu
94
94
  ```
95
95
 
96
- The region is fixed when the environment is created. Databases attached to an environment are placed near that environment's region automatically, and observability data is routed to the ingest region that matches the environment's residency zone. See [Regions](https://mastra.ai/docs/mastra-platform/regions) for the full list of supported regions, database placement, and observability co-location.
96
+ The region is fixed when the environment is created. Databases attached to an environment are placed near that environment's region automatically, and observability data is routed to the ingest region that matches the environment's residency zone. See [Regions](https://mastra.ai/docs/mastra-platform/regions) for the full list of supported regions and database placement, along with observability co-location.
97
97
 
98
98
  ## Preflight checks
99
99
 
@@ -151,7 +151,7 @@ Projects that depend on packages from a private registry install them during the
151
151
  //npm.pkg.github.com/:_authToken=${NPM_TOKEN}
152
152
  ```
153
153
 
154
- Keep the `${NPM_TOKEN}` reference literal. The package manager resolves it at install time, so the token itself never lands in your repository.
154
+ Keep the `${NPM_TOKEN}` reference literal. The package manager resolves it at install time, so the token itself is never written to your repository.
155
155
 
156
156
  3. Deploy as usual:
157
157
 
@@ -229,14 +229,14 @@ The deploy log is the source of truth: the legacy pipeline prints a deprecation
229
229
  Check whether this project is ready for the Mastra Platform environment pipeline.
230
230
 
231
231
  1. Find the installed version of `@mastra/core` (check package.json and the
232
- lockfile for the version that actually resolved, not just the range).
233
- 2. If it is >= 1.44.0, tell me I'm good — no further action needed.
234
- 3. If it is < 1.44.0:
232
+ lockfile for the version that actually resolved, rather than only the range).
233
+ 2. If it's >= 1.44.0, tell me I'm good. No further action is needed.
234
+ 3. If it's < 1.44.0:
235
235
  a. Fetch the `@mastra/core` changelog from
236
236
  https://github.com/mastra-ai/mastra/blob/main/packages/core/CHANGELOG.md
237
237
  and read every entry between my installed version and the latest release.
238
238
  b. Scan my project (agents, workflows, tools, memory, storage, deployers,
239
- telemetry — anywhere `@mastra/core`, `@mastra/*`, or `mastra` is imported)
239
+ telemetry, anywhere `@mastra/core`, `@mastra/*`, or `mastra` is imported)
240
240
  and list every Mastra API surface I actually use.
241
241
  c. For each used API, cross-reference the changelog and produce a table of:
242
242
  API I use → breaking change → severity (breaks build / breaks runtime /
@@ -248,11 +248,11 @@ The deploy log is the source of truth: the legacy pipeline prints a deprecation
248
248
  versions, then run typecheck and tests. Report anything still failing.
249
249
  4. Search my scripts, package.json, Dockerfiles, and CI config for
250
250
  `mastra server deploy` and `mastra studio deploy`. Replace each
251
- occurrence with `mastra deploy` — this is the unified command required
251
+ occurrence with `mastra deploy`. This is the unified command required
252
252
  by the environment pipeline.
253
253
 
254
- Do not restructure my CI, provision new infra, or change my environment
255
- variable values — only the Mastra usage in my code and the deploy command
254
+ don't restructure my CI, provision new infra, or change my environment
255
+ variable values. Change only the Mastra usage in my code and the deploy command
256
256
  itself.
257
257
  ```
258
258
 
@@ -264,7 +264,7 @@ The deploy log is the source of truth: the legacy pipeline prints a deprecation
264
264
  + mastra deploy
265
265
  ```
266
266
 
267
- `mastra deploy` builds once and deploys both the server and the Studio UI shell for the target environment. Any recent `mastra` CLI supports it. If yours doesn't, upgrade with `npm install -g mastra@latest`.
267
+ `mastra deploy` builds once and deploys both the server and the Studio UI shell for the target environment. It's supported by every recent `mastra` CLI; otherwise, upgrade with `npm install -g mastra@latest`.
268
268
 
269
269
  3. Deploy once. Your project is auto-adopted onto the environment pipeline and the `production` environment is created on first deploy. See [Environments](https://mastra.ai/docs/mastra-platform/environments) for the full model.
270
270
 
@@ -32,7 +32,7 @@ mastra deploy --env staging
32
32
  mastra env create eu-preview --type preview --region eu
33
33
  ```
34
34
 
35
- Each project has a single `production` environment, created by your first deploy. The region is fixed at creation. Databases attached to an environment are placed near the environment's region automatically, and observability data is routed to the ingest region for the matching residency zone. See [Regions](https://mastra.ai/docs/mastra-platform/regions) for the supported regions, database placement, and observability co-location. The number of environments per project depends on your plan.
35
+ Each project has a single `production` environment, created by your first deploy. The region is fixed at creation. Attached databases are placed near the environment automatically, while observability data goes to the ingest region for the matching residency zone. See [Regions](https://mastra.ai/docs/mastra-platform/regions) for supported regions and database placement, along with observability co-location. The number of environments per project depends on your plan.
36
36
 
37
37
  ## List environments
38
38
 
@@ -92,7 +92,7 @@ mastra env db create staging --kind turso --name my-project-staging-db
92
92
 
93
93
  If you'd rather share one database across every environment, attach it with `--shared` instead: `mastra env db create --kind turso --shared`.
94
94
 
95
- An environment can only use one database per provider. If the project already has a shared (`--shared`) database of the same provider, attaching an environment-scoped one is rejected with a variable name conflict, delete the shared database with `mastra env db delete` first. Deleting a database destroys it with the provider along with all of its data, so export anything you need to keep. See [Hosted databases](https://mastra.ai/docs/mastra-platform/database) for the full scoping model.
95
+ Each environment can use one database per provider. An existing shared (`--shared`) database from the same provider creates a variable-name conflict with an environment-scoped database. Export any data you need to keep before running `mastra env db delete`, because this command destroys the shared provider database and its data. See [Hosted databases](https://mastra.ai/docs/mastra-platform/database) for the full scoping model.
96
96
 
97
97
  ## Delete an environment
98
98
 
@@ -65,7 +65,7 @@ Templates are the fastest way to get started. The platform creates a new reposit
65
65
 
66
66
  4. Add any template-specific environment variables (for example, AI provider API keys). The platform seeds `MASTRA_GATEWAY_API_KEY` and `MASTRA_PLATFORM_ACCESS_TOKEN` automatically so that template code that talks to the Gateway works on the first deploy.
67
67
 
68
- 5. Select **Create project**. The platform creates the repository, writes a `.mastra-project.json` config file into it, provisions the managed databases, and triggers the initial Studio and Server deploys.
68
+ 5. Select **Create project**. The platform creates the repository with a `.mastra-project.json` config file, provisions its managed databases, then triggers the initial Studio and Server deploys.
69
69
 
70
70
  The initial deploy waits for managed databases to finish provisioning before it starts, so the template's first build sees the database connection environment variables.
71
71
 
@@ -109,7 +109,7 @@ Only one build per deploy target runs at a time. If a new push arrives while a b
109
109
 
110
110
  ### Manual GitHub deploys
111
111
 
112
- You can also trigger a deploy from the dashboard without pushing. Open the project, select **Deploy from GitHub**, pick the target (Studio, Server, or both) and a branch, and submit. The platform runs the deploy against the head commit of that branch and records the trigger as a **GitHub Workflow** deploy.
112
+ You can also trigger a deploy from the dashboard without pushing. Open the project and select **Deploy from GitHub**. Choose the target (Studio, Server, or both) together with a branch, then submit. The platform runs the deploy against the head commit of that branch and records the trigger as a **GitHub Workflow** deploy.
113
113
 
114
114
  ## Track deploys
115
115
 
@@ -65,7 +65,7 @@ Observability ingest runs in two regions today: **US** (Iowa, `us-central1`) and
65
65
  | `pdx`, `iad`, `sfo`, `us` shorthand | US (Iowa) |
66
66
  | `ams`, `eu` shorthand | EU (Amsterdam) |
67
67
 
68
- Compute and databases can be placed in more Railway and provider regions than observability supports, so co-location isn't perfect for every combination. A `us`-zone environment always sends telemetry to US ingest, and an `eu`-zone environment always sends telemetry to EU ingest, even if the underlying Railway region is a specific city not directly served by an ingest endpoint. Data residency is preserved at the zone level. Telemetry from an `eu` environment never crosses into the US.
68
+ Railway and database providers offer more regions than observability ingest, so some combinations can't be fully co-located. Environments in the `us` zone always send telemetry to US ingest, while those in the `eu` zone use EU ingest. This routing applies even when the underlying Railway region is a city without a dedicated ingest endpoint. Data residency is preserved at the zone level. Telemetry from an `eu` environment never crosses into the US.
69
69
 
70
70
  ## Related
71
71
 
@@ -48,7 +48,7 @@ You get a stable API endpoint with environment variable management and custom do
48
48
 
49
49
  If you're not already authenticated, the CLI prompts you to log in. It stores your credentials locally and any subsequent CLI commands use these credentials.
50
50
 
51
- The command runs `mastra build`, uploads the artifact, builds a Docker image, and deploys it. On first deploy, the CLI creates a `.mastra-project.json` file linking your local project to the platform. Commit this file so subsequent deploys and CI/CD target the same project.
51
+ The command runs `mastra build` and uploads its artifact, then builds and deploys a Docker image. On first deploy, the CLI creates a `.mastra-project.json` file linking your local project to the platform. Commit this file so subsequent deploys and CI/CD target the same project.
52
52
 
53
53
  > **Note:** Environment variables from `.env`, `.env.local`, and `.env.production` are included automatically. On the first deploy, these seed the project if no env vars are set yet. After that, manage env vars through the web dashboard. Review and sanitize these files before first deploy to avoid uploading development-only or personal secrets.
54
54
 
@@ -60,7 +60,7 @@ You get a stable API endpoint with environment variable management and custom do
60
60
 
61
61
  ## Deploy lifecycle
62
62
 
63
- A deploy transitions through **queued → uploading → building → deploying → running** (or **failed**, **cancelled**, **crashed**, or **stopped**). A project runs one build at a time. When multiple deploys queue up, the latest proceeds and the rest are cancelled. Builds running longer than 15 minutes are automatically failed. The first deploy provisions infrastructure and seeds environment variables from your local `.env`. Your server URL remains stable across deploys.
63
+ Each project runs one build at a time as its deploy transitions through **queued → uploading → building → deploying → running** (or **failed**, **cancelled**, **crashed**, or **stopped**). When multiple deploys queue up, the latest proceeds and the rest are cancelled. Builds running longer than 15 minutes are automatically failed. The first deploy provisions infrastructure and seeds environment variables from your local `.env`. Your server URL remains stable across deploys.
64
64
 
65
65
  ## Idle behavior
66
66
 
@@ -146,9 +146,9 @@ Automate deployments from GitHub Actions, GitLab CI, or any CI provider. After y
146
146
  mastra auth tokens create ci-deploy
147
147
  ```
148
148
 
149
- The CLI prints the token once. Copy it immediately — it cannot be retrieved again.
149
+ The CLI prints the token once. Copy it immediately because it can't be retrieved again.
150
150
 
151
- 2. Add the token as a secret in your CI provider. In GitHub Actions, go to **Settings → Secrets and variables → Actions** and create a secret named `MASTRA_API_TOKEN`.
151
+ 2. Add the token as a secret in your CI provider. In GitHub Actions, go to **Settings → Secrets and variables → Actions** and create the `MASTRA_API_TOKEN` secret.
152
152
 
153
153
  3. Ensure your `.mastra-project.json` file is committed to the repository. The CLI reads the `organizationId` and `projectId` from this file to target the correct project during CI deploys.
154
154
 
@@ -70,7 +70,7 @@ To run the same codebase across `production` and `staging`, use [`mastra deploy
70
70
 
71
71
  ## Create a new project non-interactively
72
72
 
73
- `mastra deploy` can create a project on first run. If `--project <name>` doesn't match an existing project, the CLI uses the value as the new project name and creates it after confirmation. Combined with `--yes`, this is fully scriptable:
73
+ On its first run, `mastra deploy` can create a project. When `--project <name>` doesn't match an existing project, the CLI treats the value as a new project name and creates it after confirmation. Add `--yes` to make this flow fully scriptable:
74
74
 
75
75
  ```bash
76
76
  mastra deploy --project "my-new-project" --yes
@@ -74,7 +74,7 @@ A theme can persist, disappear, split, merge, or return across snapshots. Treat
74
74
 
75
75
  ## Use the Trace Intelligence page
76
76
 
77
- 1. Use the **Agent** selector to switch between agents with available analysis. An agent doesn't appear until its first themes are ready.
77
+ 1. Use the **Agent** selector to switch between agents after their first themes are ready and analysis becomes available.
78
78
  2. Select a theme in the flow to open its details and filter every column to traces containing that theme.
79
79
  3. The details panel shows the theme's description, its share of the snapshot, paged example summaries, and a trend of its trace count over time.
80
80
  4. Select **Clear filter** to restore the complete flow.