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

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 (108) 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/editor/tools.md +1 -1
  10. package/.docs/docs/index.md +2 -2
  11. package/.docs/docs/mastra-platform/configuration.md +1 -1
  12. package/.docs/docs/mastra-platform/overview.md +1 -1
  13. package/.docs/docs/memory/observational-memory.md +61 -13
  14. package/.docs/docs/memory/semantic-recall.md +68 -6
  15. package/.docs/docs/observability/logging.md +2 -2
  16. package/.docs/docs/observability/metrics/overview.md +4 -4
  17. package/.docs/docs/observability/overview.md +6 -6
  18. package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
  19. package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
  20. package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
  21. package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
  22. package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +28 -26
  23. package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
  24. package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
  25. package/.docs/docs/observability/tracing/overview.md +30 -29
  26. package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
  27. package/.docs/docs/server/mastra-server.md +30 -19
  28. package/.docs/docs/studio/observability.md +4 -4
  29. package/.docs/docs/studio/overview.md +6 -0
  30. package/.docs/docs/voice/overview.md +84 -0
  31. package/.docs/docs/workflows/suspend-and-resume.md +28 -1
  32. package/.docs/guides/deployment/inngest.md +23 -0
  33. package/.docs/guides/migrations/mastra-cloud.md +6 -6
  34. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
  35. package/.docs/models/gateways/netlify.md +2 -1
  36. package/.docs/models/gateways/openrouter.md +4 -1
  37. package/.docs/models/gateways/vercel.md +2 -1
  38. package/.docs/models/index.md +1 -1
  39. package/.docs/models/providers/chutes.md +23 -54
  40. package/.docs/models/providers/databricks.md +96 -0
  41. package/.docs/models/providers/deepseek.md +3 -1
  42. package/.docs/models/providers/digitalocean.md +9 -2
  43. package/.docs/models/providers/firepass.md +71 -0
  44. package/.docs/models/providers/google.md +3 -2
  45. package/.docs/models/providers/kilo.md +5 -3
  46. package/.docs/models/providers/llmgateway.md +7 -1
  47. package/.docs/models/providers/nebius.md +37 -55
  48. package/.docs/models/providers/novita-ai.md +5 -5
  49. package/.docs/models/providers/nvidia.md +59 -49
  50. package/.docs/models/providers/ollama-cloud.md +1 -1
  51. package/.docs/models/providers/openai.md +2 -0
  52. package/.docs/models/providers/opencode.md +44 -43
  53. package/.docs/models/providers/poe.md +4 -1
  54. package/.docs/models/providers/sarvam.md +72 -0
  55. package/.docs/models/providers/wafer.ai.md +2 -1
  56. package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
  57. package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
  58. package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
  59. package/.docs/models/providers.md +3 -1
  60. package/.docs/reference/agents/agent.md +85 -0
  61. package/.docs/reference/browser/agent-browser.md +37 -11
  62. package/.docs/reference/browser/stagehand-browser.md +35 -9
  63. package/.docs/reference/cli/mastra.md +33 -1
  64. package/.docs/reference/client-js/agents.md +115 -1
  65. package/.docs/reference/client-js/responses.md +4 -0
  66. package/.docs/reference/configuration.md +6 -6
  67. package/.docs/reference/editor/tool-provider.md +3 -3
  68. package/.docs/reference/harness/harness-class.md +21 -8
  69. package/.docs/reference/index.md +5 -0
  70. package/.docs/reference/memory/observational-memory.md +11 -1
  71. package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
  72. package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
  73. package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
  74. package/.docs/reference/observability/tracing/configuration.md +6 -3
  75. package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
  76. package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
  77. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -1
  78. package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
  79. package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
  80. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
  81. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
  82. package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
  83. package/.docs/reference/observability/tracing/instances.md +2 -2
  84. package/.docs/reference/observability/tracing/interfaces.md +37 -2
  85. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
  86. package/.docs/reference/observability/tracing/span-filtering.md +2 -2
  87. package/.docs/reference/processors/prefill-error-handler.md +3 -3
  88. package/.docs/reference/processors/response-cache.md +114 -0
  89. package/.docs/reference/processors/tool-call-filter.md +28 -0
  90. package/.docs/reference/storage/clickhouse.md +8 -8
  91. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  92. package/.docs/reference/storage/cloudflare.md +1 -1
  93. package/.docs/reference/storage/composite.md +1 -1
  94. package/.docs/reference/storage/convex.md +1 -1
  95. package/.docs/reference/storage/dsql.md +428 -0
  96. package/.docs/reference/storage/duckdb.md +3 -3
  97. package/.docs/reference/storage/dynamodb.md +1 -1
  98. package/.docs/reference/storage/lance.md +1 -1
  99. package/.docs/reference/storage/libsql.md +1 -1
  100. package/.docs/reference/storage/postgresql.md +1 -1
  101. package/.docs/reference/storage/upstash.md +1 -1
  102. package/.docs/reference/streaming/ChunkType.md +44 -0
  103. package/.docs/reference/tools/brightdata.md +167 -0
  104. package/.docs/reference/tools/create-tool.md +46 -0
  105. package/.docs/reference/voice/inworld.md +133 -0
  106. package/.docs/reference/workflows/workflow-state-reader.md +113 -0
  107. package/CHANGELOG.md +106 -0
  108. package/package.json +5 -5
@@ -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)
@@ -61,8 +61,8 @@ import { DuckDBStore } from '@mastra/duckdb'
61
61
  import { MastraCompositeStore } from '@mastra/core/storage'
62
62
  import {
63
63
  Observability,
64
- DefaultExporter,
65
- CloudExporter,
64
+ MastraStorageExporter,
65
+ MastraPlatformExporter,
66
66
  SensitiveDataFilter,
67
67
  } from '@mastra/observability'
68
68
 
@@ -82,8 +82,8 @@ export const mastra = new Mastra({
82
82
  default: {
83
83
  serviceName: 'mastra',
84
84
  exporters: [
85
- new DefaultExporter(), // Persists traces to storage for Mastra Studio
86
- new CloudExporter(), // Sends observability data to hosted Mastra Studio (if MASTRA_CLOUD_ACCESS_TOKEN is set)
85
+ new MastraStorageExporter(), // Persists observability events to Mastra Storage
86
+ new MastraPlatformExporter(), // Sends observability events to Mastra Platform (if MASTRA_CLOUD_ACCESS_TOKEN is set)
87
87
  ],
88
88
  spanOutputProcessors: [
89
89
  new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
@@ -98,9 +98,9 @@ This enables tracing, log forwarding, and metrics. Mastra also supports external
98
98
 
99
99
  ## Storage
100
100
 
101
- Not all storage backends support every signal. Traces and logs work with most backends, but metrics require an OLAP-capable store like DuckDB (development) or ClickHouse (production). For the full compatibility list, see [storage provider support](https://mastra.ai/docs/observability/tracing/exporters/default).
101
+ Not all storage backends support every signal. Traces and logs work with most backends, but metrics require an OLAP-capable store like DuckDB (development) or ClickHouse (production). For the full compatibility list, see [storage provider support](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage).
102
102
 
103
- For production environments with high traffic, use composite storage to route the observability domain to a dedicated backend. See [production recommendations](https://mastra.ai/docs/observability/tracing/exporters/default) for details.
103
+ For production environments with high traffic, use composite storage to route the observability domain to a dedicated backend. See [production recommendations](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage) for details.
104
104
 
105
105
  ## Next steps
106
106
 
@@ -31,6 +31,7 @@ The OtelBridge provides two-way integration:
31
31
  - Creates native OTEL spans for Mastra operations (agents, LLM calls, tools, workflows)
32
32
  - Maintains proper parent-child relationships in distributed traces
33
33
  - Allows OTEL-instrumented code (HTTP clients, database calls) within Mastra operations to nest correctly
34
+ - Forwards Mastra log events to the globally-registered OTEL `LoggerProvider`. Logs that originate inside a Mastra span are emitted under that span's OTEL context so backends correlate them with the trace. If no `LoggerProvider` is registered, log emission is a silent no-op.
34
35
 
35
36
  ## Installation
36
37
 
@@ -67,6 +68,7 @@ The bridge works with your existing OpenTelemetry setup. Depending on your confi
67
68
  - `@opentelemetry/exporter-trace-otlp-grpc` - OTLP exporter (gRPC)
68
69
  - `@opentelemetry/sdk-trace-base` - Base tracing SDK (for BatchSpanProcessor, etc.)
69
70
  - `@opentelemetry/core` - Core utilities (for W3CTraceContextPropagator, etc.)
71
+ - `@opentelemetry/sdk-logs` and an OTLP log exporter (e.g. `@opentelemetry/exporter-logs-otlp-http`) - Required if you want the bridge to forward Mastra log events too
70
72
 
71
73
  ## Configuration
72
74
 
@@ -130,6 +132,29 @@ export const mastra = new Mastra({
130
132
 
131
133
  No Mastra exporters are required when using the bridge — traces are sent via your OTEL SDK configuration. You can optionally add Mastra exporters if you want to send traces to additional destinations.
132
134
 
135
+ ### Forwarding logs (optional)
136
+
137
+ The bridge also forwards Mastra log events to the globally-registered OTEL `LoggerProvider`. To wire up logs alongside traces, register a `logRecordProcessor` on `NodeSDK`:
138
+
139
+ ```typescript
140
+ import { NodeSDK } from '@opentelemetry/sdk-node'
141
+ import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http'
142
+ import { BatchLogRecordProcessor } from '@opentelemetry/sdk-logs'
143
+
144
+ const sdk = new NodeSDK({
145
+ // ...trace config as usual
146
+ logRecordProcessor: new BatchLogRecordProcessor(
147
+ new OTLPLogExporter({
148
+ url: process.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT || 'http://localhost:4318/v1/logs',
149
+ }),
150
+ ),
151
+ })
152
+ ```
153
+
154
+ Logs that originate inside a Mastra span are emitted under that span's OTEL context, so backends like Datadog, Grafana, and Honeycomb correlate them with the surrounding trace automatically. Logs without trace context fall through to the currently active OTEL context.
155
+
156
+ If you do not register a `LoggerProvider`, log emission is a silent no-op — traces continue to work as configured.
157
+
133
158
  ### Running Your Application
134
159
 
135
160
  Use the `--import` flag to ensure instrumentation loads before your application:
@@ -43,7 +43,7 @@ Phoenix is an open-source observability platform that can be self-hosted or used
43
43
 
44
44
  ```bash
45
45
  # Required
46
- PHOENIX_ENDPOINT=http://localhost:6006/v1/traces # Or your Phoenix Cloud URL
46
+ PHOENIX_COLLECTOR_ENDPOINT=http://localhost:6006/v1/traces # Or your Phoenix Cloud URL
47
47
 
48
48
  # Optional
49
49
  PHOENIX_API_KEY=your-api-key # For authenticated Phoenix instances
@@ -87,7 +87,7 @@ export const mastra = new Mastra({
87
87
  serviceName: process.env.PHOENIX_PROJECT_NAME || 'mastra-service',
88
88
  exporters: [
89
89
  new ArizeExporter({
90
- endpoint: process.env.PHOENIX_ENDPOINT!,
90
+ endpoint: process.env.PHOENIX_COLLECTOR_ENDPOINT!,
91
91
  apiKey: process.env.PHOENIX_API_KEY,
92
92
  projectName: process.env.PHOENIX_PROJECT_NAME,
93
93
  }),
@@ -106,7 +106,7 @@ export const mastra = new Mastra({
106
106
  > arizephoenix/phoenix:latest
107
107
  > ```
108
108
  >
109
- > Set `PHOENIX_ENDPOINT=http://localhost:6006/v1/traces` and run your Mastra agent to see traces at [localhost:6006](http://localhost:6006).
109
+ > Set `PHOENIX_COLLECTOR_ENDPOINT=http://localhost:6006/v1/traces` and run your Mastra agent to see traces at [localhost:6006](http://localhost:6006).
110
110
 
111
111
  ### Arize AX Setup
112
112
 
@@ -218,7 +218,7 @@ Control how traces are batched and exported:
218
218
 
219
219
  ```typescript
220
220
  new ArizeExporter({
221
- endpoint: process.env.PHOENIX_ENDPOINT!,
221
+ endpoint: process.env.PHOENIX_COLLECTOR_ENDPOINT!,
222
222
  apiKey: process.env.PHOENIX_API_KEY,
223
223
 
224
224
  // Batch processing configuration
@@ -233,7 +233,7 @@ Add custom attributes to all exported spans:
233
233
 
234
234
  ```typescript
235
235
  new ArizeExporter({
236
- endpoint: process.env.PHOENIX_ENDPOINT!,
236
+ endpoint: process.env.PHOENIX_COLLECTOR_ENDPOINT!,
237
237
  resourceAttributes: {
238
238
  'deployment.environment': process.env.NODE_ENV,
239
239
  'service.namespace': 'production',
@@ -105,6 +105,43 @@ new BraintrustExporter({
105
105
  })
106
106
  ```
107
107
 
108
+ ## Attach traces to Braintrust evals
109
+
110
+ When you run Mastra inside Braintrust `Eval()` or `logger.traced()`, pass the Braintrust logger and `currentSpan` resolver to the exporter. Import `currentSpan` from the same `braintrust` package instance that creates the eval or traced span.
111
+
112
+ This helps Mastra attach its spans under the active Braintrust span when your app and `@mastra/braintrust` resolve different installed copies of the Braintrust SDK.
113
+
114
+ ```typescript
115
+ import { currentSpan, initLogger } from 'braintrust'
116
+ import { BraintrustExporter } from '@mastra/braintrust'
117
+
118
+ const logger = initLogger({
119
+ projectName: 'my-project',
120
+ apiKey: process.env.BRAINTRUST_API_KEY,
121
+ })
122
+
123
+ const exporter = new BraintrustExporter({
124
+ braintrustLogger: logger,
125
+ currentSpan,
126
+ })
127
+ ```
128
+
129
+ Use the configured Mastra instance inside the Braintrust eval task. The `currentSpan` resolver above reads the active span created by `Eval()`.
130
+
131
+ ```typescript
132
+ import { Eval } from 'braintrust'
133
+ import { mastra } from '../mastra'
134
+
135
+ await Eval('my-project', {
136
+ data: () => [{ input: 'Say hello', expected: 'Hello' }],
137
+ task: async input => {
138
+ const agent = mastra.getAgent('assistant')
139
+ return (await agent.generate(input)).text
140
+ },
141
+ scores: [],
142
+ })
143
+ ```
144
+
108
145
  ## Querying Braintrust with returned `spanId`
109
146
 
110
147
  For Braintrust, use `spanId` as the root span identifier when searching for traces because Braintrust root-span queries are typically faster than trace-id queries.
@@ -172,6 +172,27 @@ new LangfuseExporter({
172
172
  })
173
173
  ```
174
174
 
175
+ ## Scoping evaluators per agent
176
+
177
+ Langfuse evaluators (such as LLM-as-a-Judge) can be filtered to run only against specific traces. The Mastra Langfuse exporter automatically scopes each trace to the agent or workflow that started it, so trace-level filters resolve to the right runs.
178
+
179
+ For every trace whose root span is an `AGENT_RUN`, the exporter sets:
180
+
181
+ - `langfuse.trace.name`: the agent name (or id, when no name is set)
182
+ - `langfuse.trace.metadata.agentId`: the agent id
183
+ - `langfuse.trace.metadata.agentName`: the agent name
184
+
185
+ The same applies to `WORKFLOW_RUN` root spans, which set `langfuse.trace.metadata.workflowId` and `langfuse.trace.metadata.workflowName`.
186
+
187
+ To scope an evaluator to a specific agent, configure either filter in Langfuse:
188
+
189
+ - **Trace name**: equals the agent name (for example, `weather-agent`).
190
+ - **Metadata**: `agentId` equals the agent id.
191
+
192
+ The trace name dropdown in Langfuse evaluator filters lists every distinct value seen, so each agent appears as its own entry once it has produced at least one trace.
193
+
194
+ If you set a custom `traceName` via `mastra.metadata.traceName`, your value takes precedence over the default agent name.
195
+
175
196
  ## Prompt linking
176
197
 
177
198
  You can link LLM generations to prompts stored in [Langfuse Prompt Management](https://langfuse.com/docs/prompt-management). This enables version tracking and metrics for your prompts.
@@ -1,8 +1,10 @@
1
- # Cloud exporter
1
+ # Mastra Platform exporter
2
2
 
3
- The `CloudExporter` sends traces, logs, metrics, scores, and feedback to the Mastra platform. Use it to route observability data from any Mastra app to a hosted project in the Mastra platform.
3
+ The `MastraPlatformExporter` sends traces, logs, metrics, scores, and feedback to the Mastra platform. Use it to route observability data from any Mastra app to a hosted project in the Mastra platform.
4
4
 
5
- > **Self-hosted or standalone apps:** If you host your Mastra application on your own infrastructure (not on Mastra Platform), you still need a deployed Studio project to view traces, logs, and metrics. `CloudExporter` sends data to a Studio project, so one must exist before you can use it.
5
+ > **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` for backward compatibility, but it is deprecated. New code should use `MastraPlatformExporter`.
6
+
7
+ > **Self-hosted or standalone apps:** If you host your Mastra application on your own infrastructure (not on Mastra Platform), you still need a deployed Studio project to view traces, logs, and metrics. `MastraPlatformExporter` sends data to a Studio project, so one must exist before you can use it.
6
8
  >
7
9
  > 1. [Create a Mastra project](https://mastra.ai/guides/getting-started/quickstart) if you don't have one yet.
8
10
  > 2. [Deploy Studio](https://mastra.ai/docs/studio/deployment) to the Mastra platform with `mastra studio deploy`.
@@ -10,13 +12,13 @@ The `CloudExporter` sends traces, logs, metrics, scores, and feedback to the Mas
10
12
 
11
13
  ## Version compatibility
12
14
 
13
- - Use `CloudExporter` with `@mastra/observability@1.8.0` or later.
14
- - If you use `@mastra/observability@1.8.0` through `1.9.1`, set `MASTRA_CLOUD_TRACES_ENDPOINT=https://observability.mastra.ai` in addition to `MASTRA_CLOUD_ACCESS_TOKEN` and `MASTRA_PROJECT_ID`.
15
- - Starting in `@mastra/observability@1.9.2`, `CloudExporter` defaults to `https://observability.mastra.ai`, so `MASTRA_CLOUD_TRACES_ENDPOINT` is only required when you want to send telemetry to a different collector.
15
+ - `MastraPlatformExporter` is available starting in `@mastra/observability@1.12.0`. In `1.8.0` through `1.11.x` the same exporter ships only as `CloudExporter`; the constructor signature and environment variables are identical.
16
+ - In `@mastra/observability@1.8.0` through `1.9.1`, set `MASTRA_CLOUD_TRACES_ENDPOINT=https://observability.mastra.ai` in addition to `MASTRA_CLOUD_ACCESS_TOKEN` and `MASTRA_PROJECT_ID`.
17
+ - Starting in `@mastra/observability@1.9.2`, the exporter defaults to `https://observability.mastra.ai`, so `MASTRA_CLOUD_TRACES_ENDPOINT` is only required when you want to send telemetry to a different collector.
16
18
 
17
19
  ## Quickstart
18
20
 
19
- To connect `CloudExporter`, create an access token, find the destination `projectId`, and add the exporter to your observability config.
21
+ To connect `MastraPlatformExporter`, create an access token, find the destination `projectId`, and add the exporter to your observability config.
20
22
 
21
23
  ### 1. Create an access token
22
24
 
@@ -69,7 +71,7 @@ MASTRA_PROJECT_ID=<your-project-id>
69
71
 
70
72
  ### 3. Set your environment variables
71
73
 
72
- Set both values in your environment so `CloudExporter` can authenticate and route telemetry to the correct project:
74
+ Set both values in your environment so `MastraPlatformExporter` can authenticate and route telemetry to the correct project:
73
75
 
74
76
  ```bash
75
77
  MASTRA_CLOUD_ACCESS_TOKEN=<your-cloud-access-token>
@@ -88,29 +90,29 @@ If you want to send telemetry somewhere other than Mastra platform, set `MASTRA_
88
90
  MASTRA_CLOUD_TRACES_ENDPOINT=https://collector.example.com
89
91
  ```
90
92
 
91
- When you pass a base origin, `CloudExporter` derives the matching publish URLs for traces, logs, metrics, scores, and feedback automatically.
93
+ When you pass a base origin, `MastraPlatformExporter` derives the matching publish URLs for traces, logs, metrics, scores, and feedback automatically.
92
94
 
93
- ### 4. Enable `CloudExporter`
95
+ ### 4. Enable `MastraPlatformExporter`
94
96
 
95
- The following example demonstrates how to add `CloudExporter` to your observability config:
97
+ The following example demonstrates how to add `MastraPlatformExporter` to your observability config:
96
98
 
97
99
  ```ts
98
100
  import { Mastra } from '@mastra/core'
99
- import { Observability, CloudExporter } from '@mastra/observability'
101
+ import { Observability, MastraPlatformExporter } from '@mastra/observability'
100
102
 
101
103
  export const mastra = new Mastra({
102
104
  observability: new Observability({
103
105
  configs: {
104
106
  production: {
105
107
  serviceName: 'api-server',
106
- exporters: [new CloudExporter()],
108
+ exporters: [new MastraPlatformExporter()],
107
109
  },
108
110
  },
109
111
  }),
110
112
  })
111
113
  ```
112
114
 
113
- Set `serviceName` on the observability config, not on `CloudExporter` itself.
115
+ Set `serviceName` on the observability config, not on `MastraPlatformExporter` itself.
114
116
 
115
117
  Use a stable `serviceName` value. In Studio, traces can be filtered by **Deployments → Service Name**, so a consistent name makes traces easier to find.
116
118
 
@@ -119,23 +121,23 @@ Visit [Observability configuration reference](https://mastra.ai/reference/observ
119
121
  If you prefer, rely entirely on environment variables:
120
122
 
121
123
  ```ts
122
- new CloudExporter()
124
+ new MastraPlatformExporter()
123
125
  ```
124
126
 
125
- With `MASTRA_CLOUD_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` set, `CloudExporter` sends data to the Mastra platform project you configured. If you also set `MASTRA_CLOUD_TRACES_ENDPOINT`, it sends data to that collector instead.
127
+ With `MASTRA_CLOUD_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` set, `MastraPlatformExporter` sends data to the Mastra platform project you configured. If you also set `MASTRA_CLOUD_TRACES_ENDPOINT`, it sends data to that collector instead.
126
128
 
127
- > **Note:** Visit [CloudExporter reference](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter) for the full list of configuration options.
129
+ > **Note:** Visit [MastraPlatformExporter reference](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for the full list of configuration options.
128
130
 
129
131
  ## Recommended configuration
130
132
 
131
- Include `DefaultExporter` if you also want to inspect local traces in Studio or persist observability data to your configured storage.
133
+ Include `MastraStorageExporter` if you also want to inspect local traces in Studio or persist observability data to your configured storage.
132
134
 
133
135
  ```ts
134
136
  import { Mastra } from '@mastra/core'
135
137
  import {
136
138
  Observability,
137
- DefaultExporter,
138
- CloudExporter,
139
+ MastraStorageExporter,
140
+ MastraPlatformExporter,
139
141
  SensitiveDataFilter,
140
142
  } from '@mastra/observability'
141
143
 
@@ -144,7 +146,7 @@ export const mastra = new Mastra({
144
146
  configs: {
145
147
  default: {
146
148
  serviceName: 'mastra',
147
- exporters: [new DefaultExporter(), new CloudExporter()],
149
+ exporters: [new MastraStorageExporter(), new MastraPlatformExporter()],
148
150
  spanOutputProcessors: [new SensitiveDataFilter()],
149
151
  },
150
152
  },
@@ -154,7 +156,7 @@ export const mastra = new Mastra({
154
156
 
155
157
  ## Complete configuration
156
158
 
157
- `CloudExporter` defaults to Mastra platform. If you want to send telemetry to a different collector, set `MASTRA_CLOUD_TRACES_ENDPOINT` in your environment or pass `endpoint` in code.
159
+ `MastraPlatformExporter` defaults to Mastra platform. If you want to send telemetry to a different collector, set `MASTRA_CLOUD_TRACES_ENDPOINT` in your environment or pass `endpoint` in code.
158
160
 
159
161
  ```bash
160
162
  MASTRA_CLOUD_TRACES_ENDPOINT=https://collector.example.com
@@ -163,7 +165,7 @@ MASTRA_CLOUD_TRACES_ENDPOINT=https://collector.example.com
163
165
  The following example demonstrates how to override the collector endpoint and batching behavior in code:
164
166
 
165
167
  ```ts
166
- new CloudExporter({
168
+ new MastraPlatformExporter({
167
169
  endpoint: 'https://collector.example.com',
168
170
  maxBatchSize: 1000,
169
171
  maxBatchWaitMs: 5000,
@@ -173,7 +175,7 @@ new CloudExporter({
173
175
 
174
176
  ## Viewing data in Mastra Studio
175
177
 
176
- After you enable `CloudExporter`, open your project in [Mastra Studio](https://projects.mastra.ai) to inspect the exported data.
178
+ After you enable `MastraPlatformExporter`, open your project in [Mastra Studio](https://projects.mastra.ai) to inspect the exported data.
177
179
 
178
180
  - Open the project you set `MASTRA_PROJECT_ID` to and select **Open Studio**.
179
181
  - In Studio, go to **Traces** to inspect agent and workflow traces.
@@ -184,7 +186,7 @@ When you deploy with Mastra Studio, set **Deployment → Service Name** to a sta
184
186
 
185
187
  ## Performance
186
188
 
187
- > **Info:** CloudExporter uses batching to optimize network usage. Events are buffered and sent in batches, reducing overhead while maintaining near real-time visibility.
189
+ > **Info:** MastraPlatformExporter uses batching to optimize network usage. Events are buffered and sent in batches, reducing overhead while maintaining near real-time visibility.
188
190
 
189
191
  ### Batching behavior
190
192
 
@@ -196,4 +198,4 @@ When you deploy with Mastra Studio, set **Deployment → Service Name** to a sta
196
198
  ## Related
197
199
 
198
200
  - [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
199
- - [DefaultExporter](https://mastra.ai/docs/observability/tracing/exporters/default)
201
+ - [MastraStorageExporter](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage)