@mastra/core 1.0.0-beta.21 → 1.0.0-beta.22

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 (362) hide show
  1. package/CHANGELOG.md +356 -0
  2. package/dist/action/index.d.ts +7 -7
  3. package/dist/action/index.d.ts.map +1 -1
  4. package/dist/agent/agent-legacy.d.ts.map +1 -1
  5. package/dist/agent/agent.d.ts +100 -18
  6. package/dist/agent/agent.d.ts.map +1 -1
  7. package/dist/agent/agent.types.d.ts +22 -18
  8. package/dist/agent/agent.types.d.ts.map +1 -1
  9. package/dist/agent/index.cjs +13 -13
  10. package/dist/agent/index.d.ts +1 -1
  11. package/dist/agent/index.d.ts.map +1 -1
  12. package/dist/agent/index.js +2 -2
  13. package/dist/agent/message-list/adapters/AIV4Adapter.d.ts.map +1 -1
  14. package/dist/agent/message-list/index.cjs +18 -18
  15. package/dist/agent/message-list/index.js +1 -1
  16. package/dist/agent/message-list/message-list.d.ts +2 -1
  17. package/dist/agent/message-list/message-list.d.ts.map +1 -1
  18. package/dist/agent/trip-wire.d.ts +1 -2
  19. package/dist/agent/trip-wire.d.ts.map +1 -1
  20. package/dist/agent/types.d.ts +9 -10
  21. package/dist/agent/types.d.ts.map +1 -1
  22. package/dist/agent/utils.d.ts +7 -42
  23. package/dist/agent/utils.d.ts.map +1 -1
  24. package/dist/agent/workflows/prepare-stream/index.d.ts +6 -118
  25. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  26. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +7 -11
  27. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  28. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +4 -68
  29. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  30. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +3 -45
  31. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  32. package/dist/agent/workflows/prepare-stream/schema.d.ts +10 -10
  33. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +2 -8
  34. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  35. package/dist/{chunk-HJXEZSNI.js → chunk-3XY64RAM.js} +5 -5
  36. package/dist/{chunk-HJXEZSNI.js.map → chunk-3XY64RAM.js.map} +1 -1
  37. package/dist/{chunk-XSJNTLM7.js → chunk-453NPBJ7.js} +479 -47
  38. package/dist/chunk-453NPBJ7.js.map +1 -0
  39. package/dist/{chunk-3CZ42NBZ.js → chunk-5UVSKF5L.js} +17 -14
  40. package/dist/chunk-5UVSKF5L.js.map +1 -0
  41. package/dist/{chunk-XKDVT3ZH.cjs → chunk-67ZKOPA4.cjs} +480 -48
  42. package/dist/chunk-67ZKOPA4.cjs.map +1 -0
  43. package/dist/{chunk-YLP5IWH2.js → chunk-7IYWOBLG.js} +4 -4
  44. package/dist/{chunk-YLP5IWH2.js.map → chunk-7IYWOBLG.js.map} +1 -1
  45. package/dist/{chunk-3RCMDLCG.cjs → chunk-ALQFYWAR.cjs} +12 -12
  46. package/dist/{chunk-3RCMDLCG.cjs.map → chunk-ALQFYWAR.cjs.map} +1 -1
  47. package/dist/{chunk-PC3FBUWH.js → chunk-C4CIC3LZ.js} +2 -2
  48. package/dist/chunk-C4CIC3LZ.js.map +1 -0
  49. package/dist/{chunk-7JGQWNV5.js → chunk-CPLRD2VP.js} +3 -3
  50. package/dist/{chunk-7JGQWNV5.js.map → chunk-CPLRD2VP.js.map} +1 -1
  51. package/dist/{chunk-AHN7K3VE.js → chunk-CQ2E577C.js} +5 -5
  52. package/dist/chunk-CQ2E577C.js.map +1 -0
  53. package/dist/{chunk-A4MCHA5L.cjs → chunk-CVLIEFWM.cjs} +100 -819
  54. package/dist/chunk-CVLIEFWM.cjs.map +1 -0
  55. package/dist/{chunk-XBZWAUZ3.js → chunk-IFPQ2MLB.js} +25 -12
  56. package/dist/chunk-IFPQ2MLB.js.map +1 -0
  57. package/dist/{chunk-DVJZZAZA.cjs → chunk-IHD36QFA.cjs} +7 -7
  58. package/dist/{chunk-DVJZZAZA.cjs.map → chunk-IHD36QFA.cjs.map} +1 -1
  59. package/dist/{chunk-WMJEP45F.cjs → chunk-J4KVR4DZ.cjs} +25 -18
  60. package/dist/chunk-J4KVR4DZ.cjs.map +1 -0
  61. package/dist/{chunk-3RFSIHFR.js → chunk-K2LPTKSY.js} +4 -720
  62. package/dist/chunk-K2LPTKSY.js.map +1 -0
  63. package/dist/{chunk-FY3PYSMK.cjs → chunk-KHO4KFXW.cjs} +5 -5
  64. package/dist/{chunk-FY3PYSMK.cjs.map → chunk-KHO4KFXW.cjs.map} +1 -1
  65. package/dist/{chunk-W7R7GPNN.cjs → chunk-MGPIVG2O.cjs} +9 -9
  66. package/dist/chunk-MGPIVG2O.cjs.map +1 -0
  67. package/dist/{chunk-KGE3KAM7.js → chunk-N3PAHTKU.js} +23 -3
  68. package/dist/chunk-N3PAHTKU.js.map +1 -0
  69. package/dist/{chunk-O4H44CMA.js → chunk-N7TDP7ZE.js} +586 -117
  70. package/dist/chunk-N7TDP7ZE.js.map +1 -0
  71. package/dist/{chunk-I5GMA5UM.cjs → chunk-NPIYNC5A.cjs} +9 -9
  72. package/dist/{chunk-I5GMA5UM.cjs.map → chunk-NPIYNC5A.cjs.map} +1 -1
  73. package/dist/{chunk-AW7FISLD.cjs → chunk-OZ75PBBK.cjs} +27 -7
  74. package/dist/chunk-OZ75PBBK.cjs.map +1 -0
  75. package/dist/{chunk-JMAPJWVG.cjs → chunk-OZCUIZRA.cjs} +2021 -1426
  76. package/dist/chunk-OZCUIZRA.cjs.map +1 -0
  77. package/dist/{chunk-6OPEMI2Q.cjs → chunk-PM3UIIBK.cjs} +2 -3
  78. package/dist/{chunk-6OPEMI2Q.cjs.map → chunk-PM3UIIBK.cjs.map} +1 -1
  79. package/dist/{chunk-CISH55FP.js → chunk-PSIJ6OSV.js} +16 -9
  80. package/dist/chunk-PSIJ6OSV.js.map +1 -0
  81. package/dist/{chunk-UOZ3GJY2.cjs → chunk-PTK74KG4.cjs} +2 -2
  82. package/dist/chunk-PTK74KG4.cjs.map +1 -0
  83. package/dist/{chunk-O5IPTMEH.cjs → chunk-Q5QQDMSD.cjs} +32 -29
  84. package/dist/chunk-Q5QQDMSD.cjs.map +1 -0
  85. package/dist/{chunk-UVHSM2GU.cjs → chunk-SMM2C4KH.cjs} +6 -4
  86. package/dist/chunk-SMM2C4KH.cjs.map +1 -0
  87. package/dist/{chunk-UXLQEGIN.cjs → chunk-SVPXZEU7.cjs} +35 -22
  88. package/dist/chunk-SVPXZEU7.cjs.map +1 -0
  89. package/dist/{chunk-SOSXN7X4.cjs → chunk-TU6MNGBB.cjs} +619 -151
  90. package/dist/chunk-TU6MNGBB.cjs.map +1 -0
  91. package/dist/{chunk-EK7E4ETB.js → chunk-TX5GUG5Q.js} +3 -3
  92. package/dist/{chunk-EK7E4ETB.js.map → chunk-TX5GUG5Q.js.map} +1 -1
  93. package/dist/{chunk-SQ7T6FWC.cjs → chunk-UAH236P2.cjs} +13 -13
  94. package/dist/{chunk-SQ7T6FWC.cjs.map → chunk-UAH236P2.cjs.map} +1 -1
  95. package/dist/{chunk-AIJ6HPJG.js → chunk-UL7TJCKA.js} +4 -4
  96. package/dist/{chunk-AIJ6HPJG.js.map → chunk-UL7TJCKA.js.map} +1 -1
  97. package/dist/{chunk-IC2MIQBW.js → chunk-UVOQLIWL.js} +1922 -1326
  98. package/dist/chunk-UVOQLIWL.js.map +1 -0
  99. package/dist/{chunk-IMLORTHO.js → chunk-WANKWENG.js} +5 -5
  100. package/dist/{chunk-IMLORTHO.js.map → chunk-WANKWENG.js.map} +1 -1
  101. package/dist/{chunk-ICU4Z5MO.cjs → chunk-X7DR353F.cjs} +8 -8
  102. package/dist/{chunk-ICU4Z5MO.cjs.map → chunk-X7DR353F.cjs.map} +1 -1
  103. package/dist/{chunk-6TBWJV35.js → chunk-Y22QMA7S.js} +6 -4
  104. package/dist/chunk-Y22QMA7S.js.map +1 -0
  105. package/dist/{chunk-FT7DFPAL.js → chunk-YYNZEEOO.js} +5 -5
  106. package/dist/{chunk-FT7DFPAL.js.map → chunk-YYNZEEOO.js.map} +1 -1
  107. package/dist/di/index.cjs +4 -4
  108. package/dist/di/index.js +1 -1
  109. package/dist/docs/README.md +6 -5
  110. package/dist/docs/SKILL.md +6 -5
  111. package/dist/docs/SOURCE_MAP.json +288 -293
  112. package/dist/docs/agents/01-overview.md +2 -2
  113. package/dist/docs/agents/02-using-tools.md +5 -0
  114. package/dist/docs/agents/04-structured-output.md +24 -4
  115. package/dist/docs/agents/06-processors.md +65 -1
  116. package/dist/docs/agents/08-agent-approval.md +5 -6
  117. package/dist/docs/agents/09-network-approval.md +274 -0
  118. package/dist/docs/agents/{10-reference.md → 11-reference.md} +1 -1
  119. package/dist/docs/ai-sdk/01-reference.md +1 -1
  120. package/dist/docs/cli/01-reference.md +1 -1
  121. package/dist/docs/client-js/01-reference.md +10 -5
  122. package/dist/docs/configuration.mdx/01-reference.md +750 -0
  123. package/dist/docs/core/01-reference.md +9 -35
  124. package/dist/docs/deployer/01-reference.md +19 -6
  125. package/dist/docs/evals/01-overview.md +5 -5
  126. package/dist/docs/evals/02-custom-scorers.md +49 -6
  127. package/dist/docs/evals/04-reference.md +10 -4
  128. package/dist/docs/mcp/01-overview.md +26 -16
  129. package/dist/docs/mcp/02-publishing-mcp-server.md +2 -2
  130. package/dist/docs/memory/01-overview.md +2 -2
  131. package/dist/docs/memory/02-storage.md +59 -25
  132. package/dist/docs/memory/03-working-memory.md +10 -6
  133. package/dist/docs/memory/04-semantic-recall.md +2 -4
  134. package/dist/docs/memory/05-memory-processors.md +2 -3
  135. package/dist/docs/memory/06-reference.md +2 -4
  136. package/dist/docs/observability/01-overview.md +1 -1
  137. package/dist/docs/observability/02-logging.md +4 -5
  138. package/dist/docs/observability/03-overview.md +69 -13
  139. package/dist/docs/observability/09-datadog.md +169 -0
  140. package/dist/docs/observability/10-laminar.md +95 -0
  141. package/dist/docs/observability/{11-otel.md → 13-otel.md} +12 -7
  142. package/dist/docs/observability/{13-reference.md → 15-reference.md} +125 -1
  143. package/dist/docs/processors/01-reference.md +23 -0
  144. package/dist/docs/rag/01-overview.md +1 -1
  145. package/dist/docs/rag/02-chunking-and-embedding.md +0 -1
  146. package/dist/docs/rag/03-vector-databases.md +10 -5
  147. package/dist/docs/rag/04-retrieval.md +5 -6
  148. package/dist/docs/rag/06-reference.md +4 -5
  149. package/dist/docs/server/01-mastra-server.md +32 -49
  150. package/dist/docs/server/02-custom-adapters.md +5 -2
  151. package/dist/docs/server/04-request-context.md +50 -11
  152. package/dist/docs/server/05-custom-api-routes.md +1 -1
  153. package/dist/docs/server/06-mastra-client.md +2 -2
  154. package/dist/docs/storage/01-reference.md +99 -23
  155. package/dist/docs/streaming/04-reference.md +6 -1
  156. package/dist/docs/tools/01-reference.md +380 -25
  157. package/dist/docs/tools-mcp/01-mcp-overview.md +10 -2
  158. package/dist/docs/tools-mcp/02-overview.md +4 -4
  159. package/dist/docs/vectors/01-reference.md +24 -11
  160. package/dist/docs/voice/01-overview.md +2 -2
  161. package/dist/docs/voice/05-reference.md +2 -2
  162. package/dist/docs/workflows/01-overview.md +5 -5
  163. package/dist/docs/workflows/04-agents-and-tools.md +4 -6
  164. package/dist/docs/workflows/06-suspend-and-resume.md +5 -7
  165. package/dist/docs/workflows/11-reference.md +1 -91
  166. package/dist/evals/base.d.ts.map +1 -1
  167. package/dist/evals/index.cjs +20 -20
  168. package/dist/evals/index.js +3 -3
  169. package/dist/evals/scoreTraces/index.cjs +5 -5
  170. package/dist/evals/scoreTraces/index.js +2 -2
  171. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts +4 -67
  172. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
  173. package/dist/index.cjs +2 -2
  174. package/dist/index.js +1 -1
  175. package/dist/integration/index.cjs +2 -2
  176. package/dist/integration/index.js +1 -1
  177. package/dist/llm/index.cjs +9 -9
  178. package/dist/llm/index.js +2 -2
  179. package/dist/llm/model/model.loop.d.ts +1 -2
  180. package/dist/llm/model/model.loop.d.ts.map +1 -1
  181. package/dist/llm/model/model.loop.types.d.ts +1 -2
  182. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  183. package/dist/llm/model/provider-types.generated.d.ts +224 -18
  184. package/dist/loop/index.cjs +12 -12
  185. package/dist/loop/index.js +1 -1
  186. package/dist/loop/loop.d.ts +1 -2
  187. package/dist/loop/loop.d.ts.map +1 -1
  188. package/dist/loop/network/index.d.ts +21 -80
  189. package/dist/loop/network/index.d.ts.map +1 -1
  190. package/dist/loop/network/run-command-tool.d.ts +14 -11
  191. package/dist/loop/network/run-command-tool.d.ts.map +1 -1
  192. package/dist/loop/network/validation.d.ts +3 -4
  193. package/dist/loop/network/validation.d.ts.map +1 -1
  194. package/dist/loop/test-utils/options.d.ts.map +1 -1
  195. package/dist/loop/types.d.ts +4 -5
  196. package/dist/loop/types.d.ts.map +1 -1
  197. package/dist/loop/workflows/agentic-execution/index.d.ts +31 -804
  198. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  199. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +22 -539
  200. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  201. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +13 -294
  202. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  203. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +2 -41
  204. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  205. package/dist/loop/workflows/agentic-loop/index.d.ts +32 -805
  206. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  207. package/dist/loop/workflows/schema.d.ts +90 -91
  208. package/dist/loop/workflows/schema.d.ts.map +1 -1
  209. package/dist/loop/workflows/stream.d.ts +1 -2
  210. package/dist/loop/workflows/stream.d.ts.map +1 -1
  211. package/dist/mastra/index.cjs +2 -2
  212. package/dist/mastra/index.d.ts +28 -9
  213. package/dist/mastra/index.d.ts.map +1 -1
  214. package/dist/mastra/index.js +1 -1
  215. package/dist/memory/index.cjs +11 -11
  216. package/dist/memory/index.js +1 -1
  217. package/dist/memory/memory.d.ts +4 -2
  218. package/dist/memory/memory.d.ts.map +1 -1
  219. package/dist/observability/index.cjs +11 -11
  220. package/dist/observability/index.js +1 -1
  221. package/dist/observability/types/tracing.d.ts +45 -7
  222. package/dist/observability/types/tracing.d.ts.map +1 -1
  223. package/dist/processors/index.cjs +38 -38
  224. package/dist/processors/index.d.ts +3 -3
  225. package/dist/processors/index.d.ts.map +1 -1
  226. package/dist/processors/index.js +1 -1
  227. package/dist/processors/memory/semantic-recall.d.ts +2 -0
  228. package/dist/processors/memory/semantic-recall.d.ts.map +1 -1
  229. package/dist/processors/processors/structured-output.d.ts +2 -2
  230. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  231. package/dist/processors/processors/token-limiter.d.ts +16 -10
  232. package/dist/processors/processors/token-limiter.d.ts.map +1 -1
  233. package/dist/processors/runner.d.ts +4 -4
  234. package/dist/processors/runner.d.ts.map +1 -1
  235. package/dist/processors/step-schema.d.ts +66 -67
  236. package/dist/processors/step-schema.d.ts.map +1 -1
  237. package/dist/provider-registry-C3IAGLLU.js +3 -0
  238. package/dist/{provider-registry-6DWM3X3I.js.map → provider-registry-C3IAGLLU.js.map} +1 -1
  239. package/dist/provider-registry-YH4FCTT2.cjs +40 -0
  240. package/dist/{provider-registry-DCECMUCQ.cjs.map → provider-registry-YH4FCTT2.cjs.map} +1 -1
  241. package/dist/provider-registry.json +477 -45
  242. package/dist/relevance/index.cjs +3 -3
  243. package/dist/relevance/index.js +1 -1
  244. package/dist/request-context/index.cjs +4 -4
  245. package/dist/request-context/index.d.ts +10 -9
  246. package/dist/request-context/index.d.ts.map +1 -1
  247. package/dist/request-context/index.js +1 -1
  248. package/dist/server/types.d.ts +1 -1
  249. package/dist/storage/constants.cjs +14 -14
  250. package/dist/storage/constants.d.ts +1 -1
  251. package/dist/storage/constants.js +1 -1
  252. package/dist/storage/domains/observability/types.d.ts +90 -90
  253. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  254. package/dist/storage/index.cjs +93 -93
  255. package/dist/storage/index.js +2 -2
  256. package/dist/stream/MastraAgentNetworkStream.d.ts +8 -12
  257. package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
  258. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  259. package/dist/stream/aisdk/v5/execute.d.ts +2 -3
  260. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  261. package/dist/stream/aisdk/v5/transform.d.ts +2 -3
  262. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  263. package/dist/stream/base/output-format-handlers.d.ts +2 -2
  264. package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
  265. package/dist/stream/base/output.d.ts +76 -50
  266. package/dist/stream/base/output.d.ts.map +1 -1
  267. package/dist/stream/base/schema.d.ts +7 -2
  268. package/dist/stream/base/schema.d.ts.map +1 -1
  269. package/dist/stream/index.cjs +11 -15
  270. package/dist/stream/index.d.ts +2 -2
  271. package/dist/stream/index.d.ts.map +1 -1
  272. package/dist/stream/index.js +2 -2
  273. package/dist/stream/types.d.ts +72 -26
  274. package/dist/stream/types.d.ts.map +1 -1
  275. package/dist/test-utils/llm-mock.cjs +4 -4
  276. package/dist/test-utils/llm-mock.js +1 -1
  277. package/dist/tool-loop-agent/index.cjs +4 -4
  278. package/dist/tool-loop-agent/index.d.ts +1 -1
  279. package/dist/tool-loop-agent/index.d.ts.map +1 -1
  280. package/dist/tool-loop-agent/index.js +1 -1
  281. package/dist/tool-loop-agent/tool-loop-processor.d.ts +1 -2
  282. package/dist/tool-loop-agent/tool-loop-processor.d.ts.map +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/tool.d.ts +27 -14
  289. package/dist/tools/tool.d.ts.map +1 -1
  290. package/dist/tools/types.d.ts +76 -20
  291. package/dist/tools/types.d.ts.map +1 -1
  292. package/dist/tools/ui-types.d.ts +3 -4
  293. package/dist/tools/ui-types.d.ts.map +1 -1
  294. package/dist/tools/validation.d.ts +4 -4
  295. package/dist/tools/validation.d.ts.map +1 -1
  296. package/dist/types/dynamic-argument.d.ts +61 -1
  297. package/dist/types/dynamic-argument.d.ts.map +1 -1
  298. package/dist/types/zod-compat.d.ts +3 -11
  299. package/dist/types/zod-compat.d.ts.map +1 -1
  300. package/dist/utils.cjs +22 -22
  301. package/dist/utils.d.ts +1 -1
  302. package/dist/utils.d.ts.map +1 -1
  303. package/dist/utils.js +1 -1
  304. package/dist/vector/index.cjs +2 -2
  305. package/dist/vector/index.js +1 -1
  306. package/dist/voice/index.cjs +6 -6
  307. package/dist/voice/index.js +1 -1
  308. package/dist/workflows/default.d.ts +114 -2
  309. package/dist/workflows/default.d.ts.map +1 -1
  310. package/dist/workflows/evented/index.cjs +10 -10
  311. package/dist/workflows/evented/index.js +1 -1
  312. package/dist/workflows/evented/step-executor.d.ts +1 -1
  313. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  314. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  315. package/dist/workflows/evented/workflow-event-processor/utils.d.ts +1 -1
  316. package/dist/workflows/evented/workflow.d.ts +74 -21
  317. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  318. package/dist/workflows/handlers/control-flow.d.ts +2 -2
  319. package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
  320. package/dist/workflows/handlers/sleep.d.ts.map +1 -1
  321. package/dist/workflows/handlers/step.d.ts +1 -1
  322. package/dist/workflows/handlers/step.d.ts.map +1 -1
  323. package/dist/workflows/index.cjs +23 -23
  324. package/dist/workflows/index.js +1 -1
  325. package/dist/workflows/step.d.ts +28 -24
  326. package/dist/workflows/step.d.ts.map +1 -1
  327. package/dist/workflows/types.d.ts +91 -54
  328. package/dist/workflows/types.d.ts.map +1 -1
  329. package/dist/workflows/workflow.d.ts +165 -118
  330. package/dist/workflows/workflow.d.ts.map +1 -1
  331. package/package.json +4 -4
  332. package/src/llm/model/provider-types.generated.d.ts +224 -18
  333. package/dist/chunk-3CZ42NBZ.js.map +0 -1
  334. package/dist/chunk-3RFSIHFR.js.map +0 -1
  335. package/dist/chunk-6TBWJV35.js.map +0 -1
  336. package/dist/chunk-A4MCHA5L.cjs.map +0 -1
  337. package/dist/chunk-AHN7K3VE.js.map +0 -1
  338. package/dist/chunk-AW7FISLD.cjs.map +0 -1
  339. package/dist/chunk-CISH55FP.js.map +0 -1
  340. package/dist/chunk-IC2MIQBW.js.map +0 -1
  341. package/dist/chunk-JMAPJWVG.cjs.map +0 -1
  342. package/dist/chunk-KGE3KAM7.js.map +0 -1
  343. package/dist/chunk-O4H44CMA.js.map +0 -1
  344. package/dist/chunk-O5IPTMEH.cjs.map +0 -1
  345. package/dist/chunk-PC3FBUWH.js.map +0 -1
  346. package/dist/chunk-SOSXN7X4.cjs.map +0 -1
  347. package/dist/chunk-UOZ3GJY2.cjs.map +0 -1
  348. package/dist/chunk-UVHSM2GU.cjs.map +0 -1
  349. package/dist/chunk-UXLQEGIN.cjs.map +0 -1
  350. package/dist/chunk-W7R7GPNN.cjs.map +0 -1
  351. package/dist/chunk-WMJEP45F.cjs.map +0 -1
  352. package/dist/chunk-XBZWAUZ3.js.map +0 -1
  353. package/dist/chunk-XKDVT3ZH.cjs.map +0 -1
  354. package/dist/chunk-XSJNTLM7.js.map +0 -1
  355. package/dist/provider-registry-6DWM3X3I.js +0 -3
  356. package/dist/provider-registry-DCECMUCQ.cjs +0 -40
  357. package/dist/stream/aisdk/v5/output.d.ts +0 -121
  358. package/dist/stream/aisdk/v5/output.d.ts.map +0 -1
  359. /package/dist/docs/agents/{09-adding-voice.md → 10-adding-voice.md} +0 -0
  360. /package/dist/docs/observability/{09-langfuse.md → 11-langfuse.md} +0 -0
  361. /package/dist/docs/observability/{10-langsmith.md → 12-langsmith.md} +0 -0
  362. /package/dist/docs/observability/{12-posthog.md → 14-posthog.md} +0 -0
@@ -1,8 +1,8 @@
1
1
  > Overview of agents in Mastra, detailing their capabilities and how they interact with tools, workflows, and external systems.
2
2
 
3
3
  > **Code References:**
4
- - `Agent`: dist/agent/agent.d.ts → dist/chunk-IC2MIQBW.js:16163
5
- - `Mastra`: dist/mastra/index.d.ts → dist/chunk-XBZWAUZ3.js:24
4
+ - `Agent`: dist/agent/agent.d.ts → dist/chunk-UVOQLIWL.js:16630
5
+ - `Mastra`: dist/mastra/index.d.ts → dist/chunk-IFPQ2MLB.js:24
6
6
 
7
7
  # Using Agents
8
8
 
@@ -141,8 +141,13 @@ When the agent calls the workflow tool, it receives a response containing the wo
141
141
  }
142
142
  ```
143
143
 
144
+ ## Tools with structured output
145
+
146
+ When using tools with [structured output](https://mastra.ai/docs/v1/agents/structured-output), some models don't support combining both features in the same API call. If your tools aren't being called when structured output is enabled, or you receive errors about incompatible options, see [Combining tools and structured output](https://mastra.ai/docs/v1/agents/structured-output#combining-tools-and-structured-output) for model compatibility information and workarounds.
147
+
144
148
  ## Related
145
149
 
146
150
  - [MCP Overview](https://mastra.ai/docs/v1/mcp/overview)
151
+ - [Structured Output](https://mastra.ai/docs/v1/agents/structured-output)
147
152
  - [Agent Memory](https://mastra.ai/docs/v1/agents/agent-memory)
148
153
  - [Request Context](https://mastra.ai/docs/v1/server/request-context)
@@ -65,7 +65,7 @@ console.log(response.object);
65
65
 
66
66
  > **Note:**
67
67
 
68
- Visit [.generate()](https://mastra.ai/reference/v1/agents/generate#structuredoutput) for a full list of configuration options.
68
+ Visit [.generate()](https://mastra.ai/reference/v1/agents/generate) for a full list of configuration options.
69
69
 
70
70
  ### Example output
71
71
 
@@ -149,9 +149,25 @@ const response = await testAgent.generate("Analyze the TypeScript programming la
149
149
  console.log(response.object);
150
150
  ```
151
151
 
152
- ## LLM Structured Output support
152
+ ## Combining tools and structured output
153
153
 
154
- Structured output support varies across LLM's due to the model itself. There are various workarounds provided to be able to use the full range of features supported for structured output, mainly returning structured output, tool calling, and the combination of the two.
154
+ When an agent has both tools and structured output configured, some models may not support using both features together. This is a limitation of the underlying model APIs, not Mastra itself.
155
+
156
+ If your tools aren't being called when structured output is enabled, or you receive an error when combining both features, try one of the workarounds below.
157
+
158
+ ### Workaround options
159
+
160
+ When your model doesn't support tools and structured output together, you have three options:
161
+
162
+ 1. **Use `jsonPromptInjection: true`** - Injects the schema into the prompt instead of using the API's `response_format` parameter
163
+ 2. **Use a separate structuring model** - Pass a `model` to `structuredOutput` to use a second LLM for structuring
164
+ 3. **Use `prepareStep`** - Handle tools and structured output in separate steps
165
+
166
+ Each approach is detailed in the sections below.
167
+
168
+ ## LLM structured output support
169
+
170
+ Structured output support varies across LLMs due to differences in their APIs. The sections below cover workarounds for models that don't fully support structured output or combining it with tools.
155
171
 
156
172
  ### `jsonPromptInjection`
157
173
 
@@ -179,7 +195,11 @@ console.log(response.object);
179
195
 
180
196
  > **Gemini 2.5 with tools**
181
197
 
182
- Gemini 2.5 models do not support combining `response_format` (structured output) with function calling (tools) in the same API call. If your agent has tools and you're using `structuredOutput` with a Gemini 2.5 model, you must set `jsonPromptInjection: true` to avoid the error `Function calling with a response mime type: 'application/json' is unsupported`.
198
+ Gemini 2.5 models do not support combining `response_format` (structured output) with function calling (tools) in the same API call. If your agent has tools and you're using `structuredOutput` with a Gemini 2.5 model, you must set `jsonPromptInjection: true` to avoid the error:
199
+
200
+ ```
201
+ Function calling with a response mime type: 'application/json' is unsupported
202
+ ```
183
203
 
184
204
  ```typescript
185
205
  const response = await agentWithTools.generate("Your prompt", {
@@ -277,6 +277,70 @@ export class CustomOutputProcessor implements Processor {
277
277
  }
278
278
  ```
279
279
 
280
+ #### Adding metadata in output processors
281
+
282
+ You can add custom metadata to messages in `processOutputResult`. This metadata is accessible via the response object:
283
+
284
+ ```typescript title="src/mastra/processors/metadata-processor.ts"
285
+ import type { Processor, MastraDBMessage } from "@mastra/core";
286
+
287
+ export class MetadataProcessor implements Processor {
288
+ id = "metadata-processor";
289
+
290
+ async processOutputResult({
291
+ messages,
292
+ }: {
293
+ messages: MastraDBMessage[];
294
+ }): Promise<MastraDBMessage[]> {
295
+ return messages.map((msg) => {
296
+ if (msg.role === "assistant") {
297
+ return {
298
+ ...msg,
299
+ content: {
300
+ ...msg.content,
301
+ metadata: {
302
+ ...msg.content.metadata,
303
+ processedAt: new Date().toISOString(),
304
+ customData: "your data here",
305
+ },
306
+ },
307
+ };
308
+ }
309
+ return msg;
310
+ });
311
+ }
312
+ }
313
+ ```
314
+
315
+ Access the metadata with `generate()`:
316
+
317
+ ```typescript
318
+ const result = await agent.generate("Hello");
319
+
320
+ // The response includes uiMessages with processor-added metadata
321
+ const assistantMessage = result.response?.uiMessages?.find((m) => m.role === "assistant");
322
+ console.log(assistantMessage?.metadata?.customData);
323
+ ```
324
+
325
+ Access the metadata when streaming:
326
+
327
+ ```typescript
328
+ const stream = await agent.stream("Hello");
329
+
330
+ for await (const chunk of stream.fullStream) {
331
+ if (chunk.type === "finish") {
332
+ // Access response with processor-added metadata from the finish chunk
333
+ const uiMessages = chunk.payload.response?.uiMessages;
334
+ const assistantMessage = uiMessages?.find((m) => m.role === "assistant");
335
+ console.log(assistantMessage?.metadata?.customData);
336
+ }
337
+ }
338
+
339
+ // Or via the response promise after consuming the stream
340
+ const response = await stream.response;
341
+ console.log(response.uiMessages);
342
+ ```
343
+
280
344
  ## Built-in Utility Processors
281
345
 
282
346
  Mastra provides utility processors for common tasks:
@@ -377,7 +441,7 @@ const agent = new Agent({
377
441
  });
378
442
  ```
379
443
 
380
- When an agent is registered with Mastra, processor workflows are automatically registered as workflows, allowing you to view and debug them in the playground.
444
+ 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/v1/getting-started/studio).
381
445
 
382
446
  ## Retry mechanism
383
447
 
@@ -85,8 +85,8 @@ export const testTool = createTool({
85
85
  resumeSchema: z.object({
86
86
  approved: z.boolean()
87
87
  }),
88
- execute: async ({ location }) => {
89
- const response = await fetch(`https://wttr.in/${location}?format=3`);
88
+ execute: async (inputData) => {
89
+ const response = await fetch(`https://wttr.in/${inputData.location}?format=3`);
90
90
  const weather = await response.text();
91
91
 
92
92
  return { weather };
@@ -121,7 +121,6 @@ const handleResume = async () => {
121
121
  With this approach, neither the agent nor the tool uses `requireApproval`. Instead, the tool implementation calls `suspend` to pause execution and return context or confirmation prompts to the user.
122
122
 
123
123
  ```typescript
124
-
125
124
  export const testToolB = createTool({
126
125
  id: "test-tool-b",
127
126
  description: "Fetches weather for a location",
@@ -137,14 +136,14 @@ export const testToolB = createTool({
137
136
  suspendSchema: z.object({
138
137
  reason: z.string()
139
138
  }),
140
- execute: async ({ location }, { agent } = {}) => {
141
- const { resumeData: { approved } = {}, suspend } = agent ?? {};
139
+ execute: async (inputData, context) => {
140
+ const { resumeData: { approved } = {}, suspend } = context?.agent ?? {};
142
141
 
143
142
  if (!approved) {
144
143
  return suspend?.({ reason: "Approval required." });
145
144
  }
146
145
 
147
- const response = await fetch(`https://wttr.in/${location}?format=3`);
146
+ const response = await fetch(`https://wttr.in/${inputData.location}?format=3`);
148
147
  const weather = await response.text();
149
148
 
150
149
  return { weather };
@@ -0,0 +1,274 @@
1
+ > Learn how to require approvals, suspend execution, and resume suspended networks while keeping humans in control of agent network workflows.
2
+
3
+ # Network Approval
4
+
5
+ Agent networks can require the same [human-in-the-loop](https://mastra.ai/docs/v1/workflows/human-in-the-loop) oversight used in individual agents and workflows. When a tool, sub-agent, or workflow within a network requires approval or suspends execution, the network pauses and emits events that allow your application to collect user input before resuming.
6
+
7
+ ## Storage
8
+
9
+ Network approval uses snapshots to capture execution state. Ensure you've enabled a storage provider in your Mastra instance. If storage isn't enabled you'll see an error relating to snapshot not found.
10
+
11
+ ```typescript title="src/mastra/index.ts"
12
+ import { Mastra } from "@mastra/core/mastra";
13
+ import { LibSQLStore } from "@mastra/libsql";
14
+
15
+ export const mastra = new Mastra({
16
+ storage: new LibSQLStore({
17
+ id: "mastra-storage",
18
+ url: ":memory:"
19
+ })
20
+ });
21
+ ```
22
+
23
+ ## Approving network tool calls
24
+
25
+ When a tool within a network has `requireApproval: true`, the network stream emits an `agent-execution-approval` chunk and pauses. To allow the tool to execute, call `approveNetworkToolCall` with the `runId`.
26
+
27
+ ```typescript
28
+ const stream = await routingAgent.network("Process this query", {
29
+ memory: {
30
+ thread: "user-123",
31
+ resource: "my-app"
32
+ }
33
+ });
34
+
35
+ let runId: string;
36
+
37
+ for await (const chunk of stream) {
38
+ runId = stream.runId;
39
+ // if the requirApproval is in a tool inside a subAgent or the subAgent has requireToolApproval set to true
40
+ if (chunk.type === "agent-execution-approval") {
41
+ console.log("Tool requires approval:", chunk.payload);
42
+ }
43
+
44
+ // if the requirApproval is in a tool directly in the network agent
45
+ if (chunk.type === "tool-execution-approval") {
46
+ console.log("Tool requires approval:", chunk.payload);
47
+ }
48
+ }
49
+
50
+ // Approve and resume execution
51
+ const approvedStream = await routingAgent.approveNetworkToolCall({
52
+ runId,
53
+ memory: {
54
+ thread: "user-123",
55
+ resource: "my-app"
56
+ }
57
+ });
58
+
59
+ for await (const chunk of approvedStream) {
60
+ if (chunk.type === "network-execution-event-step-finish") {
61
+ console.log(chunk.payload.result);
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Declining network tool calls
67
+
68
+ To decline a pending tool call and prevent execution, call `declineNetworkToolCall`. The network continues without executing the tool.
69
+
70
+ ```typescript
71
+ const declinedStream = await routingAgent.declineNetworkToolCall({
72
+ runId,
73
+ memory: {
74
+ thread: "user-123",
75
+ resource: "my-app"
76
+ }
77
+ });
78
+
79
+ for await (const chunk of declinedStream) {
80
+ if (chunk.type === "network-execution-event-step-finish") {
81
+ console.log(chunk.payload.result);
82
+ }
83
+ }
84
+ ```
85
+
86
+ ## Resuming suspended networks
87
+
88
+ When a primitive in the network calls `suspend()`, the stream emits an `agent-execution-suspended`/`tool-execution-suspended`/`workflow-execution-suspended` chunk with a `suspendPayload` containing context from the primitive. Use `resumeNetwork` to provide the data requested by the primitive and continue execution.
89
+
90
+ ```typescript
91
+ import { createTool } from "@mastra/core/tools";
92
+ import { z } from "zod";
93
+
94
+ const confirmationTool = createTool({
95
+ id: "confirmation-tool",
96
+ description: "Requests user confirmation before proceeding",
97
+ inputSchema: z.object({
98
+ action: z.string()
99
+ }),
100
+ outputSchema: z.object({
101
+ confirmed: z.boolean(),
102
+ action: z.string()
103
+ }),
104
+ suspendSchema: z.object({
105
+ message: z.string(),
106
+ action: z.string()
107
+ }),
108
+ resumeSchema: z.object({
109
+ confirmed: z.boolean()
110
+ }),
111
+ execute: async (inputData, context) => {
112
+ const { resumeData, suspend } = context?.agent ?? {};
113
+
114
+ if (!resumeData?.confirmed) {
115
+ return suspend?.({
116
+ message: `Please confirm: ${inputData.action}`,
117
+ action: inputData.action
118
+ });
119
+ }
120
+
121
+ return { confirmed: true, action: inputData.action };
122
+ }
123
+ });
124
+ ```
125
+
126
+ Handle the suspension and resume with user-provided data:
127
+
128
+ ```typescript
129
+ const stream = await routingAgent.network("Delete the old records", {
130
+ memory: {
131
+ thread: "user-123",
132
+ resource: "my-app"
133
+ }
134
+ });
135
+
136
+ for await (const chunk of stream) {
137
+ if (chunk.type === "workflow-execution-suspended") {
138
+ console.log(chunk.payload.suspendPayload);
139
+ // { message: "Please confirm: delete old records", action: "delete old records" }
140
+ }
141
+ }
142
+
143
+ // Resume with user confirmation
144
+ const resumedStream = await routingAgent.resumeNetwork(
145
+ { confirmed: true },
146
+ {
147
+ runId: stream.runId,
148
+ memory: {
149
+ thread: "user-123",
150
+ resource: "my-app"
151
+ }
152
+ }
153
+ );
154
+
155
+ for await (const chunk of resumedStream) {
156
+ if (chunk.type === "network-execution-event-step-finish") {
157
+ console.log(chunk.payload.result);
158
+ }
159
+ }
160
+ ```
161
+
162
+ ## Automatic primitive resumption
163
+
164
+ When using primitives that call `suspend()`, you can enable automatic resumption so the network resumes suspended primitives based on the user's next message. This creates a conversational flow where users provide the required information naturally.
165
+
166
+ ### Enabling auto-resume
167
+
168
+ Set `autoResumeSuspendedTools` to `true` in the agent's `defaultNetworkOptions` or when calling `network()`:
169
+
170
+ ```typescript
171
+ import { Agent } from "@mastra/core/agent";
172
+ import { Memory } from "@mastra/memory";
173
+
174
+ // Option 1: In agent configuration
175
+ const routingAgent = new Agent({
176
+ id: "routing-agent",
177
+ name: "Routing Agent",
178
+ instructions: "You coordinate tasks across multiple agents",
179
+ model: "openai/gpt-4o-mini",
180
+ tools: { confirmationTool },
181
+ memory: new Memory(),
182
+ defaultNetworkOptions: {
183
+ autoResumeSuspendedTools: true,
184
+ },
185
+ });
186
+
187
+ // Option 2: Per-request
188
+ const stream = await routingAgent.network("Process this request", {
189
+ autoResumeSuspendedTools: true,
190
+ memory: {
191
+ thread: "user-123",
192
+ resource: "my-app"
193
+ }
194
+ });
195
+ ```
196
+
197
+ ### How it works
198
+
199
+ When `autoResumeSuspendedTools` is enabled:
200
+
201
+ 1. A primitive suspends execution by calling `suspend()` with a payload
202
+ 2. The suspension is persisted to memory along with the conversation
203
+ 3. When the user sends their next message on the same thread, the network:
204
+ - Detects the suspended primitive from message history
205
+ - Extracts `resumeData` from the user's message based on the tool's `resumeSchema`
206
+ - Automatically resumes the primitive with the extracted data
207
+
208
+ ### Example
209
+
210
+ ```typescript
211
+ const stream = await routingAgent.network("Delete the old records", {
212
+ autoResumeSuspendedTools: true,
213
+ memory: {
214
+ thread: "user-123",
215
+ resource: "my-app"
216
+ }
217
+ });
218
+
219
+ for await (const chunk of stream) {
220
+ if (chunk.type === "workflow-execution-suspended") {
221
+ console.log(chunk.payload.suspendPayload);
222
+ // { message: "Please confirm: delete old records", action: "delete old records" }
223
+ }
224
+ }
225
+
226
+ // User provides confirmation in their next message
227
+ const resumedStream = await routingAgent.network("Yes, confirmed", {
228
+ autoResumeSuspendedTools: true,
229
+ memory: {
230
+ thread: "user-123",
231
+ resource: "my-app"
232
+ }
233
+ });
234
+
235
+ for await (const chunk of resumedStream) {
236
+ if (chunk.type === "network-execution-event-step-finish") {
237
+ console.log(chunk.payload.result);
238
+ }
239
+ }
240
+ ```
241
+
242
+ **Conversation flow:**
243
+
244
+ ```
245
+ User: "Delete the old records"
246
+ Agent: "Please confirm: delete old records"
247
+
248
+ User: "Yes, confirmed"
249
+ Agent: "Records deleted successfully"
250
+ ```
251
+
252
+ ### Requirements
253
+
254
+ For automatic tool resumption to work:
255
+
256
+ - **Memory configured**: The agent needs memory to track suspended tools across messages
257
+ - **Same thread**: The follow-up message must use the same memory thread and resource identifiers
258
+ - **`resumeSchema` defined**: The tool (either directly in the network agent or in a subAgent) / workflow (step that gets suspended) must define a `resumeSchema` so the agent knows what data to extract from the user's message
259
+
260
+ ### Manual vs automatic resumption
261
+
262
+ | Approach | Use case |
263
+ |----------|----------|
264
+ | Manual (`resumeNetwork()`) | Programmatic control, webhooks, button clicks, external triggers |
265
+ | Automatic (`autoResumeSuspendedTools`) | Conversational flows where users provide resume data in natural language |
266
+
267
+ Both approaches work with the same tool definitions. Automatic resumption triggers only when suspended tools exist in the message history and the user sends a new message on the same thread.
268
+
269
+ ## Related
270
+
271
+ - [Agent Networks](./networks)
272
+ - [Agent Approval](./agent-approval)
273
+ - [Human-in-the-Loop](https://mastra.ai/docs/v1/workflows/human-in-the-loop)
274
+ - [Agent Memory](./agent-memory)
@@ -189,7 +189,7 @@ await agent.generateLegacy("message for agent");
189
189
 
190
190
  > **Note:**
191
191
 
192
- The new `.generate()` method offers enhanced capabilities including AI SDK v5 compatibility, better structured output handling, and improved streaming support. See the [migration guide](https://mastra.ai/guides/v1/migrations/vnext-to-standard-apis) for detailed migration instructions.
192
+ The new `.generate()` method offers enhanced capabilities including AI SDK v5+ compatibility, better structured output handling, and improved streaming support. See the [migration guide](https://mastra.ai/guides/v1/migrations/vnext-to-standard-apis) for detailed migration instructions.
193
193
 
194
194
  ### Quick Migration Example
195
195
 
@@ -423,7 +423,7 @@ Use [`handleWorkflowStream()`](https://mastra.ai/reference/v1/ai-sdk/handle-work
423
423
 
424
424
  When a workflow step pipes an agent's stream to the workflow writer (e.g., `await response.fullStream.pipeTo(writer)`), the agent's text chunks and tool calls are forwarded to the UI stream in real time, even when the agent runs inside workflow steps.
425
425
 
426
- See [Workflow Streaming](https://mastra.ai/docs/v1/streaming/workflow-streaming#streaming-agent-text-chunks-to-ui) for more details.
426
+ See [Workflow Streaming](https://mastra.ai/docs/v1/streaming/workflow-streaming) for more details.
427
427
 
428
428
  ## Usage example
429
429
 
@@ -23,7 +23,7 @@ The command accepts [common flags][common-flags] and the following additional fl
23
23
 
24
24
  #### `--https`
25
25
 
26
- Enable local HTTPS support. [Learn more](https://mastra.ai/docs/v1/getting-started/studio#local-https).
26
+ Enable local HTTPS support. [Learn more](https://mastra.ai/reference/v1/configuration#serverhttps).
27
27
 
28
28
  #### `--inspect`
29
29
 
@@ -67,12 +67,14 @@ const response = await agent.generate(
67
67
  );
68
68
  ```
69
69
 
70
- You can also use the simplified string format:
70
+ You can also use the simplified string format with memory options:
71
71
 
72
72
  ```typescript
73
73
  const response = await agent.generate("Hello, how are you?", {
74
- threadId: "thread-1",
75
- resourceId: "resource-1",
74
+ memory: {
75
+ thread: "thread-1",
76
+ resource: "resource-1",
77
+ },
76
78
  });
77
79
  ```
78
80
 
@@ -91,11 +93,14 @@ response.processDataStream({
91
93
  });
92
94
  ```
93
95
 
94
- You can also use the simplified string format:
96
+ You can also use the simplified string format with memory options:
95
97
 
96
98
  ```typescript
97
99
  const response = await agent.stream("Tell me a story", {
98
- threadId: "thread-1",
100
+ memory: {
101
+ thread: "thread-1",
102
+ resource: "resource-1",
103
+ },
99
104
  clientTools: { colorChangeTool },
100
105
  });
101
106