@mastra/mcp-docs-server 0.13.37 → 0.13.39-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 (450) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +2 -0
  2. package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +2 -0
  3. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
  4. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +11 -11
  6. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +16 -16
  7. package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
  8. package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
  9. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +11 -11
  10. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
  11. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +38 -38
  12. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
  13. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
  14. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +10 -10
  15. package/.docs/organized/changelogs/%40mastra%2Fcore.md +88 -88
  16. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +11 -11
  17. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +28 -28
  18. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +27 -27
  19. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +27 -27
  20. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +27 -27
  21. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +59 -59
  22. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +11 -11
  23. package/.docs/organized/changelogs/%40mastra%2Fevals.md +11 -11
  24. package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
  25. package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
  26. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +11 -11
  27. package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
  28. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +25 -25
  29. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
  30. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +11 -11
  31. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +11 -11
  32. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +10 -10
  33. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +11 -11
  34. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
  35. package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
  36. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
  37. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +48 -48
  38. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +11 -11
  39. package/.docs/organized/changelogs/%40mastra%2Frag.md +10 -10
  40. package/.docs/organized/changelogs/%40mastra%2Freact.md +24 -24
  41. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
  42. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  43. package/.docs/organized/changelogs/%40mastra%2Fserver.md +40 -40
  44. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
  45. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +10 -10
  46. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +11 -11
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +11 -11
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +11 -11
  52. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +11 -1
  53. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +10 -10
  54. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +11 -11
  55. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
  56. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
  57. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
  58. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
  59. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
  60. package/.docs/organized/changelogs/create-mastra.md +11 -11
  61. package/.docs/organized/changelogs/mastra.md +34 -34
  62. package/.docs/raw/agents/adding-voice.mdx +20 -9
  63. package/.docs/raw/agents/agent-memory.mdx +55 -39
  64. package/.docs/raw/agents/guardrails.mdx +68 -61
  65. package/.docs/raw/agents/networks.mdx +50 -46
  66. package/.docs/raw/agents/overview.mdx +126 -89
  67. package/.docs/raw/agents/using-tools.mdx +14 -15
  68. package/.docs/raw/auth/auth0.mdx +28 -27
  69. package/.docs/raw/auth/clerk.mdx +22 -20
  70. package/.docs/raw/auth/firebase.mdx +42 -39
  71. package/.docs/raw/auth/index.mdx +1 -1
  72. package/.docs/raw/auth/jwt.mdx +18 -16
  73. package/.docs/raw/auth/supabase.mdx +20 -18
  74. package/.docs/raw/auth/workos.mdx +32 -26
  75. package/.docs/raw/community/contributing-templates.mdx +7 -7
  76. package/.docs/raw/community/discord.mdx +2 -2
  77. package/.docs/raw/community/licensing.mdx +1 -1
  78. package/.docs/raw/course/02-agent-tools-mcp/04-initializing-mcp-tools.md +2 -2
  79. package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +1 -1
  80. package/.docs/raw/course/03-agent-memory/26-updating-mastra-export-comprehensive.md +0 -32
  81. package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +41 -22
  82. package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +48 -29
  83. package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +52 -24
  84. package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +86 -55
  85. package/.docs/raw/deployment/cloud-providers/index.mdx +16 -13
  86. package/.docs/raw/deployment/monorepo.mdx +32 -42
  87. package/.docs/raw/deployment/overview.mdx +15 -15
  88. package/.docs/raw/deployment/server-deployment.mdx +18 -23
  89. package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +16 -17
  90. package/.docs/raw/deployment/serverless-platforms/index.mdx +15 -12
  91. package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +14 -23
  92. package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +16 -23
  93. package/.docs/raw/deployment/web-framework.mdx +14 -14
  94. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +130 -121
  95. package/.docs/raw/frameworks/agentic-uis/assistant-ui.mdx +54 -43
  96. package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +51 -36
  97. package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +161 -120
  98. package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +60 -49
  99. package/.docs/raw/frameworks/servers/express.mdx +46 -45
  100. package/.docs/raw/frameworks/web-frameworks/astro.mdx +245 -162
  101. package/.docs/raw/frameworks/web-frameworks/next-js.mdx +112 -69
  102. package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +171 -130
  103. package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +94 -81
  104. package/.docs/raw/getting-started/installation.mdx +165 -134
  105. package/.docs/raw/getting-started/mcp-docs-server.mdx +36 -39
  106. package/.docs/raw/getting-started/project-structure.mdx +34 -42
  107. package/.docs/raw/getting-started/studio.mdx +42 -50
  108. package/.docs/raw/getting-started/templates.mdx +18 -15
  109. package/.docs/raw/index.mdx +9 -9
  110. package/.docs/raw/mastra-cloud/dashboard.mdx +12 -12
  111. package/.docs/raw/mastra-cloud/observability.mdx +9 -10
  112. package/.docs/raw/mastra-cloud/overview.mdx +17 -23
  113. package/.docs/raw/mastra-cloud/setting-up.mdx +33 -20
  114. package/.docs/raw/memory/conversation-history.mdx +2 -2
  115. package/.docs/raw/memory/overview.mdx +22 -24
  116. package/.docs/raw/memory/semantic-recall.mdx +16 -17
  117. package/.docs/raw/memory/storage/memory-with-libsql.mdx +27 -28
  118. package/.docs/raw/memory/storage/memory-with-pg.mdx +26 -26
  119. package/.docs/raw/memory/storage/memory-with-upstash.mdx +26 -27
  120. package/.docs/raw/memory/threads-and-resources.mdx +24 -21
  121. package/.docs/raw/memory/working-memory.mdx +27 -38
  122. package/.docs/raw/observability/ai-tracing/exporters/arize.mdx +30 -29
  123. package/.docs/raw/observability/ai-tracing/exporters/braintrust.mdx +8 -9
  124. package/.docs/raw/observability/ai-tracing/exporters/cloud.mdx +17 -16
  125. package/.docs/raw/observability/ai-tracing/exporters/default.mdx +37 -38
  126. package/.docs/raw/observability/ai-tracing/exporters/langfuse.mdx +18 -17
  127. package/.docs/raw/observability/ai-tracing/exporters/langsmith.mdx +14 -14
  128. package/.docs/raw/observability/ai-tracing/exporters/otel.mdx +56 -46
  129. package/.docs/raw/observability/ai-tracing/overview.mdx +151 -128
  130. package/.docs/raw/observability/ai-tracing/processors/sensitive-data-filter.mdx +57 -36
  131. package/.docs/raw/observability/logging.mdx +14 -17
  132. package/.docs/raw/observability/nextjs-tracing.mdx +5 -5
  133. package/.docs/raw/observability/otel-tracing.mdx +17 -18
  134. package/.docs/raw/observability/overview.mdx +15 -11
  135. package/.docs/raw/rag/chunking-and-embedding.mdx +10 -8
  136. package/.docs/raw/rag/overview.mdx +5 -5
  137. package/.docs/raw/rag/retrieval.mdx +125 -107
  138. package/.docs/raw/rag/vector-databases.mdx +232 -223
  139. package/.docs/raw/reference/agents/agent.mdx +56 -43
  140. package/.docs/raw/reference/agents/generate.mdx +367 -261
  141. package/.docs/raw/reference/agents/generateLegacy.mdx +260 -178
  142. package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +7 -5
  143. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +7 -5
  144. package/.docs/raw/reference/agents/getDescription.mdx +3 -2
  145. package/.docs/raw/reference/agents/getInstructions.mdx +7 -5
  146. package/.docs/raw/reference/agents/getLLM.mdx +11 -7
  147. package/.docs/raw/reference/agents/getMemory.mdx +7 -5
  148. package/.docs/raw/reference/agents/getModel.mdx +7 -5
  149. package/.docs/raw/reference/agents/getScorers.mdx +7 -5
  150. package/.docs/raw/reference/agents/getTools.mdx +7 -5
  151. package/.docs/raw/reference/agents/getVoice.mdx +7 -5
  152. package/.docs/raw/reference/agents/getWorkflows.mdx +7 -5
  153. package/.docs/raw/reference/agents/listAgents.mdx +6 -4
  154. package/.docs/raw/reference/agents/listScorers.mdx +69 -0
  155. package/.docs/raw/reference/agents/listTools.mdx +69 -0
  156. package/.docs/raw/reference/agents/listWorkflows.mdx +69 -0
  157. package/.docs/raw/reference/agents/network.mdx +171 -116
  158. package/.docs/raw/reference/auth/auth0.mdx +18 -14
  159. package/.docs/raw/reference/auth/clerk.mdx +15 -12
  160. package/.docs/raw/reference/auth/firebase.mdx +23 -16
  161. package/.docs/raw/reference/auth/jwt.mdx +7 -6
  162. package/.docs/raw/reference/auth/supabase.mdx +13 -10
  163. package/.docs/raw/reference/auth/workos.mdx +17 -13
  164. package/.docs/raw/reference/cli/create-mastra.mdx +61 -44
  165. package/.docs/raw/reference/cli/mastra.mdx +11 -11
  166. package/.docs/raw/reference/client-js/agents.mdx +41 -44
  167. package/.docs/raw/reference/client-js/error-handling.mdx +1 -1
  168. package/.docs/raw/reference/client-js/logs.mdx +2 -2
  169. package/.docs/raw/reference/client-js/mastra-client.mdx +28 -20
  170. package/.docs/raw/reference/client-js/memory.mdx +7 -3
  171. package/.docs/raw/reference/client-js/observability.mdx +10 -9
  172. package/.docs/raw/reference/client-js/telemetry.mdx +1 -1
  173. package/.docs/raw/reference/client-js/tools.mdx +2 -2
  174. package/.docs/raw/reference/client-js/vectors.mdx +1 -1
  175. package/.docs/raw/reference/client-js/workflows-legacy.mdx +1 -1
  176. package/.docs/raw/reference/client-js/workflows.mdx +8 -8
  177. package/.docs/raw/reference/core/getAgent.mdx +6 -5
  178. package/.docs/raw/reference/core/getAgentById.mdx +5 -4
  179. package/.docs/raw/reference/core/getAgents.mdx +3 -3
  180. package/.docs/raw/reference/core/getDeployer.mdx +4 -3
  181. package/.docs/raw/reference/core/getLogger.mdx +4 -3
  182. package/.docs/raw/reference/core/getLogs.mdx +10 -6
  183. package/.docs/raw/reference/core/getLogsByRunId.mdx +8 -5
  184. package/.docs/raw/reference/core/getMCPServer.mdx +8 -5
  185. package/.docs/raw/reference/core/getMCPServers.mdx +4 -3
  186. package/.docs/raw/reference/core/getMemory.mdx +4 -3
  187. package/.docs/raw/reference/core/getScorer.mdx +15 -12
  188. package/.docs/raw/reference/core/getScorerByName.mdx +13 -10
  189. package/.docs/raw/reference/core/getScorers.mdx +3 -2
  190. package/.docs/raw/reference/core/getServer.mdx +4 -3
  191. package/.docs/raw/reference/core/getStorage.mdx +4 -3
  192. package/.docs/raw/reference/core/getTelemetry.mdx +4 -3
  193. package/.docs/raw/reference/core/getVector.mdx +6 -4
  194. package/.docs/raw/reference/core/getVectors.mdx +4 -3
  195. package/.docs/raw/reference/core/getWorkflow.mdx +7 -4
  196. package/.docs/raw/reference/core/getWorkflows.mdx +5 -3
  197. package/.docs/raw/reference/core/listAgents.mdx +35 -0
  198. package/.docs/raw/reference/core/listLogs.mdx +96 -0
  199. package/.docs/raw/reference/core/listLogsByRunId.mdx +87 -0
  200. package/.docs/raw/reference/core/listScorers.mdx +43 -0
  201. package/.docs/raw/reference/core/listWorkflows.mdx +45 -0
  202. package/.docs/raw/reference/core/mastra-class.mdx +16 -16
  203. package/.docs/raw/reference/core/setLogger.mdx +6 -4
  204. package/.docs/raw/reference/core/setStorage.mdx +4 -4
  205. package/.docs/raw/reference/core/setTelemetry.mdx +4 -3
  206. package/.docs/raw/reference/deployer/cloudflare.mdx +11 -7
  207. package/.docs/raw/reference/deployer/deployer.mdx +2 -1
  208. package/.docs/raw/reference/deployer/netlify.mdx +4 -4
  209. package/.docs/raw/reference/deployer/vercel.mdx +6 -6
  210. package/.docs/raw/reference/evals/answer-relevancy.mdx +4 -5
  211. package/.docs/raw/reference/evals/bias.mdx +4 -5
  212. package/.docs/raw/reference/evals/completeness.mdx +4 -5
  213. package/.docs/raw/reference/evals/content-similarity.mdx +4 -5
  214. package/.docs/raw/reference/evals/context-position.mdx +4 -5
  215. package/.docs/raw/reference/evals/context-precision.mdx +4 -5
  216. package/.docs/raw/reference/evals/context-relevancy.mdx +4 -5
  217. package/.docs/raw/reference/evals/contextual-recall.mdx +4 -5
  218. package/.docs/raw/reference/evals/faithfulness.mdx +4 -5
  219. package/.docs/raw/reference/evals/hallucination.mdx +4 -6
  220. package/.docs/raw/reference/evals/keyword-coverage.mdx +4 -5
  221. package/.docs/raw/reference/evals/prompt-alignment.mdx +4 -6
  222. package/.docs/raw/reference/evals/summarization.mdx +4 -6
  223. package/.docs/raw/reference/evals/textual-difference.mdx +4 -5
  224. package/.docs/raw/reference/evals/tone-consistency.mdx +4 -7
  225. package/.docs/raw/reference/evals/toxicity.mdx +4 -5
  226. package/.docs/raw/reference/index.mdx +3 -3
  227. package/.docs/raw/reference/legacyWorkflows/after.mdx +5 -5
  228. package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +5 -5
  229. package/.docs/raw/reference/legacyWorkflows/commit.mdx +5 -5
  230. package/.docs/raw/reference/legacyWorkflows/createRun.mdx +4 -4
  231. package/.docs/raw/reference/legacyWorkflows/else.mdx +5 -5
  232. package/.docs/raw/reference/legacyWorkflows/events.mdx +7 -7
  233. package/.docs/raw/reference/legacyWorkflows/execute.mdx +4 -4
  234. package/.docs/raw/reference/legacyWorkflows/if.mdx +5 -5
  235. package/.docs/raw/reference/legacyWorkflows/resume.mdx +5 -5
  236. package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +6 -6
  237. package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +6 -6
  238. package/.docs/raw/reference/legacyWorkflows/start.mdx +6 -6
  239. package/.docs/raw/reference/legacyWorkflows/step-class.mdx +4 -4
  240. package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +4 -4
  241. package/.docs/raw/reference/legacyWorkflows/step-function.mdx +5 -5
  242. package/.docs/raw/reference/legacyWorkflows/step-options.mdx +6 -6
  243. package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +4 -4
  244. package/.docs/raw/reference/legacyWorkflows/suspend.mdx +4 -4
  245. package/.docs/raw/reference/legacyWorkflows/then.mdx +5 -5
  246. package/.docs/raw/reference/legacyWorkflows/until.mdx +4 -4
  247. package/.docs/raw/reference/legacyWorkflows/watch.mdx +3 -3
  248. package/.docs/raw/reference/legacyWorkflows/while.mdx +4 -4
  249. package/.docs/raw/reference/legacyWorkflows/workflow.mdx +7 -7
  250. package/.docs/raw/reference/memory/createThread.mdx +10 -10
  251. package/.docs/raw/reference/memory/deleteMessages.mdx +7 -5
  252. package/.docs/raw/reference/memory/getThreadById.mdx +6 -5
  253. package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +11 -10
  254. package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +10 -9
  255. package/.docs/raw/reference/memory/{Memory.mdx → memory-class.mdx} +55 -47
  256. package/.docs/raw/reference/memory/query.mdx +39 -25
  257. package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +9 -6
  258. package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +26 -22
  259. package/.docs/raw/reference/observability/ai-tracing/exporters/arize.mdx +16 -12
  260. package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +14 -14
  261. package/.docs/raw/reference/observability/ai-tracing/exporters/cloud-exporter.mdx +16 -11
  262. package/.docs/raw/reference/observability/ai-tracing/exporters/console-exporter.mdx +10 -6
  263. package/.docs/raw/reference/observability/ai-tracing/exporters/default-exporter.mdx +23 -15
  264. package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +6 -6
  265. package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +13 -13
  266. package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +44 -36
  267. package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +116 -107
  268. package/.docs/raw/reference/observability/ai-tracing/processors/sensitive-data-filter.mdx +37 -32
  269. package/.docs/raw/reference/observability/ai-tracing/span.mdx +29 -26
  270. package/.docs/raw/reference/observability/logging/pino-logger.mdx +13 -15
  271. package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +2 -2
  272. package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +3 -3
  273. package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +2 -1
  274. package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +1 -1
  275. package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +12 -14
  276. package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +4 -4
  277. package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +1 -1
  278. package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +4 -4
  279. package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +1 -1
  280. package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +2 -2
  281. package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +1 -1
  282. package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +1 -1
  283. package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +1 -1
  284. package/.docs/raw/reference/processors/batch-parts-processor.mdx +3 -4
  285. package/.docs/raw/reference/processors/language-detector.mdx +6 -8
  286. package/.docs/raw/reference/processors/moderation-processor.mdx +36 -11
  287. package/.docs/raw/reference/processors/pii-detector.mdx +34 -9
  288. package/.docs/raw/reference/processors/prompt-injection-detector.mdx +6 -8
  289. package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +14 -10
  290. package/.docs/raw/reference/processors/token-limiter-processor.mdx +3 -5
  291. package/.docs/raw/reference/processors/unicode-normalizer.mdx +3 -4
  292. package/.docs/raw/reference/rag/chunk.mdx +41 -23
  293. package/.docs/raw/reference/rag/database-config.mdx +56 -38
  294. package/.docs/raw/reference/rag/embeddings.mdx +1 -1
  295. package/.docs/raw/reference/rag/extract-params.mdx +1 -1
  296. package/.docs/raw/reference/rag/graph-rag.mdx +1 -1
  297. package/.docs/raw/reference/rag/metadata-filters.mdx +23 -26
  298. package/.docs/raw/reference/rag/rerank.mdx +1 -1
  299. package/.docs/raw/reference/rag/rerankWithScorer.mdx +2 -2
  300. package/.docs/raw/reference/scorers/answer-relevancy.mdx +35 -17
  301. package/.docs/raw/reference/scorers/answer-similarity.mdx +84 -68
  302. package/.docs/raw/reference/scorers/bias.mdx +22 -19
  303. package/.docs/raw/reference/scorers/completeness.mdx +21 -16
  304. package/.docs/raw/reference/scorers/content-similarity.mdx +12 -10
  305. package/.docs/raw/reference/scorers/context-precision.mdx +73 -64
  306. package/.docs/raw/reference/scorers/context-relevance.mdx +142 -126
  307. package/.docs/raw/reference/scorers/create-scorer.mdx +93 -61
  308. package/.docs/raw/reference/scorers/faithfulness.mdx +21 -13
  309. package/.docs/raw/reference/scorers/hallucination.mdx +17 -12
  310. package/.docs/raw/reference/scorers/keyword-coverage.mdx +32 -27
  311. package/.docs/raw/reference/scorers/mastra-scorer.mdx +39 -33
  312. package/.docs/raw/reference/scorers/noise-sensitivity.mdx +203 -152
  313. package/.docs/raw/reference/scorers/prompt-alignment.mdx +186 -132
  314. package/.docs/raw/reference/scorers/run-experiment.mdx +41 -32
  315. package/.docs/raw/reference/scorers/textual-difference.mdx +25 -26
  316. package/.docs/raw/reference/scorers/tone-consistency.mdx +29 -26
  317. package/.docs/raw/reference/scorers/tool-call-accuracy.mdx +180 -176
  318. package/.docs/raw/reference/scorers/toxicity.mdx +35 -31
  319. package/.docs/raw/reference/storage/cloudflare-d1.mdx +1 -1
  320. package/.docs/raw/reference/storage/cloudflare.mdx +1 -1
  321. package/.docs/raw/reference/storage/dynamodb.mdx +1 -1
  322. package/.docs/raw/reference/storage/lance.mdx +1 -1
  323. package/.docs/raw/reference/storage/libsql.mdx +2 -2
  324. package/.docs/raw/reference/storage/mongodb.mdx +4 -5
  325. package/.docs/raw/reference/storage/mssql.mdx +8 -7
  326. package/.docs/raw/reference/storage/postgresql.mdx +35 -33
  327. package/.docs/raw/reference/storage/upstash.mdx +6 -5
  328. package/.docs/raw/reference/streaming/ChunkType.mdx +788 -314
  329. package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +265 -109
  330. package/.docs/raw/reference/streaming/agents/stream.mdx +375 -266
  331. package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +233 -162
  332. package/.docs/raw/reference/streaming/workflows/observeStream.mdx +4 -4
  333. package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +5 -5
  334. package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +25 -21
  335. package/.docs/raw/reference/streaming/workflows/stream.mdx +36 -27
  336. package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +37 -28
  337. package/.docs/raw/reference/templates/overview.mdx +16 -39
  338. package/.docs/raw/reference/tools/client.mdx +1 -1
  339. package/.docs/raw/reference/tools/create-tool.mdx +45 -35
  340. package/.docs/raw/reference/tools/document-chunker-tool.mdx +2 -2
  341. package/.docs/raw/reference/tools/graph-rag-tool.mdx +12 -12
  342. package/.docs/raw/reference/tools/mcp-client.mdx +78 -72
  343. package/.docs/raw/reference/tools/mcp-server.mdx +91 -78
  344. package/.docs/raw/reference/tools/vector-query-tool.mdx +48 -38
  345. package/.docs/raw/reference/vectors/astra.mdx +1 -1
  346. package/.docs/raw/reference/vectors/chroma.mdx +25 -19
  347. package/.docs/raw/reference/vectors/couchbase.mdx +4 -4
  348. package/.docs/raw/reference/vectors/lance.mdx +5 -6
  349. package/.docs/raw/reference/vectors/libsql.mdx +1 -1
  350. package/.docs/raw/reference/vectors/mongodb.mdx +1 -1
  351. package/.docs/raw/reference/vectors/opensearch.mdx +1 -1
  352. package/.docs/raw/reference/vectors/pg.mdx +8 -4
  353. package/.docs/raw/reference/vectors/pinecone.mdx +1 -1
  354. package/.docs/raw/reference/vectors/qdrant.mdx +1 -1
  355. package/.docs/raw/reference/vectors/s3vectors.mdx +35 -27
  356. package/.docs/raw/reference/vectors/turbopuffer.mdx +1 -1
  357. package/.docs/raw/reference/vectors/upstash.mdx +33 -25
  358. package/.docs/raw/reference/vectors/vectorize.mdx +1 -1
  359. package/.docs/raw/reference/voice/azure.mdx +1 -1
  360. package/.docs/raw/reference/voice/cloudflare.mdx +1 -1
  361. package/.docs/raw/reference/voice/composite-voice.mdx +1 -1
  362. package/.docs/raw/reference/voice/deepgram.mdx +1 -1
  363. package/.docs/raw/reference/voice/elevenlabs.mdx +1 -1
  364. package/.docs/raw/reference/voice/google-gemini-live.mdx +7 -5
  365. package/.docs/raw/reference/voice/google.mdx +1 -1
  366. package/.docs/raw/reference/voice/mastra-voice.mdx +1 -1
  367. package/.docs/raw/reference/voice/murf.mdx +1 -1
  368. package/.docs/raw/reference/voice/openai-realtime.mdx +1 -1
  369. package/.docs/raw/reference/voice/openai.mdx +1 -1
  370. package/.docs/raw/reference/voice/playai.mdx +1 -1
  371. package/.docs/raw/reference/voice/sarvam.mdx +1 -1
  372. package/.docs/raw/reference/voice/speechify.mdx +1 -1
  373. package/.docs/raw/reference/voice/voice.addInstructions.mdx +1 -1
  374. package/.docs/raw/reference/voice/voice.addTools.mdx +1 -1
  375. package/.docs/raw/reference/voice/voice.answer.mdx +1 -1
  376. package/.docs/raw/reference/voice/voice.close.mdx +1 -1
  377. package/.docs/raw/reference/voice/voice.connect.mdx +1 -1
  378. package/.docs/raw/reference/voice/voice.events.mdx +1 -1
  379. package/.docs/raw/reference/voice/voice.getSpeakers.mdx +23 -30
  380. package/.docs/raw/reference/voice/voice.listen.mdx +1 -1
  381. package/.docs/raw/reference/voice/voice.off.mdx +1 -1
  382. package/.docs/raw/reference/voice/voice.on.mdx +1 -1
  383. package/.docs/raw/reference/voice/voice.send.mdx +1 -1
  384. package/.docs/raw/reference/voice/voice.speak.mdx +1 -1
  385. package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
  386. package/.docs/raw/reference/workflows/run-methods/cancel.mdx +4 -3
  387. package/.docs/raw/reference/workflows/run-methods/resume.mdx +49 -34
  388. package/.docs/raw/reference/workflows/run-methods/start.mdx +43 -31
  389. package/.docs/raw/reference/workflows/run-methods/watch.mdx +7 -8
  390. package/.docs/raw/reference/workflows/run.mdx +7 -10
  391. package/.docs/raw/reference/workflows/step.mdx +16 -13
  392. package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +2 -2
  393. package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
  394. package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +7 -7
  395. package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +2 -2
  396. package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +2 -2
  397. package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +1 -1
  398. package/.docs/raw/reference/workflows/workflow-methods/map.mdx +74 -3
  399. package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
  400. package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +5 -5
  401. package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +3 -2
  402. package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +3 -2
  403. package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
  404. package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +3 -3
  405. package/.docs/raw/reference/workflows/workflow.mdx +12 -23
  406. package/.docs/raw/scorers/custom-scorers.mdx +58 -48
  407. package/.docs/raw/scorers/evals-old-api/custom-eval.mdx +6 -8
  408. package/.docs/raw/scorers/evals-old-api/overview.mdx +8 -8
  409. package/.docs/raw/scorers/evals-old-api/running-in-ci.mdx +9 -9
  410. package/.docs/raw/scorers/evals-old-api/textual-evals.mdx +5 -5
  411. package/.docs/raw/scorers/off-the-shelf-scorers.mdx +3 -1
  412. package/.docs/raw/scorers/overview.mdx +23 -22
  413. package/.docs/raw/server-db/custom-api-routes.mdx +8 -8
  414. package/.docs/raw/server-db/mastra-client.mdx +56 -54
  415. package/.docs/raw/server-db/middleware.mdx +15 -11
  416. package/.docs/raw/server-db/production-server.mdx +5 -7
  417. package/.docs/raw/server-db/runtime-context.mdx +41 -38
  418. package/.docs/raw/server-db/storage.mdx +82 -87
  419. package/.docs/raw/streaming/events.mdx +24 -16
  420. package/.docs/raw/streaming/overview.mdx +17 -18
  421. package/.docs/raw/streaming/tool-streaming.mdx +9 -10
  422. package/.docs/raw/streaming/workflow-streaming.mdx +14 -12
  423. package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
  424. package/.docs/raw/tools-mcp/mcp-overview.mdx +92 -102
  425. package/.docs/raw/tools-mcp/overview.mdx +10 -15
  426. package/.docs/raw/voice/overview.mdx +273 -250
  427. package/.docs/raw/voice/speech-to-speech.mdx +14 -12
  428. package/.docs/raw/voice/speech-to-text.mdx +2 -2
  429. package/.docs/raw/voice/text-to-speech.mdx +2 -2
  430. package/.docs/raw/workflows/agents-and-tools.mdx +27 -30
  431. package/.docs/raw/workflows/control-flow.mdx +213 -170
  432. package/.docs/raw/workflows/error-handling.mdx +15 -17
  433. package/.docs/raw/workflows/human-in-the-loop.mdx +39 -39
  434. package/.docs/raw/workflows/inngest-workflow.mdx +35 -31
  435. package/.docs/raw/workflows/overview.mdx +108 -56
  436. package/.docs/raw/workflows/snapshots.mdx +54 -36
  437. package/.docs/raw/workflows/suspend-and-resume.mdx +52 -65
  438. package/.docs/raw/workflows-legacy/control-flow.mdx +15 -17
  439. package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +3 -1
  440. package/.docs/raw/workflows-legacy/error-handling.mdx +8 -6
  441. package/.docs/raw/workflows-legacy/nested-workflows.mdx +6 -0
  442. package/.docs/raw/workflows-legacy/overview.mdx +28 -26
  443. package/.docs/raw/workflows-legacy/runtime-variables.mdx +4 -2
  444. package/.docs/raw/workflows-legacy/steps.mdx +5 -3
  445. package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +10 -8
  446. package/.docs/raw/workflows-legacy/variables.mdx +10 -8
  447. package/CHANGELOG.md +24 -0
  448. package/package.json +5 -5
  449. package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -148
  450. package/.docs/raw/workflows/input-data-mapping.mdx +0 -107
@@ -1,31 +1,29 @@
1
1
  ---
2
- title: "Reference: Agent.stream() | Agents | Mastra Docs"
2
+ title: "Reference: Agent.stream() | Streaming | Mastra Docs"
3
3
  description: "Documentation for the `Agent.stream()` method in Mastra agents, which enables real-time streaming of responses with enhanced capabilities."
4
4
  ---
5
5
 
6
- import { Callout } from 'nextra/components';
7
-
8
- # Agent.stream()
9
-
6
+ # Agent.stream()
10
7
 
11
8
  The `.stream()` method enables real-time streaming of responses from an agent with enhanced capabilities and format flexibility. This method accepts messages and optional streaming options, providing a next-generation streaming experience with support for both Mastra's native format and AI SDK v5 compatibility.
12
9
 
13
10
  ## Usage example
14
11
 
15
- ```ts filename="index.ts" copy
12
+ ```ts title="index.ts" copy
16
13
  // Default Mastra format
17
14
  const mastraStream = await agent.stream("message for agent");
18
15
 
19
16
  // AI SDK v5 compatible format
20
17
  const aiSdkStream = await agent.stream("message for agent", {
21
- format: 'aisdk'
18
+ format: "aisdk",
22
19
  });
23
20
  ```
24
21
 
25
- <Callout type="info">
26
- **Model Compatibility**: This method is designed for V2 models. V1 models should use the [`.streamLegacy()`](./streamLegacy.mdx) method. The framework automatically detects your model version and will throw an error if there's a mismatch.
27
- </Callout>
22
+ :::info
28
23
 
24
+ **Model Compatibility**: This method is designed for V2 models. V1 models should use the [`.streamLegacy()`](./streamLegacy) method. The framework automatically detects your model version and will throw an error if there's a mismatch.
25
+
26
+ :::
29
27
 
30
28
  ## Parameters
31
29
 
@@ -34,7 +32,8 @@ const aiSdkStream = await agent.stream("message for agent", {
34
32
  {
35
33
  name: "messages",
36
34
  type: "string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[]",
37
- description: "The messages to send to the agent. Can be a single string, array of strings, or structured message objects.",
35
+ description:
36
+ "The messages to send to the agent. Can be a single string, array of strings, or structured message objects.",
38
37
  },
39
38
  {
40
39
  name: "options",
@@ -45,8 +44,6 @@ const aiSdkStream = await agent.stream("message for agent", {
45
44
  ]}
46
45
  />
47
46
 
48
-
49
-
50
47
  ### Options
51
48
 
52
49
  <PropertiesTable
@@ -56,7 +53,8 @@ const aiSdkStream = await agent.stream("message for agent", {
56
53
  type: "'mastra' | 'aisdk'",
57
54
  isOptional: true,
58
55
  defaultValue: "'mastra'",
59
- description: "Determines the output stream format. Use 'mastra' for Mastra's native format (default) or 'aisdk' for AI SDK v5 compatibility.",
56
+ description:
57
+ "Determines the output stream format. Use 'mastra' for Mastra's native format (default) or 'aisdk' for AI SDK v5 compatibility.",
60
58
  },
61
59
  {
62
60
  name: "maxSteps",
@@ -71,40 +69,50 @@ const aiSdkStream = await agent.stream("message for agent", {
71
69
  description: "Evaluation scorers to run on the execution results.",
72
70
  properties: [
73
71
  {
74
- parameters: [{
75
- name: "scorer",
76
- type: "string",
77
- isOptional: false,
78
- description: "Name of the scorer to use."
79
- }]
80
- },
81
- {
82
- parameters: [{
83
- name: "sampling",
84
- type: "ScoringSamplingConfig",
85
- isOptional: true,
86
- description: "Sampling configuration for the scorer.",
87
- properties: [
88
- {
89
- parameters: [{
90
- name: "type",
91
- type: "'none' | 'ratio'",
92
- isOptional: false,
93
- description: "Type of sampling strategy. Use 'none' to disable sampling or 'ratio' for percentage-based sampling."
94
- }]
95
- },
96
- {
97
- parameters: [{
98
- name: "rate",
99
- type: "number",
100
- isOptional: true,
101
- description: "Sampling rate (0-1). Required when type is 'ratio'."
102
- }]
103
- }
104
- ]
105
- }]
106
- }
107
- ]
72
+ parameters: [
73
+ {
74
+ name: "scorer",
75
+ type: "string",
76
+ isOptional: false,
77
+ description: "Name of the scorer to use.",
78
+ },
79
+ ],
80
+ },
81
+ {
82
+ parameters: [
83
+ {
84
+ name: "sampling",
85
+ type: "ScoringSamplingConfig",
86
+ isOptional: true,
87
+ description: "Sampling configuration for the scorer.",
88
+ properties: [
89
+ {
90
+ parameters: [
91
+ {
92
+ name: "type",
93
+ type: "'none' | 'ratio'",
94
+ isOptional: false,
95
+ description:
96
+ "Type of sampling strategy. Use 'none' to disable sampling or 'ratio' for percentage-based sampling.",
97
+ },
98
+ ],
99
+ },
100
+ {
101
+ parameters: [
102
+ {
103
+ name: "rate",
104
+ type: "number",
105
+ isOptional: true,
106
+ description:
107
+ "Sampling rate (0-1). Required when type is 'ratio'.",
108
+ },
109
+ ],
110
+ },
111
+ ],
112
+ },
113
+ ],
114
+ },
115
+ ],
108
116
  },
109
117
  {
110
118
  name: "tracingContext",
@@ -128,7 +136,8 @@ const aiSdkStream = await agent.stream("message for agent", {
128
136
  name: "onError",
129
137
  type: "({ error }: { error: Error | string }) => Promise<void> | void",
130
138
  isOptional: true,
131
- description: "Callback function called when an error occurs during streaming.",
139
+ description:
140
+ "Callback function called when an error occurs during streaming.",
132
141
  },
133
142
  {
134
143
  name: "onAbort",
@@ -140,19 +149,22 @@ const aiSdkStream = await agent.stream("message for agent", {
140
149
  name: "abortSignal",
141
150
  type: "AbortSignal",
142
151
  isOptional: true,
143
- description: "Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated.",
152
+ description:
153
+ "Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated.",
144
154
  },
145
155
  {
146
156
  name: "activeTools",
147
157
  type: "Array<keyof ToolSet> | undefined",
148
158
  isOptional: true,
149
- description: "Array of active tool names that can be used during execution.",
159
+ description:
160
+ "Array of active tool names that can be used during execution.",
150
161
  },
151
162
  {
152
163
  name: "prepareStep",
153
164
  type: "PrepareStepFunction<any>",
154
165
  isOptional: true,
155
- description: "Callback function called before each step of multi-step execution.",
166
+ description:
167
+ "Callback function called before each step of multi-step execution.",
156
168
  },
157
169
  {
158
170
  name: "context",
@@ -167,66 +179,85 @@ const aiSdkStream = await agent.stream("message for agent", {
167
179
  description: "Options to fine tune your structured output generation.",
168
180
  properties: [
169
181
  {
170
- parameters: [{
171
- name: "schema",
172
- type: "z.ZodSchema<S>",
173
- isOptional: false,
174
- description: "Zod schema defining the expected output structure."
175
- }]
182
+ parameters: [
183
+ {
184
+ name: "schema",
185
+ type: "z.ZodSchema<S>",
186
+ isOptional: false,
187
+ description: "Zod schema defining the expected output structure.",
188
+ },
189
+ ],
176
190
  },
177
191
  {
178
- parameters: [{
179
- name: "model",
180
- type: "MastraLanguageModel",
181
- isOptional: true,
182
- description: "Language model to use for structured output generation. If provided, enables the agent to respond in multi step with tool calls, text, and structured output"
183
- }]
192
+ parameters: [
193
+ {
194
+ name: "model",
195
+ type: "MastraLanguageModel",
196
+ isOptional: true,
197
+ description:
198
+ "Language model to use for structured output generation. If provided, enables the agent to respond in multi step with tool calls, text, and structured output",
199
+ },
200
+ ],
184
201
  },
185
202
  {
186
- parameters: [{
187
- name: "errorStrategy",
188
- type: "'strict' | 'warn' | 'fallback'",
189
- isOptional: true,
190
- description: "Strategy for handling schema validation errors. 'strict' throws errors, 'warn' logs warnings, 'fallback' uses fallback values."
191
- }]
203
+ parameters: [
204
+ {
205
+ name: "errorStrategy",
206
+ type: "'strict' | 'warn' | 'fallback'",
207
+ isOptional: true,
208
+ description:
209
+ "Strategy for handling schema validation errors. 'strict' throws errors, 'warn' logs warnings, 'fallback' uses fallback values.",
210
+ },
211
+ ],
192
212
  },
193
213
  {
194
- parameters: [{
195
- name: "fallbackValue",
196
- type: "<S extends ZodTypeAny>",
197
- isOptional: true,
198
- description: "Fallback value to use when schema validation fails and errorStrategy is 'fallback'."
199
- }]
214
+ parameters: [
215
+ {
216
+ name: "fallbackValue",
217
+ type: "<S extends ZodTypeAny>",
218
+ isOptional: true,
219
+ description:
220
+ "Fallback value to use when schema validation fails and errorStrategy is 'fallback'.",
221
+ },
222
+ ],
200
223
  },
201
224
  {
202
- parameters: [{
203
- name: "instructions",
204
- type: "string",
205
- isOptional: true,
206
- description: "Additional instructions for the structured output model."
207
- }]
225
+ parameters: [
226
+ {
227
+ name: "instructions",
228
+ type: "string",
229
+ isOptional: true,
230
+ description:
231
+ "Additional instructions for the structured output model.",
232
+ },
233
+ ],
208
234
  },
209
235
  {
210
- parameters: [{
211
- name: "jsonPromptInjection",
212
- type: "boolean",
213
- isOptional: true,
214
- description: "Injects system prompt into the main agent instructing it to return structured output, useful for when a model does not natively support structured outputs."
215
- }]
216
- }
217
- ]
236
+ parameters: [
237
+ {
238
+ name: "jsonPromptInjection",
239
+ type: "boolean",
240
+ isOptional: true,
241
+ description:
242
+ "Injects system prompt into the main agent instructing it to return structured output, useful for when a model does not natively support structured outputs.",
243
+ },
244
+ ],
245
+ },
246
+ ],
218
247
  },
219
248
  {
220
249
  name: "outputProcessors",
221
250
  type: "Processor[]",
222
251
  isOptional: true,
223
- description: "Overrides the output processors set on the agent. Output processors that can modify or validate messages from the agent before they are returned to the user. Must implement either (or both) of the `processOutputResult` and `processOutputStream` functions.",
252
+ description:
253
+ "Overrides the output processors set on the agent. Output processors that can modify or validate messages from the agent before they are returned to the user. Must implement either (or both) of the `processOutputResult` and `processOutputStream` functions.",
224
254
  },
225
255
  {
226
256
  name: "inputProcessors",
227
257
  type: "Processor[]",
228
258
  isOptional: true,
229
- description: "Overrides the input processors set on the agent. Input processors that can modify or validate messages before they are processed by the agent. Must implement the `processInput` function.",
259
+ description:
260
+ "Overrides the input processors set on the agent. Input processors that can modify or validate messages before they are processed by the agent. Must implement the `processInput` function.",
230
261
  },
231
262
  {
232
263
  name: "instructions",
@@ -239,7 +270,8 @@ const aiSdkStream = await agent.stream("message for agent", {
239
270
  name: "system",
240
271
  type: "string | string[] | CoreSystemMessage | SystemModelMessage | CoreSystemMessage[] | SystemModelMessage[]",
241
272
  isOptional: true,
242
- description: "Custom system message(s) to include in the prompt. Can be a single string, message object, or array of either. System messages provide additional context or behavior instructions that supplement the agent's main instructions.",
273
+ description:
274
+ "Custom system message(s) to include in the prompt. Can be a single string, message object, or array of either. System messages provide additional context or behavior instructions that supplement the agent's main instructions.",
243
275
  },
244
276
  {
245
277
  name: "output",
@@ -252,33 +284,43 @@ const aiSdkStream = await agent.stream("message for agent", {
252
284
  name: "memory",
253
285
  type: "object",
254
286
  isOptional: true,
255
- description: "Configuration for memory. This is the preferred way to manage memory.",
287
+ description:
288
+ "Configuration for memory. This is the preferred way to manage memory.",
256
289
  properties: [
257
290
  {
258
- parameters: [{
291
+ parameters: [
292
+ {
259
293
  name: "thread",
260
294
  type: "string | { id: string; metadata?: Record<string, any>, title?: string }",
261
295
  isOptional: false,
262
- description: "The conversation thread, as a string ID or an object with an `id` and optional `metadata`."
263
- }]
296
+ description:
297
+ "The conversation thread, as a string ID or an object with an `id` and optional `metadata`.",
298
+ },
299
+ ],
264
300
  },
265
301
  {
266
- parameters: [{
302
+ parameters: [
303
+ {
267
304
  name: "resource",
268
305
  type: "string",
269
306
  isOptional: false,
270
- description: "Identifier for the user or resource associated with the thread."
271
- }]
307
+ description:
308
+ "Identifier for the user or resource associated with the thread.",
309
+ },
310
+ ],
272
311
  },
273
312
  {
274
- parameters: [{
313
+ parameters: [
314
+ {
275
315
  name: "options",
276
316
  type: "MemoryConfig",
277
317
  isOptional: true,
278
- description: "Configuration for memory behavior, like message history and semantic recall."
279
- }]
280
- }
281
- ]
318
+ description:
319
+ "Configuration for memory behavior, like message history and semantic recall.",
320
+ },
321
+ ],
322
+ },
323
+ ],
282
324
  },
283
325
  {
284
326
  name: "onFinish",
@@ -309,38 +351,50 @@ const aiSdkStream = await agent.stream("message for agent", {
309
351
  "Settings for OTLP telemetry collection during streaming (not AI tracing).",
310
352
  properties: [
311
353
  {
312
- parameters: [{
313
- name: "isEnabled",
314
- type: "boolean",
315
- isOptional: true,
316
- description: "Enable or disable telemetry. Disabled by default while experimental."
317
- }]
354
+ parameters: [
355
+ {
356
+ name: "isEnabled",
357
+ type: "boolean",
358
+ isOptional: true,
359
+ description:
360
+ "Enable or disable telemetry. Disabled by default while experimental.",
361
+ },
362
+ ],
318
363
  },
319
364
  {
320
- parameters: [{
321
- name: "recordInputs",
322
- type: "boolean",
323
- isOptional: true,
324
- description: "Enable or disable input recording. Enabled by default. You might want to disable input recording to avoid recording sensitive information."
325
- }]
365
+ parameters: [
366
+ {
367
+ name: "recordInputs",
368
+ type: "boolean",
369
+ isOptional: true,
370
+ description:
371
+ "Enable or disable input recording. Enabled by default. You might want to disable input recording to avoid recording sensitive information.",
372
+ },
373
+ ],
326
374
  },
327
375
  {
328
- parameters: [{
329
- name: "recordOutputs",
330
- type: "boolean",
331
- isOptional: true,
332
- description: "Enable or disable output recording. Enabled by default. You might want to disable output recording to avoid recording sensitive information."
333
- }]
376
+ parameters: [
377
+ {
378
+ name: "recordOutputs",
379
+ type: "boolean",
380
+ isOptional: true,
381
+ description:
382
+ "Enable or disable output recording. Enabled by default. You might want to disable output recording to avoid recording sensitive information.",
383
+ },
384
+ ],
334
385
  },
335
386
  {
336
- parameters: [{
337
- name: "functionId",
338
- type: "string",
339
- isOptional: true,
340
- description: "Identifier for this function. Used to group telemetry data by function."
341
- }]
342
- }
343
- ]
387
+ parameters: [
388
+ {
389
+ name: "functionId",
390
+ type: "string",
391
+ isOptional: true,
392
+ description:
393
+ "Identifier for this function. Used to group telemetry data by function.",
394
+ },
395
+ ],
396
+ },
397
+ ],
344
398
  },
345
399
  {
346
400
  name: "modelSettings",
@@ -350,62 +404,82 @@ const aiSdkStream = await agent.stream("message for agent", {
350
404
  "Model-specific settings like temperature, maxTokens, topP, etc. These are passed to the underlying language model.",
351
405
  properties: [
352
406
  {
353
- parameters: [{
354
- name: "temperature",
355
- type: "number",
356
- isOptional: true,
357
- description: "Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic."
358
- }]
407
+ parameters: [
408
+ {
409
+ name: "temperature",
410
+ type: "number",
411
+ isOptional: true,
412
+ description:
413
+ "Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic.",
414
+ },
415
+ ],
359
416
  },
360
417
  {
361
- parameters: [{
362
- name: "maxRetries",
363
- type: "number",
364
- isOptional: true,
365
- description: "Maximum number of retries for failed requests."
366
- }]
418
+ parameters: [
419
+ {
420
+ name: "maxRetries",
421
+ type: "number",
422
+ isOptional: true,
423
+ description: "Maximum number of retries for failed requests.",
424
+ },
425
+ ],
367
426
  },
368
427
  {
369
- parameters: [{
370
- name: "topP",
371
- type: "number",
372
- isOptional: true,
373
- description: "Nucleus sampling. This is a number between 0 and 1. It is recommended to set either temperature or topP, but not both."
374
- }]
428
+ parameters: [
429
+ {
430
+ name: "topP",
431
+ type: "number",
432
+ isOptional: true,
433
+ description:
434
+ "Nucleus sampling. This is a number between 0 and 1. It is recommended to set either temperature or topP, but not both.",
435
+ },
436
+ ],
375
437
  },
376
438
  {
377
- parameters: [{
378
- name: "topK",
379
- type: "number",
380
- isOptional: true,
381
- description: "Only sample from the top K options for each subsequent token. Used to remove 'long tail' low probability responses."
382
- }]
439
+ parameters: [
440
+ {
441
+ name: "topK",
442
+ type: "number",
443
+ isOptional: true,
444
+ description:
445
+ "Only sample from the top K options for each subsequent token. Used to remove 'long tail' low probability responses.",
446
+ },
447
+ ],
383
448
  },
384
449
  {
385
- parameters: [{
386
- name: "presencePenalty",
387
- type: "number",
388
- isOptional: true,
389
- description: "Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition)."
390
- }]
450
+ parameters: [
451
+ {
452
+ name: "presencePenalty",
453
+ type: "number",
454
+ isOptional: true,
455
+ description:
456
+ "Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).",
457
+ },
458
+ ],
391
459
  },
392
460
  {
393
- parameters: [{
394
- name: "frequencyPenalty",
395
- type: "number",
396
- isOptional: true,
397
- description: "Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition)."
398
- }]
461
+ parameters: [
462
+ {
463
+ name: "frequencyPenalty",
464
+ type: "number",
465
+ isOptional: true,
466
+ description:
467
+ "Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).",
468
+ },
469
+ ],
399
470
  },
400
471
  {
401
- parameters: [{
402
- name: "stopSequences",
403
- type: "string[]",
404
- isOptional: true,
405
- description: "Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated."
406
- }]
472
+ parameters: [
473
+ {
474
+ name: "stopSequences",
475
+ type: "string[]",
476
+ isOptional: true,
477
+ description:
478
+ "Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated.",
479
+ },
480
+ ],
407
481
  },
408
- ]
482
+ ],
409
483
  },
410
484
  {
411
485
  name: "threadId",
@@ -422,34 +496,43 @@ const aiSdkStream = await agent.stream("message for agent", {
422
496
  description: "Controls how the agent uses tools during streaming.",
423
497
  properties: [
424
498
  {
425
- parameters: [{
426
- name: "'auto'",
427
- type: "string",
428
- description: "Let the model decide whether to use tools (default)."
429
- }]
499
+ parameters: [
500
+ {
501
+ name: "'auto'",
502
+ type: "string",
503
+ description:
504
+ "Let the model decide whether to use tools (default).",
505
+ },
506
+ ],
430
507
  },
431
508
  {
432
- parameters: [{
433
- name: "'none'",
434
- type: "string",
435
- description: "Do not use any tools."
436
- }]
509
+ parameters: [
510
+ {
511
+ name: "'none'",
512
+ type: "string",
513
+ description: "Do not use any tools.",
514
+ },
515
+ ],
437
516
  },
438
517
  {
439
- parameters: [{
440
- name: "'required'",
441
- type: "string",
442
- description: "Require the model to use at least one tool."
443
- }]
518
+ parameters: [
519
+ {
520
+ name: "'required'",
521
+ type: "string",
522
+ description: "Require the model to use at least one tool.",
523
+ },
524
+ ],
444
525
  },
445
526
  {
446
- parameters: [{
447
- name: "{ type: 'tool'; toolName: string }",
448
- type: "object",
449
- description: "Require the model to use a specific tool by name."
450
- }]
451
- }
452
- ]
527
+ parameters: [
528
+ {
529
+ name: "{ type: 'tool'; toolName: string }",
530
+ type: "object",
531
+ description: "Require the model to use a specific tool by name.",
532
+ },
533
+ ],
534
+ },
535
+ ],
453
536
  },
454
537
  {
455
538
  name: "toolsets",
@@ -469,75 +552,95 @@ const aiSdkStream = await agent.stream("message for agent", {
469
552
  name: "savePerStep",
470
553
  type: "boolean",
471
554
  isOptional: true,
472
- description: "Save messages incrementally after each stream step completes (default: false).",
555
+ description:
556
+ "Save messages incrementally after each stream step completes (default: false).",
473
557
  },
474
558
  {
475
559
  name: "providerOptions",
476
560
  type: "Record<string, Record<string, JSONValue>>",
477
561
  isOptional: true,
478
- description: "Additional provider-specific options that are passed through to the underlying LLM provider. The structure is `{ providerName: { optionKey: value } }`. For example: `{ openai: { reasoningEffort: 'high' }, anthropic: { maxTokens: 1000 } }`.",
562
+ description:
563
+ "Additional provider-specific options that are passed through to the underlying LLM provider. The structure is `{ providerName: { optionKey: value } }`. For example: `{ openai: { reasoningEffort: 'high' }, anthropic: { maxTokens: 1000 } }`.",
479
564
  properties: [
480
565
  {
481
- parameters: [{
482
- name: "openai",
483
- type: "Record<string, JSONValue>",
484
- isOptional: true,
485
- description: "OpenAI-specific options. Example: `{ reasoningEffort: 'high' }`"
486
- }]
566
+ parameters: [
567
+ {
568
+ name: "openai",
569
+ type: "Record<string, JSONValue>",
570
+ isOptional: true,
571
+ description:
572
+ "OpenAI-specific options. Example: `{ reasoningEffort: 'high' }`",
573
+ },
574
+ ],
487
575
  },
488
576
  {
489
- parameters: [{
490
- name: "anthropic",
491
- type: "Record<string, JSONValue>",
492
- isOptional: true,
493
- description: "Anthropic-specific options. Example: `{ maxTokens: 1000 }`"
494
- }]
577
+ parameters: [
578
+ {
579
+ name: "anthropic",
580
+ type: "Record<string, JSONValue>",
581
+ isOptional: true,
582
+ description:
583
+ "Anthropic-specific options. Example: `{ maxTokens: 1000 }`",
584
+ },
585
+ ],
495
586
  },
496
587
  {
497
- parameters: [{
498
- name: "google",
499
- type: "Record<string, JSONValue>",
500
- isOptional: true,
501
- description: "Google-specific options. Example: `{ safetySettings: [...] }`"
502
- }]
588
+ parameters: [
589
+ {
590
+ name: "google",
591
+ type: "Record<string, JSONValue>",
592
+ isOptional: true,
593
+ description:
594
+ "Google-specific options. Example: `{ safetySettings: [...] }`",
595
+ },
596
+ ],
503
597
  },
504
598
  {
505
- parameters: [{
506
- name: "[providerName]",
507
- type: "Record<string, JSONValue>",
508
- isOptional: true,
509
- description: "Other provider-specific options. The key is the provider name and the value is a record of provider-specific options."
510
- }]
511
- }
512
- ]
599
+ parameters: [
600
+ {
601
+ name: "[providerName]",
602
+ type: "Record<string, JSONValue>",
603
+ isOptional: true,
604
+ description:
605
+ "Other provider-specific options. The key is the provider name and the value is a record of provider-specific options.",
606
+ },
607
+ ],
608
+ },
609
+ ],
513
610
  },
514
611
  {
515
612
  name: "runId",
516
613
  type: "string",
517
614
  isOptional: true,
518
- description: "Unique ID for this generation run. Useful for tracking and debugging purposes.",
615
+ description:
616
+ "Unique ID for this generation run. Useful for tracking and debugging purposes.",
519
617
  },
520
618
  {
521
619
  name: "runtimeContext",
522
620
  type: "RuntimeContext",
523
621
  isOptional: true,
524
- description: "Runtime context for dependency injection and contextual information.",
622
+ description:
623
+ "Runtime context for dependency injection and contextual information.",
525
624
  },
526
625
  {
527
626
  name: "tracingContext",
528
627
  type: "TracingContext",
529
628
  isOptional: true,
530
- description: "AI tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.",
629
+ description:
630
+ "AI tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.",
531
631
  properties: [
532
632
  {
533
- parameters: [{
534
- name: "currentSpan",
535
- type: "AISpan",
536
- isOptional: true,
537
- description: "Current AI span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution."
538
- }]
539
- }
540
- ]
633
+ parameters: [
634
+ {
635
+ name: "currentSpan",
636
+ type: "AISpan",
637
+ isOptional: true,
638
+ description:
639
+ "Current AI span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.",
640
+ },
641
+ ],
642
+ },
643
+ ],
541
644
  },
542
645
  {
543
646
  name: "tracingOptions",
@@ -546,20 +649,24 @@ const aiSdkStream = await agent.stream("message for agent", {
546
649
  description: "Options for AI tracing configuration.",
547
650
  properties: [
548
651
  {
549
- parameters: [{
550
- name: "metadata",
551
- type: "Record<string, any>",
552
- isOptional: true,
553
- description: "Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags."
554
- }]
555
- }
556
- ]
652
+ parameters: [
653
+ {
654
+ name: "metadata",
655
+ type: "Record<string, any>",
656
+ isOptional: true,
657
+ description:
658
+ "Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.",
659
+ },
660
+ ],
661
+ },
662
+ ],
557
663
  },
558
664
  {
559
665
  name: "maxTokens",
560
666
  type: "number",
561
667
  isOptional: true,
562
- description: "Condition(s) that determine when to stop the agent's execution. Can be a single condition or array of conditions.",
668
+ description:
669
+ "Condition(s) that determine when to stop the agent's execution. Can be a single condition or array of conditions.",
563
670
  },
564
671
  ]}
565
672
  />
@@ -571,13 +678,15 @@ const aiSdkStream = await agent.stream("message for agent", {
571
678
  {
572
679
  name: "stream",
573
680
  type: "MastraModelOutput<Output> | AISDKV5OutputStream<Output>",
574
- description: "Returns a streaming interface based on the format parameter. When format is 'mastra' (default), returns MastraModelOutput. When format is 'aisdk', returns AISDKV5OutputStream for AI SDK v5 compatibility.",
681
+ description:
682
+ "Returns a streaming interface based on the format parameter. When format is 'mastra' (default), returns MastraModelOutput. When format is 'aisdk', returns AISDKV5OutputStream for AI SDK v5 compatibility.",
575
683
  },
576
684
  {
577
685
  name: "traceId",
578
686
  type: "string",
579
687
  isOptional: true,
580
- description: "The trace ID associated with this execution when AI tracing is enabled. Use this to correlate logs and debug execution flow.",
688
+ description:
689
+ "The trace ID associated with this execution when AI tracing is enabled. Use this to correlate logs and debug execution flow.",
581
690
  },
582
691
  ]}
583
692
  />
@@ -586,8 +695,8 @@ const aiSdkStream = await agent.stream("message for agent", {
586
695
 
587
696
  ### Mastra Format (Default)
588
697
 
589
- ```ts filename="index.ts" showLineNumbers copy
590
- import { stepCountIs } from 'ai-v5';
698
+ ```ts title="index.ts" showLineNumbers copy
699
+ import { stepCountIs } from "ai-v5";
591
700
 
592
701
  const stream = await agent.stream("Tell me a story", {
593
702
  stopWhen: stepCountIs(3), // Stop after 3 steps
@@ -607,11 +716,11 @@ const fullText = await stream.text;
607
716
 
608
717
  ### AI SDK v5 Format
609
718
 
610
- ```ts filename="index.ts" showLineNumbers copy
611
- import { stepCountIs } from 'ai-v5';
719
+ ```ts title="index.ts" showLineNumbers copy
720
+ import { stepCountIs } from "ai-v5";
612
721
 
613
722
  const stream = await agent.stream("Tell me a story", {
614
- format: 'aisdk',
723
+ format: "aisdk",
615
724
  stopWhen: stepCountIs(3), // Stop after 3 steps
616
725
  modelSettings: {
617
726
  temperature: 0.7,
@@ -620,7 +729,7 @@ const stream = await agent.stream("Tell me a story", {
620
729
 
621
730
  // Use with AI SDK v5 compatible interfaces
622
731
  for await (const part of stream.fullStream) {
623
- if (part.type === 'text-delta') {
732
+ if (part.type === "text-delta") {
624
733
  console.log(part.text);
625
734
  }
626
735
  }
@@ -633,22 +742,22 @@ return stream.toUIMessageStreamResponse();
633
742
 
634
743
  All callback functions are now available as top-level properties for a cleaner API experience.
635
744
 
636
- ```ts filename="index.ts" showLineNumbers copy
745
+ ```ts title="index.ts" showLineNumbers copy
637
746
  const stream = await agent.stream("Tell me a story", {
638
747
  onFinish: (result) => {
639
- console.log('Streaming finished:', result);
748
+ console.log("Streaming finished:", result);
640
749
  },
641
750
  onStepFinish: (step) => {
642
- console.log('Step completed:', step);
751
+ console.log("Step completed:", step);
643
752
  },
644
753
  onChunk: (chunk) => {
645
- console.log('Received chunk:', chunk);
754
+ console.log("Received chunk:", chunk);
646
755
  },
647
756
  onError: ({ error }) => {
648
- console.error('Streaming error:', error);
757
+ console.error("Streaming error:", error);
649
758
  },
650
759
  onAbort: (event) => {
651
- console.log('Stream aborted:', event);
760
+ console.log("Stream aborted:", event);
652
761
  },
653
762
  });
654
763
 
@@ -660,29 +769,29 @@ for await (const chunk of stream.textStream) {
660
769
 
661
770
  ### Advanced Example with Options
662
771
 
663
- ```ts filename="index.ts" showLineNumbers copy
772
+ ```ts title="index.ts" showLineNumbers copy
664
773
  import { z } from "zod";
665
- import { stepCountIs } from 'ai-v5';
774
+ import { stepCountIs } from "ai-v5";
666
775
 
667
776
  await agent.stream("message for agent", {
668
- format: 'aisdk', // Enable AI SDK v5 compatibility
777
+ format: "aisdk", // Enable AI SDK v5 compatibility
669
778
  stopWhen: stepCountIs(3), // Stop after 3 steps
670
779
  modelSettings: {
671
780
  temperature: 0.7,
672
781
  },
673
782
  memory: {
674
783
  thread: "user-123",
675
- resource: "test-app"
784
+ resource: "test-app",
676
785
  },
677
786
  toolChoice: "auto",
678
787
  // Structured output with better DX
679
788
  structuredOutput: {
680
789
  schema: z.object({
681
- sentiment: z.enum(['positive', 'negative', 'neutral']),
790
+ sentiment: z.enum(["positive", "negative", "neutral"]),
682
791
  confidence: z.number(),
683
792
  }),
684
793
  model: "openai/gpt-4o-mini",
685
- errorStrategy: 'warn',
794
+ errorStrategy: "warn",
686
795
  },
687
796
  // Output processors for streaming response validation
688
797
  outputProcessors: [
@@ -694,5 +803,5 @@ await agent.stream("message for agent", {
694
803
 
695
804
  ## Related
696
805
 
697
- - [Generating responses](../../../../docs/agents/overview.mdx#generating-responses)
698
- - [Streaming responses](../../../../docs/agents/overview.mdx#streaming-responses)
806
+ - [Generating responses](/docs/agents/overview#generating-responses)
807
+ - [Streaming responses](/docs/agents/overview#generating-responses)