@mastra/mcp-docs-server 0.0.0-commonjs-20250414101718

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 (254) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fastra.md +302 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +302 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +161 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +302 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +110 -0
  6. package/.docs/organized/changelogs/%40mastra%2Fcore.md +302 -0
  7. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +302 -0
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +302 -0
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +302 -0
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +302 -0
  11. package/.docs/organized/changelogs/%40mastra%2Fevals.md +302 -0
  12. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +302 -0
  13. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +302 -0
  14. package/.docs/organized/changelogs/%40mastra%2Floggers.md +302 -0
  15. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +302 -0
  16. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +26 -0
  17. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +302 -0
  18. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +196 -0
  19. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +302 -0
  20. package/.docs/organized/changelogs/%40mastra%2Fpg.md +302 -0
  21. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +302 -0
  22. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +302 -0
  23. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +302 -0
  24. package/.docs/organized/changelogs/%40mastra%2Frag.md +302 -0
  25. package/.docs/organized/changelogs/%40mastra%2Fragie.md +302 -0
  26. package/.docs/organized/changelogs/%40mastra%2Fserver.md +302 -0
  27. package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +302 -0
  28. package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +302 -0
  29. package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +302 -0
  30. package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +302 -0
  31. package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +302 -0
  32. package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +302 -0
  33. package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +302 -0
  34. package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +302 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +302 -0
  36. package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +302 -0
  37. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +302 -0
  38. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +302 -0
  39. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +302 -0
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +250 -0
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +250 -0
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +302 -0
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +302 -0
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +302 -0
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +302 -0
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +302 -0
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +302 -0
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +302 -0
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +302 -0
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +302 -0
  51. package/.docs/organized/changelogs/create-mastra.md +302 -0
  52. package/.docs/organized/changelogs/mastra.md +302 -0
  53. package/.docs/organized/code-examples/agent-network.md +282 -0
  54. package/.docs/organized/code-examples/agent.md +388 -0
  55. package/.docs/organized/code-examples/ai-sdk-useChat.md +378 -0
  56. package/.docs/organized/code-examples/assistant-ui.md +37 -0
  57. package/.docs/organized/code-examples/bird-checker-with-express.md +235 -0
  58. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +360 -0
  59. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +250 -0
  60. package/.docs/organized/code-examples/client-side-tools.md +69 -0
  61. package/.docs/organized/code-examples/crypto-chatbot.md +96 -0
  62. package/.docs/organized/code-examples/fireworks-r1.md +159 -0
  63. package/.docs/organized/code-examples/mcp-registry-registry.md +63 -0
  64. package/.docs/organized/code-examples/memory-todo-agent.md +164 -0
  65. package/.docs/organized/code-examples/memory-with-context.md +167 -0
  66. package/.docs/organized/code-examples/memory-with-libsql.md +204 -0
  67. package/.docs/organized/code-examples/memory-with-mem0.md +121 -0
  68. package/.docs/organized/code-examples/memory-with-pg.md +224 -0
  69. package/.docs/organized/code-examples/memory-with-upstash.md +268 -0
  70. package/.docs/organized/code-examples/quick-start.md +129 -0
  71. package/.docs/organized/code-examples/stock-price-tool.md +124 -0
  72. package/.docs/organized/code-examples/weather-agent.md +353 -0
  73. package/.docs/organized/code-examples/workflow-ai-recruiter.md +159 -0
  74. package/.docs/organized/code-examples/workflow-with-inline-steps.md +111 -0
  75. package/.docs/organized/code-examples/workflow-with-memory.md +393 -0
  76. package/.docs/organized/code-examples/workflow-with-separate-steps.md +131 -0
  77. package/.docs/raw/agents/adding-tools.mdx +317 -0
  78. package/.docs/raw/agents/adding-voice.mdx +175 -0
  79. package/.docs/raw/agents/agent-memory.mdx +62 -0
  80. package/.docs/raw/agents/mcp-guide.mdx +215 -0
  81. package/.docs/raw/agents/overview.mdx +303 -0
  82. package/.docs/raw/community/discord.mdx +12 -0
  83. package/.docs/raw/community/licensing.mdx +63 -0
  84. package/.docs/raw/deployment/client.mdx +120 -0
  85. package/.docs/raw/deployment/deployment.mdx +127 -0
  86. package/.docs/raw/deployment/server.mdx +282 -0
  87. package/.docs/raw/evals/custom-eval.mdx +22 -0
  88. package/.docs/raw/evals/overview.mdx +95 -0
  89. package/.docs/raw/evals/running-in-ci.mdx +81 -0
  90. package/.docs/raw/evals/textual-evals.mdx +54 -0
  91. package/.docs/raw/faq/index.mdx +63 -0
  92. package/.docs/raw/frameworks/ai-sdk.mdx +296 -0
  93. package/.docs/raw/frameworks/next-js.mdx +238 -0
  94. package/.docs/raw/getting-started/installation.mdx +442 -0
  95. package/.docs/raw/getting-started/mcp-docs-server.mdx +141 -0
  96. package/.docs/raw/getting-started/project-structure.mdx +80 -0
  97. package/.docs/raw/index.mdx +22 -0
  98. package/.docs/raw/integrations/index.mdx +213 -0
  99. package/.docs/raw/local-dev/add-to-existing-project.mdx +48 -0
  100. package/.docs/raw/local-dev/creating-a-new-project.mdx +54 -0
  101. package/.docs/raw/local-dev/mastra-dev.mdx +108 -0
  102. package/.docs/raw/memory/memory-processors.mdx +131 -0
  103. package/.docs/raw/memory/overview.mdx +119 -0
  104. package/.docs/raw/memory/semantic-recall.mdx +122 -0
  105. package/.docs/raw/memory/working-memory.mdx +87 -0
  106. package/.docs/raw/observability/logging.mdx +38 -0
  107. package/.docs/raw/observability/nextjs-tracing.mdx +108 -0
  108. package/.docs/raw/observability/tracing.mdx +115 -0
  109. package/.docs/raw/rag/chunking-and-embedding.mdx +156 -0
  110. package/.docs/raw/rag/overview.mdx +85 -0
  111. package/.docs/raw/rag/retrieval.mdx +365 -0
  112. package/.docs/raw/rag/vector-databases.mdx +340 -0
  113. package/.docs/raw/reference/agents/createTool.mdx +229 -0
  114. package/.docs/raw/reference/agents/generate.mdx +334 -0
  115. package/.docs/raw/reference/agents/getAgent.mdx +54 -0
  116. package/.docs/raw/reference/agents/stream.mdx +369 -0
  117. package/.docs/raw/reference/cli/build.mdx +55 -0
  118. package/.docs/raw/reference/cli/dev.mdx +134 -0
  119. package/.docs/raw/reference/cli/init.mdx +43 -0
  120. package/.docs/raw/reference/client-js/agents.mdx +107 -0
  121. package/.docs/raw/reference/client-js/error-handling.mdx +38 -0
  122. package/.docs/raw/reference/client-js/logs.mdx +24 -0
  123. package/.docs/raw/reference/client-js/memory.mdx +97 -0
  124. package/.docs/raw/reference/client-js/telemetry.mdx +20 -0
  125. package/.docs/raw/reference/client-js/tools.mdx +44 -0
  126. package/.docs/raw/reference/client-js/vectors.mdx +79 -0
  127. package/.docs/raw/reference/client-js/workflows.mdx +136 -0
  128. package/.docs/raw/reference/core/mastra-class.mdx +232 -0
  129. package/.docs/raw/reference/deployer/cloudflare.mdx +207 -0
  130. package/.docs/raw/reference/deployer/deployer.mdx +159 -0
  131. package/.docs/raw/reference/deployer/netlify.mdx +109 -0
  132. package/.docs/raw/reference/deployer/vercel.mdx +117 -0
  133. package/.docs/raw/reference/evals/answer-relevancy.mdx +186 -0
  134. package/.docs/raw/reference/evals/bias.mdx +186 -0
  135. package/.docs/raw/reference/evals/completeness.mdx +174 -0
  136. package/.docs/raw/reference/evals/content-similarity.mdx +183 -0
  137. package/.docs/raw/reference/evals/context-position.mdx +190 -0
  138. package/.docs/raw/reference/evals/context-precision.mdx +189 -0
  139. package/.docs/raw/reference/evals/context-relevancy.mdx +188 -0
  140. package/.docs/raw/reference/evals/contextual-recall.mdx +191 -0
  141. package/.docs/raw/reference/evals/faithfulness.mdx +193 -0
  142. package/.docs/raw/reference/evals/hallucination.mdx +219 -0
  143. package/.docs/raw/reference/evals/keyword-coverage.mdx +176 -0
  144. package/.docs/raw/reference/evals/prompt-alignment.mdx +238 -0
  145. package/.docs/raw/reference/evals/summarization.mdx +205 -0
  146. package/.docs/raw/reference/evals/textual-difference.mdx +161 -0
  147. package/.docs/raw/reference/evals/tone-consistency.mdx +181 -0
  148. package/.docs/raw/reference/evals/toxicity.mdx +165 -0
  149. package/.docs/raw/reference/index.mdx +12 -0
  150. package/.docs/raw/reference/memory/Memory.mdx +212 -0
  151. package/.docs/raw/reference/memory/createThread.mdx +95 -0
  152. package/.docs/raw/reference/memory/getThreadById.mdx +46 -0
  153. package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +48 -0
  154. package/.docs/raw/reference/memory/query.mdx +167 -0
  155. package/.docs/raw/reference/networks/agent-network.mdx +159 -0
  156. package/.docs/raw/reference/observability/create-logger.mdx +106 -0
  157. package/.docs/raw/reference/observability/logger.mdx +55 -0
  158. package/.docs/raw/reference/observability/otel-config.mdx +120 -0
  159. package/.docs/raw/reference/observability/providers/braintrust.mdx +40 -0
  160. package/.docs/raw/reference/observability/providers/dash0.mdx +40 -0
  161. package/.docs/raw/reference/observability/providers/index.mdx +16 -0
  162. package/.docs/raw/reference/observability/providers/laminar.mdx +41 -0
  163. package/.docs/raw/reference/observability/providers/langfuse.mdx +51 -0
  164. package/.docs/raw/reference/observability/providers/langsmith.mdx +48 -0
  165. package/.docs/raw/reference/observability/providers/langwatch.mdx +45 -0
  166. package/.docs/raw/reference/observability/providers/new-relic.mdx +40 -0
  167. package/.docs/raw/reference/observability/providers/signoz.mdx +40 -0
  168. package/.docs/raw/reference/observability/providers/traceloop.mdx +40 -0
  169. package/.docs/raw/reference/rag/astra.mdx +258 -0
  170. package/.docs/raw/reference/rag/chroma.mdx +281 -0
  171. package/.docs/raw/reference/rag/chunk.mdx +235 -0
  172. package/.docs/raw/reference/rag/document.mdx +127 -0
  173. package/.docs/raw/reference/rag/embeddings.mdx +160 -0
  174. package/.docs/raw/reference/rag/extract-params.mdx +226 -0
  175. package/.docs/raw/reference/rag/graph-rag.mdx +182 -0
  176. package/.docs/raw/reference/rag/libsql.mdx +357 -0
  177. package/.docs/raw/reference/rag/metadata-filters.mdx +298 -0
  178. package/.docs/raw/reference/rag/pg.mdx +477 -0
  179. package/.docs/raw/reference/rag/pinecone.mdx +281 -0
  180. package/.docs/raw/reference/rag/qdrant.mdx +236 -0
  181. package/.docs/raw/reference/rag/rerank.mdx +212 -0
  182. package/.docs/raw/reference/rag/turbopuffer.mdx +249 -0
  183. package/.docs/raw/reference/rag/upstash.mdx +247 -0
  184. package/.docs/raw/reference/rag/vectorize.mdx +298 -0
  185. package/.docs/raw/reference/storage/libsql.mdx +74 -0
  186. package/.docs/raw/reference/storage/postgresql.mdx +48 -0
  187. package/.docs/raw/reference/storage/upstash.mdx +86 -0
  188. package/.docs/raw/reference/tools/client.mdx +207 -0
  189. package/.docs/raw/reference/tools/document-chunker-tool.mdx +141 -0
  190. package/.docs/raw/reference/tools/graph-rag-tool.mdx +154 -0
  191. package/.docs/raw/reference/tools/mcp-configuration.mdx +206 -0
  192. package/.docs/raw/reference/tools/vector-query-tool.mdx +212 -0
  193. package/.docs/raw/reference/voice/composite-voice.mdx +140 -0
  194. package/.docs/raw/reference/voice/deepgram.mdx +164 -0
  195. package/.docs/raw/reference/voice/elevenlabs.mdx +216 -0
  196. package/.docs/raw/reference/voice/google.mdx +198 -0
  197. package/.docs/raw/reference/voice/mastra-voice.mdx +394 -0
  198. package/.docs/raw/reference/voice/murf.mdx +251 -0
  199. package/.docs/raw/reference/voice/openai-realtime.mdx +431 -0
  200. package/.docs/raw/reference/voice/openai.mdx +168 -0
  201. package/.docs/raw/reference/voice/playai.mdx +159 -0
  202. package/.docs/raw/reference/voice/sarvam.mdx +260 -0
  203. package/.docs/raw/reference/voice/speechify.mdx +145 -0
  204. package/.docs/raw/reference/voice/voice.answer.mdx +122 -0
  205. package/.docs/raw/reference/voice/voice.connect.mdx +124 -0
  206. package/.docs/raw/reference/voice/voice.listen.mdx +195 -0
  207. package/.docs/raw/reference/voice/voice.on.mdx +189 -0
  208. package/.docs/raw/reference/voice/voice.send.mdx +118 -0
  209. package/.docs/raw/reference/voice/voice.speak.mdx +203 -0
  210. package/.docs/raw/reference/workflows/after.mdx +88 -0
  211. package/.docs/raw/reference/workflows/afterEvent.mdx +76 -0
  212. package/.docs/raw/reference/workflows/commit.mdx +37 -0
  213. package/.docs/raw/reference/workflows/createRun.mdx +77 -0
  214. package/.docs/raw/reference/workflows/else.mdx +72 -0
  215. package/.docs/raw/reference/workflows/events.mdx +305 -0
  216. package/.docs/raw/reference/workflows/execute.mdx +110 -0
  217. package/.docs/raw/reference/workflows/if.mdx +107 -0
  218. package/.docs/raw/reference/workflows/resume.mdx +155 -0
  219. package/.docs/raw/reference/workflows/resumeWithEvent.mdx +133 -0
  220. package/.docs/raw/reference/workflows/snapshots.mdx +207 -0
  221. package/.docs/raw/reference/workflows/start.mdx +84 -0
  222. package/.docs/raw/reference/workflows/step-class.mdx +100 -0
  223. package/.docs/raw/reference/workflows/step-condition.mdx +134 -0
  224. package/.docs/raw/reference/workflows/step-function.mdx +92 -0
  225. package/.docs/raw/reference/workflows/step-options.mdx +69 -0
  226. package/.docs/raw/reference/workflows/step-retries.mdx +203 -0
  227. package/.docs/raw/reference/workflows/suspend.mdx +70 -0
  228. package/.docs/raw/reference/workflows/then.mdx +74 -0
  229. package/.docs/raw/reference/workflows/until.mdx +165 -0
  230. package/.docs/raw/reference/workflows/watch.mdx +118 -0
  231. package/.docs/raw/reference/workflows/while.mdx +168 -0
  232. package/.docs/raw/reference/workflows/workflow.mdx +233 -0
  233. package/.docs/raw/storage/overview.mdx +378 -0
  234. package/.docs/raw/voice/overview.mdx +135 -0
  235. package/.docs/raw/voice/speech-to-text.mdx +45 -0
  236. package/.docs/raw/voice/text-to-speech.mdx +52 -0
  237. package/.docs/raw/voice/voice-to-voice.mdx +310 -0
  238. package/.docs/raw/workflows/control-flow.mdx +778 -0
  239. package/.docs/raw/workflows/dynamic-workflows.mdx +236 -0
  240. package/.docs/raw/workflows/error-handling.mdx +183 -0
  241. package/.docs/raw/workflows/nested-workflows.mdx +352 -0
  242. package/.docs/raw/workflows/overview.mdx +203 -0
  243. package/.docs/raw/workflows/steps.mdx +108 -0
  244. package/.docs/raw/workflows/suspend-and-resume.mdx +404 -0
  245. package/.docs/raw/workflows/variables.mdx +313 -0
  246. package/LICENSE.md +46 -0
  247. package/README.md +129 -0
  248. package/dist/_tsup-dts-rollup.d.ts +149 -0
  249. package/dist/chunk-QWYMT5LP.js +194 -0
  250. package/dist/prepare-docs/prepare.d.ts +1 -0
  251. package/dist/prepare-docs/prepare.js +1 -0
  252. package/dist/stdio.d.ts +1 -0
  253. package/dist/stdio.js +518 -0
  254. package/package.json +60 -0
@@ -0,0 +1,369 @@
1
+ ---
2
+ title: "Reference: Agent.stream() | Streaming | Agents | Mastra Docs"
3
+ description: Documentation for the `.stream()` method in Mastra agents, which enables real-time streaming of responses.
4
+ ---
5
+
6
+ # `stream()`
7
+
8
+ The `stream()` method enables real-time streaming of responses from an agent. This method accepts `messages` and an optional `options` object as parameters, similar to `generate()`.
9
+
10
+ ## Parameters
11
+
12
+ ### `messages`
13
+
14
+ The `messages` parameter can be:
15
+
16
+ - A single string
17
+ - An array of strings
18
+ - An array of message objects with `role` and `content` properties
19
+
20
+ The message object structure:
21
+
22
+ ```typescript
23
+ interface Message {
24
+ role: 'system' | 'user' | 'assistant';
25
+ content: string;
26
+ }
27
+ ```
28
+
29
+ ### `options` (Optional)
30
+
31
+ An optional object that can include configuration for output structure, memory management, tool usage, telemetry, and more.
32
+
33
+ <PropertiesTable
34
+ content={[
35
+ {
36
+ name: "abortSignal",
37
+ type: "AbortSignal",
38
+ isOptional: true,
39
+ description: "Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated.",
40
+ },
41
+ {
42
+ name: "context",
43
+ type: "CoreMessage[]",
44
+ isOptional: true,
45
+ description: "Additional context messages to provide to the agent.",
46
+ },
47
+ {
48
+ name: "experimental_output",
49
+ type: "Zod schema | JsonSchema7",
50
+ isOptional: true,
51
+ description: "Enables structured output generation alongside text generation and tool calls. The model will generate responses that conform to the provided schema.",
52
+ },
53
+ {
54
+ name: "instructions",
55
+ type: "string",
56
+ isOptional: true,
57
+ description: "Custom instructions that override the agent's default instructions for this specific generation. Useful for dynamically modifying agent behavior without creating a new agent instance.",
58
+ },
59
+ {
60
+ name: "maxSteps",
61
+ type: "number",
62
+ isOptional: true,
63
+ defaultValue: "5",
64
+ description: "Maximum number of steps allowed during streaming.",
65
+ },
66
+ {
67
+ name: "maxRetries",
68
+ type: "number",
69
+ isOptional: true,
70
+ defaultValue: "2",
71
+ description: "Maximum number of retries. Set to 0 to disable retries.",
72
+ },
73
+ {
74
+ name: "memoryOptions",
75
+ type: "MemoryConfig",
76
+ isOptional: true,
77
+ description: "Configuration options for memory management. See MemoryConfig section below for details.",
78
+ },
79
+ {
80
+ name: "onFinish",
81
+ type: "StreamTextOnFinishCallback | StreamObjectOnFinishCallback",
82
+ isOptional: true,
83
+ description: "Callback function called when streaming is complete.",
84
+ },
85
+ {
86
+ name: "onStepFinish",
87
+ type: "GenerateTextOnStepFinishCallback<any> | never",
88
+ isOptional: true,
89
+ description: "Callback function called after each step during streaming. Unavailable for structured output",
90
+ },
91
+ {
92
+ name: "output",
93
+ type: "Zod schema | JsonSchema7",
94
+ isOptional: true,
95
+ description: "Defines the expected structure of the output. Can be a JSON Schema object or a Zod schema.",
96
+ },
97
+ {
98
+ name: "resourceId",
99
+ type: "string",
100
+ isOptional: true,
101
+ description: "Identifier for the user or resource interacting with the agent. Must be provided if threadId is provided.",
102
+ },
103
+ {
104
+ name: "telemetry",
105
+ type: "TelemetrySettings",
106
+ isOptional: true,
107
+ description: "Settings for telemetry collection during streaming. See TelemetrySettings section below for details.",
108
+ },
109
+ {
110
+ name: "temperature",
111
+ type: "number",
112
+ isOptional: true,
113
+ 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.",
114
+ },
115
+ {
116
+ name: "threadId",
117
+ type: "string",
118
+ isOptional: true,
119
+ description: "Identifier for the conversation thread. Allows for maintaining context across multiple interactions. Must be provided if resourceId is provided.",
120
+ },
121
+ {
122
+ name: "toolChoice",
123
+ type: "'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }",
124
+ isOptional: true,
125
+ defaultValue: "'auto'",
126
+ description: "Controls how the agent uses tools during streaming.",
127
+ },
128
+ {
129
+ name: "toolsets",
130
+ type: "ToolsetsInput",
131
+ isOptional: true,
132
+ description: "Additional toolsets to make available to the agent during this stream.",
133
+ }
134
+ ]}
135
+ />
136
+
137
+ #### MemoryConfig
138
+
139
+ Configuration options for memory management:
140
+
141
+ <PropertiesTable
142
+ content={[
143
+ {
144
+ name: "lastMessages",
145
+ type: "number | false",
146
+ isOptional: true,
147
+ description: "Number of most recent messages to include in context. Set to false to disable.",
148
+ },
149
+ {
150
+ name: "semanticRecall",
151
+ type: "boolean | object",
152
+ isOptional: true,
153
+ description: "Configuration for semantic memory recall. Can be boolean or detailed config.",
154
+ properties: [
155
+ {
156
+ type: "number",
157
+ parameters: [
158
+ {
159
+ name: "topK",
160
+ type: "number",
161
+ isOptional: true,
162
+ description: "Number of most semantically similar messages to retrieve.",
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ type: "number | object",
168
+ parameters: [
169
+ {
170
+ name: "messageRange",
171
+ type: "number | { before: number; after: number }",
172
+ isOptional: true,
173
+ description: "Range of messages to consider for semantic search. Can be a single number or before/after configuration.",
174
+ }
175
+ ]
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ name: "workingMemory",
181
+ type: "object",
182
+ isOptional: true,
183
+ description: "Configuration for working memory.",
184
+ properties: [
185
+ {
186
+ type: "boolean",
187
+ parameters: [
188
+ {
189
+ name: "enabled",
190
+ type: "boolean",
191
+ isOptional: true,
192
+ description: "Whether to enable working memory."
193
+ }
194
+ ]
195
+ },
196
+ {
197
+ type: "string",
198
+ parameters: [
199
+ {
200
+ name: "template",
201
+ type: "string",
202
+ isOptional: true,
203
+ description: "Template to use for working memory.",
204
+ }
205
+ ]
206
+ },
207
+ {
208
+ type: "'text-stream' | 'tool-call'",
209
+ parameters: [
210
+ {
211
+ name: "type",
212
+ type: "'text-stream' | 'tool-call'",
213
+ isOptional: true,
214
+ description: "Type of content to use for working memory.",
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ name: "threads",
222
+ type: "object",
223
+ isOptional: true,
224
+ description: "Thread-specific memory configuration.",
225
+ properties: [
226
+ {
227
+ type: "boolean",
228
+ parameters: [
229
+ {
230
+ name: "generateTitle",
231
+ type: "boolean",
232
+ isOptional: true,
233
+ description: "Whether to automatically generate titles for new threads.",
234
+ }
235
+ ]
236
+ }
237
+ ]
238
+ }
239
+ ]}
240
+ />
241
+
242
+ #### TelemetrySettings
243
+
244
+ Settings for telemetry collection during streaming:
245
+
246
+ <PropertiesTable
247
+ content={[
248
+ {
249
+ name: "isEnabled",
250
+ type: "boolean",
251
+ isOptional: true,
252
+ defaultValue: "false",
253
+ description: "Enable or disable telemetry. Disabled by default while experimental.",
254
+ },
255
+ {
256
+ name: "recordInputs",
257
+ type: "boolean",
258
+ isOptional: true,
259
+ defaultValue: "true",
260
+ description: "Enable or disable input recording. You might want to disable this to avoid recording sensitive information, reduce data transfers, or increase performance.",
261
+ },
262
+ {
263
+ name: "recordOutputs",
264
+ type: "boolean",
265
+ isOptional: true,
266
+ defaultValue: "true",
267
+ description: "Enable or disable output recording. You might want to disable this to avoid recording sensitive information, reduce data transfers, or increase performance.",
268
+ },
269
+ {
270
+ name: "functionId",
271
+ type: "string",
272
+ isOptional: true,
273
+ description: "Identifier for this function. Used to group telemetry data by function.",
274
+ },
275
+ {
276
+ name: "metadata",
277
+ type: "Record<string, AttributeValue>",
278
+ isOptional: true,
279
+ description: "Additional information to include in the telemetry data. AttributeValue can be string, number, boolean, array of these types, or null.",
280
+ },
281
+ {
282
+ name: "tracer",
283
+ type: "Tracer",
284
+ isOptional: true,
285
+ description: "A custom OpenTelemetry tracer instance to use for the telemetry data. See OpenTelemetry documentation for details.",
286
+ }
287
+ ]}
288
+ />
289
+
290
+ ## Returns
291
+
292
+ The return value of the `stream()` method depends on the options provided, specifically the `output` option.
293
+
294
+ ### PropertiesTable for Return Values
295
+
296
+ <PropertiesTable
297
+ content={[
298
+ {
299
+ name: "textStream",
300
+ type: "AsyncIterable<string>",
301
+ isOptional: true,
302
+ description: "Stream of text chunks. Present when output is 'text' (no schema provided) or when using `experimental_output`.",
303
+ },
304
+ {
305
+ name: "objectStream",
306
+ type: "AsyncIterable<object>",
307
+ isOptional: true,
308
+ description: "Stream of structured data. Present only when using `output` option with a schema.",
309
+ },
310
+ {
311
+ name: "partialObjectStream",
312
+ type: "AsyncIterable<object>",
313
+ isOptional: true,
314
+ description: "Stream of structured data. Present only when using `experimental_output` option.",
315
+ },
316
+ {
317
+ name: "object",
318
+ type: "Promise<object>",
319
+ isOptional: true,
320
+ description: "Promise that resolves to the final structured output. Present when using either `output` or `experimental_output` options.",
321
+ }
322
+ ]}
323
+ />
324
+
325
+ ## Examples
326
+
327
+ ### Basic Text Streaming
328
+
329
+ ```typescript
330
+ const stream = await myAgent.stream([
331
+ { role: "user", content: "Tell me a story." }
332
+ ]);
333
+
334
+ for await (const chunk of stream.textStream) {
335
+ process.stdout.write(chunk);
336
+ }
337
+ ```
338
+
339
+ ### Structured Output Streaming with Thread Context
340
+
341
+ ```typescript
342
+ const schema = {
343
+ type: 'object',
344
+ properties: {
345
+ summary: { type: 'string' },
346
+ nextSteps: { type: 'array', items: { type: 'string' } }
347
+ },
348
+ required: ['summary', 'nextSteps']
349
+ };
350
+
351
+ const response = await myAgent.stream(
352
+ "What should we do next?",
353
+ {
354
+ output: schema,
355
+ threadId: "project-123",
356
+ onFinish: text => console.log("Finished:", text)
357
+ }
358
+ );
359
+
360
+ for await (const chunk of response.textStream) {
361
+ console.log(chunk);
362
+ }
363
+
364
+ const result = await response.object;
365
+ console.log("Final structured result:", result);
366
+ ```
367
+
368
+ The key difference between Agent's `stream()` and LLM's `stream()` is that Agents maintain conversation context through `threadId`, can access tools, and integrate with the agent's memory system.
369
+
@@ -0,0 +1,55 @@
1
+ ---
2
+ title: "mastra build"
3
+ description: "Build your Mastra project for production deployment"
4
+ ---
5
+
6
+ The `mastra build` command bundles your Mastra project into a production-ready Hono server. Hono is a lightweight web framework that provides type-safe routing and middleware support, making it ideal for deploying Mastra agents as HTTP endpoints.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ mastra build [options]
12
+ ```
13
+
14
+ ## Options
15
+
16
+ - `--dir <path>`: Directory containing your Mastra project (default: current directory)
17
+
18
+ ## What It Does
19
+
20
+ 1. Locates your Mastra entry file (either `src/mastra/index.ts` or `src/mastra/index.js`)
21
+ 2. Creates a `.mastra` output directory
22
+ 3. Bundles your code using Rollup with:
23
+ - Tree shaking for optimal bundle size
24
+ - Node.js environment targeting
25
+ - Source map generation for debugging
26
+
27
+ ## Example
28
+
29
+ ```bash
30
+ # Build from current directory
31
+ mastra build
32
+
33
+ # Build from specific directory
34
+ mastra build --dir ./my-mastra-project
35
+ ```
36
+
37
+ ## Output
38
+
39
+ The command generates a production bundle in the `.mastra` directory, which includes:
40
+ - A Hono-based HTTP server with your Mastra agents exposed as endpoints
41
+ - Bundled JavaScript files optimized for production
42
+ - Source maps for debugging
43
+ - Required dependencies
44
+
45
+ This output is suitable for:
46
+ - Deploying to cloud servers (EC2, Digital Ocean)
47
+ - Running in containerized environments
48
+ - Using with container orchestration systems
49
+
50
+ ## Deployers
51
+ When a Deployer is used, the build output is automatically prepared for the target platform e.g
52
+ - [Vercel Deployer](/reference/deployers/vercel)
53
+ - [Netlify Deployer](/reference/deployers/netlify)
54
+ - [Cloudflare Deployer](/reference/deployers/cloudflare)
55
+
@@ -0,0 +1,134 @@
1
+ ---
2
+ title: "`mastra dev` Reference | Local Development | Mastra CLI"
3
+ description: Documentation for the mastra dev command, which starts a development server for agents, tools, and workflows.
4
+ ---
5
+
6
+ # `mastra dev` Reference
7
+
8
+ The `mastra dev` command starts a development server that exposes REST routes for your agents, tools, and workflows,
9
+
10
+ ## Parameters
11
+
12
+ <PropertiesTable
13
+ content={[
14
+ {
15
+ name: "--dir",
16
+ type: "string",
17
+ description:
18
+ "Specifies the path to your Mastra folder (containing agents, tools, and workflows). Defaults to the current working directory.",
19
+ isOptional: true,
20
+ },
21
+ {
22
+ name: "--tools",
23
+ type: "string",
24
+ description:
25
+ "Comma-separated paths to additional tool directories that should be registered. For example: 'src/tools/dbTools,src/tools/scraperTools'.",
26
+ isOptional: true,
27
+ },
28
+ {
29
+ name: "--port",
30
+ type: "number",
31
+ description:
32
+ "Specifies the port number for the development server. Defaults to 4111.",
33
+ isOptional: true,
34
+ },
35
+ ]}
36
+ />
37
+
38
+ ## Routes
39
+
40
+ Starting the server with `mastra dev` exposes a set of REST routes by default:
41
+
42
+ ### System Routes
43
+ - **GET `/api`**: Get API status.
44
+
45
+ ### Agent Routes
46
+
47
+ Agents are expected to be exported from `src/mastra/agents`.
48
+
49
+ - **GET `/api/agents`**: Lists the registered agents found in your Mastra folder.
50
+ - **GET `/api/agents/:agentId`**: Get agent by ID.
51
+ - **GET `/api/agents/:agentId/evals/ci`**: Get CI evals by agent ID.
52
+ - **GET `/api/agents/:agentId/evals/live`**: Get live evals by agent ID.
53
+ - **POST `/api/agents/:agentId/generate`**: Sends a text-based prompt to the specified agent, returning the agent's response.
54
+ - **POST `/api/agents/:agentId/stream`**: Stream a response from an agent.
55
+ - **POST `/api/agents/:agentId/instructions`**: Update an agent's instructions.
56
+ - **POST `/api/agents/:agentId/instructions/enhance`**: Generate an improved system prompt from instructions.
57
+ - **GET `/api/agents/:agentId/speakers`**: Get available speakers for an agent.
58
+ - **POST `/api/agents/:agentId/speak`**: Convert text to speech using the agent's voice provider.
59
+ - **POST `/api/agents/:agentId/listen`**: Convert speech to text using the agent's voice provider.
60
+ - **POST `/api/agents/:agentId/tools/:toolId/execute`**: Execute a tool through an agent.
61
+
62
+ ### Tool Routes
63
+
64
+ Tools are expected to be exported from `src/mastra/tools` (or the configured tools directory).
65
+
66
+ - **GET `/api/tools`**: Get all tools.
67
+ - **GET `/api/tools/:toolId`**: Get tool by ID.
68
+ - **POST `/api/tools/:toolId/execute`**: Invokes a specific tool by name, passing input data in the request body.
69
+
70
+ ### Workflow Routes
71
+
72
+ Workflows are expected to be exported from `src/mastra/workflows` (or the configured workflows directory).
73
+
74
+ - **GET `/api/workflows`**: Get all workflows.
75
+ - **GET `/api/workflows/:workflowId`**: Get workflow by ID.
76
+ - **POST `/api/workflows/:workflowName/start`**: Starts the specified workflow.
77
+ - **POST `/api/workflows/:workflowName/:instanceId/event`**: Sends an event or trigger signal to an existing workflow instance.
78
+ - **GET `/api/workflows/:workflowName/:instanceId/status`**: Returns status info for a running workflow instance.
79
+ - **POST `/api/workflows/:workflowId/resume`**: Resume a suspended workflow step.
80
+ - **POST `/api/workflows/:workflowId/resume-async`**: Resume a suspended workflow step asynchronously.
81
+ - **POST `/api/workflows/:workflowId/createRun`**: Create a new workflow run.
82
+ - **POST `/api/workflows/:workflowId/start-async`**: Execute/Start a workflow asynchronously.
83
+ - **GET `/api/workflows/:workflowId/watch`**: Watch workflow transitions in real-time.
84
+
85
+ ### Memory Routes
86
+ - **GET `/api/memory/status`**: Get memory status.
87
+ - **GET `/api/memory/threads`**: Get all threads.
88
+ - **GET `/api/memory/threads/:threadId`**: Get thread by ID.
89
+ - **GET `/api/memory/threads/:threadId/messages`**: Get messages for a thread.
90
+ - **POST `/api/memory/threads`**: Create a new thread.
91
+ - **PATCH `/api/memory/threads/:threadId`**: Update a thread.
92
+ - **DELETE `/api/memory/threads/:threadId`**: Delete a thread.
93
+ - **POST `/api/memory/save-messages`**: Save messages.
94
+
95
+ ### Telemetry Routes
96
+ - **GET `/api/telemetry`**: Get all traces.
97
+
98
+ ### Log Routes
99
+ - **GET `/api/logs`**: Get all logs.
100
+ - **GET `/api/logs/transports`**: List of all log transports.
101
+ - **GET `/api/logs/:runId`**: Get logs by run ID.
102
+
103
+ ### Vector Routes
104
+ - **POST `/api/vector/:vectorName/upsert`**: Upsert vectors into an index.
105
+ - **POST `/api/vector/:vectorName/create-index`**: Create a new vector index.
106
+ - **POST `/api/vector/:vectorName/query`**: Query vectors from an index.
107
+ - **GET `/api/vector/:vectorName/indexes`**: List all indexes for a vector store.
108
+ - **GET `/api/vector/:vectorName/indexes/:indexName`**: Get details about a specific index.
109
+ - **DELETE `/api/vector/:vectorName/indexes/:indexName`**: Delete a specific index.
110
+
111
+ ### OpenAPI Specification
112
+
113
+ - **GET `/openapi.json`**: Returns an auto-generated OpenAPI specification for your project's routes.
114
+ - **GET `/swagger-ui`**: Access Swagger UI for API documentation.
115
+
116
+ ## Additional Notes
117
+
118
+ The port defaults to 4111.
119
+
120
+ Make sure you have your environment variables set up in your `.env.development` or `.env` file for any providers you use (e.g., `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.).
121
+
122
+ ### Example request
123
+
124
+ To test an agent after running `mastra dev`:
125
+
126
+ ```bash
127
+ curl -X POST http://localhost:4111/api/agents/myAgent/generate \
128
+ -H "Content-Type: application/json" \
129
+ -d '{
130
+ "messages": [
131
+ { "role": "user", "content": "Hello, how can you assist me today?" }
132
+ ]
133
+ }'
134
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: "`mastra init` reference | Project Creation | Mastra CLI"
3
+ description: Documentation for the mastra init command, which creates a new Mastra project with interactive setup options.
4
+ ---
5
+
6
+ # `mastra init` Reference
7
+
8
+ ## `mastra init`
9
+
10
+ This creates a new Mastra project. You can run it in three different ways:
11
+
12
+ 1. **Interactive Mode (Recommended)**
13
+ Run without flags to use the interactive prompt, which will guide you through:
14
+
15
+ - Choosing a directory for Mastra files
16
+ - Selecting components to install (Agents, Tools, Workflows)
17
+ - Choosing a default LLM provider (OpenAI, Anthropic, or Groq)
18
+ - Deciding whether to include example code
19
+
20
+ 2. **Quick Start with Defaults**
21
+
22
+ ```bash
23
+ mastra init --default
24
+ ```
25
+
26
+ This sets up a project with:
27
+
28
+ - Source directory: `src/`
29
+ - All components: agents, tools, workflows
30
+ - OpenAI as the default provider
31
+ - No example code
32
+
33
+ 3. **Custom Setup**
34
+ ```bash
35
+ mastra init --dir src/mastra --components agents,tools --llm openai --example
36
+ ```
37
+ Options:
38
+ - `-d, --dir`: Directory for Mastra files (defaults to src/mastra)
39
+ - `-c, --components`: Comma-separated list of components (agents, tools, workflows)
40
+ - `-l, --llm`: Default model provider (openai, anthropic, or groq)
41
+ - `-k, --llm-api-key`: API key for the selected LLM provider (will be added to .env file)
42
+ - `-e, --example`: Include example code
43
+ - `-ne, --no-example`: Skip example code
@@ -0,0 +1,107 @@
1
+ # Agents API
2
+
3
+ The Agents API provides methods to interact with Mastra AI agents, including generating responses, streaming interactions, and managing agent tools.
4
+
5
+ ## Getting All Agents
6
+
7
+ Retrieve a list of all available agents:
8
+
9
+ ```typescript
10
+ const agents = await client.getAgents();
11
+ ```
12
+
13
+ ## Working with a Specific Agent
14
+
15
+ Get an instance of a specific agent:
16
+
17
+ ```typescript
18
+ const agent = client.getAgent("agent-id");
19
+ ```
20
+
21
+ ## Agent Methods
22
+
23
+ ### Get Agent Details
24
+
25
+ Retrieve detailed information about an agent:
26
+
27
+ ```typescript
28
+ const details = await agent.details();
29
+ ```
30
+
31
+ ### Generate Response
32
+
33
+ Generate a response from the agent:
34
+
35
+ ```typescript
36
+ const response = await agent.generate({
37
+ messages: [
38
+ {
39
+ role: "user",
40
+ content: "Hello, how are you?",
41
+ },
42
+ ],
43
+ threadId: "thread-1", // Optional: Thread ID for conversation context
44
+ resourceid: "resource-1", // Optional: Resource ID
45
+ output: {}, // Optional: Output configuration
46
+ });
47
+ ```
48
+
49
+ ### Stream Response
50
+
51
+ Stream responses from the agent for real-time interactions:
52
+
53
+
54
+ ```typescript
55
+ const response = await agent.stream({
56
+ messages: [
57
+ {
58
+ role: "user",
59
+ content: "Tell me a story",
60
+ },
61
+ ],
62
+ });
63
+
64
+ // Process data stream with the processDataStream util
65
+ response.processDataStream({
66
+ onTextPart: (text) => {
67
+ process.stdout.write(text);
68
+ },
69
+ onFilePart: (file) => {
70
+ console.log(file);
71
+ },
72
+ onDataPart: (data) => {
73
+ console.log(data);
74
+ },
75
+ onErrorPart: (error) => {
76
+ console.error(error);
77
+ },
78
+ });
79
+
80
+ // You can also read from response body directly
81
+ const reader = response.body.getReader();
82
+ while (true) {
83
+ const { done, value } = await reader.read();
84
+ if (done) break;
85
+ console.log(new TextDecoder().decode(value));
86
+ }
87
+ ```
88
+
89
+ ### Get Agent Tool
90
+
91
+ Retrieve information about a specific tool available to the agent:
92
+
93
+ ```typescript
94
+ const tool = await agent.getTool("tool-id");
95
+ ```
96
+
97
+ ### Get Agent Evaluations
98
+
99
+ Get evaluation results for the agent:
100
+
101
+ ```typescript
102
+ // Get CI evaluations
103
+ const evals = await agent.evals();
104
+
105
+ // Get live evaluations
106
+ const liveEvals = await agent.liveEvals();
107
+ ```