@mastra/mcp-docs-server 1.2.23-alpha.5 → 1.2.23-alpha.8

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 (138) 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 +1 -1
  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 +1 -1
  13. package/.docs/docs/evals/multi-turn.md +1 -1
  14. package/.docs/docs/evals/overview.md +2 -2
  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 +1 -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/schedules.md +1 -1
  24. package/.docs/docs/harness/signal-providers.md +1 -1
  25. package/.docs/docs/harness/signals.md +1 -1
  26. package/.docs/docs/index.md +1 -1
  27. package/.docs/docs/mastra-platform/deploy.md +15 -15
  28. package/.docs/docs/mastra-platform/environments.md +2 -2
  29. package/.docs/docs/mastra-platform/github.md +2 -2
  30. package/.docs/docs/mastra-platform/regions.md +1 -1
  31. package/.docs/docs/mastra-platform/server.md +4 -4
  32. package/.docs/docs/mastra-platform/studio.md +1 -1
  33. package/.docs/docs/mastra-platform/trace-intelligence.md +1 -1
  34. package/.docs/docs/mastra-platform/workspaces.md +1 -1
  35. package/.docs/docs/memory/message-history.md +3 -3
  36. package/.docs/docs/memory/observational-memory.md +18 -18
  37. package/.docs/docs/memory/overview.md +1 -1
  38. package/.docs/docs/memory/working-memory.md +1 -1
  39. package/.docs/docs/observability/feedback.md +1 -1
  40. package/.docs/docs/observability/logging.md +1 -1
  41. package/.docs/docs/observability/tracing/overview.md +1 -1
  42. package/.docs/docs/sandbox/lsp.md +1 -1
  43. package/.docs/docs/sandbox/overview.md +1 -1
  44. package/.docs/docs/server/mastra-client.md +1 -1
  45. package/.docs/docs/server/overview.md +1 -1
  46. package/.docs/docs/server/pubsub.md +1 -1
  47. package/.docs/docs/server/request-context.md +2 -2
  48. package/.docs/docs/server/server-adapters.md +1 -1
  49. package/.docs/docs/skills.md +1 -1
  50. package/.docs/docs/studio/deployment.md +1 -1
  51. package/.docs/docs/studio/editor.md +1 -1
  52. package/.docs/docs/studio/overview.md +1 -1
  53. package/.docs/docs/subagents.md +2 -2
  54. package/.docs/docs/workflows/control-flow.md +1 -1
  55. package/.docs/docs/workflows/overview.md +1 -1
  56. package/.docs/docs/workflows/scheduled-workflows.md +1 -1
  57. package/.docs/docs/workflows/suspend-and-resume.md +2 -2
  58. package/.docs/integrations/sandboxes/agentcore.md +2 -0
  59. package/.docs/integrations/sandboxes/apple-container.md +4 -2
  60. package/.docs/integrations/sandboxes/blaxel.md +2 -0
  61. package/.docs/integrations/sandboxes/cloudflare-sandbox.md +1 -1
  62. package/.docs/integrations/sandboxes/daytona.md +2 -0
  63. package/.docs/integrations/sandboxes/docker.md +3 -1
  64. package/.docs/integrations/sandboxes/e2b.md +2 -0
  65. package/.docs/integrations/sandboxes/modal.md +3 -1
  66. package/.docs/integrations/sandboxes/railway.md +2 -0
  67. package/.docs/integrations/sandboxes/vercel.md +4 -0
  68. package/.docs/models/gateways/merge-gateway.md +2 -1
  69. package/.docs/models/gateways/netlify.md +1 -1
  70. package/.docs/models/gateways/openrouter.md +1 -1
  71. package/.docs/models/gateways/vercel.md +3 -1
  72. package/.docs/models/index.md +1 -1
  73. package/.docs/models/providers/abliteration-ai.md +7 -6
  74. package/.docs/models/providers/chutes.md +1 -1
  75. package/.docs/models/providers/coralbricks.md +4 -4
  76. package/.docs/models/providers/cortecs.md +3 -3
  77. package/.docs/models/providers/crossmodel.md +2 -2
  78. package/.docs/models/providers/edenai.md +7 -5
  79. package/.docs/models/providers/google.md +1 -2
  80. package/.docs/models/providers/groq.md +2 -1
  81. package/.docs/models/providers/hyper.md +8 -6
  82. package/.docs/models/providers/iteracompute.md +8 -7
  83. package/.docs/models/providers/kilo.md +23 -24
  84. package/.docs/models/providers/llmgateway-providers.md +2 -26
  85. package/.docs/models/providers/llmgateway.md +3 -14
  86. package/.docs/models/providers/nano-gpt.md +5 -3
  87. package/.docs/models/providers/requesty.md +4 -4
  88. package/.docs/models/providers/vancine.md +13 -11
  89. package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
  90. package/.docs/reference/agent-controller/session.md +3 -3
  91. package/.docs/reference/agents/durable-agent.md +77 -9
  92. package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
  93. package/.docs/reference/agents/listSuspendedRuns.md +2 -2
  94. package/.docs/reference/ai-sdk/chat-route.md +1 -1
  95. package/.docs/reference/ai-sdk/network-route.md +1 -1
  96. package/.docs/reference/ai-sdk/workflow-route.md +1 -1
  97. package/.docs/reference/browser/browser-viewer.md +1 -1
  98. package/.docs/reference/cli/mastra.md +4 -4
  99. package/.docs/reference/core/mastra-class.md +1 -1
  100. package/.docs/reference/datasets/createExperiment.md +1 -1
  101. package/.docs/reference/editor/tool-provider.md +1 -1
  102. package/.docs/reference/editor/versioning.md +1 -1
  103. package/.docs/reference/evals/multi-turn-judge.md +1 -1
  104. package/.docs/reference/evals/rubric.md +1 -1
  105. package/.docs/reference/file-based-agents/schedules.md +2 -2
  106. package/.docs/reference/file-based-agents/workspace.md +1 -1
  107. package/.docs/reference/manual-install.md +3 -3
  108. package/.docs/reference/memory/observational-memory.md +4 -4
  109. package/.docs/reference/memory/settled.md +1 -1
  110. package/.docs/reference/migrations/mastra-cloud.md +9 -9
  111. package/.docs/reference/migrations/upgrade-to-v1/overview.md +1 -1
  112. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +1 -1
  113. package/.docs/reference/processors/processor-interface.md +1 -1
  114. package/.docs/reference/processors/regex-filter-processor.md +3 -3
  115. package/.docs/reference/processors/token-cost-control.md +2 -2
  116. package/.docs/reference/processors/token-limiter-processor.md +1 -1
  117. package/.docs/reference/processors/tool-search-processor.md +1 -1
  118. package/.docs/reference/processors/working-memory-processor.md +1 -1
  119. package/.docs/reference/pubsub/base.md +2 -2
  120. package/.docs/reference/pubsub/lease-provider.md +2 -2
  121. package/.docs/reference/rag/vector-databases.md +33 -33
  122. package/.docs/reference/server/create-route.md +1 -1
  123. package/.docs/reference/signals/task-signal-provider.md +1 -1
  124. package/.docs/reference/storage/composite.md +1 -1
  125. package/.docs/reference/storage/retention.md +4 -4
  126. package/.docs/reference/streaming/ChunkType.md +1 -1
  127. package/.docs/reference/tools/isolated-vm-transport.md +1 -1
  128. package/.docs/reference/tools/mcp-client.md +2 -2
  129. package/.docs/reference/vectors/couchbase.md +1 -1
  130. package/.docs/reference/vectors/mongodb.md +2 -2
  131. package/.docs/reference/voice/overview.md +1 -1
  132. package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
  133. package/.docs/reference/workspace/platform-sandbox.md +3 -1
  134. package/.docs/reference/workspace/process-manager.md +1 -1
  135. package/.docs/reference/workspace/sandbox.md +20 -3
  136. package/.docs/reference/workspace/workspace-class.md +3 -3
  137. package/package.json +6 -7
  138. package/CHANGELOG.md +0 -5936
@@ -4,7 +4,7 @@
4
4
 
5
5
  # chatRoute()
6
6
 
7
- Creates a chat route handler for streaming agent conversations using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts messages, executes an agent, and streams the response back to the client in AI SDK-compatible format. You have to use it inside a [custom API route](https://mastra.ai/docs/server/custom-api-routes).
7
+ Creates a chat route handler for streaming agent conversations in AI SDK format. The function registers an HTTP `POST` endpoint that accepts messages and executes an agent before streaming the response to the client in AI SDK-compatible format. Use it inside a [custom API route](https://mastra.ai/docs/server/custom-api-routes).
8
8
 
9
9
  Use [`handleChatStream()`](https://mastra.ai/reference/ai-sdk/handle-chat-stream) if you need a framework-agnostic handler.
10
10
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  > **Deprecated:** Agent networks are deprecated and will be removed in a future release. Use [supervisor agents](https://mastra.ai/docs/subagents) with `agent.stream()` or `agent.generate()` instead. See the [migration guide](https://mastra.ai/reference/migrations/network-to-supervisor) to upgrade.
8
8
 
9
- Creates a network route handler for streaming network execution using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts messages, executes an agent network, and streams the response back to the client in AI SDK-compatible format. Agent networks allow a routing agent to delegate tasks to other agents. You have to use it inside a [custom API route](https://mastra.ai/docs/server/custom-api-routes).
9
+ Creates a network route handler for streaming network execution in AI SDK format. The function registers an HTTP `POST` endpoint that accepts messages and executes an agent network before streaming the response to the client in AI SDK-compatible format. Agent networks let a routing agent delegate tasks to other agents. Use this function inside a [custom API route](https://mastra.ai/docs/server/custom-api-routes).
10
10
 
11
11
  Use [`handleNetworkStream()`](https://mastra.ai/reference/ai-sdk/handle-network-stream) if you need a framework-agnostic handler.
12
12
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # workflowRoute()
6
6
 
7
- Creates a workflow route handler for streaming workflow execution using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts input data, executes a workflow, and streams the response back to the client in AI SDK-compatible format. You have to use it inside a [custom API route](https://mastra.ai/docs/server/custom-api-routes).
7
+ Creates a workflow route handler for streaming workflow execution in AI SDK format. The function registers an HTTP `POST` endpoint that accepts input data and executes a workflow before streaming the response to the client in AI SDK-compatible format. Use it inside a [custom API route](https://mastra.ai/docs/server/custom-api-routes).
8
8
 
9
9
  Use [`handleWorkflowStream()`](https://mastra.ai/reference/ai-sdk/handle-workflow-stream) if you need a framework-agnostic handler.
10
10
 
@@ -88,7 +88,7 @@ When `cdpUrl` is provided, `BrowserViewer` connects to the existing browser inst
88
88
 
89
89
  #### `launch(threadId?)`
90
90
 
91
- Launches Chrome. For `'shared'` scope, launches a single shared browser. For `'thread'` scope, launches a browser for the specified thread.
91
+ Launches Chrome with either a single shared browser for `'shared'` scope or a browser for the specified thread when using `'thread'` scope.
92
92
 
93
93
  ```typescript
94
94
  await viewer.launch()
@@ -353,7 +353,7 @@ The command runs `mastra build` and zips the output before uploading it to the s
353
353
 
354
354
  Organization, project, and environment are resolved in order from: environment variable (`MASTRA_ORG_ID`, `MASTRA_PROJECT_ID`), CLI flag (`--org`, `--project`, `--env`), `.mastra-project.json` config file, current org from credentials, and lastly interactive prompt. On first deploy, the CLI saves the resolved org and project IDs to `.mastra-project.json` so subsequent deploys skip the prompts.
355
355
 
356
- If the project doesn't exist yet, the CLI creates it from the `package.json` `name` field after confirmation. If the target environment doesn't exist, the CLI creates it (defaulting to `type: staging` for anything other than `production`) after confirmation. Combined with `--yes`, this creates and deploys everything in one non-interactive command:
356
+ After confirmation, the CLI creates a missing project from the `package.json` `name` field and creates a missing target environment, defaulting to `type: staging` for anything other than `production`. Combined with `--yes`, this creates and deploys everything in one non-interactive command:
357
357
 
358
358
  ```bash
359
359
  mastra deploy --env staging --yes
@@ -717,7 +717,7 @@ Shows diagnosis results and suggested fixes for a failed Studio deploy.
717
717
  mastra studio deploy suggestions [deploy-id]
718
718
  ```
719
719
 
720
- If you omit `deploy-id`, the command uses the latest deploy for the linked project. If a diagnosis doesn't exist yet, the command starts one and polls until results are ready. Suggestions appear only when the diagnosis finds a problem.
720
+ When you omit `deploy-id`, the command uses the latest deploy for the linked project and starts a diagnosis if needed, polling until the results are ready. Suggestions appear only when the diagnosis finds a problem.
721
721
 
722
722
  ### `mastra studio projects`
723
723
 
@@ -725,7 +725,7 @@ Lists all projects in the current organization.
725
725
 
726
726
  ### `mastra studio projects create`
727
727
 
728
- Creates a new project through an interactive prompt. This command doesn't accept a `--name` flag; for non-interactive project creation, use [`mastra studio deploy --project <name> --yes`](#mastra-studio-deploy) instead, which creates the project and deploys to it in one step.
728
+ Creates a new project through an interactive prompt, but doesn't accept a `--name` flag. For non-interactive project creation, use [`mastra studio deploy --project <name> --yes`](#mastra-studio-deploy) instead. That command creates the project and deploys to it in one step.
729
729
 
730
730
  ## `mastra server deploy`
731
731
 
@@ -747,7 +747,7 @@ Shows diagnosis results and suggested fixes for a failed Server deploy.
747
747
  mastra server deploy suggestions [deploy-id]
748
748
  ```
749
749
 
750
- If you omit `deploy-id`, the command uses the latest deploy for the linked project. If a diagnosis doesn't exist yet, the command starts one and polls until results are ready. Suggestions appear only when the diagnosis finds a problem.
750
+ When you omit `deploy-id`, the command uses the latest deploy for the linked project and starts a diagnosis if needed, polling until the results are ready. Suggestions appear only when the diagnosis finds a problem.
751
751
 
752
752
  ## `mastra server pause`
753
753
 
@@ -73,7 +73,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
73
73
 
74
74
  **observability** (`ObservabilityEntrypoint`): Observability configuration for tracing and monitoring
75
75
 
76
- **environment** (`string`): Deployment environment name (e.g. production, staging, development). When set, automatically attached to all observability signals so they can be filtered by environment without passing tracingOptions.metadata.environment on each call. Falls back to process.env.NODE\_ENV when unset; left undefined if neither is set. Per-call tracingOptions.metadata.environment always takes precedence.
76
+ **environment** (`string`): Deployment environment name (e.g. production, staging, development). When set, automatically attached to all observability signals so they can be filtered by environment without passing tracingOptions.metadata.environment on each call. When unset, resolves to development for mastra dev runs, then falls back to process.env.NODE\_ENV; left undefined if none are set. Per-call tracingOptions.metadata.environment always takes precedence.
77
77
 
78
78
  **deployer** (`MastraDeployer`): An instance of a MastraDeployer for managing deployments.
79
79
 
@@ -32,7 +32,7 @@ const { experimentId, totalItems, datasetVersion } = await dataset.createExperim
32
32
  })
33
33
  ```
34
34
 
35
- Passing your own `id` makes creation idempotent: calling it again with the same `id` returns the existing experiment instead of failing, so a retried workflow activity is safe. If the `id` belongs to an experiment on another dataset or an experiment with a different target, the call throws an `EXPERIMENT_ID_CONFLICT` error.
35
+ Passing your own `id` makes creation idempotent, so another call with the same `id` returns the existing experiment and keeps a retried workflow activity safe. The call throws an `EXPERIMENT_ID_CONFLICT` error if the `id` belongs to an experiment on another dataset or one with a different target.
36
36
 
37
37
  `targetType` and `targetId` must be provided together, and the target must exist in the Mastra registry at create time. `scorers` requires a target because Mastra never scores target-less experiments; submit flat scores through `submitExperimentResult` instead.
38
38
 
@@ -252,4 +252,4 @@ Arcade tools use `Toolkit.ToolName` format: `Github.GetRepository`, `Slack.SendM
252
252
 
253
253
  ### Authentication
254
254
 
255
- The legacy Arcade resolver uses `resourceId` from request context when available. It otherwise falls back to the supplied `userId`, then to a shared `default` identity. Use `default` only for intentionally shared integrations. In tenant-isolated deployments, provide a trusted, stable `resourceId` or explicit `userId`. Omitting both doesn't isolate callers.
255
+ The legacy Arcade resolver uses `resourceId` from request context when available, falling back to the supplied `userId` and then to a shared `default` identity. Reserve `default` for intentionally shared integrations, and provide a trusted, stable `resourceId` or explicit `userId` in tenant-isolated deployments because omitting both doesn't isolate callers.
@@ -10,7 +10,7 @@ See [Editor versioning](https://mastra.ai/docs/studio/editor) for release and ex
10
10
 
11
11
  ## Database lifecycle
12
12
 
13
- The resource record stores an `activeVersionId`. Individual snapshots don't store a lifecycle status.
13
+ The resource record stores an `activeVersionId`, while individual snapshots don't store a lifecycle status.
14
14
 
15
15
  | Term | Meaning |
16
16
  | ---------- | -------------------------------------------------------------------------------------------- |
@@ -88,7 +88,7 @@ See [Score persistence](https://mastra.ai/docs/evals/overview) for the full requ
88
88
 
89
89
  The scorer runs in two phases:
90
90
 
91
- 1. **Grade**: Every assistant message in `run.output` is collected in order and rendered as a numbered transcript, then the judge decides whether the conversation as a whole satisfies the criterion. Assistant messages with no text (a turn that only carried tool calls, for example) are skipped.
91
+ 1. **Grade**: The assistant messages in `run.output` form a numbered transcript that the judge evaluates as a whole against the criterion. Turns containing only tool calls or otherwise lacking text are skipped.
92
92
  2. **Score**: A `satisfied` verdict scores `1` and anything else scores `0`, multiplied by `scale`.
93
93
 
94
94
  The judge only sees what the assistant said. The user's turns and any tool results aren't included, so write criteria in terms of the agent's responses. This keeps the graded text limited to the agent's own output, but it also means a reply that only makes sense next to the question that prompted it ("Yes, bring one.") can't be judged on its own. For criteria that depend on the user's turns, grade each turn with `turns[].scorers` or write a [custom scorer](https://mastra.ai/docs/evals/multi-turn) that renders both roles.
@@ -106,7 +106,7 @@ If no rubric resolves, the scorer returns `1` and doesn't gate the loop.
106
106
  The scorer runs in two phases:
107
107
 
108
108
  1. **Grade**: The judge model evaluates each criterion independently and returns a per-criterion verdict (`satisfied` / not) with reasoning.
109
- 2. **Score**: The result is `1` only when every required criterion is `satisfied`, otherwise `0`. If no criteria are marked required, all criteria are treated as required.
109
+ 2. **Score**: The scorer returns `1` only when every required criterion is `satisfied` and treats every criterion as required when none are marked. All other results receive `0`.
110
110
 
111
111
  The `reason` summarizes the result and lists each criterion with its verdict, so a failing grade gives the agent targeted, useful feedback rather than a generic "try again".
112
112
 
@@ -181,9 +181,9 @@ Schedules created at runtime through `mastra.schedules.create(...)` live in a se
181
181
 
182
182
  ## Limits
183
183
 
184
- **Root agents only.** Schedules must be declared on a top-level agent. A `schedules/` directory under `subagents/` is a build error, because subagents are wired into their parent rather than registered on the Mastra instance, so the scheduler could never resolve one as a target. Give the parent the schedule and let it delegate.
184
+ **Root agents only.** Declare schedules on a top-level agent. A `schedules/` directory under `subagents/` causes a build error because subagents are wired into their parent instead of being registered on the Mastra instance, leaving the scheduler unable to resolve them as targets. Give the parent the schedule and let it delegate.
185
185
 
186
- **Storage required.** Schedules are persisted rows, so the instance needs [storage](https://mastra.ai/reference/file-based-agents/storage) configured. Rows in an in-memory store don't survive a restart.
186
+ **Storage required.** Because schedules are persisted rows and rows in an in-memory store don't survive a restart, the instance needs [storage](https://mastra.ai/reference/file-based-agents/storage) configured.
187
187
 
188
188
  **Hosting.** The scheduler runs as a background worker inside the Mastra process, so it needs a host that keeps that process alive. Long-running Node servers and containers work. Environments that freeze or recycle the process between requests, which includes most serverless function platforms, will miss fires. Use the platform's own cron to call the run endpoint there instead.
189
189
 
@@ -71,7 +71,7 @@ For provider patterns and runtime behavior, see the [sandbox guide](https://mast
71
71
 
72
72
  ## Runtime boundary
73
73
 
74
- The workspace filesystem controls what file tools can read and write. The sandbox controls where shell commands run. Application runtime code, including code in [`tools/`](https://mastra.ai/reference/file-based-agents/tools), still runs in your app/server process unless it explicitly calls workspace or sandbox APIs.
74
+ The workspace filesystem controls file-tool access, and the sandbox determines where shell commands run. Unless it explicitly calls workspace or sandbox APIs, application runtime code still runs in your app or server process, including code in [`tools/`](https://mastra.ai/reference/file-based-agents/tools).
75
75
 
76
76
  ## Seed files
77
77
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Manual install
6
6
 
7
- **For AI agents:** Use this guide when tasked to create a runnable Mastra project from scratch without a CLI/boilerplate. It provides code examples for agents, tools, model configuration and how to install dependencies. Do not navigate to the quickstart guide, which is for humans. The model string is Mastra's model router format ('provider/model'; use / and not : to separate provider and model). Do not install any ai-sdk packages.
7
+ **For AI agents:** Use this guide when tasked to create a runnable Mastra project from scratch without a CLI/boilerplate. It provides code examples for agents, tools, model configuration and how to install dependencies. Don't use the quickstart guide, which is for humans. The model string is Mastra's model router format (`provider/model`). Use `/`, not `:`, to separate the provider and model. Don't install any AI SDK packages.
8
8
 
9
9
  Use this guide to manually build a standalone Mastra server step by step. In most cases, use the [`create-mastra`](https://mastra.ai/reference/cli/create-mastra) command described in [Get started](https://mastra.ai/docs). For existing projects, you can also use [`mastra init`](https://mastra.ai/reference/cli/mastra).
10
10
 
@@ -167,7 +167,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
167
167
  mkdir -p src/mastra/agents && touch src/mastra/agents/weather-agent.ts
168
168
  ```
169
169
 
170
- Use `import { Agent } from "@mastra/core/agent"`. Constructor takes `{ id, name, instructions, model: 'openai/gpt-5.6-sol' }`. The model string is Mastra's model router format ('provider/model'; use / and not : to separate provider and model). Do not install any ai-sdk packages.
170
+ Use `import { Agent } from "@mastra/core/agent"`. Constructor takes `{ id, name, instructions, model: 'openai/gpt-5.6-sol' }`. The model string uses Mastra's model router format, 'provider/model', with / rather than : between the provider and model. Don't install any AI SDK packages.
171
171
 
172
172
  Add the following code:
173
173
 
@@ -212,7 +212,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
212
212
  })
213
213
  ```
214
214
 
215
- 7. **For AI agents:** Do not launch Studio when working on a script that e.g. should print to the console. Studio is a long-running web-based interfaced for humans. Instead, call the agent.generate() method directly. Example: `import { mastra } from './src/mastra/index.ts'; const agent = mastra.getAgentById('weather-agent'); const response = await agent.generate('Weather in SF'); console.log(response.text);`
215
+ 7. **For AI agents:** don't launch Studio when working on a script that e.g. should print to the console. Studio is a long-running web-based interfaced for humans. Instead, call the agent.generate() method directly. Example: `import { mastra } from './src/mastra/index.ts'; const agent = mastra.getAgentById('weather-agent'); const response = await agent.generate('Weather in SF'); console.log(response.text);`
216
216
 
217
217
  You can now launch [Studio](https://mastra.ai/docs/studio/overview) and test your agent.
218
218
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  **Added in:** `@mastra/memory@1.1.0`
8
8
 
9
- Observational Memory (OM) is Mastra's memory system for long-context agentic memory. An **Observer** watches conversations and creates observations. A **Reflector** restructures those observations by combining related items and condensing overarching patterns. Together, they maintain an observation log that replaces raw message history as it grows.
9
+ Observational Memory (OM) is Mastra's memory system for long-context agentic memory. An **Observer** watches conversations and creates observations, which a **Reflector** restructures by combining related items and condensing overarching patterns. Together, they maintain an observation log that replaces raw message history as it grows.
10
10
 
11
11
  ## Usage
12
12
 
@@ -245,7 +245,7 @@ export const agent = new Agent({
245
245
 
246
246
  ### Shared token budget
247
247
 
248
- When `shareTokenBudget` is enabled, the total budget is `observation.messageTokens + reflection.observationTokens` (100k in this example). If observations only use 30k tokens, messages can expand to use up to 70k. If messages are short, observations have more room before triggering reflection.
248
+ When `shareTokenBudget` is enabled, the total budget is `observation.messageTokens + reflection.observationTokens`, which is 100k in this example. Observations that use only 30k tokens leave up to 70k for messages, while short messages give observations more room before reflection starts.
249
249
 
250
250
  ```typescript
251
251
  import { Memory } from '@mastra/memory'
@@ -359,7 +359,7 @@ export const agent = new Agent({
359
359
 
360
360
  Async buffering is **enabled by default**. It pre-computes observations in the background as the conversation grows: when the `messageTokens` threshold is reached, buffered observations activate instantly with no blocking LLM call.
361
361
 
362
- The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals, each producing a chunk of observations. At threshold, chunks activate: observations move into the log, raw messages are removed from context. Above the `blockAfter` threshold, activation may overshoot the retention target instead of activating fewer chunks. If the threshold is reached and no buffered chunk activates, a synchronous observation runs instead.
362
+ The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals and produce chunks of observations. At the threshold, activation moves observations into the log and removes raw messages from context. Above `blockAfter`, activation may overshoot the retention target instead of activating fewer chunks. A synchronous observation runs if the threshold is reached without activating a buffered chunk.
363
363
 
364
364
  Default settings:
365
365
 
@@ -765,7 +765,7 @@ The standalone `ObservationalMemory` class accepts all the same options as the `
765
765
 
766
766
  ## Recall tool
767
767
 
768
- When `retrieval` is set (any truthy value), a `recall` tool is registered so the agent can page through raw messages behind observation group ranges. By default (scope `'resource'`), the tool supports listing threads (`mode: "threads"`), browsing other threads (`threadId`), and cross-thread search. With `retrieval: { vector: true }`, semantic search is available (`mode: "search"`). Set `scope: 'thread'` to restrict the tool to the current thread only. The tool is automatically added to the agent's tool list.
768
+ When `retrieval` is truthy, Mastra registers a `recall` tool that pages through raw messages behind observation group ranges. With the default resource scope, the tool can list threads (`mode: "threads"`) and browse another thread through `threadId`. It also supports cross-thread search. Set `retrieval: { vector: true }` for semantic search (`mode: "search"`), or use `scope: 'thread'` to restrict the tool to the current thread. The tool is automatically added to the agent.
769
769
 
770
770
  Mastra also injects scope-aware usage instructions into the agent's context. For resource scope with `vector: true`, these cover routing between `search`, `threads`, and `messages`, including fallback to thread discovery when search results are unsuitable. Without `vector: true`, the instructions only cover `threads` and `messages` browsing, so the agent isn't steered toward a search mode that isn't configured. Resource-scoped instructions are injected even before any observation group exists, so the agent can browse other threads from the first message. Use `retrieval: { instructions: '...' }` to append application-specific guidance after the built-in instructions.
771
771
 
@@ -50,7 +50,7 @@ await memory.settled()
50
50
  await store.close()
51
51
  ```
52
52
 
53
- > **Note:** `settled()` joins the work that had started by the time you called it, plus any work that work enqueues. It does not prevent new work from starting afterwards, so call it once the agent runs you care about have returned.
53
+ > **Note:** `settled()` joins the work that had started by the time you called it, plus any work that work enqueues. It doesn't prevent new work from starting afterwards, so call it once the agent runs you care about have returned.
54
54
 
55
55
  ## Related
56
56
 
@@ -60,7 +60,7 @@ The Mastra platform replaces Mastra Cloud with separate Studio and Server produc
60
60
 
61
61
  ## Replace Mastra Cloud Store with a hosted database
62
62
 
63
- Mastra Cloud provided a managed libSQL database, backed by [Turso](https://turso.tech). The Mastra platform doesn't host a database for you, so you need to point your storage at an externally hosted instance.
63
+ Unlike Mastra Cloud, which provided a managed libSQL database backed by [Turso](https://turso.tech), the Mastra platform doesn't host a database for you. Point your storage at an externally hosted instance.
64
64
 
65
65
  If you were already using a hosted database ("bring your own"), keep the existing database configuration. Ensure the connection string is set as an environment variable in the dashboard rather than hardcoded.
66
66
 
@@ -80,7 +80,7 @@ Once the download completes, convert the dump into a SQLite database file:
80
80
  sqlite3 mydb.db < ~/Downloads/mastra-cloud-dump.sql
81
81
  ```
82
82
 
83
- You now have a portable `mydb.db` file you can inspect locally, back up, or use as the source for the new database in the steps that follow.
83
+ You now have a portable `mydb.db` file that you can inspect locally or back up before using it as the source for the new database in the following steps.
84
84
 
85
85
  #### Option B: Export via the Turso CLI
86
86
 
@@ -88,16 +88,16 @@ If you prefer to work from the command line, or need to script the export, you c
88
88
 
89
89
  1. Retrieve your Cloud Store credentials from the dashboard.
90
90
 
91
- Open your project in the [Mastra dashboard](https://projects.mastra.ai) and navigate to **Runtime → Settings → Env Variables**. For Cloud Store–backed projects, two variables are injected alongside your own:
91
+ Open your project in the [Mastra dashboard](https://projects.mastra.ai) and navigate to **Runtime → Settings → Env Variables**. For projects backed by Cloud Store, two variables are injected alongside your own:
92
92
 
93
93
  - `MASTRA_STORAGE_URL`: A libSQL connection string (e.g. `libsql://<db-name>-<org>.turso.io`).
94
94
  - `MASTRA_STORAGE_AUTH_TOKEN`: A read-capable auth token scoped to that database.
95
95
 
96
- Each row supports the standard environment variable actions — show/hide via the eye toggle, Edit, Delete, and Copy Value. Use **Copy Value** to grab both values for the dump command below.
96
+ Each row supports the standard environment variable actions: show or hide via the eye toggle, Edit, Delete, and Copy Value. Use **Copy Value** to grab both values for the dump command below.
97
97
 
98
98
  > **Note:** These variables only appear for projects that were provisioned with Cloud Store. If you brought your own database to Mastra Cloud, you already have these credentials and can skip ahead to [Point your Mastra app at the new database](#point-your-mastra-app-at-the-new-database).
99
99
 
100
- > **Note:** If the variables are missing, the values do not decrypt, or the Turso CLI rejects the token, email <support@mastra.ai> from the address associated with your Mastra Cloud account and ask for the libSQL URL and auth token for the project you want to export. Include the project name/ID. Support can also run the dump on your behalf if CLI access is blocked on your network.
100
+ > **Note:** If the variables are missing, the values don't decrypt, or the Turso CLI rejects the token, email <support@mastra.ai> from the address associated with your Mastra Cloud account and ask for the libSQL URL and auth token for the project you want to export. Include the project name/ID. Support can also run the dump on your behalf if CLI access is blocked on your network.
101
101
 
102
102
  2. Install the Turso CLI.
103
103
 
@@ -113,7 +113,7 @@ If you prefer to work from the command line, or need to script the export, you c
113
113
 
114
114
  3. Export the database to a SQL dump.
115
115
 
116
- Set the credentials provided by support (or use the dashboard values if you already copied them earlier) as environment variables, then dump the database to a local file. If you copied the URL from the dashboard, swap the `libsql://` scheme for `https://` — the Turso CLI expects the HTTPS form when passing the URL with an auth token.
116
+ Set the credentials provided by support (or use the dashboard values if you already copied them earlier) as environment variables, then dump the database to a local file. If you copied the URL from the dashboard, swap the `libsql://` scheme for `https://` because the Turso CLI expects the HTTPS form when passing the URL with an auth token.
117
117
 
118
118
  ```bash
119
119
  export MASTRA_STORAGE_URL="https://<db-name>-<org>.turso.io"
@@ -122,7 +122,7 @@ If you prefer to work from the command line, or need to script the export, you c
122
122
  turso db shell "$MASTRA_STORAGE_URL?authToken=$MASTRA_STORAGE_AUTH_TOKEN" ".dump" > mastra-cloud-dump.sql
123
123
  ```
124
124
 
125
- > **Warning:** Embedding the auth token in the connection string is less secure than Turso's recommended pattern — the full URL (with token) can end up in shell history, process listings, and terminal logs. Turso officially recommends running `turso auth login` and then dumping by database name only: `turso db shell <database-name> ".dump" > mastra-cloud-dump.sql`. That flow requires the database to live in a Turso account you own, which is not the case for Cloud Store, so the env-var example above is provided as an alternative for this one-time export. If you prefer to avoid token interpolation entirely, ask support to run the dump on your behalf and send you the resulting SQL file.
125
+ > **Warning:** Embedding the auth token in the connection string is less secure than Turso's recommended pattern because the full URL, including the token, can appear in command history and in process or terminal output. Turso recommends running `turso auth login` and dumping by database name only: `turso db shell <database-name> ".dump" > mastra-cloud-dump.sql`. That flow requires the database to belong to a Turso account you own, which isn't true for Cloud Store, so the environment-variable example above provides an alternative for this one-time export. To avoid token interpolation entirely, ask support to run the dump and send you the resulting SQL file.
126
126
 
127
127
  The resulting `mastra-cloud-dump.sql` contains the full schema and data: thread and message history, workflow snapshots, traces, and eval scores. Store it somewhere safe before continuing.
128
128
 
@@ -136,7 +136,7 @@ The dump is a standard SQL file and can be loaded into any libSQL-compatible dat
136
136
  turso auth login
137
137
  ```
138
138
 
139
- If you do not have a Turso account, the CLI will prompt you to create one. See [Turso pricing](https://turso.tech/pricing) for plan details.
139
+ If you don't have a Turso account, the CLI will prompt you to create one. See [Turso pricing](https://turso.tech/pricing) for plan details.
140
140
 
141
141
  2. Create a new database and load the dump in one step.
142
142
 
@@ -144,7 +144,7 @@ The dump is a standard SQL file and can be loaded into any libSQL-compatible dat
144
144
  turso db create mastra-migrated --from-dump ./mastra-cloud-dump.sql
145
145
  ```
146
146
 
147
- `--from-dump` restores a local SQLite/libSQL dump at create time, which is faster and safer than piping statements through `turso db shell` after the fact. Pick a region close to where your Mastra Server runs to minimize latency — list available regions with `turso db locations` and pass `--group <group-name>` if you manage multiple groups.
147
+ `--from-dump` restores a local SQLite/libSQL dump at create time, which is faster and safer than piping statements through `turso db shell` after the fact. Pick a region close to where your Mastra Server runs to minimize latency. List available regions with `turso db locations` and pass `--group <group-name>` if you manage multiple groups.
148
148
 
149
149
  For multi-gigabyte dumps, add `--wait` so the CLI blocks until the database is fully available.
150
150
 
@@ -12,7 +12,7 @@ This guide covers the breaking changes when upgrading from Mastra 0.x to v1.0. T
12
12
 
13
13
  > **Need help?:** Need help with the migration? Join our [Discord community](https://discord.gg/BTYqqHKUrf) to ask questions.
14
14
 
15
- > **Coming from Mastra Cloud?:** The legacy Mastra Cloud product has been replaced by the [Mastra platform](https://mastra.ai/docs/mastra-platform/overview), which splits hosting into two separate products: **Studio** (visual environment, observability) and **Server** (production API). Old Mastra Cloud access tokens don't work with Mastra platform. Create new ones with `mastra auth tokens create`.
15
+ > **Coming from Mastra Cloud?:** The legacy Mastra Cloud product has been replaced by the [Mastra platform](https://mastra.ai/docs/mastra-platform/overview), which splits hosting into two separate products: **Studio** (visual environment, observability) and **Server** (production API). Because old Mastra Cloud access tokens don't work with Mastra platform, create new ones with `mastra auth tokens create`.
16
16
  >
17
17
  > If you upgrade to v1 packages without also migrating your `telemetry:` config to `observability:` and creating a Studio project, observability data will stop flowing. Follow the [Mastra Cloud migration guide](https://mastra.ai/reference/migrations/mastra-cloud) end to end.
18
18
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  **Added in:** `@mastra/observability@1.8.0`. **Deprecated in `1.12.0`** in favor of [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter).
8
8
 
9
- > **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. Both classes share the same constructor, environment variables, and runtime behavior. `CloudExporter` keeps its original `mastra-cloud-observability-exporter` exporter `name` and `CLOUD_EXPORTER_*` error IDs so monitoring rules built against it keep working.
9
+ > **Deprecated:** `CloudExporter` remains available for backward compatibility but will be removed in a future major version, so use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. The classes have identical constructors and share environment variables and runtime behavior. To preserve existing monitoring rules, `CloudExporter` retains its original `mastra-cloud-observability-exporter` exporter `name` and `CLOUD_EXPORTER_*` error IDs.
10
10
 
11
11
  Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
12
12
 
@@ -165,7 +165,7 @@ Most processor methods receive both `messages` and `messageList`. They point to
165
165
 
166
166
  ### `messages` vs `messageList`
167
167
 
168
- - `messages`: A plain array of `MastraDBMessage` objects, scoped to the current stage. For `processInput` and `processInputStep` this excludes system messages. For `processOutputResult` and `processOutputStep` this includes the latest LLM response. The array is backed by `messageList`, so editing a message's `content.parts` in place is visible to downstream processors and to persistence.
168
+ - `messages`: A stage-scoped array of `MastraDBMessage` objects. For input processing, `processInput` and `processInputStep` exclude system messages. For output processing, `processOutputResult` and `processOutputStep` include the latest LLM response. The array is backed by `messageList`, so in-place edits to a message's `content.parts` remain visible to downstream processors and persistence.
169
169
  - `messageList`: The live `MessageList` instance backing the run. It exposes filtered views (input, response, remembered, all), multiple output formats (db, ui, core), and methods for mutating the conversation.
170
170
 
171
171
  Use `messages` when you only need to read, map over, or lightly edit fields on the current stage's messages. Use `messageList` when you need to:
@@ -132,7 +132,7 @@ When the `block` strategy is active (default), `RegexFilterProcessor` throws a `
132
132
 
133
133
  ## Redaction behavior
134
134
 
135
- Every rule is matched independently, so two rules can claim text that overlaps. A card number written without separators matches both `phone` and `credit-card`, for example. Overlapping matches are combined into a single region and replaced once, using the replacement of the longest match.
135
+ Every rule is matched independently, which lets two rules claim overlapping text. For example, a card number without separators matches both `phone` and `credit-card`. Overlapping matches are combined into one region and replaced once with the replacement from the longest match.
136
136
 
137
137
  ```typescript
138
138
  const filter = new RegexFilterProcessor({
@@ -143,11 +143,11 @@ const filter = new RegexFilterProcessor({
143
143
  // "Charge 4111111111111111 today" becomes "Charge [CREDIT_CARD] today"
144
144
  ```
145
145
 
146
- A replacement string can reference capture groups with `$1` or `$&`. Those references resolve for a single match whose pattern also matches the matched text on its own. In a combined region, or for a rule anchored on its surroundings with a lookbehind or lookahead, the replacement string is inserted as written. The region is redacted either way.
146
+ A replacement string can use `$1` or `$&` to reference capture groups for an independent single match. When matches form a combined region, the replacement string is inserted as written. The same applies when a rule relies on surrounding text through a lookbehind or lookahead. The region is redacted in either case.
147
147
 
148
148
  ## Redaction reporting
149
149
 
150
- The `redact` strategy rewrites text in place, so nothing downstream can tell what changed. Assign `onViolation` to record it. The processor calls it once per redacted message, message part, or stream chunk, and offsets are relative to that piece of text. Async callbacks are awaited, and errors are caught so an unavailable audit sink can't fail the request.
150
+ Because the `redact` strategy rewrites text in place, downstream code can't determine what changed. Assign `onViolation` to record the change for each redacted message or message part and for each stream chunk, with offsets relative to that text. Async callbacks are awaited, while errors are caught so an unavailable audit sink can't fail the request.
151
151
 
152
152
  ```typescript
153
153
  import { RegexFilterProcessor, type RegexRedactionDetail } from '@mastra/core/processors'
@@ -145,12 +145,12 @@ Numbers interpolated into violation messages are normalized to at most 6 decimal
145
145
  | `organization` | Yes | `organizationId` + time window | `organizationId` key in `RequestContext` |
146
146
  | `session` | Yes | `sessionId` + time window | `sessionId` key in `RequestContext` |
147
147
 
148
- All scopes require observability storage with `getMetricAggregate` support. If the Mastra instance doesn't have observability storage configured, an error is thrown at registration time.
148
+ All scopes require observability storage with `getMetricAggregate` support; without configured observability storage, the Mastra instance throws an error at registration time.
149
149
 
150
150
  For `run` scope, the processor reads the trace ID from the current span's tracing context. If no tracing context is available, the check is skipped (fail-open).
151
151
 
152
152
  For all other scopes, if the required context ID is missing at runtime, the check is skipped. Observability query failures are handled with a fail-open strategy: if a query fails, a warning is logged through the Mastra logger and the step proceeds.
153
153
 
154
- > **The `user`, `organization`, and `session` scopes require annotated traces.** These scopes match metric records by their `userId`, `organizationId`, and `sessionId` fields, which are populated from span metadata on the trace (for example, via tracing options metadata). If your traces don't carry the matching metadata, these scopes match zero records and the guard never trips. Setting the RequestContext key alone isn't enough: both the RequestContext key (for scope resolution) and the span metadata (for cost attribution) must be present.
154
+ > **The `user`, `organization`, and `session` scopes require annotated traces.** These scopes match metric records by their `userId`, `organizationId`, and `sessionId` fields, which are populated from span metadata on the trace (for example, via tracing options metadata). Without matching trace metadata, these scopes match zero records and the guard never trips, because setting the RequestContext key alone isn't enough: both the RequestContext key (for scope resolution) and the span metadata (for cost attribution) must be present.
155
155
 
156
156
  > **Note on metric persistence delay.** The observability pipeline uses buffered exporters that flush metrics asynchronously. A short delay exists between when an LLM call completes and when its cost metrics are available for query. During high-frequency agent execution, the cost control may not detect a limit breach until one or more steps after the actual cost exceeded the threshold.
@@ -68,7 +68,7 @@ for await (const part of stream.fullStream) {
68
68
 
69
69
  ## Media token counting
70
70
 
71
- Images and file attachments are estimated rather than tokenized. This applies to `file` message parts and to tool results shaped like `{ data, mediaType }`. Images use a flat per-image estimate, other media is estimated from its decoded byte size, and remote URLs or provider file ids use a flat fallback because their size isn't known locally. Encoded payloads such as base64 data are never counted as text, which would otherwise inflate the count by an order of magnitude and truncate history unnecessarily.
71
+ Images and file attachments are estimated instead of tokenized, including `file` message parts and tool results shaped like `{ data, mediaType }`. Images use a flat per-image estimate; other media uses decoded byte size, while remote URLs and provider file ids use a flat fallback because their size isn't known locally. Encoded payloads such as base64 data are never counted as text, avoiding an inflated count that could truncate history unnecessarily.
72
72
 
73
73
  ## Error behavior
74
74
 
@@ -253,7 +253,7 @@ const toolSearch = new ToolSearchProcessor({
253
253
 
254
254
  Loading tools is cache-friendly in both modes: loads are append-only, so the cached prompt prefix stays stable for providers that support prompt caching.
255
255
 
256
- Unloading a tool changes the tool definitions sent to the model, which shifts the cached prefix and causes the next turn to pay a cache write instead of a cache hit. In `'in-memory'` mode this happens when a thread's state is evicted by `ttl`. In `'context'` mode it happens when a tool's discovery result is no longer present in the messages (for example, when older messages are trimmed). The tool de-loads, and the model must search for it again before reuse. This is expected: removing an unused tool trades one cache write for a smaller prefix on later turns.
256
+ Unloading a tool changes the definitions sent to the model, shifting the cached prefix so the next turn pays for a cache write instead of receiving a cache hit. In `'in-memory'` mode, this happens when `ttl` evicts a thread's state; in `'context'` mode, it happens when older-message trimming removes the tool's discovery result. The model must then search for the unloaded tool before reuse. This expected tradeoff exchanges one cache write for a smaller prefix on later turns.
257
257
 
258
258
  ## Combining with other processors
259
259
 
@@ -130,7 +130,7 @@ const processor = new WorkingMemory({
130
130
 
131
131
  4. Generates system instructions based on mode:
132
132
 
133
- - **Normal mode**: Includes guidelines for storing/updating information, template structure, and current data
133
+ - **Normal mode**: Includes guidelines for storing and updating information, along with the template structure and current data
134
134
  - **Read-only mode** (`readOnly: true`): Includes only the current data as context without update instructions
135
135
 
136
136
  5. Adds the instruction as a system message with `source: 'memory'` tag
@@ -79,7 +79,7 @@ await pubsub.publish('my-topic', {
79
79
 
80
80
  Registers a callback to receive events published to a topic. When `options.group` is set, subscribers in the same group compete for messages and each event is delivered to one member. Without a group, every subscriber receives every event.
81
81
 
82
- Pass `options.batch` to opt in to batched delivery. The callback signature is unchanged: a batch of N events is delivered as N consecutive `cb(event, ack, nack)` calls in publish order. Batching is honored only when the backend's [`supportsNativeBatching`](#properties) is `true`. Other backends ignore the option and deliver events one at a time.
82
+ Pass `options.batch` to opt in to batched delivery. The unchanged callback signature delivers a batch of N events as N consecutive `cb(event, ack, nack)` calls in publish order. Batching is honored only when the backend's [`supportsNativeBatching`](#properties) is `true`. Other backends ignore the option and deliver events one at a time.
83
83
 
84
84
  Set `options.startFrom` to `"latest"` to receive only events published after a new consumer group is created. The default, `"earliest"`, includes retained events. Existing consumer groups keep their current checkpoint.
85
85
 
@@ -113,7 +113,7 @@ await pubsub.flush()
113
113
 
114
114
  Deletes all retained state for a topic (cached history, persistent stream entries, and consumer groups) once no more events will be published to it. Mastra's run lifecycles (durable agents and the evented workflow engine) call this automatically when a run reaches a terminal state, so per-run topics don't accumulate on transports that retain messages.
115
115
 
116
- The default implementation is a no-op: transports that retain nothing per topic (such as `EventEmitterPubSub`) have nothing to clear. Backends that persist messages, like [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), override it. The contract is best-effort: implementations log failures rather than throwing, because callers invoke it fire-and-forget at cleanup boundaries.
116
+ The default implementation is a no-op because transports that retain nothing per topic, such as `EventEmitterPubSub`, have nothing to clear. Backends that persist messages, like [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), override it. Implementations follow a best-effort contract and log failures instead of throwing because callers invoke cleanup without awaiting it.
117
117
 
118
118
  ```typescript
119
119
  await pubsub.clearTopic('workflow.events.v2.run-123')
@@ -6,7 +6,7 @@
6
6
 
7
7
  `LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/harness/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
8
8
 
9
- Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can actually coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that can't lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
9
+ Leasing is separate from pub/sub. A `LeaseProvider` implementation needs actual lock coordination, whether through an atomic Redis operation such as `SET` or Lua or through an in-memory map for a single process. For backends that omit leasing, the signals runtime preserves single-process behavior with a no-op provider.
10
10
 
11
11
  The built-in [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) implements `LeaseProvider`, which is what enables signals to coordinate across instances in distributed and serverless deployments.
12
12
 
@@ -119,7 +119,7 @@ if (!transferred) {
119
119
 
120
120
  Returns: `Promise<boolean>`
121
121
 
122
- > **Warning:** Backends that can't perform the transfer atomically must still implement it as a best-effort `releaseLease(fromOwner)` followed by `acquireLease(toOwner)`, and document that the swap is non-atomic, since a racing process can win the key in the gap. Keeping the method required means callers have a single code path and atomicity is an explicit per-backend decision.
122
+ > **Warning:** Backends that can't transfer a lease atomically must use a best-effort `releaseLease(fromOwner)` followed by `acquireLease(toOwner)`. They must document that the swap is non-atomic because another process can claim the key between those calls. Keeping the method required gives callers one code path while making atomicity an explicit per-backend decision.
123
123
 
124
124
  ## Capability detection
125
125