@mastra/core 1.2.0 → 1.2.1-alpha.0

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 (406) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +30 -17
  3. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +10 -7
  4. package/dist/agent/index.cjs +13 -13
  5. package/dist/agent/index.js +2 -2
  6. package/dist/agent/message-list/index.cjs +18 -18
  7. package/dist/agent/message-list/index.js +1 -1
  8. package/dist/{chunk-VBOO4F4D.cjs → chunk-2DMSFLJY.cjs} +5 -5
  9. package/dist/{chunk-VBOO4F4D.cjs.map → chunk-2DMSFLJY.cjs.map} +1 -1
  10. package/dist/{chunk-ARQG4ZSD.cjs → chunk-5SOS47PH.cjs} +37 -37
  11. package/dist/chunk-5SOS47PH.cjs.map +1 -0
  12. package/dist/{chunk-NRMSZFAU.js → chunk-5YVR7B4R.js} +5 -5
  13. package/dist/{chunk-NRMSZFAU.js.map → chunk-5YVR7B4R.js.map} +1 -1
  14. package/dist/{chunk-G5NRZOPO.cjs → chunk-7MDVYPWX.cjs} +4 -4
  15. package/dist/{chunk-G5NRZOPO.cjs.map → chunk-7MDVYPWX.cjs.map} +1 -1
  16. package/dist/{chunk-AP3Z4EAP.cjs → chunk-A5QFWX67.cjs} +53 -53
  17. package/dist/{chunk-AP3Z4EAP.cjs.map → chunk-A5QFWX67.cjs.map} +1 -1
  18. package/dist/{chunk-4XLGMCCQ.js → chunk-AUF6U2BL.js} +3 -3
  19. package/dist/{chunk-4XLGMCCQ.js.map → chunk-AUF6U2BL.js.map} +1 -1
  20. package/dist/{chunk-POKH6N2J.cjs → chunk-AXN5P2GE.cjs} +4 -4
  21. package/dist/{chunk-POKH6N2J.cjs.map → chunk-AXN5P2GE.cjs.map} +1 -1
  22. package/dist/{chunk-YL6ETQ5I.cjs → chunk-B4M33FCS.cjs} +9 -9
  23. package/dist/{chunk-YL6ETQ5I.cjs.map → chunk-B4M33FCS.cjs.map} +1 -1
  24. package/dist/{chunk-DG6C6ZTL.cjs → chunk-CC3OOESY.cjs} +44 -43
  25. package/dist/chunk-CC3OOESY.cjs.map +1 -0
  26. package/dist/{chunk-NYC6PYZF.js → chunk-E3VFKTIA.js} +36 -4
  27. package/dist/chunk-E3VFKTIA.js.map +1 -0
  28. package/dist/{chunk-3LRUJTH3.cjs → chunk-GVLPTDJA.cjs} +50 -13
  29. package/dist/chunk-GVLPTDJA.cjs.map +1 -0
  30. package/dist/{chunk-SS4AZHZW.cjs → chunk-HU2ONA2W.cjs} +9 -9
  31. package/dist/{chunk-SS4AZHZW.cjs.map → chunk-HU2ONA2W.cjs.map} +1 -1
  32. package/dist/chunk-HVG7MWNT.js +439 -0
  33. package/dist/chunk-HVG7MWNT.js.map +1 -0
  34. package/dist/chunk-JCEP2VPF.cjs +441 -0
  35. package/dist/chunk-JCEP2VPF.cjs.map +1 -0
  36. package/dist/{chunk-PPAJGWVW.js → chunk-MSWXEOZC.js} +3 -3
  37. package/dist/{chunk-PPAJGWVW.js.map → chunk-MSWXEOZC.js.map} +1 -1
  38. package/dist/{chunk-AQHO4OC2.cjs → chunk-QOFI2WBM.cjs} +6 -6
  39. package/dist/{chunk-AQHO4OC2.cjs.map → chunk-QOFI2WBM.cjs.map} +1 -1
  40. package/dist/{chunk-EY3WXGUD.js → chunk-RXD5EGQF.js} +43 -6
  41. package/dist/chunk-RXD5EGQF.js.map +1 -0
  42. package/dist/{chunk-XC7WIZBL.js → chunk-S6BH5HHY.js} +4 -3
  43. package/dist/chunk-S6BH5HHY.js.map +1 -0
  44. package/dist/{chunk-IPXNR6RQ.js → chunk-V2MLGA7T.js} +1884 -998
  45. package/dist/chunk-V2MLGA7T.js.map +1 -0
  46. package/dist/{chunk-Z4PGSIZ5.cjs → chunk-VTE2OBKS.cjs} +1890 -1004
  47. package/dist/chunk-VTE2OBKS.cjs.map +1 -0
  48. package/dist/{chunk-ZODRDMZ7.js → chunk-VX7UA3SO.js} +3 -3
  49. package/dist/{chunk-ZODRDMZ7.js.map → chunk-VX7UA3SO.js.map} +1 -1
  50. package/dist/{chunk-5HDIPOLV.js → chunk-WFUNLRQX.js} +6 -6
  51. package/dist/chunk-WFUNLRQX.js.map +1 -0
  52. package/dist/{chunk-V3LENMEW.js → chunk-X5ORARLG.js} +4 -4
  53. package/dist/{chunk-V3LENMEW.js.map → chunk-X5ORARLG.js.map} +1 -1
  54. package/dist/{chunk-Z2OKCLGV.cjs → chunk-XCPEEIHI.cjs} +41 -8
  55. package/dist/chunk-XCPEEIHI.cjs.map +1 -0
  56. package/dist/{chunk-57O4TPB3.js → chunk-Z6NRYYOH.js} +3 -3
  57. package/dist/{chunk-57O4TPB3.js.map → chunk-Z6NRYYOH.js.map} +1 -1
  58. package/dist/{chunk-RUMXBL6P.js → chunk-ZWM2CAIM.js} +5 -5
  59. package/dist/{chunk-RUMXBL6P.js.map → chunk-ZWM2CAIM.js.map} +1 -1
  60. package/dist/docs/SKILL.md +270 -64
  61. package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +156 -152
  62. package/dist/docs/{agents/10-adding-voice.md → references/docs-agents-adding-voice.md} +6 -5
  63. package/dist/docs/{agents/08-agent-approval.md → references/docs-agents-agent-approval.md} +19 -19
  64. package/dist/docs/{agents/03-agent-memory.md → references/docs-agents-agent-memory.md} +57 -55
  65. package/dist/docs/{agents/07-guardrails.md → references/docs-agents-guardrails.md} +21 -39
  66. package/dist/docs/{agents/09-network-approval.md → references/docs-agents-network-approval.md} +12 -11
  67. package/dist/docs/{agents/05-networks.md → references/docs-agents-networks.md} +7 -9
  68. package/dist/docs/{agents/01-overview.md → references/docs-agents-overview.md} +54 -72
  69. package/dist/docs/{agents/06-processors.md → references/docs-agents-processors.md} +29 -24
  70. package/dist/docs/{agents/04-structured-output.md → references/docs-agents-structured-output.md} +13 -22
  71. package/dist/docs/{agents/02-using-tools.md → references/docs-agents-using-tools.md} +12 -13
  72. package/dist/docs/{evals/02-custom-scorers.md → references/docs-evals-custom-scorers.md} +5 -7
  73. package/dist/docs/{evals/01-overview.md → references/docs-evals-overview.md} +26 -17
  74. package/dist/docs/{evals/03-running-in-ci.md → references/docs-evals-running-in-ci.md} +2 -4
  75. package/dist/docs/{mcp/01-overview.md → references/docs-mcp-overview.md} +135 -140
  76. package/dist/docs/references/docs-mcp-publishing-mcp-server.md +95 -0
  77. package/dist/docs/{memory/05-memory-processors.md → references/docs-memory-memory-processors.md} +6 -8
  78. package/dist/docs/references/docs-memory-observational-memory.md +166 -0
  79. package/dist/docs/{memory/01-overview.md → references/docs-memory-overview.md} +8 -8
  80. package/dist/docs/{memory/04-semantic-recall.md → references/docs-memory-semantic-recall.md} +33 -17
  81. package/dist/docs/{memory/02-storage.md → references/docs-memory-storage.md} +29 -39
  82. package/dist/docs/{memory/03-working-memory.md → references/docs-memory-working-memory.md} +16 -27
  83. package/dist/docs/{observability/02-logging.md → references/docs-observability-logging.md} +6 -10
  84. package/dist/docs/{observability/01-overview.md → references/docs-observability-overview.md} +4 -10
  85. package/dist/docs/{observability/04-otel.md → references/docs-observability-tracing-bridges-otel.md} +31 -14
  86. package/dist/docs/{observability/07-arize.md → references/docs-observability-tracing-exporters-arize.md} +38 -22
  87. package/dist/docs/{observability/08-braintrust.md → references/docs-observability-tracing-exporters-braintrust.md} +24 -6
  88. package/dist/docs/{observability/06-cloud.md → references/docs-observability-tracing-exporters-cloud.md} +7 -7
  89. package/dist/docs/{observability/09-datadog.md → references/docs-observability-tracing-exporters-datadog.md} +26 -8
  90. package/dist/docs/{observability/05-default.md → references/docs-observability-tracing-exporters-default.md} +11 -14
  91. package/dist/docs/{observability/10-laminar.md → references/docs-observability-tracing-exporters-laminar.md} +24 -6
  92. package/dist/docs/{observability/11-langfuse.md → references/docs-observability-tracing-exporters-langfuse.md} +31 -12
  93. package/dist/docs/{observability/12-langsmith.md → references/docs-observability-tracing-exporters-langsmith.md} +29 -11
  94. package/dist/docs/{observability/13-otel.md → references/docs-observability-tracing-exporters-otel.md} +107 -63
  95. package/dist/docs/{observability/14-posthog.md → references/docs-observability-tracing-exporters-posthog.md} +24 -6
  96. package/dist/docs/{observability/03-overview.md → references/docs-observability-tracing-overview.md} +45 -53
  97. package/dist/docs/{rag/02-chunking-and-embedding.md → references/docs-rag-chunking-and-embedding.md} +5 -11
  98. package/dist/docs/{rag/05-graph-rag.md → references/docs-rag-graph-rag.md} +0 -2
  99. package/dist/docs/{rag/01-overview.md → references/docs-rag-overview.md} +2 -7
  100. package/dist/docs/{rag/04-retrieval.md → references/docs-rag-retrieval.md} +26 -53
  101. package/dist/docs/{rag/03-vector-databases.md → references/docs-rag-vector-databases.md} +198 -202
  102. package/dist/docs/{server/13-auth0.md → references/docs-server-auth-auth0.md} +68 -79
  103. package/dist/docs/{server/09-clerk.md → references/docs-server-auth-clerk.md} +41 -52
  104. package/dist/docs/{server/14-composite-auth.md → references/docs-server-auth-composite-auth.md} +1 -3
  105. package/dist/docs/{server/15-custom-auth-provider.md → references/docs-server-auth-custom-auth-provider.md} +13 -15
  106. package/dist/docs/{server/11-firebase.md → references/docs-server-auth-firebase.md} +83 -97
  107. package/dist/docs/{server/08-jwt.md → references/docs-server-auth-jwt.md} +46 -35
  108. package/dist/docs/{server/07-simple-auth.md → references/docs-server-auth-simple-auth.md} +10 -11
  109. package/dist/docs/{server/10-supabase.md → references/docs-server-auth-supabase.md} +33 -44
  110. package/dist/docs/{server/12-workos.md → references/docs-server-auth-workos.md} +45 -56
  111. package/dist/docs/{server/02-custom-adapters.md → references/docs-server-custom-adapters.md} +25 -31
  112. package/dist/docs/{server/05-custom-api-routes.md → references/docs-server-custom-api-routes.md} +7 -7
  113. package/dist/docs/{server/06-mastra-client.md → references/docs-server-mastra-client.md} +32 -20
  114. package/dist/docs/{server/01-mastra-server.md → references/docs-server-mastra-server.md} +5 -11
  115. package/dist/docs/{server/03-middleware.md → references/docs-server-middleware.md} +8 -15
  116. package/dist/docs/{server/04-request-context.md → references/docs-server-request-context.md} +29 -43
  117. package/dist/docs/{streaming/01-events.md → references/docs-streaming-events.md} +9 -16
  118. package/dist/docs/{streaming/02-tool-streaming.md → references/docs-streaming-tool-streaming.md} +6 -11
  119. package/dist/docs/{streaming/03-workflow-streaming.md → references/docs-streaming-workflow-streaming.md} +2 -6
  120. package/dist/docs/{tools-mcp/03-advanced-usage.md → references/docs-tools-mcp-advanced-usage.md} +23 -5
  121. package/dist/docs/{tools-mcp/01-mcp-overview.md → references/docs-tools-mcp-mcp-overview.md} +141 -146
  122. package/dist/docs/{tools-mcp/02-overview.md → references/docs-tools-mcp-overview.md} +4 -12
  123. package/dist/docs/{voice/01-overview.md → references/docs-voice-overview.md} +37 -81
  124. package/dist/docs/{voice/04-speech-to-speech.md → references/docs-voice-speech-to-speech.md} +1 -4
  125. package/dist/docs/{voice/03-speech-to-text.md → references/docs-voice-speech-to-text.md} +8 -11
  126. package/dist/docs/{voice/02-text-to-speech.md → references/docs-voice-text-to-speech.md} +12 -15
  127. package/dist/docs/{workflows/04-agents-and-tools.md → references/docs-workflows-agents-and-tools.md} +11 -21
  128. package/dist/docs/{workflows/03-control-flow.md → references/docs-workflows-control-flow.md} +58 -56
  129. package/dist/docs/{workflows/09-error-handling.md → references/docs-workflows-error-handling.md} +13 -15
  130. package/dist/docs/{workflows/07-human-in-the-loop.md → references/docs-workflows-human-in-the-loop.md} +11 -12
  131. package/dist/docs/{workflows/10-input-data-mapping.md → references/docs-workflows-input-data-mapping.md} +12 -14
  132. package/dist/docs/{workflows/01-overview.md → references/docs-workflows-overview.md} +31 -52
  133. package/dist/docs/{workflows/05-snapshots.md → references/docs-workflows-snapshots.md} +3 -5
  134. package/dist/docs/{workflows/06-suspend-and-resume.md → references/docs-workflows-suspend-and-resume.md} +12 -12
  135. package/dist/docs/{workflows/08-time-travel.md → references/docs-workflows-time-travel.md} +2 -5
  136. package/dist/docs/{workflows/02-workflow-state.md → references/docs-workflows-workflow-state.md} +4 -6
  137. package/dist/docs/{workspace/02-filesystem.md → references/docs-workspace-filesystem.md} +3 -8
  138. package/dist/docs/{workspace/01-overview.md → references/docs-workspace-overview.md} +10 -16
  139. package/dist/docs/{workspace/03-sandbox.md → references/docs-workspace-sandbox.md} +2 -4
  140. package/dist/docs/{workspace/05-search.md → references/docs-workspace-search.md} +20 -22
  141. package/dist/docs/{workspace/04-skills.md → references/docs-workspace-skills.md} +6 -9
  142. package/dist/docs/{guides/01-ai-sdk.md → references/guides-agent-frameworks-ai-sdk.md} +25 -9
  143. package/dist/docs/references/reference-agents-agent.md +142 -0
  144. package/dist/docs/references/reference-agents-generate.md +174 -0
  145. package/dist/docs/references/reference-agents-generateLegacy.md +176 -0
  146. package/dist/docs/references/reference-agents-getDefaultGenerateOptions.md +36 -0
  147. package/dist/docs/references/reference-agents-getDefaultOptions.md +34 -0
  148. package/dist/docs/references/reference-agents-getDefaultStreamOptions.md +36 -0
  149. package/dist/docs/references/reference-agents-getDescription.md +21 -0
  150. package/dist/docs/references/reference-agents-getInstructions.md +34 -0
  151. package/dist/docs/references/reference-agents-getLLM.md +37 -0
  152. package/dist/docs/references/reference-agents-getMemory.md +34 -0
  153. package/dist/docs/references/reference-agents-getModel.md +34 -0
  154. package/dist/docs/references/reference-agents-getTools.md +34 -0
  155. package/dist/docs/references/reference-agents-getVoice.md +34 -0
  156. package/dist/docs/references/reference-agents-listAgents.md +35 -0
  157. package/dist/docs/references/reference-agents-listScorers.md +34 -0
  158. package/dist/docs/references/reference-agents-listTools.md +34 -0
  159. package/dist/docs/references/reference-agents-listWorkflows.md +34 -0
  160. package/dist/docs/references/reference-agents-network.md +136 -0
  161. package/dist/docs/references/reference-ai-sdk-chat-route.md +82 -0
  162. package/dist/docs/references/reference-ai-sdk-network-route.md +74 -0
  163. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +232 -0
  164. package/dist/docs/references/reference-ai-sdk-with-mastra.md +59 -0
  165. package/dist/docs/references/reference-ai-sdk-workflow-route.md +79 -0
  166. package/dist/docs/references/reference-auth-auth0.md +73 -0
  167. package/dist/docs/references/reference-auth-clerk.md +36 -0
  168. package/dist/docs/references/reference-auth-firebase.md +80 -0
  169. package/dist/docs/references/reference-auth-jwt.md +26 -0
  170. package/dist/docs/references/reference-auth-supabase.md +33 -0
  171. package/dist/docs/references/reference-auth-workos.md +84 -0
  172. package/dist/docs/{cli/01-reference.md → references/reference-cli-mastra.md} +14 -28
  173. package/dist/docs/{client-js/01-reference.md → references/reference-client-js-agents.md} +3 -12
  174. package/dist/docs/{configuration.mdx/01-reference.md → references/reference-configuration.md} +71 -91
  175. package/dist/docs/references/reference-core-addGateway.md +42 -0
  176. package/dist/docs/references/reference-core-getAgent.md +21 -0
  177. package/dist/docs/references/reference-core-getAgentById.md +21 -0
  178. package/dist/docs/references/reference-core-getDeployer.md +22 -0
  179. package/dist/docs/references/reference-core-getGateway.md +38 -0
  180. package/dist/docs/references/reference-core-getGatewayById.md +41 -0
  181. package/dist/docs/references/reference-core-getLogger.md +22 -0
  182. package/dist/docs/references/reference-core-getMCPServer.md +45 -0
  183. package/dist/docs/references/reference-core-getMCPServerById.md +53 -0
  184. package/dist/docs/references/reference-core-getMemory.md +50 -0
  185. package/dist/docs/references/reference-core-getScorer.md +54 -0
  186. package/dist/docs/references/reference-core-getScorerById.md +54 -0
  187. package/dist/docs/references/reference-core-getServer.md +22 -0
  188. package/dist/docs/references/reference-core-getStorage.md +22 -0
  189. package/dist/docs/references/reference-core-getStoredAgentById.md +89 -0
  190. package/dist/docs/references/reference-core-getTelemetry.md +22 -0
  191. package/dist/docs/references/reference-core-getVector.md +22 -0
  192. package/dist/docs/references/reference-core-getWorkflow.md +40 -0
  193. package/dist/docs/references/reference-core-listAgents.md +21 -0
  194. package/dist/docs/references/reference-core-listGateways.md +40 -0
  195. package/dist/docs/references/reference-core-listLogs.md +38 -0
  196. package/dist/docs/references/reference-core-listLogsByRunId.md +36 -0
  197. package/dist/docs/references/reference-core-listMCPServers.md +51 -0
  198. package/dist/docs/references/reference-core-listMemory.md +56 -0
  199. package/dist/docs/references/reference-core-listScorers.md +29 -0
  200. package/dist/docs/references/reference-core-listStoredAgents.md +93 -0
  201. package/dist/docs/references/reference-core-listVectors.md +22 -0
  202. package/dist/docs/references/reference-core-listWorkflows.md +21 -0
  203. package/dist/docs/references/reference-core-mastra-class.md +66 -0
  204. package/dist/docs/references/reference-core-mastra-model-gateway.md +153 -0
  205. package/dist/docs/references/reference-core-setLogger.md +26 -0
  206. package/dist/docs/references/reference-core-setStorage.md +27 -0
  207. package/dist/docs/references/reference-deployer-cloudflare.md +56 -0
  208. package/dist/docs/references/reference-deployer-netlify.md +14 -0
  209. package/dist/docs/references/reference-deployer-vercel.md +39 -0
  210. package/dist/docs/references/reference-evals-answer-relevancy.md +105 -0
  211. package/dist/docs/references/reference-evals-answer-similarity.md +99 -0
  212. package/dist/docs/references/reference-evals-bias.md +120 -0
  213. package/dist/docs/references/reference-evals-completeness.md +137 -0
  214. package/dist/docs/references/reference-evals-content-similarity.md +101 -0
  215. package/dist/docs/references/reference-evals-context-precision.md +196 -0
  216. package/dist/docs/references/reference-evals-create-scorer.md +270 -0
  217. package/dist/docs/references/reference-evals-faithfulness.md +114 -0
  218. package/dist/docs/references/reference-evals-hallucination.md +220 -0
  219. package/dist/docs/references/reference-evals-keyword-coverage.md +128 -0
  220. package/dist/docs/references/reference-evals-mastra-scorer.md +123 -0
  221. package/dist/docs/references/reference-evals-run-evals.md +138 -0
  222. package/dist/docs/references/reference-evals-scorer-utils.md +330 -0
  223. package/dist/docs/references/reference-evals-textual-difference.md +113 -0
  224. package/dist/docs/references/reference-evals-tone-consistency.md +119 -0
  225. package/dist/docs/references/reference-evals-toxicity.md +123 -0
  226. package/dist/docs/{logging/01-reference.md → references/reference-logging-pino-logger.md} +16 -15
  227. package/dist/docs/references/reference-memory-deleteMessages.md +40 -0
  228. package/dist/docs/{memory/06-reference.md → references/reference-memory-memory-class.md} +28 -55
  229. package/dist/docs/references/reference-memory-observational-memory.md +217 -0
  230. package/dist/docs/references/reference-observability-tracing-bridges-otel.md +131 -0
  231. package/dist/docs/references/reference-observability-tracing-configuration.md +178 -0
  232. package/dist/docs/references/reference-observability-tracing-exporters-console-exporter.md +138 -0
  233. package/dist/docs/references/reference-observability-tracing-exporters-datadog.md +116 -0
  234. package/dist/docs/references/reference-observability-tracing-instances.md +109 -0
  235. package/dist/docs/references/reference-observability-tracing-interfaces.md +749 -0
  236. package/dist/docs/references/reference-observability-tracing-processors-sensitive-data-filter.md +144 -0
  237. package/dist/docs/references/reference-observability-tracing-spans.md +224 -0
  238. package/dist/docs/references/reference-processors-batch-parts-processor.md +61 -0
  239. package/dist/docs/references/reference-processors-language-detector.md +81 -0
  240. package/dist/docs/references/reference-processors-message-history-processor.md +85 -0
  241. package/dist/docs/references/reference-processors-moderation-processor.md +104 -0
  242. package/dist/docs/references/reference-processors-pii-detector.md +107 -0
  243. package/dist/docs/references/reference-processors-processor-interface.md +521 -0
  244. package/dist/docs/references/reference-processors-prompt-injection-detector.md +71 -0
  245. package/dist/docs/references/reference-processors-semantic-recall-processor.md +123 -0
  246. package/dist/docs/references/reference-processors-system-prompt-scrubber.md +80 -0
  247. package/dist/docs/references/reference-processors-token-limiter-processor.md +113 -0
  248. package/dist/docs/references/reference-processors-tool-call-filter.md +85 -0
  249. package/dist/docs/references/reference-processors-tool-search-processor.md +113 -0
  250. package/dist/docs/references/reference-processors-unicode-normalizer.md +62 -0
  251. package/dist/docs/references/reference-processors-working-memory-processor.md +154 -0
  252. package/dist/docs/references/reference-rag-database-config.md +264 -0
  253. package/dist/docs/references/reference-rag-embeddings.md +92 -0
  254. package/dist/docs/references/reference-server-mastra-server.md +298 -0
  255. package/dist/docs/references/reference-server-register-api-route.md +249 -0
  256. package/dist/docs/references/reference-storage-cloudflare-d1.md +218 -0
  257. package/dist/docs/references/reference-storage-composite.md +235 -0
  258. package/dist/docs/references/reference-storage-lance.md +131 -0
  259. package/dist/docs/references/reference-storage-libsql.md +135 -0
  260. package/dist/docs/references/reference-storage-mongodb.md +262 -0
  261. package/dist/docs/references/reference-storage-mssql.md +155 -0
  262. package/dist/docs/references/reference-storage-overview.md +121 -0
  263. package/dist/docs/references/reference-storage-postgresql.md +529 -0
  264. package/dist/docs/references/reference-storage-upstash.md +160 -0
  265. package/dist/docs/references/reference-streaming-ChunkType.md +292 -0
  266. package/dist/docs/references/reference-streaming-agents-MastraModelOutput.md +182 -0
  267. package/dist/docs/references/reference-streaming-agents-streamLegacy.md +142 -0
  268. package/dist/docs/references/reference-streaming-workflows-observeStream.md +42 -0
  269. package/dist/docs/references/reference-streaming-workflows-resumeStream.md +61 -0
  270. package/dist/docs/references/reference-streaming-workflows-stream.md +87 -0
  271. package/dist/docs/references/reference-streaming-workflows-timeTravelStream.md +142 -0
  272. package/dist/docs/{templates/01-reference.md → references/reference-templates-overview.md} +8 -17
  273. package/dist/docs/references/reference-tools-client.md +228 -0
  274. package/dist/docs/references/reference-tools-create-tool.md +237 -0
  275. package/dist/docs/references/reference-tools-graph-rag-tool.md +185 -0
  276. package/dist/docs/references/reference-tools-mcp-client.md +964 -0
  277. package/dist/docs/references/reference-tools-mcp-server.md +1275 -0
  278. package/dist/docs/references/reference-tools-vector-query-tool.md +459 -0
  279. package/dist/docs/references/reference-vectors-libsql.md +305 -0
  280. package/dist/docs/references/reference-vectors-mongodb.md +295 -0
  281. package/dist/docs/references/reference-vectors-pg.md +408 -0
  282. package/dist/docs/references/reference-vectors-upstash.md +294 -0
  283. package/dist/docs/references/reference-voice-composite-voice.md +121 -0
  284. package/dist/docs/references/reference-voice-mastra-voice.md +313 -0
  285. package/dist/docs/references/reference-voice-voice.addInstructions.md +56 -0
  286. package/dist/docs/references/reference-voice-voice.addTools.md +67 -0
  287. package/dist/docs/references/reference-voice-voice.connect.md +94 -0
  288. package/dist/docs/references/reference-voice-voice.events.md +37 -0
  289. package/dist/docs/references/reference-voice-voice.listen.md +164 -0
  290. package/dist/docs/references/reference-voice-voice.on.md +111 -0
  291. package/dist/docs/references/reference-voice-voice.speak.md +157 -0
  292. package/dist/docs/references/reference-workflows-run-methods-cancel.md +86 -0
  293. package/dist/docs/references/reference-workflows-run-methods-restart.md +33 -0
  294. package/dist/docs/references/reference-workflows-run-methods-resume.md +59 -0
  295. package/dist/docs/references/reference-workflows-run-methods-start.md +58 -0
  296. package/dist/docs/references/reference-workflows-run-methods-startAsync.md +67 -0
  297. package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +142 -0
  298. package/dist/docs/references/reference-workflows-run.md +59 -0
  299. package/dist/docs/references/reference-workflows-step.md +117 -0
  300. package/dist/docs/references/reference-workflows-workflow-methods-branch.md +25 -0
  301. package/dist/docs/references/reference-workflows-workflow-methods-commit.md +17 -0
  302. package/dist/docs/references/reference-workflows-workflow-methods-create-run.md +63 -0
  303. package/dist/docs/references/reference-workflows-workflow-methods-dountil.md +25 -0
  304. package/dist/docs/references/reference-workflows-workflow-methods-dowhile.md +25 -0
  305. package/dist/docs/references/reference-workflows-workflow-methods-foreach.md +88 -0
  306. package/dist/docs/references/reference-workflows-workflow-methods-map.md +93 -0
  307. package/dist/docs/references/reference-workflows-workflow-methods-parallel.md +21 -0
  308. package/dist/docs/references/reference-workflows-workflow-methods-sleep.md +35 -0
  309. package/dist/docs/references/reference-workflows-workflow-methods-sleepUntil.md +35 -0
  310. package/dist/docs/references/reference-workflows-workflow-methods-then.md +21 -0
  311. package/dist/docs/references/reference-workflows-workflow.md +157 -0
  312. package/dist/docs/references/reference-workspace-filesystem.md +200 -0
  313. package/dist/docs/references/reference-workspace-local-filesystem.md +300 -0
  314. package/dist/docs/references/reference-workspace-local-sandbox.md +283 -0
  315. package/dist/docs/references/reference-workspace-sandbox.md +79 -0
  316. package/dist/docs/references/reference-workspace-workspace-class.md +247 -0
  317. package/dist/docs/references/reference.md +243 -0
  318. package/dist/evals/index.cjs +5 -5
  319. package/dist/evals/index.js +2 -2
  320. package/dist/evals/scoreTraces/index.cjs +3 -3
  321. package/dist/evals/scoreTraces/index.js +1 -1
  322. package/dist/index.cjs +4 -4
  323. package/dist/index.js +2 -2
  324. package/dist/llm/index.cjs +9 -5
  325. package/dist/llm/index.d.ts +1 -1
  326. package/dist/llm/index.d.ts.map +1 -1
  327. package/dist/llm/index.js +1 -1
  328. package/dist/llm/model/index.d.ts +1 -1
  329. package/dist/llm/model/index.d.ts.map +1 -1
  330. package/dist/loop/index.cjs +12 -12
  331. package/dist/loop/index.js +1 -1
  332. package/dist/mastra/index.cjs +2 -2
  333. package/dist/mastra/index.d.ts +17 -0
  334. package/dist/mastra/index.d.ts.map +1 -1
  335. package/dist/mastra/index.js +1 -1
  336. package/dist/memory/index.cjs +14 -14
  337. package/dist/memory/index.js +1 -1
  338. package/dist/memory/types.d.ts +3 -2
  339. package/dist/memory/types.d.ts.map +1 -1
  340. package/dist/processors/index.cjs +41 -41
  341. package/dist/processors/index.js +1 -1
  342. package/dist/relevance/index.cjs +3 -3
  343. package/dist/relevance/index.js +1 -1
  344. package/dist/storage/index.cjs +33 -33
  345. package/dist/storage/index.js +1 -1
  346. package/dist/stream/index.cjs +11 -11
  347. package/dist/stream/index.js +2 -2
  348. package/dist/test-utils/llm-mock.cjs +12 -12
  349. package/dist/test-utils/llm-mock.js +3 -3
  350. package/dist/{token-6GSAFR2W-TOUJCAPY.js → token-APYSY3BW-QJCV2XQG.js} +11 -11
  351. package/dist/token-APYSY3BW-QJCV2XQG.js.map +1 -0
  352. package/dist/{token-6GSAFR2W-GERJXNN5.cjs → token-APYSY3BW-UBKUGJQP.cjs} +14 -14
  353. package/dist/token-APYSY3BW-UBKUGJQP.cjs.map +1 -0
  354. package/dist/token-util-RMHT2CPJ-S2YMG7N3.js +8 -0
  355. package/dist/token-util-RMHT2CPJ-S2YMG7N3.js.map +1 -0
  356. package/dist/token-util-RMHT2CPJ-WV2T74WQ.cjs +10 -0
  357. package/dist/token-util-RMHT2CPJ-WV2T74WQ.cjs.map +1 -0
  358. package/dist/tool-loop-agent/index.cjs +4 -4
  359. package/dist/tool-loop-agent/index.js +1 -1
  360. package/dist/vector/index.cjs +11 -11
  361. package/dist/vector/index.js +3 -3
  362. package/dist/workflows/evented/index.cjs +10 -10
  363. package/dist/workflows/evented/index.js +1 -1
  364. package/dist/workflows/index.cjs +25 -25
  365. package/dist/workflows/index.js +1 -1
  366. package/package.json +4 -5
  367. package/dist/chunk-3LRUJTH3.cjs.map +0 -1
  368. package/dist/chunk-5HDIPOLV.js.map +0 -1
  369. package/dist/chunk-ARQG4ZSD.cjs.map +0 -1
  370. package/dist/chunk-DG6C6ZTL.cjs.map +0 -1
  371. package/dist/chunk-EY3WXGUD.js.map +0 -1
  372. package/dist/chunk-IPXNR6RQ.js.map +0 -1
  373. package/dist/chunk-NYC6PYZF.js.map +0 -1
  374. package/dist/chunk-X5HU5YVN.js +0 -250
  375. package/dist/chunk-X5HU5YVN.js.map +0 -1
  376. package/dist/chunk-XC7WIZBL.js.map +0 -1
  377. package/dist/chunk-Z2OKCLGV.cjs.map +0 -1
  378. package/dist/chunk-Z4PGSIZ5.cjs.map +0 -1
  379. package/dist/chunk-ZZF2IKZJ.cjs +0 -252
  380. package/dist/chunk-ZZF2IKZJ.cjs.map +0 -1
  381. package/dist/docs/README.md +0 -57
  382. package/dist/docs/agents/11-reference.md +0 -854
  383. package/dist/docs/ai-sdk/01-reference.md +0 -490
  384. package/dist/docs/auth/01-reference.md +0 -308
  385. package/dist/docs/core/01-reference.md +0 -1283
  386. package/dist/docs/deployer/01-reference.md +0 -128
  387. package/dist/docs/evals/04-reference.md +0 -2137
  388. package/dist/docs/index.mdx/01-reference.md +0 -14
  389. package/dist/docs/mcp/02-publishing-mcp-server.md +0 -111
  390. package/dist/docs/observability/15-reference.md +0 -1831
  391. package/dist/docs/processors/01-reference.md +0 -1418
  392. package/dist/docs/rag/06-reference.md +0 -342
  393. package/dist/docs/server/16-reference.md +0 -513
  394. package/dist/docs/storage/01-reference.md +0 -2022
  395. package/dist/docs/streaming/04-reference.md +0 -724
  396. package/dist/docs/tools/01-reference.md +0 -3136
  397. package/dist/docs/vectors/01-reference.md +0 -942
  398. package/dist/docs/voice/05-reference.md +0 -1043
  399. package/dist/docs/workflows/11-reference.md +0 -1044
  400. package/dist/docs/workspace/06-reference.md +0 -946
  401. package/dist/token-6GSAFR2W-GERJXNN5.cjs.map +0 -1
  402. package/dist/token-6GSAFR2W-TOUJCAPY.js.map +0 -1
  403. package/dist/token-util-NEHG7TUY-R2XAU2MF.cjs +0 -10
  404. package/dist/token-util-NEHG7TUY-R2XAU2MF.cjs.map +0 -1
  405. package/dist/token-util-NEHG7TUY-TZ426VZB.js +0 -8
  406. package/dist/token-util-NEHG7TUY-TZ426VZB.js.map +0 -1
@@ -1,17 +1,8 @@
1
- # Configuration.mdx API Reference
2
-
3
- > API reference for configuration.mdx - 1 entries
4
-
5
-
6
- ---
7
-
8
- ## Reference: Configuration
9
-
10
- > Reference documentation on Mastra
1
+ # Configuration
11
2
 
12
3
  The following reference covers all supported options in Mastra. You initialize and configure Mastra by instantiating the [`Mastra` class](https://mastra.ai/reference/core/mastra-class).
13
4
 
14
- ```ts title="src/mastra/index.ts"
5
+ ```ts
15
6
  import { Mastra } from "@mastra/core";
16
7
 
17
8
  export const mastra = new Mastra({
@@ -29,7 +20,7 @@ A record of agent instances keyed by their names. Agents are autonomous systems
29
20
 
30
21
  Visit the [Agents documentation](https://mastra.ai/docs/agents/overview) to learn more.
31
22
 
32
- ```typescript title="src/mastra/index.ts"
23
+ ```typescript
33
24
  import { Mastra } from "@mastra/core";
34
25
  import { Agent } from "@mastra/core/agent";
35
26
 
@@ -53,7 +44,7 @@ Deployment provider for publishing applications to cloud platforms.
53
44
 
54
45
  Visit the [Deployment documentation](https://mastra.ai/docs/deployment/overview) to learn more.
55
46
 
56
- ```typescript title="src/mastra/index.ts"
47
+ ```typescript
57
48
  import { Mastra } from "@mastra/core";
58
49
  import { NetlifyDeployer } from "@mastra/deployer-netlify";
59
50
 
@@ -71,10 +62,9 @@ export const mastra = new Mastra({
71
62
 
72
63
  Event handlers for the internal pub/sub system. Maps event topics to handler functions that are called when events are published to those topics.
73
64
 
74
- > **Note:**
75
- This is used internally by Mastra's workflow engine. Most users will not need to configure this option.
65
+ > **Warning:** This is used internally by Mastra's workflow engine. Most users will not need to configure this option.
76
66
 
77
- ```typescript title="src/mastra/index.ts"
67
+ ```typescript
78
68
  import { Mastra } from "@mastra/core";
79
69
 
80
70
  export const mastra = new Mastra({
@@ -94,7 +84,7 @@ Custom model router gateways for accessing LLM providers. Gateways handle provid
94
84
 
95
85
  Visit the [Custom Gateways documentation](https://mastra.ai/models/gateways/custom-gateways) to learn more.
96
86
 
97
- ```typescript title="src/mastra/index.ts"
87
+ ```typescript
98
88
  import { Mastra } from "@mastra/core";
99
89
  import { MyPrivateGateway } from "./gateways";
100
90
 
@@ -107,16 +97,14 @@ export const mastra = new Mastra({
107
97
 
108
98
  ### idGenerator
109
99
 
110
- **Type:** `() => string`
100
+ **Type:** `() => string`\
111
101
  **Default:** `crypto.randomUUID()`
112
102
 
113
103
  Custom ID generator function for creating unique identifiers.
114
104
 
115
- > **Note:**
116
-
117
- This is used internally by Mastra for creating IDs for workflow runs, agent conversations, and other resources. Most users will not need to configure this option.
105
+ > **Warning:** This is used internally by Mastra for creating IDs for workflow runs, agent conversations, and other resources. Most users will not need to configure this option.
118
106
 
119
- ```typescript title="src/mastra/index.ts"
107
+ ```typescript
120
108
  import { Mastra } from "@mastra/core";
121
109
  import { nanoid } from "nanoid";
122
110
 
@@ -127,14 +115,14 @@ export const mastra = new Mastra({
127
115
 
128
116
  ### logger
129
117
 
130
- **Type:** `IMastraLogger | false`
118
+ **Type:** `IMastraLogger | false`\
131
119
  **Default:** `ConsoleLogger` with `INFO` level in development, `WARN` in production
132
120
 
133
121
  Logger implementation for application logging and debugging. Set to `false` to disable logging entirely.
134
122
 
135
123
  Visit the [Logging documentation](https://mastra.ai/docs/observability/logging) to learn more.
136
124
 
137
- ```typescript title="src/mastra/index.ts"
125
+ ```typescript
138
126
  import { Mastra } from "@mastra/core";
139
127
  import { PinoLogger } from "@mastra/loggers";
140
128
 
@@ -151,7 +139,7 @@ MCP (Model Context Protocol) servers that expose Mastra tools, agents, workflows
151
139
 
152
140
  Visit the [MCP Overview](https://mastra.ai/docs/mcp/overview) to learn more.
153
141
 
154
- ```typescript title="src/mastra/index.ts"
142
+ ```typescript
155
143
  import { Mastra } from "@mastra/core";
156
144
  import { MCPServer } from "@mastra/mcp";
157
145
 
@@ -176,11 +164,9 @@ A registry of memory instances that can be referenced by agents. Memory gives ag
176
164
 
177
165
  Visit the [Memory documentation](https://mastra.ai/docs/memory/overview) to learn more.
178
166
 
179
- > **Note:**
167
+ > **Note:** Most users configure memory directly on agents. This top-level configuration is for defining reusable memory instances that can be shared across multiple agents.
180
168
 
181
- Most users configure memory directly on agents. This top-level configuration is for defining reusable memory instances that can be shared across multiple agents.
182
-
183
- ```typescript title="src/mastra/index.ts"
169
+ ```typescript
184
170
  import { Mastra } from "@mastra/core";
185
171
  import { Memory } from "@mastra/memory";
186
172
  import { LibSQLStore } from "@mastra/libsql";
@@ -208,7 +194,7 @@ Mastra provides observability features for AI applications. Monitor LLM operatio
208
194
 
209
195
  Visit the [Observability documentation](https://mastra.ai/docs/observability/overview) to learn more.
210
196
 
211
- ```typescript title="src/mastra/index.ts"
197
+ ```typescript
212
198
  import { Mastra } from "@mastra/core";
213
199
  import { LibSQLStore } from "@mastra/libsql";
214
200
  import { Observability, DefaultExporter } from "@mastra/observability";
@@ -237,11 +223,9 @@ Input/output processors for transforming agent inputs and outputs. Processors ru
237
223
 
238
224
  Visit the [Processors documentation](https://mastra.ai/docs/agents/processors) to learn more.
239
225
 
240
- > **Note:**
241
-
242
- Most users configure processors directly on agents. This top-level configuration is for defining reusable processor instances that can be shared across multiple agents.
226
+ > **Note:** Most users configure processors directly on agents. This top-level configuration is for defining reusable processor instances that can be shared across multiple agents.
243
227
 
244
- ```typescript title="src/mastra/index.ts"
228
+ ```typescript
245
229
  import { Mastra } from "@mastra/core";
246
230
  import { ModerationProcessor } from "@mastra/core/processors";
247
231
 
@@ -257,15 +241,14 @@ export const mastra = new Mastra({
257
241
 
258
242
  ### pubsub
259
243
 
260
- **Type:** `PubSub`
244
+ **Type:** `PubSub`\
261
245
  **Default:** `EventEmitterPubSub`
262
246
 
263
247
  Pub/sub system for event-driven communication between components. Used internally by Mastra for workflow event processing and component communication.
264
248
 
265
- > **Note:**
266
- This is used internally by Mastra. Most users will not need to configure this option.
249
+ > **Warning:** This is used internally by Mastra. Most users will not need to configure this option.
267
250
 
268
- ```typescript title="src/mastra/index.ts"
251
+ ```typescript
269
252
  import { Mastra } from "@mastra/core";
270
253
  import { CustomPubSub } from "./pubsub";
271
254
 
@@ -282,11 +265,9 @@ Scorers assess the quality of agent responses and workflow outputs. They provide
282
265
 
283
266
  Visit the [Scorers documentation](https://mastra.ai/docs/evals/overview) to learn more.
284
267
 
285
- > **Note:**
286
-
287
- Most users configure scorers directly on agents. This top-level configuration is for defining reusable scorer instances that can be shared across multiple agents.
268
+ > **Note:** Most users configure scorers directly on agents. This top-level configuration is for defining reusable scorer instances that can be shared across multiple agents.
288
269
 
289
- ```typescript title="src/mastra/index.ts"
270
+ ```typescript
290
271
  import { Mastra } from "@mastra/core";
291
272
  import { createToxicityScorer } from "@mastra/evals/scorers/prebuilt";
292
273
 
@@ -305,7 +286,7 @@ Storage provider for persisting application data. Used by memory, workflows, tra
305
286
 
306
287
  Visit the [Storage documentation](https://mastra.ai/docs/memory/storage) to learn more.
307
288
 
308
- ```typescript title="src/mastra/index.ts"
289
+ ```typescript
309
290
  import { Mastra } from "@mastra/core";
310
291
  import { LibSQLStore } from "@mastra/libsql";
311
292
 
@@ -325,10 +306,9 @@ Tools are reusable functions that agents can use to interact with external syste
325
306
 
326
307
  Visit the [Tools documentation](https://mastra.ai/docs/tools-mcp/overview) to learn more.
327
308
 
328
- > **Note:**
329
- Most users configure tools directly on agents. This top-level configuration is for defining reusable tools that can be shared across multiple agents.
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.
330
310
 
331
- ```typescript title="src/mastra/index.ts"
311
+ ```typescript
332
312
  import { Mastra } from "@mastra/core";
333
313
  import { createTool } from "@mastra/core/tools";
334
314
  import { z } from "zod";
@@ -359,10 +339,9 @@ Text-to-speech providers for voice synthesis capabilities. Register voice provid
359
339
 
360
340
  Visit the [Voice documentation](https://mastra.ai/docs/voice/overview) to learn more.
361
341
 
362
- > **Note:**
363
- Most users configure voice directly on agents. This top-level configuration is for defining reusable voice providers that can be shared across multiple agents.
342
+ > **Note:** Most users configure voice directly on agents. This top-level configuration is for defining reusable voice providers that can be shared across multiple agents.
364
343
 
365
- ```typescript title="src/mastra/index.ts"
344
+ ```typescript
366
345
  import { Mastra } from "@mastra/core";
367
346
  import { OpenAIVoice } from "@mastra/voice-openai";
368
347
 
@@ -381,10 +360,9 @@ Vector stores for semantic search and embeddings. Used in RAG pipelines, similar
381
360
 
382
361
  Visit the [RAG documentation](https://mastra.ai/docs/rag/overview) to learn more.
383
362
 
384
- > **Note:**
385
- Most users create vector stores directly when building RAG pipelines. This top-level configuration is for defining reusable vector store instances that can be shared across your application.
363
+ > **Note:** Most users create vector stores directly when building RAG pipelines. This top-level configuration is for defining reusable vector store instances that can be shared across your application.
386
364
 
387
- ```typescript title="src/mastra/index.ts"
365
+ ```typescript
388
366
  import { Mastra } from "@mastra/core";
389
367
  import { PineconeVector } from "@mastra/pinecone";
390
368
 
@@ -406,7 +384,7 @@ Workflows define step-based execution pipelines with type-safe inputs and output
406
384
 
407
385
  Visit the [Workflows documentation](https://mastra.ai/docs/workflows/overview) to learn more.
408
386
 
409
- ```typescript title="src/mastra/index.ts"
387
+ ```typescript
410
388
  import { Mastra } from "@mastra/core";
411
389
  import { testWorkflow } from "./workflows/test-workflow";
412
390
 
@@ -424,7 +402,8 @@ export const mastra = new Mastra({
424
402
  A Mastra workspace gives agents a persistent environment for storing files and executing commands. Agents inherit the global workspace on the `Mastra` class unless they have their own workspace configured.
425
403
 
426
404
  See the [Workspace documentation](https://mastra.ai/docs/workspace/overview) for implementation details.
427
- ```typescript title="src/mastra/index.ts"
405
+
406
+ ```typescript
428
407
  import { Mastra } from '@mastra/core';
429
408
  import { Workspace, LocalFilesystem } from '@mastra/core/workspace';
430
409
 
@@ -441,7 +420,7 @@ const mastra = new Mastra({
441
420
 
442
421
  ### bundler.externals
443
422
 
444
- **Type:** `boolean | string[]`
423
+ **Type:** `boolean | string[]`\
445
424
  **Default:** `true`
446
425
 
447
426
  When `mastra build` is run, Mastra bundles your project into the `.mastra/output` directory. This option controls which packages are excluded from the bundle (marked as "external") and installed separately through a package manager. This is useful when the internal Mastra bundler ([Rollup](https://rollupjs.org/configuration-options/#external)) has trouble bundling certain packages.
@@ -454,7 +433,7 @@ Here's an overview of what the different values mean:
454
433
  - `false`: No dependencies are marked as external; everything is bundled together
455
434
  - `string[]`: An array of package names to mark as external, the rest will be bundled together
456
435
 
457
- ```typescript title="src/mastra/index.ts"
436
+ ```typescript
458
437
  import { Mastra } from "@mastra/core";
459
438
 
460
439
  export const mastra = new Mastra({
@@ -466,12 +445,12 @@ export const mastra = new Mastra({
466
445
 
467
446
  ### bundler.sourcemap
468
447
 
469
- **Type:** `boolean`
448
+ **Type:** `boolean`\
470
449
  **Default:** `false`
471
450
 
472
451
  Enables source map generation for the bundled output.
473
452
 
474
- ```typescript title="src/mastra/index.ts"
453
+ ```typescript
475
454
  import { Mastra } from "@mastra/core";
476
455
 
477
456
  export const mastra = new Mastra({
@@ -483,7 +462,7 @@ export const mastra = new Mastra({
483
462
 
484
463
  ### bundler.transpilePackages
485
464
 
486
- **Type:** `string[]`
465
+ **Type:** `string[]`\
487
466
  **Default:** `[]`
488
467
 
489
468
  List of packages whose source code should be transpiled through esbuild during the build process. Use this for dependencies that contain TypeScript or other code that needs compilation before bundling.
@@ -492,7 +471,7 @@ You only need this option if you're importing uncompiled source code directly. I
492
471
 
493
472
  Mastra automatically detects workspace packages in monorepo setups and adds them to this list, so you typically only need to specify external packages that require transpilation.
494
473
 
495
- ```typescript title="src/mastra/index.ts"
474
+ ```typescript
496
475
  import { Mastra } from "@mastra/core";
497
476
 
498
477
  export const mastra = new Mastra({
@@ -512,7 +491,7 @@ Mastra automatically exposes registered agents and workflows via its server. For
512
491
 
513
492
  Visit the [Custom API routes](https://mastra.ai/docs/server/custom-api-routes) documentation to learn more.
514
493
 
515
- ```typescript title="src/mastra/index.ts"
494
+ ```typescript
516
495
  import { Mastra } from "@mastra/core";
517
496
  import { registerApiRoute } from "@mastra/core/server";
518
497
 
@@ -538,7 +517,7 @@ Authentication configuration for the server. Mastra supports multiple authentica
538
517
 
539
518
  Visit the [Authentication documentation](https://mastra.ai/docs/server/auth) to learn more.
540
519
 
541
- ```typescript title="src/mastra/index.ts"
520
+ ```typescript
542
521
  import { Mastra } from "@mastra/core";
543
522
  import { MastraJwtAuth } from "@mastra/auth";
544
523
 
@@ -553,12 +532,12 @@ export const mastra = new Mastra({
553
532
 
554
533
  ### server.bodySizeLimit
555
534
 
556
- **Type:** `number`
535
+ **Type:** `number`\
557
536
  **Default:** `4_718_592` (4.5 MB)
558
537
 
559
538
  Maximum request body size in bytes. Increase this limit if your application needs to handle larger payloads.
560
539
 
561
- ```typescript title="src/mastra/index.ts"
540
+ ```typescript
562
541
  import { Mastra } from "@mastra/core";
563
542
 
564
543
  export const mastra = new Mastra({
@@ -572,13 +551,13 @@ export const mastra = new Mastra({
572
551
 
573
552
  Build-time configuration for server features. These options control development tools like Swagger UI and request logging, which are enabled during local development but disabled in production by default.
574
553
 
575
- | Property | Type | Default | Description |
576
- |----------|------|---------|-------------|
577
- | `swaggerUI` | `boolean` | `false` | Enable Swagger UI at `/swagger-ui` for interactive API exploration (requires `openAPIDocs` to be `true`) |
578
- | `apiReqLogs` | `boolean` | `false` | Enable API request logging to the console |
579
- | `openAPIDocs` | `boolean` | `false` | Enable OpenAPI specification at `/openapi.json` |
554
+ | Property | Type | Default | Description |
555
+ | ------------- | --------- | ------- | -------------------------------------------------------------------------------------------------------- |
556
+ | `swaggerUI` | `boolean` | `false` | Enable Swagger UI at `/swagger-ui` for interactive API exploration (requires `openAPIDocs` to be `true`) |
557
+ | `apiReqLogs` | `boolean` | `false` | Enable API request logging to the console |
558
+ | `openAPIDocs` | `boolean` | `false` | Enable OpenAPI specification at `/openapi.json` |
580
559
 
581
- ```typescript title="src/mastra/index.ts"
560
+ ```typescript
582
561
  import { Mastra } from "@mastra/core";
583
562
 
584
563
  export const mastra = new Mastra({
@@ -594,20 +573,20 @@ export const mastra = new Mastra({
594
573
 
595
574
  ### server.cors
596
575
 
597
- **Type:** `CorsOptions | false`
576
+ **Type:** `CorsOptions | false`
598
577
 
599
578
  CORS (Cross-Origin Resource Sharing) configuration for the server. Set to `false` to disable CORS entirely.
600
579
 
601
- | Property | Type | Default | Description |
602
- |----------|------|---------|-------------|
603
- | `origin` | `string \| string[]` | `'*'` | Origins for CORS requests |
604
- | `allowMethods` | `string[]` | `['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']` | HTTP methods |
605
- | `allowHeaders` | `string[]` | `['Content-Type', 'Authorization', 'x-mastra-client-type']` | Request headers |
606
- | `exposeHeaders` | `string[]` | `['Content-Length', 'X-Requested-With']` | Browser headers |
607
- | `credentials` | `boolean` | `false` | Credentials (cookies, authorization headers) |
608
- | `maxAge` | `number` | `3600` | Preflight request cache duration in seconds |
580
+ | Property | Type | Default | Description |
581
+ | --------------- | -------------------- | ----------------------------------------------------------- | -------------------------------------------- |
582
+ | `origin` | `string \| string[]` | `'*'` | Origins for CORS requests |
583
+ | `allowMethods` | `string[]` | `['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']` | HTTP methods |
584
+ | `allowHeaders` | `string[]` | `['Content-Type', 'Authorization', 'x-mastra-client-type']` | Request headers |
585
+ | `exposeHeaders` | `string[]` | `['Content-Length', 'X-Requested-With']` | Browser headers |
586
+ | `credentials` | `boolean` | `false` | Credentials (cookies, authorization headers) |
587
+ | `maxAge` | `number` | `3600` | Preflight request cache duration in seconds |
609
588
 
610
- ```typescript title="src/mastra/index.ts"
589
+ ```typescript
611
590
  import { Mastra } from "@mastra/core";
612
591
 
613
592
  export const mastra = new Mastra({
@@ -624,12 +603,12 @@ export const mastra = new Mastra({
624
603
 
625
604
  ### server.host
626
605
 
627
- **Type:** `string`
606
+ **Type:** `string`\
628
607
  **Default:** `localhost`
629
608
 
630
609
  Host address the Mastra development server binds to.
631
610
 
632
- ```typescript title="src/mastra/index.ts"
611
+ ```typescript
633
612
  import { Mastra } from "@mastra/core";
634
613
 
635
614
  export const mastra = new Mastra({
@@ -645,7 +624,7 @@ export const mastra = new Mastra({
645
624
 
646
625
  HTTPS configuration for running the development server with TLS. Mastra supports local HTTPS development through the `mastra dev --https` flag, which automatically creates and manages certificates. For custom certificate management, provide your own key and certificate files:
647
626
 
648
- ```typescript title="src/mastra/index.ts"
627
+ ```typescript
649
628
  import { Mastra } from "@mastra/core";
650
629
  import fs from "node:fs";
651
630
 
@@ -667,7 +646,7 @@ Custom middleware functions to intercept requests before or after route handlers
667
646
 
668
647
  Visit the [Middleware documentation](https://mastra.ai/docs/server/middleware) to learn more.
669
648
 
670
- ```typescript title="src/mastra/index.ts"
649
+ ```typescript
671
650
  import { Mastra } from "@mastra/core";
672
651
 
673
652
  export const mastra = new Mastra({
@@ -694,7 +673,7 @@ export const mastra = new Mastra({
694
673
 
695
674
  Custom error handler called when an unhandled error occurs. Use this to customize error responses, log errors to external services like Sentry, or implement custom error formatting.
696
675
 
697
- ```typescript title="src/mastra/index.ts"
676
+ ```typescript
698
677
  import { Mastra } from "@mastra/core";
699
678
  import * as Sentry from "@sentry/node";
700
679
 
@@ -714,12 +693,12 @@ export const mastra = new Mastra({
714
693
 
715
694
  ### server.port
716
695
 
717
- **Type:** `number`
696
+ **Type:** `number`\
718
697
  **Default:** `4111` (or `PORT` environment variable if set)
719
698
 
720
699
  Port the Mastra development server binds to. If the `PORT` environment variable is set, it takes precedence over the default.
721
700
 
722
- ```typescript title="src/mastra/index.ts"
701
+ ```typescript
723
702
  import { Mastra } from "@mastra/core";
724
703
 
725
704
  export const mastra = new Mastra({
@@ -731,14 +710,14 @@ export const mastra = new Mastra({
731
710
 
732
711
  ### server.studioBase
733
712
 
734
- **Type:** `string`
713
+ **Type:** `string`\
735
714
  **Default:** `/`
736
715
 
737
716
  Base path for hosting Mastra Studio. Use this to host the Studio on a sub-path of your existing application instead of the root.
738
717
 
739
718
  This is useful when integrating with existing applications, using authentication tools like Cloudflare Zero Trust that benefit from shared domains, or managing multiple services under a single domain.
740
719
 
741
- ```typescript title="src/mastra/index.ts"
720
+ ```typescript
742
721
  import { Mastra } from "@mastra/core";
743
722
 
744
723
  export const mastra = new Mastra({
@@ -749,17 +728,18 @@ export const mastra = new Mastra({
749
728
  ```
750
729
 
751
730
  **Example URLs:**
731
+
752
732
  - Default: `http://localhost:4111/` (studio at root)
753
733
  - With `studioBase`: `http://localhost:4111/my-mastra-studio/` (studio at sub-path)
754
734
 
755
735
  ### server.timeout
756
736
 
757
- **Type:** `number`
737
+ **Type:** `number`\
758
738
  **Default:** `180000` (3 minutes)
759
739
 
760
740
  Request timeout in milliseconds. Requests that exceed this duration will be terminated.
761
741
 
762
- ```typescript title="src/mastra/index.ts"
742
+ ```typescript
763
743
  import { Mastra } from "@mastra/core";
764
744
 
765
745
  export const mastra = new Mastra({
@@ -0,0 +1,42 @@
1
+ # Mastra.addGateway()
2
+
3
+ Dynamically adds a gateway to the Mastra instance. Can be used during or after initialization.
4
+
5
+ ## Usage example
6
+
7
+ ```typescript
8
+ import { Mastra } from '@mastra/core';
9
+
10
+ const mastra = new Mastra();
11
+
12
+ // Add with explicit key
13
+ mastra.addGateway(new MyCustomGateway(), 'myGateway');
14
+
15
+ // Add using gateway's ID as the key
16
+ mastra.addGateway(new MyCustomGateway());
17
+ // Stored with key 'my-custom-gateway' (the gateway's id)
18
+ ```
19
+
20
+ ## Parameters
21
+
22
+ **gateway:** (`MastraModelGateway`): The gateway instance to add
23
+
24
+ **key?:** (`string`): Optional registration key. If not provided, uses gateway.getId()
25
+
26
+ ## Returns
27
+
28
+ Void. The gateway is added to the internal registry.
29
+
30
+ ## Behavior
31
+
32
+ - If a gateway with the same key already exists, the addition is skipped
33
+ - In development mode (`MASTRA_DEV=true`), automatically triggers type generation for custom gateways
34
+ - The gateway becomes available immediately for model resolution
35
+
36
+ ## Related
37
+
38
+ - [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway) - Get gateway by registration key
39
+ - [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById) - Get gateway by ID
40
+ - [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways) - List all gateways
41
+ - [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway) - Gateway base class
42
+ - [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways) - Creating custom gateways
@@ -0,0 +1,21 @@
1
+ # Mastra.getAgent()
2
+
3
+ The `.getAgent()` method is used to retrieve an agent. The method accepts a single `string` parameter for the agent's name.
4
+
5
+ ## Usage example
6
+
7
+ ```typescript
8
+ mastra.getAgent("testAgent");
9
+ ```
10
+
11
+ ## Parameters
12
+
13
+ **name:** (`TAgentName extends keyof TAgents`): The name of the agent to retrieve. Must be a valid agent name that exists in the Mastra configuration.
14
+
15
+ ## Returns
16
+
17
+ **agent:** (`TAgents[TAgentName]`): The agent instance with the specified name. Throws an error if the agent is not found.
18
+
19
+ ## Related
20
+
21
+ - [Agents overview](https://mastra.ai/docs/agents/overview)
@@ -0,0 +1,21 @@
1
+ # Mastra.getAgentById()
2
+
3
+ The `.getAgentById()` method is used to retrieve an agent by its ID. The method accepts a single `string` parameter for the agent's ID.
4
+
5
+ ## Usage example
6
+
7
+ ```typescript
8
+ mastra.getAgentById("test-agent-123");
9
+ ```
10
+
11
+ ## Parameters
12
+
13
+ **id:** (`string`): The ID of the agent to retrieve. The method will first search for an agent with this ID, and if not found, will attempt to use it as a name to call getAgent().
14
+
15
+ ## Returns
16
+
17
+ **agent:** (`Agent`): The agent instance with the specified ID. Throws an error if the agent is not found.
18
+
19
+ ## Related
20
+
21
+ - [Agents overview](https://mastra.ai/docs/agents/overview)
@@ -0,0 +1,22 @@
1
+ # Mastra.getDeployer()
2
+
3
+ The `.getDeployer()` method is used to retrieve the deployer instance that has been configured in the Mastra instance.
4
+
5
+ ## Usage example
6
+
7
+ ```typescript
8
+ mastra.getDeployer();
9
+ ```
10
+
11
+ ## Parameters
12
+
13
+ This method does not accept any parameters.
14
+
15
+ ## Returns
16
+
17
+ **deployer:** (`MastraDeployer | undefined`): The configured deployer instance, or undefined if no deployer has been configured.
18
+
19
+ ## Related
20
+
21
+ - [Deployment overview](https://mastra.ai/docs/deployment/overview)
22
+ - [Deployer reference](https://mastra.ai/reference/deployer)
@@ -0,0 +1,38 @@
1
+ # Mastra.getGateway()
2
+
3
+ Retrieves a gateway by its registration key (the key used when adding the gateway to Mastra).
4
+
5
+ ## Usage example
6
+
7
+ ```typescript
8
+ import { Mastra } from '@mastra/core';
9
+
10
+ const mastra = new Mastra({
11
+ gateways: {
12
+ myGateway: new MyCustomGateway(),
13
+ },
14
+ });
15
+
16
+ const gateway = mastra.getGateway('myGateway');
17
+ console.log(gateway.name); // 'My Custom Gateway'
18
+ ```
19
+
20
+ ## Parameters
21
+
22
+ **key:** (`string`): The registration key of the gateway
23
+
24
+ ## Returns
25
+
26
+ **gateway:** (`MastraModelGateway`): The gateway instance
27
+
28
+ ## Throws
29
+
30
+ Throws an error if no gateway is found with the specified key.
31
+
32
+ ## Related
33
+
34
+ - [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById) - Get gateway by ID
35
+ - [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways) - List all gateways
36
+ - [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway) - Add a gateway
37
+ - [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway) - Gateway base class
38
+ - [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways) - Creating custom gateways
@@ -0,0 +1,41 @@
1
+ # Mastra.getGatewayById()
2
+
3
+ Retrieves a gateway by its unique ID (the `id` property of the gateway instance). This is useful when you need to find a gateway by its intrinsic identifier rather than its registration key.
4
+
5
+ ## Usage example
6
+
7
+ ```typescript
8
+ import { Mastra } from '@mastra/core';
9
+
10
+ const mastra = new Mastra({
11
+ gateways: {
12
+ customKey: new MyCustomGateway(), // id = 'my-custom-gateway'
13
+ },
14
+ });
15
+
16
+ // Retrieve by ID (not registration key)
17
+ const gateway = mastra.getGatewayById('my-custom-gateway');
18
+ console.log(gateway.name); // 'My Custom Gateway'
19
+ ```
20
+
21
+ ## Use Cases
22
+
23
+ - Gateway versioning: Different versions with unique IDs (`'gateway-v1'`, `'gateway-v2'`)
24
+ - Finding gateways when registration keys are unknown
25
+ - Identifying gateways across different Mastra instances
26
+
27
+ ## Parameters
28
+
29
+ **id:** (`string`): The unique ID of the gateway (gateway.id property)
30
+
31
+ ## Returns
32
+
33
+ **gateway:** (`MastraModelGateway | undefined`): The gateway instance, or undefined if not found
34
+
35
+ ## Related
36
+
37
+ - [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway) - Get gateway by registration key
38
+ - [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways) - List all gateways
39
+ - [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway) - Add a gateway
40
+ - [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway) - Gateway base class
41
+ - [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways) - Creating custom gateways