@mastra/mcp-docs-server 1.1.35-alpha.8 → 1.1.36-alpha.1

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 (120) hide show
  1. package/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +48 -4
  2. package/.docs/docs/agents/background-tasks.md +62 -2
  3. package/.docs/docs/agents/processors.md +9 -1
  4. package/.docs/docs/agents/response-caching.md +148 -0
  5. package/.docs/docs/agents/signals.md +151 -0
  6. package/.docs/docs/agents/using-tools.md +8 -0
  7. package/.docs/docs/browser/agent-browser.md +15 -0
  8. package/.docs/docs/browser/stagehand.md +25 -1
  9. package/.docs/docs/deployment/cloud-providers.md +1 -1
  10. package/.docs/docs/deployment/overview.md +6 -5
  11. package/.docs/docs/editor/tools.md +1 -1
  12. package/.docs/docs/index.md +2 -2
  13. package/.docs/docs/mastra-platform/configuration.md +22 -6
  14. package/.docs/docs/mastra-platform/observability.md +99 -0
  15. package/.docs/docs/mastra-platform/overview.md +12 -55
  16. package/.docs/{guides/deployment/mastra-platform.md → docs/mastra-platform/server.md} +30 -37
  17. package/.docs/docs/mastra-platform/studio.md +81 -0
  18. package/.docs/docs/memory/observational-memory.md +61 -13
  19. package/.docs/docs/memory/semantic-recall.md +68 -6
  20. package/.docs/docs/observability/logging.md +2 -2
  21. package/.docs/docs/observability/metrics/overview.md +4 -4
  22. package/.docs/docs/observability/overview.md +15 -10
  23. package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
  24. package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
  25. package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
  26. package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
  27. package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +35 -33
  28. package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
  29. package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
  30. package/.docs/docs/observability/tracing/overview.md +30 -29
  31. package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
  32. package/.docs/docs/server/mastra-server.md +30 -19
  33. package/.docs/docs/studio/deployment.md +1 -37
  34. package/.docs/docs/studio/observability.md +31 -26
  35. package/.docs/docs/studio/overview.md +8 -2
  36. package/.docs/docs/voice/overview.md +84 -0
  37. package/.docs/docs/workflows/suspend-and-resume.md +28 -1
  38. package/.docs/guides/deployment/inngest.md +23 -0
  39. package/.docs/guides/getting-started/quickstart.md +4 -4
  40. package/.docs/guides/migrations/mastra-cloud.md +12 -12
  41. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
  42. package/.docs/models/gateways/netlify.md +2 -1
  43. package/.docs/models/gateways/openrouter.md +4 -1
  44. package/.docs/models/gateways/vercel.md +2 -1
  45. package/.docs/models/index.md +1 -1
  46. package/.docs/models/providers/alibaba-cn.md +1 -1
  47. package/.docs/models/providers/alibaba.md +1 -1
  48. package/.docs/models/providers/chutes.md +23 -54
  49. package/.docs/models/providers/claudinio.md +71 -0
  50. package/.docs/models/providers/databricks.md +96 -0
  51. package/.docs/models/providers/deepinfra.md +3 -1
  52. package/.docs/models/providers/deepseek.md +3 -1
  53. package/.docs/models/providers/digitalocean.md +9 -2
  54. package/.docs/models/providers/firepass.md +71 -0
  55. package/.docs/models/providers/google.md +4 -3
  56. package/.docs/models/providers/kilo.md +6 -4
  57. package/.docs/models/providers/llmgateway.md +8 -2
  58. package/.docs/models/providers/nebius.md +37 -55
  59. package/.docs/models/providers/novita-ai.md +5 -5
  60. package/.docs/models/providers/nvidia.md +59 -49
  61. package/.docs/models/providers/ollama-cloud.md +1 -1
  62. package/.docs/models/providers/openai.md +2 -0
  63. package/.docs/models/providers/opencode.md +44 -43
  64. package/.docs/models/providers/poe.md +4 -1
  65. package/.docs/models/providers/sarvam.md +72 -0
  66. package/.docs/models/providers/wafer.ai.md +4 -5
  67. package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
  68. package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
  69. package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
  70. package/.docs/models/providers.md +4 -1
  71. package/.docs/reference/agents/agent.md +85 -0
  72. package/.docs/reference/browser/agent-browser.md +37 -11
  73. package/.docs/reference/browser/stagehand-browser.md +35 -9
  74. package/.docs/reference/cli/create-mastra.md +6 -0
  75. package/.docs/reference/cli/mastra.md +63 -15
  76. package/.docs/reference/client-js/agents.md +115 -1
  77. package/.docs/reference/client-js/responses.md +4 -0
  78. package/.docs/reference/configuration.md +6 -6
  79. package/.docs/reference/editor/tool-provider.md +3 -3
  80. package/.docs/reference/harness/harness-class.md +22 -9
  81. package/.docs/reference/index.md +5 -0
  82. package/.docs/reference/memory/observational-memory.md +11 -1
  83. package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
  84. package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
  85. package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
  86. package/.docs/reference/observability/tracing/configuration.md +6 -3
  87. package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
  88. package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
  89. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +5 -3
  90. package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
  91. package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
  92. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
  93. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
  94. package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
  95. package/.docs/reference/observability/tracing/instances.md +2 -2
  96. package/.docs/reference/observability/tracing/interfaces.md +37 -2
  97. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
  98. package/.docs/reference/observability/tracing/span-filtering.md +2 -2
  99. package/.docs/reference/processors/prefill-error-handler.md +3 -3
  100. package/.docs/reference/processors/response-cache.md +114 -0
  101. package/.docs/reference/processors/tool-call-filter.md +28 -0
  102. package/.docs/reference/storage/clickhouse.md +8 -8
  103. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  104. package/.docs/reference/storage/cloudflare.md +1 -1
  105. package/.docs/reference/storage/composite.md +1 -1
  106. package/.docs/reference/storage/convex.md +1 -1
  107. package/.docs/reference/storage/dsql.md +428 -0
  108. package/.docs/reference/storage/duckdb.md +3 -3
  109. package/.docs/reference/storage/dynamodb.md +1 -1
  110. package/.docs/reference/storage/lance.md +1 -1
  111. package/.docs/reference/storage/libsql.md +1 -1
  112. package/.docs/reference/storage/postgresql.md +1 -1
  113. package/.docs/reference/storage/upstash.md +1 -1
  114. package/.docs/reference/streaming/ChunkType.md +44 -0
  115. package/.docs/reference/tools/brightdata.md +167 -0
  116. package/.docs/reference/tools/create-tool.md +46 -0
  117. package/.docs/reference/voice/inworld.md +133 -0
  118. package/.docs/reference/workflows/workflow-state-reader.md +113 -0
  119. package/CHANGELOG.md +113 -0
  120. package/package.json +6 -6
@@ -0,0 +1,99 @@
1
+ # Observability on Mastra platform
2
+
3
+ Observability on Mastra platform is a standalone hosted product for searchable traces, logs, and metrics across Mastra projects and deploys. Use it when you want observability without deploying Studio first or setting up local storage.
4
+
5
+ Mastra can configure platform observability during project setup. The CLI provisions a platform project, writes the required environment variables, and registers observability exporters in your Mastra config.
6
+
7
+ ## Quickstart
8
+
9
+ Choose the setup path that matches your project. New and existing projects can use the CLI to provision Observability automatically, while manual setup is available when you already manage platform projects and environment variables yourself.
10
+
11
+ ### New project
12
+
13
+ Create a new Mastra project:
14
+
15
+ **npm**:
16
+
17
+ ```bash
18
+ npm create mastra@latest
19
+ ```
20
+
21
+ **pnpm**:
22
+
23
+ ```bash
24
+ pnpm create mastra
25
+ ```
26
+
27
+ **Yarn**:
28
+
29
+ ```bash
30
+ yarn create mastra
31
+ ```
32
+
33
+ **Bun**:
34
+
35
+ ```bash
36
+ bunx create-mastra
37
+ ```
38
+
39
+ When prompted, enable Mastra Observability:
40
+
41
+ ```bash
42
+ Enable Mastra Observability? (will open auth flow)
43
+
44
+ > Yes
45
+ ```
46
+
47
+ The CLI authenticates with Mastra platform, creates a platform project, writes the required environment variables, and configures the observability exporters.
48
+
49
+ ### Existing non-Mastra projects
50
+
51
+ If you already have an application, such as a Next.js app, but have not added Mastra yet, run `mastra init` and enable Mastra Observability when prompted:
52
+
53
+ **npm**:
54
+
55
+ ```bash
56
+ npx mastra init
57
+ ```
58
+
59
+ **pnpm**:
60
+
61
+ ```bash
62
+ pnpm dlx mastra init
63
+ ```
64
+
65
+ **Yarn**:
66
+
67
+ ```bash
68
+ yarn dlx mastra init
69
+ ```
70
+
71
+ **Bun**:
72
+
73
+ ```bash
74
+ bun x mastra init
75
+ ```
76
+
77
+ The CLI can select an existing platform project or create a new one.
78
+
79
+ ### Manual setup
80
+
81
+ Create a project in [Mastra Platform](https://projects.mastra.ai), add `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` to `.env`, then register `MastraPlatformExporter` in your Mastra config. Add `MastraStorageExporter` if you also want to persist observability events to your configured Mastra Storage:
82
+
83
+ ```ts
84
+ import { Mastra } from '@mastra/core/mastra'
85
+ import { Observability, MastraPlatformExporter } from '@mastra/observability'
86
+
87
+ export const mastra = new Mastra({
88
+ observability: new Observability({
89
+ configs: {
90
+ default: {
91
+ serviceName: 'mastra',
92
+ exporters: [new MastraPlatformExporter()],
93
+ },
94
+ },
95
+ }),
96
+ })
97
+ ```
98
+
99
+ See [Mastra platform configuration](https://mastra.ai/docs/mastra-platform/configuration) for the environment variables used by platform observability.
@@ -1,65 +1,22 @@
1
1
  # Mastra platform
2
2
 
3
- The [Mastra platform](https://projects.mastra.ai) provides two products for deploying and managing AI applications built with the Mastra framework:
3
+ The [Mastra platform](https://projects.mastra.ai) provides three products for deploying, monitoring, and managing AI applications built with the Mastra framework:
4
4
 
5
- - **Studio**: A hosted visual environment for testing agents, running workflows, and inspecting traces
6
- - **Server**: A production deployment target that runs your Mastra application as an API server
5
+ - [**Observability**](https://mastra.ai/docs/mastra-platform/observability): The baseline product for every platform project, with searchable traces, logs, and metrics across Mastra projects and deploys
6
+ - [**Studio**](https://mastra.ai/docs/mastra-platform/studio): A hosted visual environment for testing agents, running workflows, and inspecting traces. Starting with Studio also gives you Observability.
7
+ - [**Server**](https://mastra.ai/docs/mastra-platform/server): A production deployment target that runs your Mastra application as an API server. Starting with Server also gives you Observability.
7
8
 
8
- ## Quickstart
9
+ ## Get started
9
10
 
10
- Before you begin, ensure you have Node.js 22.13.0 or later installed.
11
+ Choose the path that matches what you want to do:
11
12
 
12
- 1. Follow the [get started guide](https://mastra.ai/docs) to create your first Mastra project.
13
-
14
- 2. Install the `mastra` CLI globally:
15
-
16
- **npm**:
17
-
18
- ```bash
19
- npm install -g mastra
20
- ```
21
-
22
- **pnpm**:
23
-
24
- ```bash
25
- pnpm add -g mastra
26
- ```
27
-
28
- **Yarn**:
29
-
30
- ```bash
31
- yarn global add mastra
32
- ```
33
-
34
- **Bun**:
35
-
36
- ```bash
37
- bun add --global mastra
38
- ```
39
-
40
- 3. Deploy Studio with a single command:
41
-
42
- ```bash
43
- mastra studio deploy
44
- ```
45
-
46
- On a successful deploy, the CLI will output the URL of your deployed Studio instance.
47
-
48
- 4. Deploy Server with a single command:
49
-
50
- ```bash
51
- mastra server deploy
52
- ```
53
-
54
- On a successful deploy, the CLI will output the URL of your deployed Server instance.
55
-
56
- You have now successfully deployed both Studio and Server instances of your Mastra application. The CLI created a `.mastra-project.json` file in your project directory.
57
-
58
- This file links your local project to a platform project. It's auto-generated on your first deploy and contains the `projectId`, `projectName`, and `organizationId`. Commit this file to your repository so CI/CD knows which project to deploy to.
13
+ - **Add hosted observability**: Use [Observability](https://mastra.ai/docs/mastra-platform/observability) to collect searchable traces, logs, and metrics across projects and deploys. Start here if you want monitoring without deploying Studio or Server first.
14
+ - **Deploy Studio**: Use [Studio](https://mastra.ai/docs/mastra-platform/studio) to host the visual development environment for your team. Start here if you want a shared UI for testing agents, running workflows, and inspecting traces.
15
+ - **Deploy Server**: Use [Server](https://mastra.ai/docs/mastra-platform/server) to run your Mastra application as a production API server. Start here when you’re ready to serve agents, tools, and workflows from the cloud.
59
16
 
60
17
  ## Key Concepts
61
18
 
62
- **Projects** are the shared parent entity across all products. A single project can have a Studio deployment and a Server deployment. Projects belong to an **Organization**, which is the multi-tenant container for your team.
19
+ **Projects** are the shared parent entity across all products. A single project can have Observability, a Studio deployment, and a Server deployment. Projects belong to an **Organization**, which is the multi-tenant container for your team.
63
20
 
64
21
  Your Mastra application is built from three building blocks:
65
22
 
@@ -73,6 +30,6 @@ Develop your project locally with [`mastra dev`](https://mastra.ai/reference/cli
73
30
 
74
31
  Once you're ready to deploy your application to production, use [`mastra studio deploy`](https://mastra.ai/reference/cli/mastra) and [`mastra server deploy`](https://mastra.ai/reference/cli/mastra) to push your application to the cloud.
75
32
 
76
- Follow the [Studio deployment guide](https://mastra.ai/docs/studio/deployment) and [Server deployment guide](https://mastra.ai/guides/deployment/mastra-platform) for step-by-step instructions.
33
+ Follow the [Studio on Mastra platform](https://mastra.ai/docs/mastra-platform/studio) and [Server on Mastra platform](https://mastra.ai/docs/mastra-platform/server) docs for step-by-step instructions.
77
34
 
78
- If you host your Mastra application on your own infrastructure, you can still send observability data to Studio using the [CloudExporter](https://mastra.ai/docs/observability/tracing/exporters/cloud).
35
+ If you host your Mastra application on your own infrastructure, you can still send observability data to Mastra platform using the [MastraPlatformExporter](https://mastra.ai/docs/observability/tracing/exporters/mastra-platform).
@@ -1,46 +1,42 @@
1
- # Deploy to Mastra platform
1
+ # Server on Mastra platform
2
2
 
3
- Mastra Server deploys your application as a production API server on cloud infrastructure. You get a stable API endpoint, environment variable management, custom domain support, and deploy history out of the box.
3
+ Server on Mastra platform is a production deployment target that runs your Mastra application as an API server. Use it when you want the platform to build, deploy, host, and manage your Mastra server.
4
4
 
5
- > **Tip:** This guide covers deploying the standalone server generated by `mastra build`. If you need to deploy Studio to the Mastra platform, see [Studio deployment](https://mastra.ai/docs/studio/deployment) instead.
5
+ You get a stable API endpoint, environment variable management, custom domain support, and deploy history out of the box.
6
6
 
7
- ## Before you begin
7
+ > **Note:** Server deploy provisions hosted storage automatically. If you override storage with [LibSQLStore](https://mastra.ai/reference/storage/libsql) and a file URL, switch to a remotely hosted database because Mastra platform uses an ephemeral filesystem.
8
8
 
9
- You'll need a [Mastra application](https://mastra.ai/guides/getting-started/quickstart) and a [Mastra platform](https://projects.mastra.ai) account.
9
+ ## Quickstart
10
10
 
11
- > **Warning:** Mastra platform uses an ephemeral filesystem, so any storage you configure (including observability storage) must be hosted externally. If you're using [LibSQLStore](https://mastra.ai/reference/storage/libsql) with a file URL, switch to a remotely hosted database.
11
+ 1. Follow the [get started guide](https://mastra.ai/docs) to create your first Mastra project.
12
12
 
13
- ## Installation
13
+ 2. Install the `mastra` CLI globally:
14
14
 
15
- Install the `mastra` CLI globally:
15
+ **npm**:
16
16
 
17
- **npm**:
18
-
19
- ```bash
20
- npm install -g mastra
21
- ```
22
-
23
- **pnpm**:
17
+ ```bash
18
+ npm install -g mastra
19
+ ```
24
20
 
25
- ```bash
26
- pnpm add -g mastra
27
- ```
21
+ **pnpm**:
28
22
 
29
- **Yarn**:
23
+ ```bash
24
+ pnpm add -g mastra
25
+ ```
30
26
 
31
- ```bash
32
- yarn global add mastra
33
- ```
27
+ **Yarn**:
34
28
 
35
- **Bun**:
29
+ ```bash
30
+ yarn global add mastra
31
+ ```
36
32
 
37
- ```bash
38
- bun add --global mastra
39
- ```
33
+ **Bun**:
40
34
 
41
- ## Deploy
35
+ ```bash
36
+ bun add --global mastra
37
+ ```
42
38
 
43
- 1. Deploy your project:
39
+ 3. Deploy your project:
44
40
 
45
41
  ```bash
46
42
  mastra server deploy
@@ -54,7 +50,7 @@ bun add --global mastra
54
50
 
55
51
  See the [CLI reference](https://mastra.ai/reference/cli/mastra) for the full list of flags.
56
52
 
57
- 2. Verify your deployment at the URL printed by the CLI. Append `/api/agents` to confirm it returns a JSON list of your agents.
53
+ 4. Verify your deployment at the URL printed by the CLI. Append `/api/agents` to confirm it returns a JSON list of your agents.
58
54
 
59
55
  > **Warning:** Set up [authentication](https://mastra.ai/docs/server/auth) before exposing your endpoints publicly.
60
56
 
@@ -181,11 +177,8 @@ The CLI reads `organizationId` and `projectId` from `.mastra-project.json` by de
181
177
 
182
178
  ## Related
183
179
 
184
- - [CLI reference: `mastra server deploy`](https://mastra.ai/reference/cli/mastra)
185
- - [CLI reference: `mastra server pause`](https://mastra.ai/reference/cli/mastra)
186
- - [CLI reference: `mastra server restart`](https://mastra.ai/reference/cli/mastra)
187
- - [CLI reference: `mastra studio deploy`](https://mastra.ai/reference/cli/mastra)
188
- - [CLI reference: `mastra auth tokens`](https://mastra.ai/reference/cli/mastra)
189
- - [Mastra platform overview](https://mastra.ai/docs/mastra-platform/overview)
190
- - [Studio deployment](https://mastra.ai/docs/studio/deployment)
191
- - [Deployment overview](https://mastra.ai/docs/deployment/overview)
180
+ - [`mastra server deploy`](https://mastra.ai/reference/cli/mastra)
181
+ - [`mastra server pause`](https://mastra.ai/reference/cli/mastra)
182
+ - [`mastra server restart`](https://mastra.ai/reference/cli/mastra)
183
+ - [`mastra studio deploy`](https://mastra.ai/reference/cli/mastra)
184
+ - [`mastra auth tokens`](https://mastra.ai/reference/cli/mastra)
@@ -0,0 +1,81 @@
1
+ # Studio on Mastra platform
2
+
3
+ Studio on Mastra platform is a hosted visual environment for testing agents, running workflows, and inspecting traces. Use it when you want to share Studio with your team without hosting the Studio UI yourself.
4
+
5
+ ## Quickstart
6
+
7
+ 1. Follow the [get started guide](https://mastra.ai/docs) to create your first Mastra project.
8
+
9
+ 2. Install the `mastra` CLI globally:
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install -g mastra
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add -g mastra
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn global add mastra
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add --global mastra
33
+ ```
34
+
35
+ 3. Deploy Studio with a single command:
36
+
37
+ ```bash
38
+ mastra studio deploy
39
+ ```
40
+
41
+ On a successful deploy, the CLI outputs the URL of your deployed Studio instance.
42
+
43
+ On your first deploy, the CLI prompts you to create a new project or select an existing one. It then creates a `.mastra-project.json` file in your project directory. This file links your local project to a platform project. It contains the `projectId`, `projectName`, and `organizationId`. Commit this file to your repository so CI/CD knows which project to deploy to.
44
+
45
+ ## How deploy works
46
+
47
+ The `mastra studio deploy` command builds your project, compiles `src/mastra/` into `.mastra/output`, packages the output as an artifact ZIP, uploads it, and deploys it to a cloud sandbox.
48
+
49
+ A deploy transitions through **queued → uploading → starting → running** or **failed** if something goes wrong. If a sandbox is already running for your project, the platform updates it in place with no downtime. Otherwise, it creates a fresh sandbox. Your instance URL is assigned per project slug and remains stable across deploys.
50
+
51
+ See the [`mastra studio deploy` CLI reference](https://mastra.ai/reference/cli/mastra) for the full list of flags and CI/CD usage.
52
+
53
+ ## Environment files
54
+
55
+ The deploy bundles environment variables from a `.env` or `.env.*` file in the project directory. If no env file is present, the deploy errors with `No env file found for deploy.` after the build step. Add at least an empty `.env` file before running the command.
56
+
57
+ When multiple env files are present, the CLI prompts you to pick one. To select non-interactively, pass `--env-file`:
58
+
59
+ ```bash
60
+ mastra studio deploy --env-file .env.production --yes
61
+ ```
62
+
63
+ This is also how you target multiple environments from a single codebase: maintain one env file per environment, such as `.env.staging` and `.env.production`, and pass the right one to each deploy. Each environment still requires its own Mastra platform project. See [Configuration](https://mastra.ai/docs/mastra-platform/configuration) for the multi-environment pattern.
64
+
65
+ ## Create a new project non-interactively
66
+
67
+ `mastra studio 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:
68
+
69
+ ```bash
70
+ mastra studio deploy --project "my-new-project" --yes
71
+ ```
72
+
73
+ Use this from CI or AI coding agents instead of `mastra studio projects create`, which is interactive only.
74
+
75
+ ## Self-host Studio
76
+
77
+ To deploy Studio on your own infrastructure, see [Studio deployment](https://mastra.ai/docs/studio/deployment).
78
+
79
+ ## Related
80
+
81
+ - [`mastra studio deploy`](https://mastra.ai/reference/cli/mastra)
@@ -77,6 +77,48 @@ The observer also sees these markers when it processes the thread, so the observ
77
77
 
78
78
  See [the API reference](https://mastra.ai/reference/memory/observational-memory) for the full configuration shape.
79
79
 
80
+ ## Early activation
81
+
82
+ OM can activate buffered observations before the token threshold is reached. This is useful when a prompt cache is likely to expire, or when the agent changes model providers.
83
+
84
+ Top-level early activation settings apply to observations by default:
85
+
86
+ ```typescript
87
+ const memory = new Memory({
88
+ options: {
89
+ observationalMemory: {
90
+ model: 'google/gemini-2.5-flash',
91
+ activateAfterIdle: '5m',
92
+ activateOnProviderChange: true,
93
+ },
94
+ },
95
+ })
96
+ ```
97
+
98
+ Use nested `observation` and `reflection` settings for per-phase control. Reflection early activation is opt-in, so top-level settings affect only observations.
99
+
100
+ ```typescript
101
+ const memory = new Memory({
102
+ options: {
103
+ observationalMemory: {
104
+ model: 'google/gemini-2.5-flash',
105
+ activateAfterIdle: '5m',
106
+ observation: {
107
+ activateAfterIdle: false,
108
+ },
109
+ reflection: {
110
+ activateAfterIdle: '10m',
111
+ activateOnProviderChange: true,
112
+ },
113
+ },
114
+ },
115
+ })
116
+ ```
117
+
118
+ In this example, the top-level idle setting is disabled for observations, while reflections opt into idle and provider-change activation.
119
+
120
+ See [the API reference](https://mastra.ai/reference/memory/observational-memory) for the full configuration shape.
121
+
80
122
  ## Benefits
81
123
 
82
124
  - **Prompt caching**: OM's context is stable and observations append over time rather than being dynamically retrieved each turn. This keeps the prompt prefix cacheable, which reduces costs.
@@ -216,7 +258,7 @@ The Observer and Reflector run in the background. Any model that works with Mast
216
258
 
217
259
  Generally speaking, we recommend using a model that has a large context window (128K+ tokens) and is fast enough to run in the background without slowing down your actions.
218
260
 
219
- If you're unsure which model to use, start with the default `google/gemini-2.5-flash`. We've also successfully tested `openai/gpt-5-mini`, `anthropic/claude-haiku-4-5`, `deepseek/deepseek-reasoner`, `qwen3`, and `glm-4.7`.
261
+ If you're unsure which model to use, start with the default `google/gemini-2.5-flash`. We've also successfully tested `openai/gpt-5-mini`, `anthropic/claude-haiku-4-5`, `deepseek/deepseek-reasoner`, `deepseek/deepseek-v4-pro`, `deepseek/deepseek-v4-flash`, `xai/grok-4-1-fast`, `qwen3`, and `glm-4.7`.
220
262
 
221
263
  ```typescript
222
264
  const memory = new Memory({
@@ -230,6 +272,10 @@ const memory = new Memory({
230
272
 
231
273
  See [model configuration](https://mastra.ai/reference/memory/observational-memory) for using different models per agent.
232
274
 
275
+ > **Note:** `google/gemini-2.5-flash` is unusually good at preserving detail in long output. As a result, the Reflector can produce reflections that stay above the configured `reflection.observationTokens` threshold even after the maximum compression retry. When this happens, the Reflector returns the smallest non-degenerate candidate produced during retries so the loop terminates instead of running forever.
276
+ >
277
+ > If you'd rather have more aggressive compression on the Reflector, swap to a model that condenses more readily, such as `xai/grok-4-1-fast`, `deepseek/deepseek-v4-pro`, or `deepseek/deepseek-v4-flash`. You can keep `google/gemini-2.5-flash` for the Observer and use a different model for the Reflector — see [different models per agent](https://mastra.ai/reference/memory/observational-memory).
278
+
233
279
  ### Token-tiered model selection
234
280
 
235
281
  **Added in:** `@mastra/memory@1.10.0`
@@ -364,17 +410,19 @@ Reflection works similarly — the Reflector runs in the background when observa
364
410
 
365
411
  ### Settings
366
412
 
367
- | Setting | Default | What it controls |
368
- | ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
369
- | `observation.bufferTokens` | `0.2` | How often to buffer. `0.2` means every 20% of `messageTokens` — with the default 30k threshold, that's roughly every 6k tokens. Can also be an absolute token count (e.g. `5000`). |
370
- | `observation.bufferActivation` | `0.8` | How aggressively to clear the message window on activation. `0.8` means remove enough messages to keep only 20% of `messageTokens` remaining. Lower values keep more message history. |
371
- | `observation.blockAfter` | `1.2` | Safety threshold as a multiplier of `messageTokens`. At `1.2`, synchronous observation is forced at 36k tokens (1.2 × 30k). Only matters if buffering can't keep up. |
372
- | `activateAfterIdle` | none | Forces buffered observations and buffered reflections to activate after a period of inactivity, even if their token thresholds have not been reached yet. Accepts milliseconds or duration strings like `300_000`, `"5m"`, or `"1hr"`. Set this to your prompt cache TTL if you want activation to happen before the next cold prompt. |
373
- | `activateOnProviderChange` | `false` | Forces buffered observations and reflections to activate when the next step uses a different `provider/model` than the one that produced the latest assistant step. Use this when switching providers or models would invalidate prompt cache reuse. |
374
- | `reflection.bufferActivation` | `0.5` | When to start background reflection. `0.5` means reflection begins when observations reach 50% of the `observationTokens` threshold. |
375
- | `reflection.blockAfter` | `1.2` | Safety threshold for reflection, same logic as observation. |
413
+ | Setting | Default | What it controls |
414
+ | ------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
415
+ | `observation.bufferTokens` | `0.2` | How often to buffer. `0.2` means every 20% of `messageTokens` — with the default 30k threshold, that's roughly every 6k tokens. Can also be an absolute token count (e.g. `5000`). |
416
+ | `observation.bufferActivation` | `0.8` | How aggressively to clear the message window on activation. `0.8` means remove enough messages to keep only 20% of `messageTokens` remaining. Lower values keep more message history. |
417
+ | `observation.blockAfter` | `1.2` | Safety threshold as a multiplier of `messageTokens`. At `1.2`, synchronous observation is forced at 36k tokens (1.2 × 30k). Only matters if buffering can't keep up. |
418
+ | `activateAfterIdle` | none | Forces buffered observations to activate after a period of inactivity, even before `observation.messageTokens` is reached. Accepts a numeric millisecond value such as `300_000`, or duration strings like `"5m"` or `"1hr"`. Set this to your prompt cache TTL if you want activation to happen before the next cold prompt. |
419
+ | `activateOnProviderChange` | `false` | Forces buffered observations to activate when the next step uses a different `provider/model` than the one that produced the latest assistant step. Use this when switching providers or models would invalidate prompt cache reuse. |
420
+ | `reflection.bufferActivation` | `0.5` | When to start background reflection. `0.5` means reflection begins when observations reach 50% of the `observationTokens` threshold. |
421
+ | `reflection.activateAfterIdle` | none | Opts buffered reflections into idle activation. Reflections don't inherit top-level `activateAfterIdle`. |
422
+ | `reflection.activateOnProviderChange` | `false` | Opts buffered reflections into provider-change activation. Reflections don't inherit top-level `activateOnProviderChange`. |
423
+ | `reflection.blockAfter` | `1.2` | Safety threshold for reflection, same logic as observation. |
376
424
 
377
- If you're relying on prompt caching, set `activateAfterIdle` to match your cache TTL. That way, once a thread has been idle long enough for the cache to expire, the next request can activate buffered observations or reflections first and send a smaller compressed context window.
425
+ If you're relying on prompt caching, set `activateAfterIdle` to match your cache TTL. That way, once a thread has been idle long enough for the cache to expire, the next request can activate buffered observations first and send a smaller compressed context window.
378
426
 
379
427
  ```typescript
380
428
  const memory = new Memory({
@@ -388,9 +436,9 @@ const memory = new Memory({
388
436
  })
389
437
  ```
390
438
 
391
- With a 5-minute prompt cache TTL, this activates buffered context after 5 minutes of inactivity so the next uncached prompt uses observations and reflections instead of a larger raw message window. If you prefer, `300_000` works the same way.
439
+ With a 5-minute prompt cache TTL, this activates buffered observations after 5 minutes of inactivity so the next uncached prompt uses compressed observations instead of a larger raw message window. If you prefer, `300_000` works the same way.
392
440
 
393
- Changing model or providers mid-thread will invalidate the prompt cache. If your agent can switch between providers or models mid-thread, `activateOnProviderChange: true` forces buffered context to activate before the new provider runs. That avoids sending a large raw window to a provider that cannot reuse the previous prompt cache.
441
+ Changing model or providers mid-thread will invalidate the prompt cache. If your agent can switch between providers or models mid-thread, `activateOnProviderChange: true` forces buffered observations to activate before the new provider runs. That avoids sending a large raw window to a provider that can't reuse the previous prompt cache.
394
442
 
395
443
  ### Disabling
396
444
 
@@ -121,26 +121,88 @@ Each vector store page below includes installation instructions, configuration p
121
121
 
122
122
  ## Recall configuration
123
123
 
124
- The three main parameters that control semantic recall behavior are:
124
+ The following options control semantic recall behavior:
125
125
 
126
- 1. **topK**: How many semantically similar messages to retrieve
127
- 2. **messageRange**: How much surrounding context to include with each match
128
- 3. **scope**: Whether to search within the current thread or across all threads owned by a resource (the default is resource scope).
126
+ 1. **topK**: The number of similar messages to retrieve
127
+ 2. **messageRange**: The surrounding messages to include with each match
128
+ 3. **scope**: Whether to search the current thread or all threads for a resource
129
+ 4. **filter**: Metadata criteria that restrict search results
129
130
 
130
131
  ```typescript
131
132
  const agent = new Agent({
132
133
  memory: new Memory({
133
134
  options: {
134
135
  semanticRecall: {
135
- topK: 3, // Retrieve 3 most similar messages
136
+ topK: 3, // Retrieve 3 similar messages
136
137
  messageRange: 2, // Include 2 messages before and after each match
137
- scope: 'resource', // Search across all threads for this user (default setting if omitted)
138
+ scope: 'resource', // Search all threads for this resource
139
+ filter: { projectId: { $eq: 'project-a' } },
138
140
  },
139
141
  },
140
142
  }),
141
143
  })
142
144
  ```
143
145
 
146
+ > **Note:** `scope: 'resource'` is supported by the LibSQL, PostgreSQL, and Upstash storage adapters.
147
+
148
+ ### Metadata filtering
149
+
150
+ The `filter` option restricts semantic recall results to messages with matching thread metadata.
151
+
152
+ ```typescript
153
+ const agent = new Agent({
154
+ memory: new Memory({
155
+ options: {
156
+ semanticRecall: {
157
+ scope: 'resource',
158
+ filter: {
159
+ projectId: { $eq: 'project-a' },
160
+ category: { $in: ['work', 'personal'] },
161
+ },
162
+ },
163
+ },
164
+ }),
165
+ })
166
+ ```
167
+
168
+ Filters match metadata stored on message embeddings when messages are saved. If thread metadata changes later, existing embeddings keep their previous metadata until those messages are saved or indexed again.
169
+
170
+ Supported filter operators:
171
+
172
+ - `$and`: Logical AND
173
+ - `$eq`: Equal to
174
+ - `$gt`: Greater than
175
+ - `$gte`: Greater than or equal
176
+ - `$in`: In array
177
+ - `$lt`: Less than
178
+ - `$lte`: Less than or equal
179
+ - `$ne`: Not equal to
180
+ - `$nin`: Not in array
181
+ - `$or`: Logical OR
182
+
183
+ The following example demonstrates metadata filters for common use cases:
184
+
185
+ ```typescript
186
+ // Filter by project
187
+ const options = {
188
+ semanticRecall: { filter: { projectId: { $eq: 'my-project' } } },
189
+ }
190
+
191
+ // Filter by multiple categories
192
+ const options = {
193
+ semanticRecall: { filter: { category: { $in: ['work', 'research'] } } },
194
+ }
195
+
196
+ // Filter by project and priority
197
+ const options = {
198
+ semanticRecall: {
199
+ filter: {
200
+ $and: [{ projectId: { $eq: 'project-a' } }, { priority: { $gte: 3 } }],
201
+ },
202
+ },
203
+ }
204
+ ```
205
+
144
206
  ## Embedder configuration
145
207
 
146
208
  Semantic recall relies on an [embedding model](https://mastra.ai/reference/memory/memory-class) to convert messages into embeddings. Mastra supports embedding models through the model router using `provider/model` strings, or you can use any [embedding model](https://sdk.vercel.ai/docs/ai-sdk-core/embeddings) compatible with the AI SDK.
@@ -35,7 +35,7 @@ You can control which log levels reach observability storage independently from
35
35
  ```typescript
36
36
  import { Mastra } from '@mastra/core/mastra'
37
37
  import { PinoLogger } from '@mastra/loggers'
38
- import { Observability, DefaultExporter } from '@mastra/observability'
38
+ import { Observability, MastraStorageExporter } from '@mastra/observability'
39
39
 
40
40
  export const mastra = new Mastra({
41
41
  logger: new PinoLogger({ name: 'Mastra', level: 'debug' }),
@@ -43,7 +43,7 @@ export const mastra = new Mastra({
43
43
  configs: {
44
44
  default: {
45
45
  serviceName: 'my-app',
46
- exporters: [new DefaultExporter()],
46
+ exporters: [new MastraStorageExporter()],
47
47
  logging: {
48
48
  enabled: true, // set to false to disable log forwarding
49
49
  level: 'info', // minimum level: 'debug' | 'info' | 'warn' | 'error' | 'fatal'
@@ -54,7 +54,7 @@ import { Mastra } from '@mastra/core/mastra'
54
54
  import { LibSQLStore } from '@mastra/libsql'
55
55
  import { DuckDBStore } from '@mastra/duckdb'
56
56
  import { MastraCompositeStore } from '@mastra/core/storage'
57
- import { Observability, DefaultExporter, SensitiveDataFilter } from '@mastra/observability'
57
+ import { Observability, MastraStorageExporter, SensitiveDataFilter } from '@mastra/observability'
58
58
 
59
59
  export const mastra = new Mastra({
60
60
  storage: new MastraCompositeStore({
@@ -71,7 +71,7 @@ export const mastra = new Mastra({
71
71
  configs: {
72
72
  default: {
73
73
  serviceName: 'mastra',
74
- exporters: [new DefaultExporter()],
74
+ exporters: [new MastraStorageExporter()],
75
75
  spanOutputProcessors: [new SensitiveDataFilter()],
76
76
  },
77
77
  },
@@ -103,7 +103,7 @@ Mastra auto-instruments agent runs, workflow steps, tool calls, and model genera
103
103
  2. **Token usage**: Extracted from the `usage` attribute on model generation spans.
104
104
  3. **Cost estimation**: Runs each token metric through an embedded pricing registry that matches by provider and model name.
105
105
 
106
- Before storage, all metric labels pass through a cardinality filter that blocks known high-cardinality values (such as trace IDs and UUIDs) to keep storage efficient. Metrics are then batched by an internal event buffer and flushed to storage by the `DefaultExporter`.
106
+ Before storage, all metric labels pass through a cardinality filter that blocks known high-cardinality values (such as trace IDs and UUIDs) to keep storage efficient. Metrics are then batched by an internal event buffer and flushed to storage by the `MastraStorageExporter`.
107
107
 
108
108
  ## Next steps
109
109
 
@@ -111,4 +111,4 @@ Before storage, all metric labels pass through a cardinality filter that blocks
111
111
  - [Tracing overview](https://mastra.ai/docs/observability/tracing/overview)
112
112
  - [Studio observability](https://mastra.ai/docs/studio/observability)
113
113
  - [Observability overview](https://mastra.ai/docs/observability/overview)
114
- - [DefaultExporter reference](https://mastra.ai/docs/observability/tracing/exporters/default)
114
+ - [MastraStorageExporter reference](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage)