@mastra/core 1.18.1-alpha.0 → 1.19.0-alpha.2

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 (225) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/agent/agent-legacy.d.ts +3 -1
  3. package/dist/agent/agent-legacy.d.ts.map +1 -1
  4. package/dist/agent/agent.d.ts +3 -1
  5. package/dist/agent/agent.d.ts.map +1 -1
  6. package/dist/agent/index.cjs +8 -8
  7. package/dist/agent/index.js +1 -1
  8. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  9. package/dist/{chunk-AV4YSAZL.cjs → chunk-2OYWVA6F.cjs} +17 -2
  10. package/dist/chunk-2OYWVA6F.cjs.map +1 -0
  11. package/dist/{chunk-45LU555A.cjs → chunk-2RTFET56.cjs} +7 -7
  12. package/dist/{chunk-45LU555A.cjs.map → chunk-2RTFET56.cjs.map} +1 -1
  13. package/dist/{chunk-LKZQG2ZZ.cjs → chunk-4TUILCMR.cjs} +7 -6
  14. package/dist/chunk-4TUILCMR.cjs.map +1 -0
  15. package/dist/{chunk-NMDKJUHA.cjs → chunk-5OBBDZBA.cjs} +185 -185
  16. package/dist/{chunk-NMDKJUHA.cjs.map → chunk-5OBBDZBA.cjs.map} +1 -1
  17. package/dist/{chunk-OF7ELKXY.js → chunk-6TEEIOHA.js} +4 -4
  18. package/dist/{chunk-OF7ELKXY.js.map → chunk-6TEEIOHA.js.map} +1 -1
  19. package/dist/{chunk-KG5NOH3Z.js → chunk-6XYHMM2X.js} +8 -8
  20. package/dist/{chunk-KG5NOH3Z.js.map → chunk-6XYHMM2X.js.map} +1 -1
  21. package/dist/{chunk-IVXAQT6H.js → chunk-BS5UESNT.js} +93 -42
  22. package/dist/chunk-BS5UESNT.js.map +1 -0
  23. package/dist/{chunk-NRIT3KHS.js → chunk-CSIKD56W.js} +3 -3
  24. package/dist/{chunk-NRIT3KHS.js.map → chunk-CSIKD56W.js.map} +1 -1
  25. package/dist/{chunk-KEYCLRBI.js → chunk-D5EXC3XM.js} +4 -4
  26. package/dist/{chunk-KEYCLRBI.js.map → chunk-D5EXC3XM.js.map} +1 -1
  27. package/dist/{chunk-XQRTJIC7.cjs → chunk-E2SMTTP6.cjs} +45 -16
  28. package/dist/chunk-E2SMTTP6.cjs.map +1 -0
  29. package/dist/{chunk-RVBOSWN5.cjs → chunk-E3JUOJME.cjs} +5 -5
  30. package/dist/{chunk-RVBOSWN5.cjs.map → chunk-E3JUOJME.cjs.map} +1 -1
  31. package/dist/{chunk-FA4PTEBK.js → chunk-EWPUWV33.js} +18 -3
  32. package/dist/chunk-EWPUWV33.js.map +1 -0
  33. package/dist/{chunk-BWRB3RPC.js → chunk-F4PVOQKD.js} +3 -3
  34. package/dist/{chunk-BWRB3RPC.js.map → chunk-F4PVOQKD.js.map} +1 -1
  35. package/dist/{chunk-TJNYXDI7.cjs → chunk-GFQPMPSV.cjs} +7 -113
  36. package/dist/chunk-GFQPMPSV.cjs.map +1 -0
  37. package/dist/{chunk-V2NQOABM.cjs → chunk-GNA52EF4.cjs} +9 -9
  38. package/dist/{chunk-V2NQOABM.cjs.map → chunk-GNA52EF4.cjs.map} +1 -1
  39. package/dist/{chunk-GALW5K2E.js → chunk-IOHKSHT4.js} +3 -3
  40. package/dist/{chunk-GALW5K2E.js.map → chunk-IOHKSHT4.js.map} +1 -1
  41. package/dist/{chunk-Z7DO2WCR.cjs → chunk-IQV2SVCE.cjs} +52 -52
  42. package/dist/{chunk-Z7DO2WCR.cjs.map → chunk-IQV2SVCE.cjs.map} +1 -1
  43. package/dist/{chunk-GXXNF6NF.cjs → chunk-L2FL7HMV.cjs} +35 -30
  44. package/dist/chunk-L2FL7HMV.cjs.map +1 -0
  45. package/dist/{chunk-HZI7AYCD.js → chunk-M62LMDHE.js} +8 -7
  46. package/dist/chunk-M62LMDHE.js.map +1 -0
  47. package/dist/{chunk-TPE5VTVF.cjs → chunk-MN7WNZE6.cjs} +6 -6
  48. package/dist/{chunk-TPE5VTVF.cjs.map → chunk-MN7WNZE6.cjs.map} +1 -1
  49. package/dist/{chunk-7W6PDCOH.cjs → chunk-NWOPWLJ3.cjs} +83 -82
  50. package/dist/chunk-NWOPWLJ3.cjs.map +1 -0
  51. package/dist/{chunk-CJ4RMDJJ.cjs → chunk-O542TXPV.cjs} +145 -94
  52. package/dist/chunk-O542TXPV.cjs.map +1 -0
  53. package/dist/{chunk-4FMKWOPC.js → chunk-OZHBY6NY.js} +32 -5
  54. package/dist/chunk-OZHBY6NY.js.map +1 -0
  55. package/dist/{chunk-MJF7NZEF.js → chunk-PPCEPCG7.js} +3 -3
  56. package/dist/{chunk-MJF7NZEF.js.map → chunk-PPCEPCG7.js.map} +1 -1
  57. package/dist/{chunk-CU764D5P.cjs → chunk-QB4YHCVA.cjs} +15 -15
  58. package/dist/{chunk-CU764D5P.cjs.map → chunk-QB4YHCVA.cjs.map} +1 -1
  59. package/dist/{chunk-K7AE4BHR.js → chunk-QIOD3LOP.js} +4 -3
  60. package/dist/chunk-QIOD3LOP.js.map +1 -0
  61. package/dist/{chunk-DTT543MP.cjs → chunk-RD76XK7E.cjs} +3 -3
  62. package/dist/{chunk-DTT543MP.cjs.map → chunk-RD76XK7E.cjs.map} +1 -1
  63. package/dist/{chunk-HRT662B6.js → chunk-SVIEJH5H.js} +13 -8
  64. package/dist/chunk-SVIEJH5H.js.map +1 -0
  65. package/dist/{chunk-KFL6ZGWG.js → chunk-VYZRHQUD.js} +5 -5
  66. package/dist/{chunk-KFL6ZGWG.js.map → chunk-VYZRHQUD.js.map} +1 -1
  67. package/dist/{chunk-H5ZOJOQ2.cjs → chunk-WKAEIA42.cjs} +9 -9
  68. package/dist/{chunk-H5ZOJOQ2.cjs.map → chunk-WKAEIA42.cjs.map} +1 -1
  69. package/dist/{chunk-L3V6LSQF.js → chunk-X5BBF6AG.js} +3 -3
  70. package/dist/{chunk-L3V6LSQF.js.map → chunk-X5BBF6AG.js.map} +1 -1
  71. package/dist/{chunk-WGJL6F3F.js → chunk-Z6I5PBGG.js} +6 -112
  72. package/dist/chunk-Z6I5PBGG.js.map +1 -0
  73. package/dist/datasets/index.cjs +17 -17
  74. package/dist/datasets/index.js +2 -2
  75. package/dist/docs/SKILL.md +8 -18
  76. package/dist/docs/assets/SOURCE_MAP.json +266 -266
  77. package/dist/docs/references/docs-agents-overview.md +4 -4
  78. package/dist/docs/references/docs-agents-processors.md +1 -1
  79. package/dist/docs/references/{docs-observability-datasets-overview.md → docs-evals-datasets-overview.md} +12 -12
  80. package/dist/docs/references/{docs-observability-datasets-running-experiments.md → docs-evals-datasets-running-experiments.md} +9 -9
  81. package/dist/docs/references/docs-evals-overview.md +8 -9
  82. package/dist/docs/references/docs-memory-observational-memory.md +20 -11
  83. package/dist/docs/references/docs-memory-overview.md +4 -4
  84. package/dist/docs/references/docs-memory-semantic-recall.md +28 -19
  85. package/dist/docs/references/docs-memory-storage.md +4 -4
  86. package/dist/docs/references/docs-rag-chunking-and-embedding.md +2 -2
  87. package/dist/docs/references/docs-server-auth-composite-auth.md +1 -7
  88. package/dist/docs/references/docs-server-auth-custom-auth-provider.md +2 -4
  89. package/dist/docs/references/docs-server-auth-jwt.md +1 -1
  90. package/dist/docs/references/docs-server-auth-simple-auth.md +1 -7
  91. package/dist/docs/references/docs-server-custom-adapters.md +3 -1
  92. package/dist/docs/references/docs-server-custom-api-routes.md +1 -1
  93. package/dist/docs/references/docs-server-mastra-client.md +1 -3
  94. package/dist/docs/references/docs-server-mastra-server.md +8 -0
  95. package/dist/docs/references/docs-server-request-context.md +17 -17
  96. package/dist/docs/references/docs-streaming-events.md +1 -90
  97. package/dist/docs/references/docs-studio-auth.md +142 -0
  98. package/dist/docs/references/docs-studio-deployment.md +260 -0
  99. package/dist/docs/references/docs-studio-observability.md +98 -0
  100. package/dist/docs/references/docs-studio-overview.md +127 -0
  101. package/dist/docs/references/docs-workflows-agents-and-tools.md +7 -10
  102. package/dist/docs/references/docs-workflows-control-flow.md +1 -1
  103. package/dist/docs/references/docs-workflows-overview.md +12 -7
  104. package/dist/docs/references/docs-workflows-suspend-and-resume.md +1 -1
  105. package/dist/docs/references/guides-concepts-multi-agent-systems.md +4 -4
  106. package/dist/docs/references/reference-agents-agent.md +1 -1
  107. package/dist/docs/references/reference-configuration.md +4 -4
  108. package/dist/docs/references/reference-memory-observational-memory.md +1 -1
  109. package/dist/docs/references/reference-storage-cloudflare-d1.md +1 -1
  110. package/dist/docs/references/reference-storage-lance.md +1 -1
  111. package/dist/docs/references/reference-storage-upstash.md +1 -1
  112. package/dist/docs/references/reference.md +16 -14
  113. package/dist/evals/index.cjs +5 -5
  114. package/dist/evals/index.js +2 -2
  115. package/dist/evals/scoreTraces/index.cjs +3 -3
  116. package/dist/evals/scoreTraces/index.js +1 -1
  117. package/dist/harness/harness.d.ts.map +1 -1
  118. package/dist/harness/index.cjs +19 -18
  119. package/dist/harness/index.cjs.map +1 -1
  120. package/dist/harness/index.js +9 -8
  121. package/dist/harness/index.js.map +1 -1
  122. package/dist/index.cjs +2 -2
  123. package/dist/index.js +1 -1
  124. package/dist/integration/index.cjs +2 -2
  125. package/dist/integration/index.js +1 -1
  126. package/dist/llm/index.cjs +16 -16
  127. package/dist/llm/index.js +5 -5
  128. package/dist/llm/model/aisdk/v5/model.d.ts +5 -0
  129. package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -1
  130. package/dist/llm/model/aisdk/v6/model.d.ts +5 -0
  131. package/dist/llm/model/aisdk/v6/model.d.ts.map +1 -1
  132. package/dist/llm/model/provider-types.generated.d.ts +1 -50
  133. package/dist/loop/index.cjs +14 -14
  134. package/dist/loop/index.js +1 -1
  135. package/dist/loop/network/validation.d.ts.map +1 -1
  136. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  137. package/dist/mastra/index.cjs +2 -2
  138. package/dist/mastra/index.js +1 -1
  139. package/dist/memory/index.cjs +14 -14
  140. package/dist/memory/index.js +1 -1
  141. package/dist/models-dev-VAVD7BDV.cjs +12 -0
  142. package/dist/{models-dev-674ULLFE.cjs.map → models-dev-VAVD7BDV.cjs.map} +1 -1
  143. package/dist/models-dev-VFIUOVG4.js +3 -0
  144. package/dist/{models-dev-AVV7SNWL.js.map → models-dev-VFIUOVG4.js.map} +1 -1
  145. package/dist/netlify-KL3UR26O.cjs +12 -0
  146. package/dist/{netlify-QP3MZ4FK.cjs.map → netlify-KL3UR26O.cjs.map} +1 -1
  147. package/dist/netlify-Q3SJTV4U.js +3 -0
  148. package/dist/{netlify-KWEJPG27.js.map → netlify-Q3SJTV4U.js.map} +1 -1
  149. package/dist/processor-provider/index.cjs +10 -10
  150. package/dist/processor-provider/index.js +1 -1
  151. package/dist/processors/index.cjs +44 -44
  152. package/dist/processors/index.js +1 -1
  153. package/dist/provider-registry-COX4XKGI.js +3 -0
  154. package/dist/{provider-registry-L3LFTZUA.js.map → provider-registry-COX4XKGI.js.map} +1 -1
  155. package/dist/provider-registry-IAU4XHVY.cjs +40 -0
  156. package/dist/{provider-registry-KZN4FOFE.cjs.map → provider-registry-IAU4XHVY.cjs.map} +1 -1
  157. package/dist/provider-registry.json +2 -108
  158. package/dist/relevance/index.cjs +3 -3
  159. package/dist/relevance/index.js +1 -1
  160. package/dist/storage/index.cjs +74 -74
  161. package/dist/storage/index.js +1 -1
  162. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  163. package/dist/stream/index.cjs +8 -8
  164. package/dist/stream/index.js +1 -1
  165. package/dist/test-utils/llm-mock.cjs +4 -4
  166. package/dist/test-utils/llm-mock.js +1 -1
  167. package/dist/tool-loop-agent/index.cjs +4 -4
  168. package/dist/tool-loop-agent/index.js +1 -1
  169. package/dist/tools/index.cjs +8 -8
  170. package/dist/tools/index.js +1 -1
  171. package/dist/tools/is-vercel-tool.cjs +2 -2
  172. package/dist/tools/is-vercel-tool.js +1 -1
  173. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  174. package/dist/tools/validation.d.ts.map +1 -1
  175. package/dist/utils.cjs +31 -23
  176. package/dist/utils.d.ts +10 -0
  177. package/dist/utils.d.ts.map +1 -1
  178. package/dist/utils.js +1 -1
  179. package/dist/vector/index.cjs +7 -7
  180. package/dist/vector/index.js +1 -1
  181. package/dist/workflows/evented/index.cjs +10 -10
  182. package/dist/workflows/evented/index.js +1 -1
  183. package/dist/workflows/index.cjs +24 -24
  184. package/dist/workflows/index.js +1 -1
  185. package/dist/workflows/workflow.d.ts.map +1 -1
  186. package/dist/workspace/index.cjs +68 -68
  187. package/dist/workspace/index.js +1 -1
  188. package/dist/workspace/workspace.d.ts +1 -0
  189. package/dist/workspace/workspace.d.ts.map +1 -1
  190. package/package.json +5 -5
  191. package/src/llm/model/provider-types.generated.d.ts +1 -50
  192. package/dist/chunk-4FMKWOPC.js.map +0 -1
  193. package/dist/chunk-7W6PDCOH.cjs.map +0 -1
  194. package/dist/chunk-AV4YSAZL.cjs.map +0 -1
  195. package/dist/chunk-CJ4RMDJJ.cjs.map +0 -1
  196. package/dist/chunk-FA4PTEBK.js.map +0 -1
  197. package/dist/chunk-GXXNF6NF.cjs.map +0 -1
  198. package/dist/chunk-HRT662B6.js.map +0 -1
  199. package/dist/chunk-HZI7AYCD.js.map +0 -1
  200. package/dist/chunk-IVXAQT6H.js.map +0 -1
  201. package/dist/chunk-K7AE4BHR.js.map +0 -1
  202. package/dist/chunk-LKZQG2ZZ.cjs.map +0 -1
  203. package/dist/chunk-TJNYXDI7.cjs.map +0 -1
  204. package/dist/chunk-WGJL6F3F.js.map +0 -1
  205. package/dist/chunk-XQRTJIC7.cjs.map +0 -1
  206. package/dist/docs/references/docs-observability-logging.md +0 -99
  207. package/dist/docs/references/docs-observability-overview.md +0 -70
  208. package/dist/docs/references/docs-observability-tracing-bridges-otel.md +0 -209
  209. package/dist/docs/references/docs-observability-tracing-exporters-arize.md +0 -272
  210. package/dist/docs/references/docs-observability-tracing-exporters-braintrust.md +0 -126
  211. package/dist/docs/references/docs-observability-tracing-exporters-cloud.md +0 -127
  212. package/dist/docs/references/docs-observability-tracing-exporters-datadog.md +0 -317
  213. package/dist/docs/references/docs-observability-tracing-exporters-default.md +0 -209
  214. package/dist/docs/references/docs-observability-tracing-exporters-laminar.md +0 -100
  215. package/dist/docs/references/docs-observability-tracing-exporters-langfuse.md +0 -213
  216. package/dist/docs/references/docs-observability-tracing-exporters-langsmith.md +0 -198
  217. package/dist/docs/references/docs-observability-tracing-exporters-otel.md +0 -476
  218. package/dist/docs/references/docs-observability-tracing-exporters-posthog.md +0 -148
  219. package/dist/docs/references/docs-observability-tracing-overview.md +0 -1112
  220. package/dist/models-dev-674ULLFE.cjs +0 -12
  221. package/dist/models-dev-AVV7SNWL.js +0 -3
  222. package/dist/netlify-KWEJPG27.js +0 -3
  223. package/dist/netlify-QP3MZ4FK.cjs +0 -12
  224. package/dist/provider-registry-KZN4FOFE.cjs +0 -40
  225. package/dist/provider-registry-L3LFTZUA.js +0 -3
@@ -38,7 +38,7 @@ export const mastra = new Mastra({
38
38
 
39
39
  Once registered, it can be called from workflows, tools, or other agents, and has access to shared resources such as memory, logging, and observability features.
40
40
 
41
- > **Tip:** Use [Studio](https://mastra.ai/docs/getting-started/studio) to test your agent with different messages, inspect tool calls and responses, and debug agent behavior.
41
+ > **Tip:** Use [Studio](https://mastra.ai/docs/studio/overview) to test your agent with different messages, inspect tool calls and responses, and debug agent behavior.
42
42
 
43
43
  > **Note:** Visit the [agent reference](https://mastra.ai/reference/agents/agent) for more information on available properties and configurations.
44
44
 
@@ -48,7 +48,7 @@ After registration, retrieve your agent with [`mastra.getAgentById()`](https://m
48
48
 
49
49
  When referencing an agent from your Mastra instance, use `mastra.getAgentById()` to ensure it has access to shared services such as instance-level storage, logging, and agent registry. A directly imported agent can still work with its own local configuration, but it won't have access to those shared services.
50
50
 
51
- **Generate**:
51
+ **.generate()**:
52
52
 
53
53
  Returns the full response after all tool calls and steps complete. The result includes `text`, `toolCalls`, `toolResults`, `steps`, and token `usage` statistics.
54
54
 
@@ -58,7 +58,7 @@ const response = await agent.generate('Help me organize my day')
58
58
  console.log(response.text)
59
59
  ```
60
60
 
61
- **Stream**:
61
+ **.stream()**:
62
62
 
63
63
  Returns a stream you can consume as tokens arrive. The result exposes `textStream` for incremental output and promises for `toolCalls`, `toolResults`, `steps`, and token `usage` that resolve when the stream finishes.
64
64
 
@@ -90,6 +90,6 @@ Once your agent is running, use this table to find the right page for what you w
90
90
 
91
91
  ## Multi-agent systems
92
92
 
93
- A multi-agent system uses multiple agents to solve a task that is too broad or too specialized for a single agent. Instead of building one agent with dozens of tools and a long instruction set, you split responsibilities across focused agents and let a coordinator bring results together.
93
+ A multi-agent system uses multiple agents to solve a task that's too broad or too specialized for a single agent. Instead of building one agent with dozens of tools and a long instruction set, you split responsibilities across focused agents and let a coordinator bring results together.
94
94
 
95
95
  Read the [conceptual overview of multi-agent systems](https://mastra.ai/guides/concepts/multi-agent-systems) to learn how you can apply different patterns with Mastra.
@@ -493,7 +493,7 @@ After a `.parallel()` step, each branch result is keyed by its processor ID (e.g
493
493
 
494
494
  If a branch uses a mutating strategy like `redact`, map to that branch so its transformed messages carry forward. If all branches only `block`, any branch works. Pick any one since none of them modify the messages.
495
495
 
496
- When an agent is registered with Mastra, processor workflows are automatically registered as workflows, allowing you to view and debug them in the [Studio](https://mastra.ai/docs/getting-started/studio).
496
+ When an agent is registered with Mastra, processor workflows are automatically registered as workflows, allowing you to view and debug them in the [Studio](https://mastra.ai/docs/studio/overview).
497
497
 
498
498
  ### Retry mechanism
499
499
 
@@ -41,6 +41,16 @@ const { datasets: all } = await datasets.list()
41
41
 
42
42
  > **Info:** Visit the [`DatasetsManager` reference](https://mastra.ai/reference/datasets/datasets-manager) for the full list of methods.
43
43
 
44
+ ## Studio
45
+
46
+ You can also manage datasets in [Studio](https://mastra.ai/docs/studio/overview). After opening Studio, select **Datasets** from the sidebar to see all your available datasets or create a new one.
47
+
48
+ To get started, select **Create Dataset** and set a name, description, and optional schemas. After confirming, you'll see the dataset details page with two tabs: **Items** and [**Experiments**](https://mastra.ai/docs/evals/datasets/running-experiments).
49
+
50
+ In the **Items** view you can add, update, and delete items, and view version history. Select **Add Item** to insert a new item with JSON editors for input and ground truth. From this view you can also import items in bulk from a CSV or JSON file. When importing, map each column to the corresponding dataset field.
51
+
52
+ Select **Versions** to see the full history of changes to the dataset. After selecting **Compare Versions**, choose any two versions and select **Compare** to see a side-by-side diff of all items that were added, changed, or removed between those versions.
53
+
44
54
  ## Creating a dataset
45
55
 
46
56
  Call [`create()`](https://mastra.ai/reference/datasets/create) with a name and optional description:
@@ -176,23 +186,13 @@ Fetch the exact items that existed at a past version:
176
186
  const items = await dataset.listItems({ version: 2 })
177
187
  ```
178
188
 
179
- You can also pin experiments to a version, see [running experiments](https://mastra.ai/docs/observability/datasets/running-experiments).
189
+ You can also pin experiments to a version, see [running experiments](https://mastra.ai/docs/evals/datasets/running-experiments).
180
190
 
181
191
  > **Info:** Visit the [`Dataset` reference](https://mastra.ai/reference/datasets/dataset) for the full list of methods and parameters.
182
192
 
183
- ## Studio
184
-
185
- You can also manage datasets in [Mastra Studio](https://mastra.ai/docs/getting-started/studio). After opening Studio, select **Datasets** from the sidebar to see all your available datasets or create a new one.
186
-
187
- To get started, select **Create Dataset** and set a name, description, and optional schemas. After confirming, you'll see the dataset details page with two tabs: **Items** and [**Experiments**](https://mastra.ai/docs/observability/datasets/running-experiments).
188
-
189
- In the **Items** view you can add, update, and delete items, and view version history. Select **Add Item** to insert a new item with JSON editors for input and ground truth. From this view you can also import items in bulk from a CSV or JSON file. When importing, map each column to the corresponding dataset field.
190
-
191
- Select **Versions** to see the full history of changes to the dataset. After selecting **Compare Versions**, choose any two versions and select **Compare** to see a side-by-side diff of all items that were added, changed, or removed between those versions.
192
-
193
193
  ## Related
194
194
 
195
- - [Running experiments](https://mastra.ai/docs/observability/datasets/running-experiments)
195
+ - [Running experiments](https://mastra.ai/docs/evals/datasets/running-experiments)
196
196
  - [Scorers overview](https://mastra.ai/docs/evals/overview)
197
197
  - [DatasetsManager reference](https://mastra.ai/reference/datasets/datasets-manager)
198
198
  - [Dataset reference](https://mastra.ai/reference/datasets/dataset)
@@ -27,6 +27,14 @@ console.log(summary.failedCount) // number of items that failed
27
27
 
28
28
  `startExperiment()` blocks until all items finish. For fire-and-forget execution, see [async experiments](#async-experiments).
29
29
 
30
+ ## Studio
31
+
32
+ You can also run experiments in [Studio](https://mastra.ai/docs/studio/overview). After you've added a dataset item, open it and select **Run Experiment** and configure the target, scorers, and options.
33
+
34
+ After running an experiment, the **Experiments** tab shows all runs for that dataset (with status, counts, and timestamps). Select an experiment to see per-item results, scores, and execution traces.
35
+
36
+ In the **Experiments** tab, select **Compare** and choose two or more experiments to compare their scores and results side by side.
37
+
30
38
  ## Experiment targets
31
39
 
32
40
  You can point an experiment at a registered agent, workflow, or scorer.
@@ -258,17 +266,9 @@ for (const result of results) {
258
266
 
259
267
  > **Info:** Visit the [`startExperiment` reference](https://mastra.ai/reference/datasets/startExperiment) for the full parameter and return type documentation.
260
268
 
261
- ## Studio
262
-
263
- You can also run experiments in [Mastra Studio](https://mastra.ai/docs/getting-started/studio). After you've added a dataset item, open it and select **Run Experiment** and configure the target, scorers, and options.
264
-
265
- After running an experiment, the **Experiments** tab shows all runs for that dataset (with status, counts, and timestamps). Select an experiment to see per-item results, scores, and execution traces.
266
-
267
- In the **Experiments** tab, select **Compare** and choose two or more experiments to compare their scores and results side by side.
268
-
269
269
  ## Related
270
270
 
271
- - [Datasets overview](https://mastra.ai/docs/observability/datasets/overview)
271
+ - [Datasets overview](https://mastra.ai/docs/evals/datasets/overview)
272
272
  - [Scorers overview](https://mastra.ai/docs/evals/overview)
273
273
  - [`startExperiment` reference](https://mastra.ai/reference/datasets/startExperiment)
274
274
  - [`listExperimentResults` reference](https://mastra.ai/reference/datasets/listExperimentResults)
@@ -111,9 +111,9 @@ export const contentWorkflow = createWorkflow({ ... })
111
111
 
112
112
  In addition to live evaluations, you can use scorers to evaluate historical traces from your agent interactions and workflows. This is particularly useful for analyzing past performance, debugging issues, or running batch evaluations.
113
113
 
114
- > **Observability Required:** To score traces, you must first configure observability in your Mastra instance to collect trace data. See [Tracing documentation](https://mastra.ai/docs/observability/tracing/overview) for setup instructions.
114
+ > **Observability required:** To score traces, you must first configure observability in your Mastra instance to collect trace data. See [Tracing documentation](https://mastra.ai/docs/observability/tracing/overview) for setup instructions.
115
115
 
116
- ### Scoring traces with Studio
116
+ ## Studio
117
117
 
118
118
  To score traces, you first need to register your scorers with your Mastra instance:
119
119
 
@@ -126,16 +126,15 @@ const mastra = new Mastra({
126
126
  })
127
127
  ```
128
128
 
129
- Once registered, you can score traces interactively within Studio under the Observability section. This provides a user-friendly interface for running scorers against historical traces.
129
+ Once registered, you can score traces interactively within Studio under the **Observability** section. Open Studio to manage scorers, review scores, and run experiments.
130
130
 
131
- ## Testing scorers locally
132
-
133
- Mastra provides a CLI command `mastra dev` to test your scorers. Studio includes a scorers section where you can run individual scorers against test inputs and view detailed results.
134
-
135
- For more details, see [Studio](https://mastra.ai/docs/getting-started/studio) docs.
131
+ - **Scorers list**: Browse all registered scorers with their description, and the number of agents and workflows each scorer is attached to.
132
+ - **Score results**: Select a scorer to see a paginated list of every score it has produced. Click a row to open the detail panel, which shows the score value, reason, input, output, and the prompts used by the judge. From this panel, save any result as a dataset item for future experiments.
133
+ - **Agent Evaluate tab**: Open the Evaluate tab on any agent to attach or detach scorers, create or edit stored scorers inline, manage datasets, and run experiments. Experiment results display per-item scores alongside pass/fail status and version tags.
134
+ - **Trace scoring**: In the Observability section, run a scorer against any historical trace or span to evaluate past interactions. Filter scores by agent or workflow.
136
135
 
137
136
  ## Next steps
138
137
 
139
138
  - Learn how to create your own scorers in the [Creating Custom Scorers](https://mastra.ai/docs/evals/custom-scorers) guide
140
139
  - Explore built-in scorers in the [Built-in Scorers](https://mastra.ai/docs/evals/built-in-scorers) section
141
- - Test scorers with [Studio](https://mastra.ai/docs/getting-started/studio)
140
+ - Test scorers with [Studio](https://mastra.ai/docs/studio/overview)
@@ -42,7 +42,7 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
42
42
 
43
43
  ## Benefits
44
44
 
45
- - **Prompt caching**: OM's context is stable observations append over time rather than being dynamically retrieved each turn. This keeps the prompt prefix cacheable, which reduces costs.
45
+ - **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.
46
46
  - **Compression**: Raw message history and tool results get compressed into a dense observation log. Smaller context means faster responses and longer coherent conversations.
47
47
  - **Zero context rot**: The agent sees relevant information instead of noisy tool calls and irrelevant tokens, so the agent stays on task over long sessions.
48
48
 
@@ -50,7 +50,7 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
50
50
 
51
51
  You don't remember every word of every conversation you've ever had. You observe what happened subconsciously, then your brain reflects — reorganizing, combining, and condensing into long-term memory. OM works the same way.
52
52
 
53
- Every time an agent responds, it sees a context window containing its system prompt, recent message history, and any injected context. The context window is finite even models with large token limits perform worse when the window is full. This causes two problems:
53
+ Every time an agent responds, it sees a context window containing its system prompt, recent message history, and any injected context. The context window is finite; even models with large token limits perform worse when the window is full. This causes two problems:
54
54
 
55
55
  - **Context rot**: the more raw message history an agent carries, the worse it performs.
56
56
  - **Context waste**: most of that history contains tokens no longer needed to keep the agent on task.
@@ -59,14 +59,15 @@ OM solves both problems by compressing old context into dense observations.
59
59
 
60
60
  ### Observations
61
61
 
62
- When message history tokens exceed a threshold (default: 30,000), the Observer creates observations concise notes about what happened:
62
+ When message history tokens exceed a threshold (default: 30,000), the Observer creates observations which are concise notes about what happened:
63
63
 
64
64
  OM uses fast local token estimation for this thresholding work. Text is estimated with `tokenx`, while image parts use provider-aware heuristics so multimodal conversations still trigger observation at the right time. The same applies to image-like `file` parts when a transport normalizes an uploaded image as a file instead of an image part. For example, OpenAI image detail settings can materially change when OM decides to observe.
65
65
 
66
66
  The Observer can also see attachments in the history it reviews. OM keeps readable placeholders like `[Image #1: reference-board.png]` or `[File #1: floorplan.pdf]` in the transcript for readability, and forwards the actual attachment parts alongside the text. Image-like `file` parts are upgraded to image inputs for the Observer when possible, while non-image attachments are forwarded as file parts with normalized token counting. This applies to both normal thread observation and batched resource-scope observation.
67
67
 
68
- ```text
68
+ ```md
69
69
  Date: 2026-01-15
70
+
70
71
  - 🔴 12:10 User is building a Next.js app with Supabase auth, due in 1 week (meaning January 22nd 2026)
71
72
  - 🔴 12:10 App uses server components with client-side hydration
72
73
  - 🟡 12:12 User asked about middleware configuration for protected routes
@@ -77,11 +78,11 @@ The compression is typically 5–40×. The Observer also tracks a **current task
77
78
 
78
79
  If you enable `observation.threadTitle`, the Observer can also suggest a short thread title when the conversation topic meaningfully changes. Thread title generation is opt-in and updates the thread metadata, so apps like Mastra Code can show the latest title in thread lists and status UI.
79
80
 
80
- Example: an agent using Playwright MCP might see 50,000+ tokens per page snapshot. With OM, the Observer watches the interaction and creates a few hundred tokens of observations about what was on the page and what actions were taken. The agent stays on task without carrying every raw snapshot.
81
+ Example: An agent using Playwright MCP might see 50,000+ tokens per page snapshot. With OM, the Observer watches the interaction and creates a few hundred tokens of observations about what was on the page and what actions were taken. The agent stays on task without carrying every raw snapshot.
81
82
 
82
83
  ### Reflections
83
84
 
84
- When observations exceed their threshold (default: 40,000 tokens), the Reflector condenses them combining related items and reflecting on patterns.
85
+ When observations exceed their threshold (default: 40,000 tokens), the Reflector condenses them, combines related items, and reflects on patterns.
85
86
 
86
87
  The result is a three-tier system:
87
88
 
@@ -93,7 +94,7 @@ The result is a three-tier system:
93
94
 
94
95
  > **Note:** Retrieval mode is experimental. The API may change in future releases.
95
96
 
96
- Normal OM compresses messages into observations, which is great for staying on task but the original wording is gone. Retrieval mode fixes this by keeping each observation group linked to the raw messages that produced it. When the agent needs exact wording, tool output, or chronology that the summary compressed away, it can call a `recall` tool to page through the source messages.
97
+ Normal OM compresses messages into observations, which is great for staying on task, but the original wording is gone. Retrieval mode fixes this by keeping each observation group linked to the raw messages that produced it. When the agent needs exact wording, tool output, or chronology that the summary compressed away, it can call a `recall` tool to page through the source messages.
97
98
 
98
99
  #### Browsing only
99
100
 
@@ -162,6 +163,16 @@ With retrieval mode enabled, OM:
162
163
 
163
164
  See the [recall tool reference](https://mastra.ai/reference/memory/observational-memory) for the full API (detail levels, part indexing, pagination, cross-thread browsing, and token limiting).
164
165
 
166
+ ## Studio
167
+
168
+ To see how it works in practice, open [Studio](https://mastra.ai/docs/studio/overview) and navigate to an agent with OM enabled. The **Memory** tab displays:
169
+
170
+ - **Token progress bars**: Current token counts for messages and observations, showing how close each is to its threshold. Hover over the info icon to see the model and threshold for the Observer and Reflector.
171
+ - **Active observations**: The current observation log, rendered inline. When previous observation or reflection records exist, expand "Previous observations" to browse them.
172
+ - **Background processing**: During a conversation, buffered observation chunks and reflection status appear as the agent processes in the background.
173
+
174
+ The progress bars update live while the agent is observing or reflecting, showing elapsed time and a status badge.
175
+
165
176
  ## Models
166
177
 
167
178
  The Observer and Reflector run in the background. Any model that works with Mastra's [model routing](https://mastra.ai/models) (`provider/model`) can be used. When using `observationalMemory: true`, the default model is `google/gemini-2.5-flash`. When passing a config object, a `model` must be explicitly set.
@@ -184,6 +195,8 @@ See [model configuration](https://mastra.ai/reference/memory/observational-memor
184
195
 
185
196
  ### Token-tiered model selection
186
197
 
198
+ **Added in:** `@mastra/memory@1.10.0`
199
+
187
200
  You can use `ModelByInputTokens` to specify different Observer or Reflector models based on input token count. OM selects the matching model tier at runtime from the configured `upTo` thresholds.
188
201
 
189
202
  ```typescript
@@ -373,10 +386,6 @@ No manual migration needed. OM reads existing messages and observes them lazily
373
386
  - **Thread scope**: The first time a thread exceeds `observation.messageTokens`, the Observer processes the backlog.
374
387
  - **Resource scope**: All unobserved messages across all threads for a resource are processed together. For users with many existing threads, this could take significant time.
375
388
 
376
- ## Viewing in Mastra Studio
377
-
378
- Mastra Studio shows OM status in real time in the memory tab: token usage, which model is running, current observations, and reflection history.
379
-
380
389
  ## Comparing OM with other memory features
381
390
 
382
391
  - **[Message history](https://mastra.ai/docs/memory/message-history)**: High-fidelity record of the current conversation
@@ -107,7 +107,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
107
107
 
108
108
  > **Note:** Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
109
109
 
110
- 5. Call your agent, for example in [Mastra Studio](https://mastra.ai/docs/getting-started/studio). Inside Studio, start a new chat with your agent and take a look at the right sidebar. It'll now display various memory-related information.
110
+ 5. Call your agent, for example in [Studio](https://mastra.ai/docs/studio/overview). Inside Studio, start a new chat with your agent and take a look at the right sidebar. It'll now display various memory-related information.
111
111
 
112
112
  ## Message history
113
113
 
@@ -165,7 +165,7 @@ export const memoryAgent = new Agent({
165
165
 
166
166
  ## Memory in multi-agent systems
167
167
 
168
- When a [supervisor agent](https://mastra.ai/docs/agents/supervisor-agents) delegates to a subagent, Mastra isolates subagent memory automatically. There is no flag to enable this as it happens on every delegation. Understanding how this scoping works lets you decide what stays private and what to share intentionally.
168
+ When a [supervisor agent](https://mastra.ai/docs/agents/supervisor-agents) delegates to a subagent, Mastra isolates subagent memory automatically. No flag enables this as it happens on every delegation. Understanding how this scoping works lets you decide what stays private and what to share intentionally.
169
169
 
170
170
  ### How delegation scopes memory
171
171
 
@@ -175,7 +175,7 @@ Each delegation creates a fresh `threadId` and a deterministic `resourceId` for
175
175
  - **Resource ID**: Derived as `{parentResourceId}-{agentName}`. Because the resource ID is stable across delegations, resource-scoped memory persists between calls. A subagent remembers facts from previous delegations by the same user.
176
176
  - **Memory instance**: If a subagent has no memory configured, it inherits the supervisor's `Memory` instance. If the subagent defines its own, that takes precedence.
177
177
 
178
- The supervisor forwards its conversation context to the subagent so it has enough background to complete the task. Only the delegation prompt and the subagent's response are saved — the full parent conversation is not stored. You can control which messages reach the subagent with the [`messageFilter`](https://mastra.ai/docs/agents/supervisor-agents) callback.
178
+ The supervisor forwards its conversation context to the subagent so it has enough background to complete the task. Only the delegation prompt and the subagent's response are saved — the full parent conversation isn't stored. You can control which messages reach the subagent with the [`messageFilter`](https://mastra.ai/docs/agents/supervisor-agents) callback.
179
179
 
180
180
  > **Note:** Subagent resource IDs are always suffixed with the agent name (`{parentResourceId}-{agentName}`). Two different subagents under the same supervisor never share a resource ID through delegation.
181
181
 
@@ -206,7 +206,7 @@ Because both calls use `resource: 'project-42'`, the writer can access the resea
206
206
 
207
207
  Enable [Tracing](https://mastra.ai/docs/observability/tracing/overview) to monitor and debug memory in action. Traces show you exactly which messages and observations the agent included in its context for each request, helping you understand agent behavior and verify that memory retrieval is working as expected.
208
208
 
209
- Open [Mastra Studio](https://mastra.ai/docs/getting-started/studio) and select the **Observability** tab in the sidebar. Open the trace of a recent agent request, then look for spans of LLMs calls.
209
+ Open [Studio](https://mastra.ai/docs/studio/overview) and select the **Observability** tab in the sidebar. Open the trace of a recent agent request, then look for spans of LLMs calls.
210
210
 
211
211
  ## Switch memory per request
212
212
 
@@ -18,18 +18,33 @@ After getting a response from the LLM, all new messages (user, assistant, and to
18
18
 
19
19
  ## Quickstart
20
20
 
21
- Semantic recall is enabled by default, so if you give your agent memory it will be included:
21
+ Semantic recall is disabled by default. To enable it, set `semanticRecall: true` in `options` and provide a `vector` store and `embedder`:
22
22
 
23
23
  ```typescript
24
24
  import { Agent } from '@mastra/core/agent'
25
25
  import { Memory } from '@mastra/memory'
26
+ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
27
+ import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
26
28
 
27
29
  const agent = new Agent({
28
30
  id: 'support-agent',
29
31
  name: 'SupportAgent',
30
32
  instructions: 'You are a helpful support agent.',
31
33
  model: 'openai/gpt-5.4',
32
- memory: new Memory(),
34
+ memory: new Memory({
35
+ storage: new LibSQLStore({
36
+ id: 'agent-storage',
37
+ url: 'file:./local.db',
38
+ }),
39
+ vector: new LibSQLVector({
40
+ id: 'agent-vector',
41
+ url: 'file:./local.db',
42
+ }),
43
+ embedder: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
44
+ options: {
45
+ semanticRecall: true,
46
+ },
47
+ }),
33
48
  })
34
49
  ```
35
50
 
@@ -77,6 +92,9 @@ const agent = new Agent({
77
92
  id: 'agent-vector',
78
93
  url: 'file:./local.db',
79
94
  }),
95
+ options: {
96
+ semanticRecall: true,
97
+ },
80
98
  }),
81
99
  })
82
100
  ```
@@ -139,6 +157,9 @@ import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
139
157
  const agent = new Agent({
140
158
  memory: new Memory({
141
159
  embedder: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
160
+ options: {
161
+ semanticRecall: true,
162
+ },
142
163
  }),
143
164
  })
144
165
  ```
@@ -262,26 +283,14 @@ const agent = new Agent({
262
283
 
263
284
  For detailed information about index configuration options and performance tuning, see the [PgVector configuration guide](https://mastra.ai/reference/vectors/pg).
264
285
 
265
- ## Disabling
286
+ ## Disable semantic recall
266
287
 
267
- Semantic recall has a performance impact. New messages are converted into embeddings and used to query a vector database before new messages are sent to the LLM.
268
-
269
- Semantic recall is enabled by default but can be disabled when not needed:
270
-
271
- ```typescript
272
- const agent = new Agent({
273
- memory: new Memory({
274
- options: {
275
- semanticRecall: false,
276
- },
277
- }),
278
- })
279
- ```
288
+ Semantic recall is disabled by default (`semanticRecall: false`). Each call adds latency because new messages are converted into embeddings and used to query a vector database before the LLM receives them.
280
289
 
281
- You might want to disable semantic recall in scenarios like:
290
+ Keep semantic recall disabled when:
282
291
 
283
- - When message history provides sufficient context for the current conversation.
284
- - In performance-sensitive applications, like realtime two-way audio, where the added latency of creating embeddings and running vector queries is noticeable.
292
+ - Message history provides sufficient context for the current conversation.
293
+ - You're building performance-sensitive applications, like realtime two-way audio, where embedding and vector query latency is noticeable.
285
294
 
286
295
  ## Viewing recalled messages
287
296
 
@@ -14,7 +14,7 @@ export const mastra = new Mastra({
14
14
  })
15
15
  ```
16
16
 
17
- > **Sharing the database with Mastra Studio:** When running `mastra dev` alongside your application (e.g., Next.js), use an absolute path to ensure both processes access the same database:
17
+ > **Sharing the database with Studio:** When running `mastra dev` alongside your application (e.g., Next.js), use an absolute path to ensure both processes access the same database:
18
18
  >
19
19
  > ```typescript
20
20
  > url: 'file:/absolute/path/to/your/project/mastra.db'
@@ -129,7 +129,7 @@ Mastra organizes conversations using two identifiers:
129
129
 
130
130
  Both identifiers are required for agents to store information:
131
131
 
132
- **Generate**:
132
+ **.generate()**:
133
133
 
134
134
  ```typescript
135
135
  const response = await agent.generate('hello', {
@@ -140,7 +140,7 @@ const response = await agent.generate('hello', {
140
140
  })
141
141
  ```
142
142
 
143
- **Stream**:
143
+ **.stream()**:
144
144
 
145
145
  ```typescript
146
146
  const stream = await agent.stream('hello', {
@@ -151,7 +151,7 @@ const stream = await agent.stream('hello', {
151
151
  })
152
152
  ```
153
153
 
154
- > **Note:** [Studio](https://mastra.ai/docs/getting-started/studio) automatically generates a thread and resource ID for you. When calling `stream()` or `generate()` yourself, remember to provide these identifiers explicitly.
154
+ > **Note:** [Studio](https://mastra.ai/docs/studio/overview) automatically generates a thread and resource ID for you. When calling `stream()` or `generate()` yourself, remember to provide these identifiers explicitly.
155
155
 
156
156
  ### Thread title generation
157
157
 
@@ -9,7 +9,7 @@ const docFromMarkdown = MDocument.fromMarkdown('# Your Markdown content...')
9
9
  const docFromJSON = MDocument.fromJSON(`{ "key": "value" }`)
10
10
  ```
11
11
 
12
- ## Step 1: Document processing
12
+ ## Document processing
13
13
 
14
14
  Use `chunk` to split documents into manageable pieces. Mastra supports multiple chunking strategies optimized for different document types:
15
15
 
@@ -65,7 +65,7 @@ const chunks = await doc.chunk({
65
65
 
66
66
  We go deeper into chunking strategies in our [`chunk()` reference documentation](https://mastra.ai/reference/rag/chunk).
67
67
 
68
- ## Step 2: Embedding generation
68
+ ## Embedding generation
69
69
 
70
70
  Transform chunks into embeddings using your preferred provider. Mastra supports embedding models through the model router.
71
71
 
@@ -225,10 +225,4 @@ function handleUser(user: User) {
225
225
  console.log('Clerk user:', user.email)
226
226
  }
227
227
  }
228
- ```
229
-
230
- ## Related
231
-
232
- - [Auth Overview](https://mastra.ai/docs/server/auth) - Authentication concepts
233
- - [Simple Auth](https://mastra.ai/docs/server/auth/simple-auth) - Token-to-user mapping
234
- - [Custom Auth Provider](https://mastra.ai/docs/server/auth/custom-auth-provider) - Build your own provider
228
+ ```
@@ -507,7 +507,5 @@ See the [source code](https://github.com/mastra-ai/mastra/tree/main/auth) for im
507
507
 
508
508
  ## Related
509
509
 
510
- - [Auth Overview](https://mastra.ai/docs/server/auth) - Authentication concepts and configuration
511
- - [JWT Auth](https://mastra.ai/docs/server/auth/jwt) - Simple JWT authentication
512
- - [Clerk Auth](https://mastra.ai/docs/server/auth/clerk) - Clerk integration
513
- - [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes) - Controlling authentication on custom endpoints
510
+ - [Auth Overview](https://mastra.ai/docs/server/auth): Authentication concepts and configuration
511
+ - [Custom API Routes](https://mastra.ai/docs/server/custom-api-routes): Controlling authentication on custom endpoints
@@ -61,7 +61,7 @@ export const mastra = new Mastra({
61
61
 
62
62
  > **Info:** Visit [MastraJwtAuth](https://mastra.ai/reference/auth/jwt) for all available configuration options.
63
63
 
64
- Inside [Studio](https://mastra.ai/docs/getting-started/studio), go to **Settings** and under **Headers** select the **"Add Header"** button. Enter `Authorization` as the header name and `Bearer <your-jwt>` as the value.
64
+ Inside [Studio](https://mastra.ai/docs/studio/overview), go to **Settings** and under **Headers** select the **"Add Header"** button. Enter `Authorization` as the header name and `Bearer <your-jwt>` as the value.
65
65
 
66
66
  ## Configuring `MastraClient`
67
67
 
@@ -171,10 +171,4 @@ SimpleAuth is designed for simplicity, not production security:
171
171
  - No cryptographic verification
172
172
  - All tokens must be known at startup
173
173
 
174
- For production applications, consider using [JWT](https://mastra.ai/docs/server/auth/jwt), [Clerk](https://mastra.ai/docs/server/auth/clerk), [Auth0](https://mastra.ai/docs/server/auth/auth0), or another identity provider.
175
-
176
- ## Related
177
-
178
- - [Auth Overview](https://mastra.ai/docs/server/auth) - Authentication concepts
179
- - [JWT Auth](https://mastra.ai/docs/server/auth/jwt) - JSON Web Token authentication
180
- - [Custom Auth Provider](https://mastra.ai/docs/server/auth/custom-auth-provider) - Build your own provider
174
+ For production applications, consider using [JWT](https://mastra.ai/docs/server/auth/jwt), [Clerk](https://mastra.ai/docs/server/auth/clerk), [Auth0](https://mastra.ai/docs/server/auth/auth0), or another identity provider.
@@ -1,6 +1,6 @@
1
1
  # Custom adapters
2
2
 
3
- Create a custom adapter when you need to run Mastra with a framework other than Hono or Express. This might be necessary if you have specific request/response handling requirements that `@mastra/hono` and `@mastra/express` don't support.
3
+ Create a custom adapter when the prebuilt server adapters (Hono, Express, Fastify, Koa) don't support your framework or you have specific request/response handling requirements.
4
4
 
5
5
  A custom adapter translates between Mastra's route definitions and your framework's routing system. You'll implement methods that register middleware, handle requests, and send responses using your framework's APIs.
6
6
 
@@ -368,6 +368,8 @@ app.listen(4111)
368
368
  ```
369
369
 
370
370
  > **Tip:** The existing [@mastra/hono](https://github.com/mastra-ai/mastra/blob/main/server-adapters/hono/src/index.ts) and [@mastra/express](https://github.com/mastra-ai/mastra/blob/main/server-adapters/express/src/index.ts) implementations are good references when building your custom adapter. They show how to handle framework-specific patterns for context storage, middleware registration, and response handling.
371
+ >
372
+ > If you want to use [Studio](https://mastra.ai/docs/studio/overview) with your server adapter, use [`mastra studio`](https://mastra.ai/reference/cli/mastra) to only launch the Studio UI.
371
373
 
372
374
  ## Related
373
375
 
@@ -262,7 +262,7 @@ For more information about authentication providers, see the [Auth documentation
262
262
 
263
263
  ## Continue generation after client disconnect
264
264
 
265
- Built-in streaming helpers such as [`chatRoute()`](https://mastra.ai/reference/ai-sdk/chat-route) forward the incoming request's `AbortSignal` to `agent.stream()`. That is the right default when a browser disconnect should cancel the model call.
265
+ Built-in streaming helpers such as [`chatRoute()`](https://mastra.ai/reference/ai-sdk/chat-route) forward the incoming request's `AbortSignal` to `agent.stream()`. That's the right default when a browser disconnect should cancel the model call.
266
266
 
267
267
  If you want the server to keep generating and persist the final response even after the client disconnects, build a custom route around the underlying `MastraModelOutput`. Start the agent stream without forwarding `c.req.raw.signal`, then call `consumeStream()` in the background so generation continues server-side.
268
268
 
@@ -10,9 +10,7 @@ To ensure smooth local development, make sure you have:
10
10
  - TypeScript `v4.7` or higher (if using TypeScript)
11
11
  - Your local Mastra server running (typically on port `4111`)
12
12
 
13
- ## Usage
14
-
15
- The Mastra Client SDK is designed for browser environments and uses the native `fetch` API for making HTTP requests to your Mastra server.
13
+ > **Note:** The Mastra Client SDK is designed for browser environments and uses the native `fetch` API for making HTTP requests to your Mastra server.
16
14
 
17
15
  ## Installation
18
16
 
@@ -43,6 +43,14 @@ export const mastra = new Mastra({
43
43
  - **[Mastra Client SDK](https://mastra.ai/docs/server/mastra-client)**: Type-safe client for calling agents, workflows, and tools from browser or server environments.
44
44
  - **[Authentication](https://mastra.ai/docs/server/auth)**: Secure endpoints with JWT, Clerk, Supabase, Firebase, Auth0, or WorkOS.
45
45
 
46
+ ## REST API
47
+
48
+ You can explore all available endpoints in the OpenAPI specification at <http://localhost:4111/api/openapi.json>, which details every endpoint and its request and response schemas.
49
+
50
+ To explore the API interactively, visit the Swagger UI at <http://localhost:4111/swagger-ui>. Here, you can discover endpoints and test them directly from your browser.
51
+
52
+ > **Note:** The OpenAPI and Swagger endpoints are disabled in production by default. To enable them, set [`server.build.openAPIDocs`](https://mastra.ai/reference/configuration) and [`server.build.swaggerUI`](https://mastra.ai/reference/configuration) to `true` respectively.
53
+
46
54
  ## Stream data redaction
47
55
 
48
56
  When streaming agent responses, the HTTP layer redacts system prompts, tool definitions, API keys, and similar data from each chunk before sending it to clients. This is enabled by default.
@@ -82,6 +82,23 @@ export const mastra = new Mastra({
82
82
 
83
83
  > **Info:** Visit [Middleware](https://mastra.ai/docs/server/middleware) for how to use server middleware.
84
84
 
85
+ ## Studio
86
+
87
+ When developing locally, you can define named presets in a JSON file and load them into [Studio](https://mastra.ai/docs/studio/overview) with the [`--request-context-presets`](https://mastra.ai/reference/cli/mastra) CLI flag. This adds a dropdown to the request context editor in Studio so you can quickly switch between configurations without manually editing JSON each time.
88
+
89
+ ```bash
90
+ mastra dev --request-context-presets ./presets.json
91
+ ```
92
+
93
+ ```json
94
+ {
95
+ "development": { "userId": "dev-user", "env": "development" },
96
+ "production": { "userId": "prod-user", "env": "production" }
97
+ }
98
+ ```
99
+
100
+ When you select a preset from the dropdown, the JSON editor populates with that preset's values. Editing the JSON manually switches the dropdown back to **"Custom"**.
101
+
85
102
  ## Accessing values with agents
86
103
 
87
104
  You can access the `requestContext` argument from any supported configuration options in agents. These functions can be sync or `async`. Use the `.get()` method to read values from `requestContext`.
@@ -446,23 +463,6 @@ requestContextSchema: z.object({
446
463
 
447
464
  **Handle tool validation errors**: Since tools return error objects instead of throwing, check for errors in your agent or workflow logic when tool execution is critical.
448
465
 
449
- ## Testing with Studio presets
450
-
451
- When developing locally, you can define named presets in a JSON file and load them into Studio with the [`--request-context-presets`](https://mastra.ai/reference/cli/mastra) CLI flag. This adds a dropdown to the request context editor in Studio so you can quickly switch between configurations without manually editing JSON each time.
452
-
453
- ```bash
454
- mastra dev --request-context-presets ./presets.json
455
- ```
456
-
457
- ```json
458
- {
459
- "development": { "userId": "dev-user", "env": "development" },
460
- "production": { "userId": "prod-user", "env": "production" }
461
- }
462
- ```
463
-
464
- When you select a preset from the dropdown, the JSON editor populates with that preset's values. Editing the JSON manually switches the dropdown back to "Custom".
465
-
466
466
  ## Related
467
467
 
468
468
  - [Agent Request Context](https://mastra.ai/docs/memory/overview)