@mastra/core 1.2.1-alpha.0 → 1.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/CHANGELOG.md +335 -0
  2. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +2093 -262
  3. package/dist/agent/agent-legacy.d.ts.map +1 -1
  4. package/dist/agent/agent.d.ts +12 -3
  5. package/dist/agent/agent.d.ts.map +1 -1
  6. package/dist/agent/index.cjs +13 -13
  7. package/dist/agent/index.js +2 -2
  8. package/dist/agent/message-list/index.cjs +18 -18
  9. package/dist/agent/message-list/index.js +1 -1
  10. package/dist/agent/message-list/message-list.d.ts.map +1 -1
  11. package/dist/agent/types.d.ts +6 -1
  12. package/dist/agent/types.d.ts.map +1 -1
  13. package/dist/agent/workflows/prepare-stream/index.d.ts +3 -1
  14. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  15. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  16. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -1
  17. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  18. package/dist/base.cjs +2 -2
  19. package/dist/base.d.ts +13 -1
  20. package/dist/base.d.ts.map +1 -1
  21. package/dist/base.js +1 -1
  22. package/dist/bundler/index.cjs +2 -2
  23. package/dist/bundler/index.js +1 -1
  24. package/dist/cache/index.cjs +3 -3
  25. package/dist/cache/index.js +1 -1
  26. package/dist/{chunk-ENCTSDWC.js → chunk-2GWTJFVM.js} +2410 -1402
  27. package/dist/chunk-2GWTJFVM.js.map +1 -0
  28. package/dist/{chunk-OB4V67IX.cjs → chunk-2K5PNW2U.cjs} +4 -4
  29. package/dist/{chunk-OB4V67IX.cjs.map → chunk-2K5PNW2U.cjs.map} +1 -1
  30. package/dist/{chunk-VZXYBFCX.cjs → chunk-2P6DD7M5.cjs} +10 -10
  31. package/dist/{chunk-VZXYBFCX.cjs.map → chunk-2P6DD7M5.cjs.map} +1 -1
  32. package/dist/{chunk-Q2D7LERO.cjs → chunk-2VD5OGOT.cjs} +4 -4
  33. package/dist/{chunk-Q2D7LERO.cjs.map → chunk-2VD5OGOT.cjs.map} +1 -1
  34. package/dist/{chunk-GVLPTDJA.cjs → chunk-5VMWMXSI.cjs} +236 -63
  35. package/dist/chunk-5VMWMXSI.cjs.map +1 -0
  36. package/dist/{chunk-4NG7CKEG.js → chunk-6VGCVSP4.js} +3 -3
  37. package/dist/{chunk-4NG7CKEG.js.map → chunk-6VGCVSP4.js.map} +1 -1
  38. package/dist/{chunk-IIZF4W7B.cjs → chunk-7UWHFWST.cjs} +52 -5
  39. package/dist/chunk-7UWHFWST.cjs.map +1 -0
  40. package/dist/{chunk-WFUNLRQX.js → chunk-AFF24QUP.js} +366 -134
  41. package/dist/chunk-AFF24QUP.js.map +1 -0
  42. package/dist/{chunk-VW7YQWDW.cjs → chunk-BFIOQFGF.cjs} +28 -2
  43. package/dist/chunk-BFIOQFGF.cjs.map +1 -0
  44. package/dist/{chunk-HMCXNOF6.cjs → chunk-CGPH7CMG.cjs} +2431 -1417
  45. package/dist/chunk-CGPH7CMG.cjs.map +1 -0
  46. package/dist/{chunk-HN2MSTR6.cjs → chunk-D5B5ON7A.cjs} +269 -42
  47. package/dist/chunk-D5B5ON7A.cjs.map +1 -0
  48. package/dist/{chunk-2DMSFLJY.cjs → chunk-DD7377YA.cjs} +8 -8
  49. package/dist/chunk-DD7377YA.cjs.map +1 -0
  50. package/dist/{chunk-A5QFWX67.cjs → chunk-DULE2DRR.cjs} +79 -59
  51. package/dist/chunk-DULE2DRR.cjs.map +1 -0
  52. package/dist/{chunk-ZWM2CAIM.js → chunk-ELBCIHOB.js} +4 -4
  53. package/dist/{chunk-ZWM2CAIM.js.map → chunk-ELBCIHOB.js.map} +1 -1
  54. package/dist/{chunk-W3AQUG66.js → chunk-GIY5BINT.js} +4 -4
  55. package/dist/{chunk-W3AQUG66.js.map → chunk-GIY5BINT.js.map} +1 -1
  56. package/dist/{chunk-M6VFJX5A.js → chunk-GMSAGYTB.js} +3 -3
  57. package/dist/{chunk-M6VFJX5A.js.map → chunk-GMSAGYTB.js.map} +1 -1
  58. package/dist/{chunk-E3VFKTIA.js → chunk-GMSEZYLZ.js} +2245 -179
  59. package/dist/chunk-GMSEZYLZ.js.map +1 -0
  60. package/dist/{chunk-JRJJ5VQE.cjs → chunk-GZD6443M.cjs} +99 -55
  61. package/dist/chunk-GZD6443M.cjs.map +1 -0
  62. package/dist/{chunk-Z6NRYYOH.js → chunk-ILQXPZCD.js} +9 -4
  63. package/dist/chunk-ILQXPZCD.js.map +1 -0
  64. package/dist/{chunk-MQB7XFXP.js → chunk-LHRHOPUC.js} +3 -3
  65. package/dist/{chunk-MQB7XFXP.js.map → chunk-LHRHOPUC.js.map} +1 -1
  66. package/dist/{chunk-5YVR7B4R.js → chunk-LULKG6NF.js} +29 -9
  67. package/dist/chunk-LULKG6NF.js.map +1 -0
  68. package/dist/{chunk-MSWXEOZC.js → chunk-MAX37NGP.js} +5 -5
  69. package/dist/chunk-MAX37NGP.js.map +1 -0
  70. package/dist/{chunk-HU2ONA2W.cjs → chunk-ON2KVIUJ.cjs} +17 -17
  71. package/dist/{chunk-HU2ONA2W.cjs.map → chunk-ON2KVIUJ.cjs.map} +1 -1
  72. package/dist/{chunk-I66TMZJ3.cjs → chunk-OOCEAC6U.cjs} +21 -18
  73. package/dist/chunk-OOCEAC6U.cjs.map +1 -0
  74. package/dist/{chunk-MNWW2R3U.js → chunk-OV7OOUUR.js} +90 -54
  75. package/dist/chunk-OV7OOUUR.js.map +1 -0
  76. package/dist/{chunk-C4WWWQHT.cjs → chunk-RO47SMI7.cjs} +23 -3
  77. package/dist/chunk-RO47SMI7.cjs.map +1 -0
  78. package/dist/{chunk-6FG6FU5Y.cjs → chunk-RQ56ZSIR.cjs} +4 -4
  79. package/dist/{chunk-6FG6FU5Y.cjs.map → chunk-RQ56ZSIR.cjs.map} +1 -1
  80. package/dist/{chunk-IW3BNL7A.js → chunk-RS6CZXGA.js} +50 -3
  81. package/dist/chunk-RS6CZXGA.js.map +1 -0
  82. package/dist/{chunk-AIJLACR2.js → chunk-S53FKKVL.js} +27 -3
  83. package/dist/chunk-S53FKKVL.js.map +1 -0
  84. package/dist/{chunk-G6E3QNJC.js → chunk-SBPPGJL6.js} +4078 -4333
  85. package/dist/chunk-SBPPGJL6.js.map +1 -0
  86. package/dist/{chunk-UZL4H5P2.cjs → chunk-SH4PCZ3X.cjs} +5375 -5648
  87. package/dist/chunk-SH4PCZ3X.cjs.map +1 -0
  88. package/dist/{chunk-QOFI2WBM.cjs → chunk-SZH2YH74.cjs} +985 -223
  89. package/dist/chunk-SZH2YH74.cjs.map +1 -0
  90. package/dist/{chunk-XCPEEIHI.cjs → chunk-U4EG3D6G.cjs} +3012 -927
  91. package/dist/chunk-U4EG3D6G.cjs.map +1 -0
  92. package/dist/{chunk-7MDVYPWX.cjs → chunk-UE2G2LRP.cjs} +9 -4
  93. package/dist/chunk-UE2G2LRP.cjs.map +1 -0
  94. package/dist/{chunk-P62OJXQ4.js → chunk-VHAFCFYP.js} +268 -41
  95. package/dist/chunk-VHAFCFYP.js.map +1 -0
  96. package/dist/{chunk-VX7UA3SO.js → chunk-VJDLIS2E.js} +968 -211
  97. package/dist/chunk-VJDLIS2E.js.map +1 -0
  98. package/dist/{chunk-AUF6U2BL.js → chunk-VM25PDSW.js} +5 -5
  99. package/dist/{chunk-AUF6U2BL.js.map → chunk-VM25PDSW.js.map} +1 -1
  100. package/dist/{chunk-JIT2OY3X.js → chunk-WCAFTXGK.js} +23 -3
  101. package/dist/chunk-WCAFTXGK.js.map +1 -0
  102. package/dist/{chunk-YLODOPYM.cjs → chunk-XDD5V446.cjs} +4163 -5352
  103. package/dist/chunk-XDD5V446.cjs.map +1 -0
  104. package/dist/{chunk-RXD5EGQF.js → chunk-YMXQDOSQ.js} +228 -55
  105. package/dist/chunk-YMXQDOSQ.js.map +1 -0
  106. package/dist/{chunk-BP2TSCBW.js → chunk-ZATLLPIH.js} +4391 -5561
  107. package/dist/chunk-ZATLLPIH.js.map +1 -0
  108. package/dist/{chunk-5SOS47PH.cjs → chunk-ZC6IHDHX.cjs} +454 -222
  109. package/dist/chunk-ZC6IHDHX.cjs.map +1 -0
  110. package/dist/{chunk-T6PRRKMW.js → chunk-ZHFM7HCQ.js} +9 -6
  111. package/dist/chunk-ZHFM7HCQ.js.map +1 -0
  112. package/dist/{chunk-B4M33FCS.cjs → chunk-ZIWDJWC3.cjs} +7 -7
  113. package/dist/{chunk-B4M33FCS.cjs.map → chunk-ZIWDJWC3.cjs.map} +1 -1
  114. package/dist/deployer/index.cjs +2 -2
  115. package/dist/deployer/index.js +1 -1
  116. package/dist/docs/SKILL.md +2 -9
  117. package/dist/docs/assets/SOURCE_MAP.json +399 -342
  118. package/dist/docs/references/docs-agents-agent-memory.md +45 -1
  119. package/dist/docs/references/docs-agents-network-approval.md +1 -1
  120. package/dist/docs/references/docs-agents-networks.md +3 -3
  121. package/dist/docs/references/docs-agents-overview.md +8 -0
  122. package/dist/docs/references/docs-agents-using-tools.md +82 -72
  123. package/dist/docs/references/docs-memory-observational-memory.md +89 -17
  124. package/dist/docs/references/docs-observability-overview.md +1 -1
  125. package/dist/docs/references/docs-observability-tracing-exporters-langsmith.md +70 -0
  126. package/dist/docs/references/docs-observability-tracing-overview.md +1 -1
  127. package/dist/docs/references/docs-server-middleware.md +0 -2
  128. package/dist/docs/references/docs-server-request-context.md +17 -0
  129. package/dist/docs/references/docs-workflows-agents-and-tools.md +2 -2
  130. package/dist/docs/references/docs-workflows-overview.md +1 -1
  131. package/dist/docs/references/docs-workspace-filesystem.md +2 -0
  132. package/dist/docs/references/docs-workspace-overview.md +3 -1
  133. package/dist/docs/references/docs-workspace-sandbox.md +2 -0
  134. package/dist/docs/references/docs-workspace-search.md +2 -0
  135. package/dist/docs/references/docs-workspace-skills.md +3 -1
  136. package/dist/docs/references/reference-agents-getTools.md +1 -6
  137. package/dist/docs/references/reference-agents-listAgents.md +1 -1
  138. package/dist/docs/references/reference-agents-network.md +0 -2
  139. package/dist/docs/references/reference-cli-mastra.md +29 -4
  140. package/dist/docs/references/reference-client-js-agents.md +1 -1
  141. package/dist/docs/references/reference-configuration.md +1 -1
  142. package/dist/docs/references/reference-core-getStoredAgentById.md +2 -2
  143. package/dist/docs/references/reference-core-listStoredAgents.md +1 -1
  144. package/dist/docs/references/reference-memory-observational-memory.md +318 -7
  145. package/dist/docs/references/reference-tools-mcp-client.md +0 -2
  146. package/dist/docs/references/reference-workflows-step.md +2 -0
  147. package/dist/docs/references/reference-workflows-workflow-methods-map.md +2 -2
  148. package/dist/docs/references/reference-workspace-filesystem.md +2 -0
  149. package/dist/docs/references/reference-workspace-local-filesystem.md +2 -0
  150. package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
  151. package/dist/docs/references/reference-workspace-sandbox.md +2 -0
  152. package/dist/docs/references/reference-workspace-workspace-class.md +2 -0
  153. package/dist/docs/references/reference.md +7 -2
  154. package/dist/editor/index.d.ts +1 -1
  155. package/dist/editor/index.d.ts.map +1 -1
  156. package/dist/editor/types.d.ts +53 -48
  157. package/dist/editor/types.d.ts.map +1 -1
  158. package/dist/evals/base.d.ts +15 -0
  159. package/dist/evals/base.d.ts.map +1 -1
  160. package/dist/evals/index.cjs +20 -20
  161. package/dist/evals/index.js +3 -3
  162. package/dist/evals/run/index.d.ts +3 -3
  163. package/dist/evals/run/index.d.ts.map +1 -1
  164. package/dist/evals/scoreTraces/index.cjs +5 -5
  165. package/dist/evals/scoreTraces/index.js +2 -2
  166. package/dist/features/index.cjs +1 -1
  167. package/dist/features/index.cjs.map +1 -1
  168. package/dist/features/index.d.ts.map +1 -1
  169. package/dist/features/index.js +1 -1
  170. package/dist/features/index.js.map +1 -1
  171. package/dist/index.cjs +4 -4
  172. package/dist/index.d.ts +3 -3
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +2 -2
  175. package/dist/integration/index.cjs +2 -2
  176. package/dist/integration/index.js +1 -1
  177. package/dist/llm/index.cjs +16 -16
  178. package/dist/llm/index.js +5 -5
  179. package/dist/llm/model/gateways/constants.d.ts.map +1 -1
  180. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  181. package/dist/llm/model/model.loop.d.ts +1 -1
  182. package/dist/llm/model/model.loop.d.ts.map +1 -1
  183. package/dist/llm/model/provider-types.generated.d.ts +122 -13
  184. package/dist/llm/model/resolve-model.d.ts.map +1 -1
  185. package/dist/loop/index.cjs +12 -12
  186. package/dist/loop/index.js +1 -1
  187. package/dist/loop/network/index.d.ts +3 -3
  188. package/dist/loop/network/index.d.ts.map +1 -1
  189. package/dist/loop/network/run-command-tool.d.ts +1 -1
  190. package/dist/loop/types.d.ts +13 -0
  191. package/dist/loop/types.d.ts.map +1 -1
  192. package/dist/loop/workflows/agentic-execution/index.d.ts +9 -9
  193. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +7 -7
  194. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  195. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +3 -3
  196. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  197. package/dist/loop/workflows/agentic-loop/index.d.ts +9 -9
  198. package/dist/loop/workflows/schema.d.ts +12 -12
  199. package/dist/mastra/index.cjs +2 -2
  200. package/dist/mastra/index.d.ts +91 -5
  201. package/dist/mastra/index.d.ts.map +1 -1
  202. package/dist/mastra/index.js +1 -1
  203. package/dist/mcp/index.cjs +2 -2
  204. package/dist/mcp/index.js +1 -1
  205. package/dist/memory/index.cjs +14 -14
  206. package/dist/memory/index.js +1 -1
  207. package/dist/memory/mock.d.ts.map +1 -1
  208. package/dist/memory/types.d.ts +128 -0
  209. package/dist/memory/types.d.ts.map +1 -1
  210. package/dist/models-dev-FQVUTQ7L.js +3 -0
  211. package/dist/{models-dev-Z45JSLWD.js.map → models-dev-FQVUTQ7L.js.map} +1 -1
  212. package/dist/models-dev-PPIXUUCU.cjs +12 -0
  213. package/dist/{models-dev-OQKVMEIT.cjs.map → models-dev-PPIXUUCU.cjs.map} +1 -1
  214. package/dist/netlify-4RIKF7Y3.js +3 -0
  215. package/dist/{netlify-SSWMYSAX.js.map → netlify-4RIKF7Y3.js.map} +1 -1
  216. package/dist/netlify-V5F7JEJH.cjs +12 -0
  217. package/dist/{netlify-TXZZCT6N.cjs.map → netlify-V5F7JEJH.cjs.map} +1 -1
  218. package/dist/processors/index.cjs +41 -41
  219. package/dist/processors/index.js +1 -1
  220. package/dist/processors/step-schema.d.ts +44 -44
  221. package/dist/provider-registry-BJJRUX4P.cjs +40 -0
  222. package/dist/{provider-registry-NR7FXV2Q.cjs.map → provider-registry-BJJRUX4P.cjs.map} +1 -1
  223. package/dist/provider-registry-VZYB342T.js +3 -0
  224. package/dist/{provider-registry-RPOTQNHI.js.map → provider-registry-VZYB342T.js.map} +1 -1
  225. package/dist/provider-registry.json +264 -37
  226. package/dist/relevance/index.cjs +3 -3
  227. package/dist/relevance/index.js +1 -1
  228. package/dist/server/index.cjs +3 -3
  229. package/dist/server/index.js +1 -1
  230. package/dist/storage/base.d.ts +3 -1
  231. package/dist/storage/base.d.ts.map +1 -1
  232. package/dist/storage/constants.cjs +51 -19
  233. package/dist/storage/constants.d.ts +10 -2
  234. package/dist/storage/constants.d.ts.map +1 -1
  235. package/dist/storage/constants.js +1 -1
  236. package/dist/storage/domains/agents/base.d.ts +13 -164
  237. package/dist/storage/domains/agents/base.d.ts.map +1 -1
  238. package/dist/storage/domains/agents/index.d.ts +0 -1
  239. package/dist/storage/domains/agents/index.d.ts.map +1 -1
  240. package/dist/storage/domains/agents/inmemory.d.ts +6 -10
  241. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
  242. package/dist/storage/domains/index.d.ts +3 -0
  243. package/dist/storage/domains/index.d.ts.map +1 -1
  244. package/dist/storage/domains/inmemory-db.d.ts +7 -1
  245. package/dist/storage/domains/inmemory-db.d.ts.map +1 -1
  246. package/dist/storage/domains/memory/base.d.ts +41 -1
  247. package/dist/storage/domains/memory/base.d.ts.map +1 -1
  248. package/dist/storage/domains/memory/inmemory.d.ts +6 -6
  249. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  250. package/dist/storage/domains/observability/types.d.ts +62 -62
  251. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  252. package/dist/storage/domains/prompt-blocks/base.d.ts +47 -0
  253. package/dist/storage/domains/prompt-blocks/base.d.ts.map +1 -0
  254. package/dist/storage/domains/prompt-blocks/index.d.ts +3 -0
  255. package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -0
  256. package/dist/storage/domains/prompt-blocks/inmemory.d.ts +31 -0
  257. package/dist/storage/domains/prompt-blocks/inmemory.d.ts.map +1 -0
  258. package/dist/storage/domains/scorer-definitions/base.d.ts +47 -0
  259. package/dist/storage/domains/scorer-definitions/base.d.ts.map +1 -0
  260. package/dist/storage/domains/scorer-definitions/index.d.ts +3 -0
  261. package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -0
  262. package/dist/storage/domains/scorer-definitions/inmemory.d.ts +31 -0
  263. package/dist/storage/domains/scorer-definitions/inmemory.d.ts.map +1 -0
  264. package/dist/storage/domains/versioned.d.ts +136 -0
  265. package/dist/storage/domains/versioned.d.ts.map +1 -0
  266. package/dist/storage/index.cjs +156 -104
  267. package/dist/storage/index.js +2 -2
  268. package/dist/storage/mock.d.ts.map +1 -1
  269. package/dist/storage/types.d.ts +481 -27
  270. package/dist/storage/types.d.ts.map +1 -1
  271. package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
  272. package/dist/stream/MastraWorkflowStream.d.ts +1 -1
  273. package/dist/stream/RunOutput.d.ts +1 -1
  274. package/dist/stream/RunOutput.d.ts.map +1 -1
  275. package/dist/stream/base/output.d.ts +4 -0
  276. package/dist/stream/base/output.d.ts.map +1 -1
  277. package/dist/stream/index.cjs +11 -11
  278. package/dist/stream/index.js +2 -2
  279. package/dist/test-utils/llm-mock.cjs +4 -4
  280. package/dist/test-utils/llm-mock.js +1 -1
  281. package/dist/tool-loop-agent/index.cjs +4 -4
  282. package/dist/tool-loop-agent/index.js +1 -1
  283. package/dist/tools/index.cjs +4 -4
  284. package/dist/tools/index.js +1 -1
  285. package/dist/tools/is-vercel-tool.cjs +2 -2
  286. package/dist/tools/is-vercel-tool.js +1 -1
  287. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  288. package/dist/tools/types.d.ts +15 -0
  289. package/dist/tools/types.d.ts.map +1 -1
  290. package/dist/tools/validation.d.ts.map +1 -1
  291. package/dist/tts/index.cjs +2 -2
  292. package/dist/tts/index.js +1 -1
  293. package/dist/types/zod-compat.d.ts +2 -2
  294. package/dist/types/zod-compat.d.ts.map +1 -1
  295. package/dist/utils/zod-utils.d.ts +19 -0
  296. package/dist/utils/zod-utils.d.ts.map +1 -1
  297. package/dist/utils.cjs +28 -28
  298. package/dist/utils.d.ts +7 -1
  299. package/dist/utils.d.ts.map +1 -1
  300. package/dist/utils.js +2 -2
  301. package/dist/vector/index.cjs +9 -9
  302. package/dist/vector/index.js +2 -2
  303. package/dist/voice/index.cjs +6 -6
  304. package/dist/voice/index.js +1 -1
  305. package/dist/workflows/evented/index.cjs +10 -10
  306. package/dist/workflows/evented/index.js +1 -1
  307. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  308. package/dist/workflows/evented/workflow.d.ts +3 -1
  309. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  310. package/dist/workflows/execution-engine.d.ts.map +1 -1
  311. package/dist/workflows/index.cjs +25 -25
  312. package/dist/workflows/index.js +1 -1
  313. package/dist/workflows/step.d.ts +4 -3
  314. package/dist/workflows/step.d.ts.map +1 -1
  315. package/dist/workflows/types.d.ts +2 -1
  316. package/dist/workflows/types.d.ts.map +1 -1
  317. package/dist/workflows/workflow.d.ts +12 -4
  318. package/dist/workflows/workflow.d.ts.map +1 -1
  319. package/dist/workspace/errors.d.ts +6 -0
  320. package/dist/workspace/errors.d.ts.map +1 -1
  321. package/dist/workspace/filesystem/composite-filesystem.d.ts +93 -0
  322. package/dist/workspace/filesystem/composite-filesystem.d.ts.map +1 -0
  323. package/dist/workspace/filesystem/filesystem.d.ts +35 -0
  324. package/dist/workspace/filesystem/filesystem.d.ts.map +1 -1
  325. package/dist/workspace/filesystem/index.d.ts +2 -0
  326. package/dist/workspace/filesystem/index.d.ts.map +1 -1
  327. package/dist/workspace/filesystem/local-filesystem.d.ts +9 -1
  328. package/dist/workspace/filesystem/local-filesystem.d.ts.map +1 -1
  329. package/dist/workspace/filesystem/mastra-filesystem.d.ts +92 -3
  330. package/dist/workspace/filesystem/mastra-filesystem.d.ts.map +1 -1
  331. package/dist/workspace/filesystem/mount.d.ts +34 -0
  332. package/dist/workspace/filesystem/mount.d.ts.map +1 -0
  333. package/dist/workspace/index.cjs +62 -34
  334. package/dist/workspace/index.d.ts +6 -2
  335. package/dist/workspace/index.d.ts.map +1 -1
  336. package/dist/workspace/index.js +1 -1
  337. package/dist/workspace/lifecycle.d.ts +29 -0
  338. package/dist/workspace/lifecycle.d.ts.map +1 -1
  339. package/dist/workspace/sandbox/errors.d.ts +50 -0
  340. package/dist/workspace/sandbox/errors.d.ts.map +1 -0
  341. package/dist/workspace/sandbox/index.d.ts +3 -0
  342. package/dist/workspace/sandbox/index.d.ts.map +1 -1
  343. package/dist/workspace/sandbox/local-sandbox.d.ts +17 -2
  344. package/dist/workspace/sandbox/local-sandbox.d.ts.map +1 -1
  345. package/dist/workspace/sandbox/mastra-sandbox.d.ts +153 -6
  346. package/dist/workspace/sandbox/mastra-sandbox.d.ts.map +1 -1
  347. package/dist/workspace/sandbox/mount-manager.d.ts +195 -0
  348. package/dist/workspace/sandbox/mount-manager.d.ts.map +1 -0
  349. package/dist/workspace/sandbox/sandbox.d.ts +37 -84
  350. package/dist/workspace/sandbox/sandbox.d.ts.map +1 -1
  351. package/dist/workspace/sandbox/types.d.ts +92 -0
  352. package/dist/workspace/sandbox/types.d.ts.map +1 -0
  353. package/dist/workspace/tools/tools.d.ts.map +1 -1
  354. package/dist/workspace/tools/tree-formatter.d.ts.map +1 -1
  355. package/dist/workspace/workspace.d.ts +73 -3
  356. package/dist/workspace/workspace.d.ts.map +1 -1
  357. package/package.json +16 -16
  358. package/src/llm/model/provider-types.generated.d.ts +122 -13
  359. package/dist/chunk-2DMSFLJY.cjs.map +0 -1
  360. package/dist/chunk-5SOS47PH.cjs.map +0 -1
  361. package/dist/chunk-5YVR7B4R.js.map +0 -1
  362. package/dist/chunk-7MDVYPWX.cjs.map +0 -1
  363. package/dist/chunk-A5QFWX67.cjs.map +0 -1
  364. package/dist/chunk-AIJLACR2.js.map +0 -1
  365. package/dist/chunk-BP2TSCBW.js.map +0 -1
  366. package/dist/chunk-C4WWWQHT.cjs.map +0 -1
  367. package/dist/chunk-E3VFKTIA.js.map +0 -1
  368. package/dist/chunk-ENCTSDWC.js.map +0 -1
  369. package/dist/chunk-G6E3QNJC.js.map +0 -1
  370. package/dist/chunk-GVLPTDJA.cjs.map +0 -1
  371. package/dist/chunk-HMCXNOF6.cjs.map +0 -1
  372. package/dist/chunk-HN2MSTR6.cjs.map +0 -1
  373. package/dist/chunk-I66TMZJ3.cjs.map +0 -1
  374. package/dist/chunk-IIZF4W7B.cjs.map +0 -1
  375. package/dist/chunk-IW3BNL7A.js.map +0 -1
  376. package/dist/chunk-JIT2OY3X.js.map +0 -1
  377. package/dist/chunk-JRJJ5VQE.cjs.map +0 -1
  378. package/dist/chunk-MNWW2R3U.js.map +0 -1
  379. package/dist/chunk-MSWXEOZC.js.map +0 -1
  380. package/dist/chunk-P62OJXQ4.js.map +0 -1
  381. package/dist/chunk-QOFI2WBM.cjs.map +0 -1
  382. package/dist/chunk-RXD5EGQF.js.map +0 -1
  383. package/dist/chunk-T6PRRKMW.js.map +0 -1
  384. package/dist/chunk-UZL4H5P2.cjs.map +0 -1
  385. package/dist/chunk-VW7YQWDW.cjs.map +0 -1
  386. package/dist/chunk-VX7UA3SO.js.map +0 -1
  387. package/dist/chunk-WFUNLRQX.js.map +0 -1
  388. package/dist/chunk-XCPEEIHI.cjs.map +0 -1
  389. package/dist/chunk-YLODOPYM.cjs.map +0 -1
  390. package/dist/chunk-Z6NRYYOH.js.map +0 -1
  391. package/dist/docs/references/docs-tools-mcp-advanced-usage.md +0 -143
  392. package/dist/docs/references/docs-tools-mcp-mcp-overview.md +0 -383
  393. package/dist/docs/references/docs-tools-mcp-overview.md +0 -78
  394. package/dist/docs/references/docs-workflows-input-data-mapping.md +0 -102
  395. package/dist/docs/references/reference-deployer-netlify.md +0 -14
  396. package/dist/docs/references/reference-deployer-vercel.md +0 -39
  397. package/dist/docs/references/reference-tools-client.md +0 -228
  398. package/dist/models-dev-OQKVMEIT.cjs +0 -12
  399. package/dist/models-dev-Z45JSLWD.js +0 -3
  400. package/dist/netlify-SSWMYSAX.js +0 -3
  401. package/dist/netlify-TXZZCT6N.cjs +0 -12
  402. package/dist/provider-registry-NR7FXV2Q.cjs +0 -40
  403. package/dist/provider-registry-RPOTQNHI.js +0 -3
@@ -1,5 +1,7 @@
1
1
  # Filesystem
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  Filesystem providers give agents the ability to read, write, and manage files. When you configure a filesystem on a workspace, agents receive tools for file operations.
4
6
 
5
7
  A filesystem provider handles all file operations for a workspace:
@@ -1,4 +1,6 @@
1
- # Workspace
1
+ # Workspaces
2
+
3
+ **Added in:** `@mastra/core@1.1.0`
2
4
 
3
5
  A Mastra workspace gives agents a persistent environment for storing files and executing commands. Agents use workspace tools to read and write files, run shell commands, and search indexed content.
4
6
 
@@ -1,5 +1,7 @@
1
1
  # Sandbox
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  Sandbox providers give agents the ability to execute shell commands. When you configure a sandbox on a workspace, agents can run commands as part of their tasks.
4
6
 
5
7
  A sandbox provider executes commands in a controlled environment:
@@ -1,5 +1,7 @@
1
1
  # Search and Indexing
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  Search lets agents find relevant content in indexed workspace files. When an agent needs to answer a question or find information, it can search the indexed content instead of reading every file.
4
6
 
5
7
  ## How it works
@@ -1,4 +1,6 @@
1
- # Skills
1
+ # Workspace Skills
2
+
3
+ **Added in:** `@mastra/core@1.1.0`
2
4
 
3
5
  Skills are reusable instructions that teach agents how to perform specific tasks. They follow the [Agent Skills specification](https://agentskills.io) - an open standard for packaging agent capabilities.
4
6
 
@@ -26,9 +26,4 @@ await agent.getTools({
26
26
 
27
27
  ### Options parameters
28
28
 
29
- **requestContext?:** (`RequestContext`): Runtime context for dependency injection and contextual information. (Default: `new RequestContext()`)
30
-
31
- ## Related
32
-
33
- - [Using tools with agents](https://mastra.ai/docs/agents/using-tools)
34
- - [MCP Overview](https://mastra.ai/docs/mcp/overview)
29
+ **requestContext?:** (`RequestContext`): Runtime context for dependency injection and contextual information. (Default: `new RequestContext()`)
@@ -1,6 +1,6 @@
1
1
  # Agent.listAgents()
2
2
 
3
- The `.listAgents()` method retrieves the sub-agents configured for an agent, resolving them if they're a function. These sub-agents enable the agent to access other agents and perform complex actions.
3
+ The `.listAgents()` method retrieves the subagents configured for an agent, resolving them if they're a function. These subagents enable the agent to access other agents and perform complex actions.
4
4
 
5
5
  ## Usage example
6
6
 
@@ -1,7 +1,5 @@
1
1
  # Agent.network()
2
2
 
3
- > **Experimental Feature:** This is an experimental API that may change in future versions. The `network()` method enables multi-agent collaboration and workflow orchestration. Use with caution in production environments.
4
-
5
3
  The `.network()` method enables multi-agent collaboration and routing. This method accepts messages and optional execution options.
6
4
 
7
5
  ## Usage example
@@ -26,7 +26,24 @@ Start the development server in inspect mode and break at the beginning of the s
26
26
 
27
27
  #### `--custom-args`
28
28
 
29
- Comma-separated list of custom arguments to pass to the development server. You can pass arguments to the Node.js process, e.g. `--experimental-transform-types`.
29
+ Comma-separated list of custom arguments to pass to the Node.js process, e.g. `--require=newrelic` or `--experimental-transform-types`.
30
+
31
+ #### `--request-context-presets`
32
+
33
+ Path to a JSON file containing named [request context](https://mastra.ai/docs/server/request-context) presets. When provided, a dropdown appears in Studio's request context editor, letting you quickly switch between preset configurations.
34
+
35
+ ```bash
36
+ mastra dev --request-context-presets ./presets.json
37
+ ```
38
+
39
+ The file must be a JSON object where each key is a preset name and each value is an object:
40
+
41
+ ```json
42
+ {
43
+ "development": { "userId": "dev-user", "env": "development" },
44
+ "production": { "userId": "prod-user", "env": "production" }
45
+ }
46
+ ```
30
47
 
31
48
  ### Configs
32
49
 
@@ -90,7 +107,7 @@ Under the hood Mastra's Rollup server locates your Mastra entry file and bundles
90
107
 
91
108
  The output in `.mastra` can be deployed to any cloud server using [`mastra start`](#mastra-start).
92
109
 
93
- If you're deploying to a [serverless platform](https://mastra.ai/guides/deployment) you need to install the correct deployer in order to receive the correct output in `.mastra`.
110
+ If you're deploying to a [serverless platform](https://mastra.ai/docs/deployment/cloud-providers) you need to install the correct deployer in order to receive the correct output in `.mastra`.
94
111
 
95
112
  It accepts [common flags](#common-flags).
96
113
 
@@ -134,9 +151,9 @@ The command accepts [common flags](#common-flags) and the following additional f
134
151
 
135
152
  The path to your built Mastra output directory. Defaults to `.mastra/output`.
136
153
 
137
- #### `--no-telemetry`
154
+ #### `--custom-args`
138
155
 
139
- Disable the [OTEL Tracing](https://mastra.ai/docs/observability/tracing/overview).
156
+ Comma-separated list of custom arguments to pass to the Node.js process, e.g. `--require=newrelic` or `--experimental-transform-types`.
140
157
 
141
158
  ## `mastra studio`
142
159
 
@@ -162,6 +179,14 @@ The port of the Mastra API server to connect to. Defaults to `4111`.
162
179
 
163
180
  The protocol of the Mastra API server to connect to. Defaults to `http`.
164
181
 
182
+ #### `--request-context-presets`
183
+
184
+ Path to a JSON file containing named [request context](https://mastra.ai/docs/server/request-context) presets. Works the same as the [`mastra dev` flag](#--request-context-presets).
185
+
186
+ ```bash
187
+ mastra studio --request-context-presets ./presets.json
188
+ ```
189
+
165
190
  ## `mastra lint`
166
191
 
167
192
  The `mastra lint` command validates the structure and code of your Mastra project to ensure it follows best practices and is error-free.
@@ -364,7 +364,7 @@ const agent = await mastraClient.createStoredAgent({
364
364
  },
365
365
  tools: ["calculator", "weather"],
366
366
  workflows: ["data-processing"],
367
- agents: ["sub-agent-1"],
367
+ agents: ["subagent-1"],
368
368
  memory: "my-memory",
369
369
  scorers: {
370
370
  "quality-scorer": {
@@ -304,7 +304,7 @@ export const mastra = new Mastra({
304
304
 
305
305
  Tools are reusable functions that agents can use to interact with external systems. Each tool defines inputs, outputs, and execution logic.
306
306
 
307
- Visit the [Tools documentation](https://mastra.ai/docs/tools-mcp/overview) to learn more.
307
+ Visit the [Tools documentation](https://mastra.ai/docs/agents/using-tools) to learn more.
308
308
 
309
309
  > **Note:** Most users configure tools directly on agents. This top-level configuration is for defining reusable tools that can be shared across multiple agents.
310
310
 
@@ -44,7 +44,7 @@ When creating an `Agent` instance from stored configuration, the method resolves
44
44
 
45
45
  - **Tools**: Resolved from `tools` registered in Mastra config
46
46
  - **Workflows**: Resolved from `workflows` registered in Mastra config
47
- - **Sub-agents**: Resolved from `agents` registered in Mastra config
47
+ - **Subagents**: Resolved from `agents` registered in Mastra config
48
48
  - **Memory**: Resolved from `memory` registered in Mastra config
49
49
  - **Scorers**: Resolved from `scorers` registered in Mastra config, including sampling configuration
50
50
 
@@ -68,7 +68,7 @@ When using `raw: true`, the returned object has the following structure:
68
68
 
69
69
  **workflows?:** (`Record<string, unknown>`): Workflow references to resolve from registry.
70
70
 
71
- **agents?:** (`Record<string, unknown>`): Sub-agent references to resolve from registry.
71
+ **agents?:** (`Record<string, unknown>`): Subagent references to resolve from registry.
72
72
 
73
73
  **memory?:** (`Record<string, unknown>`): Memory reference to resolve from registry.
74
74
 
@@ -61,7 +61,7 @@ When creating `Agent` instances (default behavior), each stored agent's configur
61
61
 
62
62
  - **Tools**: Resolved from `tools` registered in Mastra config
63
63
  - **Workflows**: Resolved from `workflows` registered in Mastra config
64
- - **Sub-agents**: Resolved from `agents` registered in Mastra config
64
+ - **Subagents**: Resolved from `agents` registered in Mastra config
65
65
  - **Memory**: Resolved from `memory` registered in Mastra config
66
66
  - **Scorers**: Resolved from `scorers` registered in Mastra config
67
67
 
@@ -1,5 +1,7 @@
1
1
  # Observational Memory
2
2
 
3
+ **Added in:** `@mastra/memory@1.1.0`
4
+
3
5
  Observational Memory (OM) is Mastra's memory system for long-context agentic memory. Two background agents — an **Observer** that watches conversations and creates observations, and a **Reflector** that restructures observations by combining related items, reflecting on overarching patterns, and condensing where possible — maintain an observation log that replaces raw message history as it grows.
4
6
 
5
7
  ## Usage
@@ -22,17 +24,15 @@ export const agent = new Agent({
22
24
 
23
25
  ## Configuration
24
26
 
25
- The `observationalMemory` option accepts `true`, `false`, or a configuration object.
26
-
27
- Setting `observationalMemory: true` enables it with all defaults. Setting `observationalMemory: false` or omitting it disables it.
27
+ The `observationalMemory` option accepts `true`, a configuration object, or `false`. Setting `true` enables OM with `google/gemini-2.5-flash` as the default model. When passing a config object, a `model` must be explicitly set — either at the top level, or on `observation.model` and/or `reflection.model`.
28
28
 
29
29
  **enabled?:** (`boolean`): Enable or disable Observational Memory. When omitted from a config object, defaults to \`true\`. Only \`enabled: false\` explicitly disables it. (Default: `true`)
30
30
 
31
- **model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Sets the model for both at once. Cannot be used together with \`observation.model\` or \`reflection.model\` — an error will be thrown if both are set. (Default: `'google/gemini-2.5-flash'`)
31
+ **model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Sets the model for both at once. Cannot be used together with \`observation.model\` or \`reflection.model\` — an error will be thrown if both are set. When using \`observationalMemory: true\`, defaults to \`google/gemini-2.5-flash\`. When passing a config object, this or \`observation.model\`/\`reflection.model\` must be set. Use \`"default"\` to explicitly use the default model (\`google/gemini-2.5-flash\`). (Default: `'google/gemini-2.5-flash' (when using observationalMemory: true)`)
32
32
 
33
33
  **scope?:** (`'resource' | 'thread'`): Memory scope for observations. \`'thread'\` keeps observations per-thread. \`'resource'\` shares observations across all threads for a resource, enabling cross-conversation memory. (Default: `'thread'`)
34
34
 
35
- **shareTokenBudget?:** (`boolean`): Share the token budget between messages and observations. When enabled, the total budget is \`observation.messageTokens + reflection.observationTokens\`. Messages can use more space when observations are small, and vice versa. This maximizes context usage through flexible allocation. (Default: `false`)
35
+ **shareTokenBudget?:** (`boolean`): Share the token budget between messages and observations. When enabled, the total budget is \`observation.messageTokens + reflection.observationTokens\`. Messages can use more space when observations are small, and vice versa. This maximizes context usage through flexible allocation. \*\*Note:\*\* \`shareTokenBudget\` is not yet compatible with async buffering. You must set \`observation: { bufferTokens: false }\` when using this option (this is a temporary limitation). (Default: `false`)
36
36
 
37
37
  **observation?:** (`ObservationalMemoryObservationConfig`): Configuration for the observation step. Controls when the Observer agent runs and how it behaves.
38
38
 
@@ -40,7 +40,7 @@ Setting `observationalMemory: true` enables it with all defaults. Setting `obser
40
40
 
41
41
  ### Observation config
42
42
 
43
- **model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for the Observer agent. Cannot be set if a top-level \`model\` is also provided. (Default: `'google/gemini-2.5-flash'`)
43
+ **model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for the Observer agent. Cannot be set if a top-level \`model\` is also provided. If neither this nor the top-level \`model\` is set, falls back to \`reflection.model\`.
44
44
 
45
45
  **messageTokens?:** (`number`): Token count of unobserved messages that triggers observation. When unobserved message tokens exceed this threshold, the Observer agent is called. (Default: `30000`)
46
46
 
@@ -48,14 +48,24 @@ Setting `observationalMemory: true` enables it with all defaults. Setting `obser
48
48
 
49
49
  **modelSettings?:** (`ObservationalMemoryModelSettings`): Model settings for the Observer agent. (Default: `{ temperature: 0.3, maxOutputTokens: 100_000 }`)
50
50
 
51
+ **bufferTokens?:** (`number | false`): Token interval for async background observation buffering. Can be an absolute token count (e.g. \`5000\`) or a fraction of \`messageTokens\` (e.g. \`0.25\` = buffer every 25% of threshold). When set, observations run in the background at this interval, storing results in a buffer. When the main \`messageTokens\` threshold is reached, buffered observations activate instantly without a blocking LLM call. Must resolve to less than \`messageTokens\`. Set to \`false\` to explicitly disable all async buffering (both observation and reflection). (Default: `0.2`)
52
+
53
+ **bufferActivation?:** (`number`): Ratio (0-1) controlling how much of the message window to retain after activation. For example, \`0.8\` means activate enough to keep only 20% of \`messageTokens\` remaining. Higher values remove more message history per activation. (Default: `0.8`)
54
+
55
+ **blockAfter?:** (`number`): Token threshold above which synchronous (blocking) observation is forced. Between \`messageTokens\` and \`blockAfter\`, only async buffering/activation is used. Above \`blockAfter\`, a synchronous observation runs as a last resort. Accepts a multiplier (1 < value < 2, multiplied by \`messageTokens\`) or an absolute token count (≥ 2, must be greater than \`messageTokens\`). Only relevant when \`bufferTokens\` is set. Defaults to \`1.2\` when async buffering is enabled. (Default: `1.2 (when bufferTokens is set)`)
56
+
51
57
  ### Reflection config
52
58
 
53
- **model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for the Reflector agent. Cannot be set if a top-level \`model\` is also provided. (Default: `'google/gemini-2.5-flash'`)
59
+ **model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for the Reflector agent. Cannot be set if a top-level \`model\` is also provided. If neither this nor the top-level \`model\` is set, falls back to \`observation.model\`.
54
60
 
55
61
  **observationTokens?:** (`number`): Token count of observations that triggers reflection. When observation tokens exceed this threshold, the Reflector agent is called to condense them. (Default: `40000`)
56
62
 
57
63
  **modelSettings?:** (`ObservationalMemoryModelSettings`): Model settings for the Reflector agent. (Default: `{ temperature: 0, maxOutputTokens: 100_000 }`)
58
64
 
65
+ **bufferActivation?:** (`number`): Ratio (0-1) controlling when async reflection buffering starts. When observation tokens reach \`observationTokens \* bufferActivation\`, reflection runs in the background. On activation at the full threshold, the buffered reflection replaces the observations it covers, preserving any new observations appended after that range. (Default: `0.5`)
66
+
67
+ **blockAfter?:** (`number`): Token threshold above which synchronous (blocking) reflection is forced. Between \`observationTokens\` and \`blockAfter\`, only async buffering/activation is used. Above \`blockAfter\`, a synchronous reflection runs as a last resort. Accepts a multiplier (1 < value < 2, multiplied by \`observationTokens\`) or an absolute token count (≥ 2, must be greater than \`observationTokens\`). Only relevant when \`bufferActivation\` is set. Defaults to \`1.2\` when async reflection is enabled. (Default: `1.2 (when bufferActivation is set)`)
68
+
59
69
  ### Model settings
60
70
 
61
71
  **temperature?:** (`number`): Temperature for generation. Lower values produce more consistent output. (Default: `0.3`)
@@ -77,6 +87,7 @@ export const agent = new Agent({
77
87
  memory: new Memory({
78
88
  options: {
79
89
  observationalMemory: {
90
+ model: "google/gemini-2.5-flash",
80
91
  scope: "resource",
81
92
  observation: {
82
93
  messageTokens: 20_000,
@@ -106,6 +117,7 @@ export const agent = new Agent({
106
117
  shareTokenBudget: true,
107
118
  observation: {
108
119
  messageTokens: 20_000,
120
+ bufferTokens: false, // required when using shareTokenBudget (temporary limitation)
109
121
  },
110
122
  reflection: {
111
123
  observationTokens: 80_000,
@@ -163,6 +175,305 @@ export const agent = new Agent({
163
175
  });
164
176
  ```
165
177
 
178
+ ### Async buffering
179
+
180
+ Async buffering is **enabled by default**. It pre-computes observations in the background as the conversation grows — when the `messageTokens` threshold is reached, buffered observations activate instantly with no blocking LLM call.
181
+
182
+ The lifecycle is: **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals, each producing a chunk of observations. At threshold, chunks activate: observations move into the log, raw messages are removed from context. The `blockAfter` threshold forces a synchronous fallback if buffering can't keep up.
183
+
184
+ Default settings:
185
+
186
+ - `observation.bufferTokens: 0.2` — buffer every 20% of `messageTokens` (e.g. every \~6k tokens with a 30k threshold)
187
+ - `observation.bufferActivation: 0.8` — on activation, remove enough messages to keep only 20% of the threshold remaining
188
+ - `reflection.bufferActivation: 0.5` — start background reflection at 50% of observation threshold
189
+
190
+ To customize:
191
+
192
+ ```typescript
193
+ import { Memory } from "@mastra/memory";
194
+ import { Agent } from "@mastra/core/agent";
195
+
196
+ export const agent = new Agent({
197
+ name: "my-agent",
198
+ instructions: "You are a helpful assistant.",
199
+ model: "openai/gpt-5-mini",
200
+ memory: new Memory({
201
+ options: {
202
+ observationalMemory: {
203
+ model: "google/gemini-2.5-flash",
204
+ observation: {
205
+ messageTokens: 30_000,
206
+ // Buffer every 5k tokens (runs in background)
207
+ bufferTokens: 5_000,
208
+ // Activate to retain 30% of threshold
209
+ bufferActivation: 0.7,
210
+ // Force synchronous observation at 1.5x threshold
211
+ blockAfter: 1.5,
212
+ },
213
+ reflection: {
214
+ observationTokens: 60_000,
215
+ // Start background reflection at 50% of threshold
216
+ bufferActivation: 0.5,
217
+ // Force synchronous reflection at 1.2x threshold
218
+ blockAfter: 1.2,
219
+ },
220
+ },
221
+ },
222
+ }),
223
+ });
224
+ ```
225
+
226
+ To disable async buffering entirely:
227
+
228
+ ```typescript
229
+ observationalMemory: {
230
+ model: "google/gemini-2.5-flash",
231
+ observation: {
232
+ bufferTokens: false,
233
+ },
234
+ }
235
+ ```
236
+
237
+ Setting `bufferTokens: false` disables both observation and reflection async buffering. Observations and reflections will run synchronously when their thresholds are reached.
238
+
239
+ > **Note:** Async buffering is not supported with `scope: 'resource'` and is automatically disabled in resource scope.
240
+
241
+ ## Streaming data parts
242
+
243
+ Observational Memory emits typed data parts during agent execution that clients can use for real-time UI feedback. These are streamed alongside the agent's response.
244
+
245
+ ### `data-om-status`
246
+
247
+ Emitted once per agent loop step, before model generation. Provides a snapshot of the current memory state, including token usage for both context windows and the state of any async buffered content.
248
+
249
+ ```typescript
250
+ interface DataOmStatusPart {
251
+ type: 'data-om-status';
252
+ data: {
253
+ windows: {
254
+ active: {
255
+ /** Unobserved message tokens and the threshold that triggers observation */
256
+ messages: { tokens: number; threshold: number };
257
+ /** Observation tokens and the threshold that triggers reflection */
258
+ observations: { tokens: number; threshold: number };
259
+ };
260
+ buffered: {
261
+ observations: {
262
+ /** Number of buffered chunks staged for activation */
263
+ chunks: number;
264
+ /** Total message tokens across all buffered chunks */
265
+ messageTokens: number;
266
+ /** Projected message tokens that would be removed if activation happened now (based on bufferActivation ratio and chunk boundaries) */
267
+ projectedMessageRemoval: number;
268
+ /** Observation tokens that will be added on activation */
269
+ observationTokens: number;
270
+ /** idle: no buffering in progress. running: background observer is working. complete: chunks are ready for activation. */
271
+ status: 'idle' | 'running' | 'complete';
272
+ };
273
+ reflection: {
274
+ /** Observation tokens that were fed into the reflector (pre-compression size) */
275
+ inputObservationTokens: number;
276
+ /** Observation tokens the reflection will produce on activation (post-compression size) */
277
+ observationTokens: number;
278
+ /** idle: no reflection buffered. running: background reflector is working. complete: reflection is ready for activation. */
279
+ status: 'idle' | 'running' | 'complete';
280
+ };
281
+ };
282
+ };
283
+ recordId: string;
284
+ threadId: string;
285
+ stepNumber: number;
286
+ /** Increments each time the Reflector creates a new generation */
287
+ generationCount: number;
288
+ };
289
+ }
290
+ ```
291
+
292
+ `buffered.reflection.inputObservationTokens` is the size of the observations that were sent to the Reflector. `buffered.reflection.observationTokens` is the compressed result — the size of what will replace those observations when the reflection activates. A client can use these two values to show a compression ratio.
293
+
294
+ Clients can derive percentages and post-activation estimates from the raw values:
295
+
296
+ ```typescript
297
+ // Message window usage %
298
+ const msgPercent = status.windows.active.messages.tokens
299
+ / status.windows.active.messages.threshold;
300
+
301
+ // Observation window usage %
302
+ const obsPercent = status.windows.active.observations.tokens
303
+ / status.windows.active.observations.threshold;
304
+
305
+ // Projected message tokens after buffered observations activate
306
+ // Uses projectedMessageRemoval which accounts for bufferActivation ratio and chunk boundaries
307
+ const postActivation = status.windows.active.messages.tokens
308
+ - status.windows.buffered.observations.projectedMessageRemoval;
309
+
310
+ // Reflection compression ratio (when buffered reflection exists)
311
+ const { inputObservationTokens, observationTokens } = status.windows.buffered.reflection;
312
+ if (inputObservationTokens > 0) {
313
+ const compressionRatio = observationTokens / inputObservationTokens;
314
+ }
315
+ ```
316
+
317
+ ### `data-om-observation-start`
318
+
319
+ Emitted when the Observer or Reflector agent begins processing.
320
+
321
+ **cycleId:** (`string`): Unique ID for this cycle — shared between start/end/failed markers.
322
+
323
+ **operationType:** (`'observation' | 'reflection'`): Whether this is an observation or reflection operation.
324
+
325
+ **startedAt:** (`string`): ISO timestamp when processing started.
326
+
327
+ **tokensToObserve:** (`number`): Message tokens (input) being processed in this batch.
328
+
329
+ **recordId:** (`string`): The OM record ID.
330
+
331
+ **threadId:** (`string`): This thread's ID.
332
+
333
+ **threadIds:** (`string[]`): All thread IDs in this batch (for resource-scoped).
334
+
335
+ **config:** (`ObservationMarkerConfig`): Snapshot of \`messageTokens\`, \`observationTokens\`, and \`scope\` at observation time.
336
+
337
+ ### `data-om-observation-end`
338
+
339
+ Emitted when observation or reflection completes successfully.
340
+
341
+ **cycleId:** (`string`): Matches the corresponding \`start\` marker.
342
+
343
+ **operationType:** (`'observation' | 'reflection'`): Type of operation that completed.
344
+
345
+ **completedAt:** (`string`): ISO timestamp when processing completed.
346
+
347
+ **durationMs:** (`number`): Duration in milliseconds.
348
+
349
+ **tokensObserved:** (`number`): Message tokens (input) that were processed.
350
+
351
+ **observationTokens:** (`number`): Resulting observation tokens (output) after the Observer compressed them.
352
+
353
+ **observations?:** (`string`): The generated observations text.
354
+
355
+ **currentTask?:** (`string`): Current task extracted by the Observer.
356
+
357
+ **suggestedResponse?:** (`string`): Suggested response extracted by the Observer.
358
+
359
+ **recordId:** (`string`): The OM record ID.
360
+
361
+ **threadId:** (`string`): This thread's ID.
362
+
363
+ ### `data-om-observation-failed`
364
+
365
+ Emitted when observation or reflection fails. The system falls back to synchronous processing.
366
+
367
+ **cycleId:** (`string`): Matches the corresponding \`start\` marker.
368
+
369
+ **operationType:** (`'observation' | 'reflection'`): Type of operation that failed.
370
+
371
+ **failedAt:** (`string`): ISO timestamp when the failure occurred.
372
+
373
+ **durationMs:** (`number`): Duration until failure in milliseconds.
374
+
375
+ **tokensAttempted:** (`number`): Message tokens (input) that were attempted.
376
+
377
+ **error:** (`string`): Error message.
378
+
379
+ **observations?:** (`string`): Any partial content available for display.
380
+
381
+ **recordId:** (`string`): The OM record ID.
382
+
383
+ **threadId:** (`string`): This thread's ID.
384
+
385
+ ### `data-om-buffering-start`
386
+
387
+ Emitted when async buffering begins in the background. Buffering pre-computes observations or reflections before the main threshold is reached.
388
+
389
+ **cycleId:** (`string`): Unique ID for this buffering cycle.
390
+
391
+ **operationType:** (`'observation' | 'reflection'`): Type of operation being buffered.
392
+
393
+ **startedAt:** (`string`): ISO timestamp when buffering started.
394
+
395
+ **tokensToBuffer:** (`number`): Message tokens (input) being buffered in this cycle.
396
+
397
+ **recordId:** (`string`): The OM record ID.
398
+
399
+ **threadId:** (`string`): This thread's ID.
400
+
401
+ **threadIds:** (`string[]`): All thread IDs being buffered (for resource-scoped).
402
+
403
+ **config:** (`ObservationMarkerConfig`): Snapshot of config at buffering time.
404
+
405
+ ### `data-om-buffering-end`
406
+
407
+ Emitted when async buffering completes. The content is stored but not yet activated in the main context.
408
+
409
+ **cycleId:** (`string`): Matches the corresponding \`buffering-start\` marker.
410
+
411
+ **operationType:** (`'observation' | 'reflection'`): Type of operation that was buffered.
412
+
413
+ **completedAt:** (`string`): ISO timestamp when buffering completed.
414
+
415
+ **durationMs:** (`number`): Duration in milliseconds.
416
+
417
+ **tokensBuffered:** (`number`): Message tokens (input) that were buffered.
418
+
419
+ **bufferedTokens:** (`number`): Observation tokens (output) after the Observer compressed them.
420
+
421
+ **observations?:** (`string`): The buffered content.
422
+
423
+ **recordId:** (`string`): The OM record ID.
424
+
425
+ **threadId:** (`string`): This thread's ID.
426
+
427
+ ### `data-om-buffering-failed`
428
+
429
+ Emitted when async buffering fails. The system falls back to synchronous processing when the threshold is reached.
430
+
431
+ **cycleId:** (`string`): Matches the corresponding \`buffering-start\` marker.
432
+
433
+ **operationType:** (`'observation' | 'reflection'`): Type of operation that failed.
434
+
435
+ **failedAt:** (`string`): ISO timestamp when the failure occurred.
436
+
437
+ **durationMs:** (`number`): Duration until failure in milliseconds.
438
+
439
+ **tokensAttempted:** (`number`): Message tokens (input) that were attempted to buffer.
440
+
441
+ **error:** (`string`): Error message.
442
+
443
+ **observations?:** (`string`): Any partial content.
444
+
445
+ **recordId:** (`string`): The OM record ID.
446
+
447
+ **threadId:** (`string`): This thread's ID.
448
+
449
+ ### `data-om-activation`
450
+
451
+ Emitted when buffered observations or reflections are activated (moved into the active context window). This is an instant operation — no LLM call is involved.
452
+
453
+ **cycleId:** (`string`): Unique ID for this activation event.
454
+
455
+ **operationType:** (`'observation' | 'reflection'`): Type of content activated.
456
+
457
+ **activatedAt:** (`string`): ISO timestamp when activation occurred.
458
+
459
+ **chunksActivated:** (`number`): Number of buffered chunks activated.
460
+
461
+ **tokensActivated:** (`number`): Message tokens (input) from activated chunks. For observation activation, these are removed from the message window. For reflection activation, this is the observation tokens that were compressed.
462
+
463
+ **observationTokens:** (`number`): Resulting observation tokens after activation.
464
+
465
+ **messagesActivated:** (`number`): Number of messages that were observed via activation.
466
+
467
+ **generationCount:** (`number`): Current reflection generation count.
468
+
469
+ **observations?:** (`string`): The activated observations text.
470
+
471
+ **recordId:** (`string`): The OM record ID.
472
+
473
+ **threadId:** (`string`): This thread's ID.
474
+
475
+ **config:** (`ObservationMarkerConfig`): Snapshot of config at activation time.
476
+
166
477
  ## Standalone usage
167
478
 
168
479
  Most users should use the `Memory` class above. Using `ObservationalMemory` directly is mainly useful for benchmarking, experimentation, or when you need to control processor ordering with other processors (like [guardrails](https://mastra.ai/docs/agents/guardrails)).
@@ -2,8 +2,6 @@
2
2
 
3
3
  The `MCPClient` class provides a way to manage multiple MCP server connections and their tools in a Mastra application. It handles connection lifecycle, tool namespacing, and provides access to tools across all configured servers.
4
4
 
5
- This class replaces the deprecated [`MastraMCPClient`](https://mastra.ai/reference/tools/client).
6
-
7
5
  ## Constructor
8
6
 
9
7
  Creates a new instance of the MCPClient class.
@@ -84,6 +84,8 @@ const agentStep = createStep(testAgent, {
84
84
 
85
85
  **execute:** (`(params: ExecuteParams) => Promise<any>`): Async function containing step logic
86
86
 
87
+ **metadata:** (`Record<string, any>`): Optional key-value pairs for storing additional step information. Values must be serializable (no functions, circular references, etc.).
88
+
87
89
  ### ExecuteParams
88
90
 
89
91
  **inputData:** (`z.infer<TStepInput>`): The input data matching the inputSchema
@@ -5,7 +5,7 @@ The `.map()` method maps output data from a previous step to the input of a subs
5
5
  ## Usage example
6
6
 
7
7
  ```typescript
8
- workflow.map(async ({ inputData }) => `${inputData.value} - map`
8
+ workflow.map(async ({ inputData }) => `${inputData.value} - map`)
9
9
  ```
10
10
 
11
11
  ## Parameters
@@ -45,7 +45,7 @@ Use `getInitData<typeof workflow>()` to access the initial input data provided t
45
45
  ```typescript
46
46
  .then(step1)
47
47
  .map(async ({ getInitData }) => {
48
- console.log(getInitData());
48
+ console.log(getInitData<any>());
49
49
  })
50
50
  ```
51
51
 
@@ -1,5 +1,7 @@
1
1
  # WorkspaceFilesystem
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  The `WorkspaceFilesystem` interface defines how workspaces interact with file storage.
4
6
 
5
7
  ## Methods
@@ -1,5 +1,7 @@
1
1
  # LocalFilesystem
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  Stores files in a directory on the local filesystem.
4
6
 
5
7
  > **Info:** For interface details, see [WorkspaceFilesystem Interface](https://mastra.ai/reference/workspace/filesystem).
@@ -1,5 +1,7 @@
1
1
  # LocalSandbox
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  Executes commands on the local system.
4
6
 
5
7
  > **Info:** For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
@@ -1,5 +1,7 @@
1
1
  # WorkspaceSandbox
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  The `WorkspaceSandbox` interface defines how workspaces execute commands.
4
6
 
5
7
  ## Methods
@@ -1,5 +1,7 @@
1
1
  # Workspace Class
2
2
 
3
+ **Added in:** `@mastra/core@1.1.0`
4
+
3
5
  The `Workspace` class combines a filesystem and sandbox to provide agents with file storage and command execution capabilities. It also supports BM25 and vector search for indexed content.
4
6
 
5
7
  ## Usage Example