@mastra/mcp-docs-server 0.13.17-alpha.1 → 0.13.17-alpha.3

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.
@@ -0,0 +1,12 @@
1
+ # @mastra/agent-builder
2
+
3
+ ## 0.0.1-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7135](https://github.com/mastra-ai/mastra/pull/7135) [`48b9e55`](https://github.com/mastra-ai/mastra/commit/48b9e553a39528dcc20fbbeb798c3b1a1961468e) Thanks [@NikAiyer](https://github.com/NikAiyer)! - Add Agent Builder package with template installation workflow
8
+
9
+ Introduces a new package for programmatically building and managing Mastra agents with intelligent template merging capabilities. Features include automated dependency resolution, file conflict handling, and validation fixes.
10
+
11
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
12
+ - @mastra/core@0.15.3-alpha.3
@@ -1,5 +1,19 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.11.3-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
8
+ - @mastra/core@0.15.3-alpha.3
9
+
10
+ ## 0.11.3-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`822c2e8`](https://github.com/mastra-ai/mastra/commit/822c2e88a3ecbffb7c680e6227976006ccefe6a8)]:
15
+ - @mastra/core@0.15.3-alpha.2
16
+
3
17
  ## 0.11.3-alpha.1
4
18
 
5
19
  ### Patch Changes
@@ -285,18 +299,4 @@
285
299
 
286
300
  ### Patch Changes
287
301
 
288
- - Updated dependencies [8388649]
289
- - Updated dependencies [dd94a26]
290
- - Updated dependencies [3ba6772]
291
- - Updated dependencies [2fff911]
292
- - @mastra/core@0.13.2-alpha.0
293
-
294
- ## 0.10.20
295
-
296
- ### Patch Changes
297
-
298
- - Updated dependencies [cd0042e]
299
- - @mastra/core@0.13.1
300
-
301
-
302
- ... 2219 more lines hidden. See full changelog in package directory.
302
+ ... 2233 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,25 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 0.15.3-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7203](https://github.com/mastra-ai/mastra/pull/7203) [`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48) Thanks [@epinzur](https://github.com/epinzur)! - Fixed wrapping of models with AI Tracing when used with structured output.
8
+
9
+ - [#7127](https://github.com/mastra-ai/mastra/pull/7127) [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb) Thanks [@abhiaiyer91](https://github.com/abhiaiyer91)! - Support file download
10
+
11
+ - [#7216](https://github.com/mastra-ai/mastra/pull/7216) [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b) Thanks [@DanielSLew](https://github.com/DanielSLew)! - Fix tool validation when schema uses context or inputData reserved keys
12
+
13
+ - [#7090](https://github.com/mastra-ai/mastra/pull/7090) [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe) Thanks [@K-Mistele](https://github.com/K-Mistele)! - Support Inngest flow control features for Mastra Inngest workflows
14
+
15
+ - [#7217](https://github.com/mastra-ai/mastra/pull/7217) [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8) Thanks [@abhiaiyer91](https://github.com/abhiaiyer91)! - Pass provider options
16
+
17
+ ## 0.15.3-alpha.2
18
+
19
+ ### Patch Changes
20
+
21
+ - [#7129](https://github.com/mastra-ai/mastra/pull/7129) [`822c2e8`](https://github.com/mastra-ai/mastra/commit/822c2e88a3ecbffb7c680e6227976006ccefe6a8) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix custom output (tool-output) in ai-sdk stream output
22
+
3
23
  ## 0.15.3-alpha.1
4
24
 
5
25
  ### Patch Changes
@@ -278,25 +298,5 @@
278
298
  - 121a3f8: Fixed an issue where telemetry logs were displaying promise statuses when `agent.stream` is called
279
299
  - ec510e7: Tool input validation now returns errors as tool results instead of throwing, allowing agents to understand validation failures and retry with corrected parameters.
280
300
  - Updated dependencies [dd94a26]
281
- - Updated dependencies [2fff911]
282
- - Updated dependencies [ae2eb63]
283
- - @mastra/schema-compat@0.10.7
284
-
285
- ## 0.13.2-alpha.3
286
-
287
- ### Patch Changes
288
-
289
- - b5cf2a3: make system message always available during agent calls
290
-
291
- ## 0.13.2-alpha.2
292
-
293
- ### Patch Changes
294
-
295
- - d5330bf: Allow agent model to be updated after the agent is created
296
- - a239d41: Updated A2A syntax to v0.3.0
297
- - b32c50d: Filter scores by source
298
- - 121a3f8: Fixed an issue where telemetry logs were displaying promise statuses when `agent.stream` is called
299
- - ec510e7: Tool input validation now returns errors as tool results instead of throwing, allowing agents to understand validation failures and retry with corrected parameters.
300
- - Updated dependencies [ae2eb63]
301
301
 
302
- ... 2826 more lines hidden. See full changelog in package directory.
302
+ ... 2846 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,21 @@
1
1
  # @mastra/deployer-cloud
2
2
 
3
+ ## 0.15.3-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`71b657b`](https://github.com/mastra-ai/mastra/commit/71b657bffebbdcfdf1ce9c6d72003041bd6e200a), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`6d98856`](https://github.com/mastra-ai/mastra/commit/6d98856ed7cf56cbd6c4e02b3254e3dfb1e455db), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
8
+ - @mastra/core@0.15.3-alpha.3
9
+ - @mastra/deployer@0.15.3-alpha.3
10
+
11
+ ## 0.15.3-alpha.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`822c2e8`](https://github.com/mastra-ai/mastra/commit/822c2e88a3ecbffb7c680e6227976006ccefe6a8)]:
16
+ - @mastra/core@0.15.3-alpha.2
17
+ - @mastra/deployer@0.15.3-alpha.2
18
+
3
19
  ## 0.15.3-alpha.1
4
20
 
5
21
  ### Patch Changes
@@ -1,5 +1,25 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.15.3-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7207](https://github.com/mastra-ai/mastra/pull/7207) [`71b657b`](https://github.com/mastra-ai/mastra/commit/71b657bffebbdcfdf1ce9c6d72003041bd6e200a) Thanks [@TheIsrael1](https://github.com/TheIsrael1)! - Excluding hono from being external
8
+
9
+ - [#7215](https://github.com/mastra-ai/mastra/pull/7215) [`6d98856`](https://github.com/mastra-ai/mastra/commit/6d98856ed7cf56cbd6c4e02b3254e3dfb1e455db) Thanks [@YujohnNattrass](https://github.com/YujohnNattrass)! - Correct set the root span for telemetry traces
10
+
11
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
12
+ - @mastra/core@0.15.3-alpha.3
13
+ - @mastra/server@0.15.3-alpha.3
14
+
15
+ ## 0.15.3-alpha.2
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`822c2e8`](https://github.com/mastra-ai/mastra/commit/822c2e88a3ecbffb7c680e6227976006ccefe6a8)]:
20
+ - @mastra/core@0.15.3-alpha.2
21
+ - @mastra/server@0.15.3-alpha.2
22
+
3
23
  ## 0.15.3-alpha.1
4
24
 
5
25
  ### Patch Changes
@@ -278,25 +298,5 @@
278
298
  - Updated dependencies [fd3a3eb]
279
299
  - Updated dependencies [a8f129d]
280
300
  - @mastra/core@0.14.0-alpha.3
281
- - @mastra/server@0.14.0-alpha.3
282
-
283
- ## 0.14.0-alpha.2
284
-
285
- ### Patch Changes
286
-
287
- - 022f3a2: Fix a bug for transpilePackages usage where sibling files inside transpiled packages didn't resolve correctly
288
- - @mastra/core@0.14.0-alpha.2
289
- - @mastra/server@0.14.0-alpha.2
290
-
291
- ## 0.14.0-alpha.1
292
-
293
- ### Patch Changes
294
-
295
- - bca2ba3: Fix issue where `.json` files couldn't be imported and used with deployers
296
- - 6313063: Implement model switcher in playground
297
- - 6dfc4a6: In a previous release analysis of the Mastra configuration was added. A bug was fixed to properly support TypeScript.
298
- - Updated dependencies [6faaee5]
299
- - Updated dependencies [4232b14]
300
- - Updated dependencies [6313063]
301
301
 
302
- ... 3686 more lines hidden. See full changelog in package directory.
302
+ ... 3706 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,14 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 0.13.8-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7200](https://github.com/mastra-ai/mastra/pull/7200) [`dbc51ef`](https://github.com/mastra-ai/mastra/commit/dbc51ef2e42604117ab90917fc284a560647a61f) Thanks [@epinzur](https://github.com/epinzur)! - Fixed dependency issue with new AI_SPAN schema
8
+
9
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
10
+ - @mastra/core@0.15.3-alpha.3
11
+
3
12
  ## 0.13.7
4
13
 
5
14
  ### Patch Changes
@@ -289,14 +298,5 @@
289
298
  - Array of message IDs: `deleteMessages(['msg-1', 'msg-2'])`
290
299
  - Message object with id property: `deleteMessages({ id: 'msg-123' })`
291
300
  - Array of message objects: `deleteMessages([{ id: 'msg-1' }, { id: 'msg-2' }])`
292
- - Implemented in all storage adapters (LibSQL, PostgreSQL, Upstash, InMemory)
293
- - Added REST API endpoint: `POST /api/memory/messages/delete`
294
- - Updated client SDK: `thread.deleteMessages()` accepts all input types
295
- - Updates thread timestamps when messages are deleted
296
- - Added comprehensive test coverage and documentation
297
-
298
- - Updated dependencies [27cc97a]
299
- - Updated dependencies [41daa63]
300
- - Updated dependencies [254a36b]
301
301
 
302
- ... 694 more lines hidden. See full changelog in package directory.
302
+ ... 703 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 0.13.17-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
8
+ - @mastra/core@0.15.3-alpha.3
9
+
10
+ ## 0.13.17-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`822c2e8`](https://github.com/mastra-ai/mastra/commit/822c2e88a3ecbffb7c680e6227976006ccefe6a8)]:
15
+ - @mastra/core@0.15.3-alpha.2
16
+
3
17
  ## 0.13.17-alpha.1
4
18
 
5
19
  ### Patch Changes
@@ -284,19 +298,5 @@
284
298
  - Updated dependencies [cd0042e]
285
299
  - @mastra/core@0.13.1-alpha.0
286
300
 
287
- ## 0.13.9
288
-
289
- ### Patch Changes
290
301
 
291
- - Updated dependencies [cb36de0]
292
- - Updated dependencies [d0496e6]
293
- - Updated dependencies [a82b851]
294
- - Updated dependencies [ea0c5f2]
295
- - Updated dependencies [41a0a0e]
296
- - Updated dependencies [2871020]
297
- - Updated dependencies [9e792ef]
298
- - Updated dependencies [94f4812]
299
- - Updated dependencies [e202b82]
300
- - Updated dependencies [e00f6a0]
301
-
302
- ... 1474 more lines hidden. See full changelog in package directory.
302
+ ... 1488 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,15 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 5.2.5-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7210](https://github.com/mastra-ai/mastra/pull/7210) [`87de958`](https://github.com/mastra-ai/mastra/commit/87de95832a7bdfa9ecb14473c84dc874331f1a7d) Thanks [@mfrachet](https://github.com/mfrachet)! - fix chat outline
8
+
9
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
10
+ - @mastra/core@0.15.3-alpha.3
11
+ - @mastra/client-js@0.11.3-alpha.3
12
+
3
13
  ## 5.2.5-alpha.0
4
14
 
5
15
  ### Patch Changes
@@ -288,15 +298,5 @@
288
298
 
289
299
  - 0ebfe8a: dependencies updates:
290
300
  - Updated dependency [`motion@^12.23.12` ↗︎](https://www.npmjs.com/package/motion/v/12.23.12) (from `^12.23.9`, in `dependencies`)
291
- - f5853be: Added a preview button that opens a modal, rendering the markdown in the working memory text area
292
- - ea0c5f2: Update to support new scorer api
293
- - Updated dependencies [cb36de0]
294
- - Updated dependencies [d0496e6]
295
- - Updated dependencies [a82b851]
296
- - Updated dependencies [ea0c5f2]
297
- - Updated dependencies [41a0a0e]
298
- - Updated dependencies [2871020]
299
- - Updated dependencies [42dfc48]
300
- - Updated dependencies [94f4812]
301
-
302
- ... 2647 more lines hidden. See full changelog in package directory.
301
+
302
+ ... 2657 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,19 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 0.15.3-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
8
+ - @mastra/core@0.15.3-alpha.3
9
+
10
+ ## 0.15.3-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`822c2e8`](https://github.com/mastra-ai/mastra/commit/822c2e88a3ecbffb7c680e6227976006ccefe6a8)]:
15
+ - @mastra/core@0.15.3-alpha.2
16
+
3
17
  ## 0.15.3-alpha.1
4
18
 
5
19
  ### Patch Changes
@@ -284,19 +298,5 @@
284
298
  - Updated dependencies [d5330bf]
285
299
  - Updated dependencies [a239d41]
286
300
  - Updated dependencies [b32c50d]
287
- - Updated dependencies [121a3f8]
288
- - Updated dependencies [ec510e7]
289
- - @mastra/core@0.13.2-alpha.2
290
-
291
- ## 0.13.2-alpha.1
292
-
293
- ### Patch Changes
294
-
295
- - Updated dependencies [2e74797]
296
- - Updated dependencies [63449d0]
297
- - @mastra/core@0.13.2-alpha.1
298
-
299
- ## 0.13.2-alpha.0
300
-
301
301
 
302
- ... 3030 more lines hidden. See full changelog in package directory.
302
+ ... 3044 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,11 @@
1
1
  # create-mastra
2
2
 
3
+ ## 0.11.3-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7210](https://github.com/mastra-ai/mastra/pull/7210) [`87de958`](https://github.com/mastra-ai/mastra/commit/87de95832a7bdfa9ecb14473c84dc874331f1a7d) Thanks [@mfrachet](https://github.com/mfrachet)! - fix chat outline
8
+
3
9
  ## 0.11.3-alpha.0
4
10
 
5
11
  ### Patch Changes
@@ -292,11 +298,5 @@
292
298
 
293
299
  ## 0.10.10-alpha.1
294
300
 
295
- ### Patch Changes
296
-
297
- - a7a836a: Highlight send event button
298
-
299
- ## 0.10.10-alpha.0
300
-
301
301
 
302
- ... 1274 more lines hidden. See full changelog in package directory.
302
+ ... 1280 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,17 @@
1
1
  # mastra
2
2
 
3
+ ## 0.11.3-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7090](https://github.com/mastra-ai/mastra/pull/7090) [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe) Thanks [@K-Mistele](https://github.com/K-Mistele)! - Support Inngest flow control features for Mastra Inngest workflows
8
+
9
+ - [#7210](https://github.com/mastra-ai/mastra/pull/7210) [`87de958`](https://github.com/mastra-ai/mastra/commit/87de95832a7bdfa9ecb14473c84dc874331f1a7d) Thanks [@mfrachet](https://github.com/mfrachet)! - fix chat outline
10
+
11
+ - Updated dependencies [[`aedbbfa`](https://github.com/mastra-ai/mastra/commit/aedbbfa064124ddde039111f12629daebfea7e48), [`71b657b`](https://github.com/mastra-ai/mastra/commit/71b657bffebbdcfdf1ce9c6d72003041bd6e200a), [`f643c65`](https://github.com/mastra-ai/mastra/commit/f643c651bdaf57c2343cf9dbfc499010495701fb), [`fef7375`](https://github.com/mastra-ai/mastra/commit/fef737534574f41b432a7361a285f776c3bac42b), [`6d98856`](https://github.com/mastra-ai/mastra/commit/6d98856ed7cf56cbd6c4e02b3254e3dfb1e455db), [`e3d8fea`](https://github.com/mastra-ai/mastra/commit/e3d8feaacfb8b5c5c03c13604cc06ea2873d45fe), [`3412597`](https://github.com/mastra-ai/mastra/commit/3412597a6644c0b6bf3236d6e319ed1450c5bae8)]:
12
+ - @mastra/core@0.15.3-alpha.3
13
+ - @mastra/deployer@0.15.3-alpha.3
14
+
3
15
  ## 0.11.3-alpha.0
4
16
 
5
17
  ### Patch Changes
@@ -286,17 +298,5 @@
286
298
 
287
299
  - 63449d0: Change the globbing of tools to exclude test files. Files inside `__tests__` directory and files with `.test.` or `.spec.` in their file name are now excluded from bundling.
288
300
  - 77b6cfe: Use just modelId for gpt-5 check
289
- - 96169cc: Create handler that returns providers user has keys for in their env
290
- - 33da97c: Set temperature to 1 for gpt-5 model in playground
291
- - c6d2603: Properly set baseUrl in playground when user sets the host or port in Mastra instance.
292
- - 7aad750: Fix tool ui showing after message when chat is refreshed
293
- - ce04175: Add update agent model handler
294
- - Updated dependencies [d5330bf]
295
- - Updated dependencies [aaf0224]
296
- - Updated dependencies [2e74797]
297
- - Updated dependencies [42cb4e9]
298
- - Updated dependencies [8388649]
299
- - Updated dependencies [a239d41]
300
- - Updated dependencies [dd94a26]
301
-
302
- ... 5162 more lines hidden. See full changelog in package directory.
301
+
302
+ ... 5174 more lines hidden. See full changelog in package directory.
@@ -3,13 +3,11 @@ title: "Reference: Agent.streamVNext() (Experimental) | Agents | Mastra Docs"
3
3
  description: "Documentation for the `Agent.streamVNext()` method in Mastra agents, which enables real-time streaming of responses with enhanced capabilities."
4
4
  ---
5
5
 
6
- import { Callout } from "nextra/components";
6
+ import { StreamVNextCallout } from "@/components/streamVNext-callout.tsx"
7
7
 
8
8
  # Agent.streamVNext() (Experimental)
9
9
 
10
- <Callout type="warning">
11
- **Experimental Feature**: This is a new streaming implementation with support for multiple output formats, including AI SDK v5 compatibility. It will replace the existing `stream()` method once battle-tested. The API may change as we refine the feature based on feedback.
12
- </Callout>
10
+ <StreamVNextCallout />
13
11
 
14
12
  The `.streamVNext()` 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.
15
13
 
@@ -3,13 +3,11 @@ title: "Reference: Run.streamVNext() | Workflows | Mastra Docs"
3
3
  description: Documentation for the `Run.streamVNext()` method in workflows, which enables real-time streaming of responses.
4
4
  ---
5
5
 
6
- import { Callout } from "nextra/components";
6
+ import { StreamVNextCallout } from "@/components/streamVNext-callout.tsx"
7
7
 
8
- # Run.streamVNext()
8
+ # Run.streamVNext() (Experimental)
9
9
 
10
- <Callout type="warning">
11
- **Experimental Feature**: This is a new streaming implementation that will replace the existing `stream()` method once battle-tested. The API may change as we refine the feature based on feedback.
12
- </Callout>
10
+ <StreamVNextCallout />
13
11
 
14
12
  The `.streamVNext()` method enables real-time streaming of responses from a workflow. This enhanced streaming capability will eventually replace the current `stream()` method.
15
13
 
@@ -0,0 +1,115 @@
1
+ ---
2
+ title: "Streaming Events | Streaming | Mastra"
3
+ description: "Learn about the different types of streaming events in Mastra, including text deltas, tool calls, step events, and how to handle them in your applications."
4
+ ---
5
+
6
+ # Streaming Events
7
+
8
+ Streaming from agents or workflows provides real-time visibility into either the LLM’s output or the status of a workflow run. This feedback can be passed directly to the user, or used within applications to handle workflow status more effectively, creating a smoother and more responsive experience.
9
+
10
+ Events emitted from agents or workflows represent different stages of generation and execution, such as when a run starts, when text is produced, or when a tool is invoked.
11
+
12
+ ## Event types
13
+
14
+ Below is a complete list of events emitted from `.streamVNext()`.
15
+ Depending on whether you’re streaming from an **agent** or a **workflow**, only a subset of these events will occur:
16
+
17
+ - **start**: Marks the beginning of an agent or workflow run.
18
+ - **step-start**: Indicates a workflow step has begun execution.
19
+ - **text-delta**: Incremental text chunks as they're generated by the LLM.
20
+ - **tool-call**: When the agent decides to use a tool, including the tool name and arguments.
21
+ - **tool-result**: The result returned from tool execution.
22
+ - **step-finish**: Confirms that a specific step has fully finalized, and may include metadata like the finish reason for that step.
23
+ - **finish**: When the agent or workflow completes, including usage statistics.
24
+
25
+ ## Inspecting agent streams
26
+
27
+ Iterate over the `stream` with a `for await` loop to inspect all emitted event chunks.
28
+
29
+ ```typescript {3,7} showLineNumbers copy
30
+ const testAgent = mastra.getAgent("testAgent");
31
+
32
+ const stream = await testAgent.streamVNext([
33
+ { role: "user", content: "Help me organize my day" },
34
+ ]);
35
+
36
+ for await (const chunk of stream) {
37
+ console.log(chunk);
38
+ }
39
+ ```
40
+
41
+ > See [Agent.streamVNext()](../../reference/agents/streamVNext.mdx) for more information.
42
+
43
+ ### Example agent output
44
+
45
+ Below is an example of events that may be emitted. Each event always includes a `type` and can include additional fields like `from` and `payload`.
46
+
47
+ ```typescript {2,7,15}
48
+ {
49
+ type: 'start',
50
+ from: 'AGENT',
51
+ // ..
52
+ }
53
+ {
54
+ type: 'step-start',
55
+ from: 'AGENT',
56
+ payload: {
57
+ messageId: 'msg-cdUrkirvXw8A6oE4t5lzDuxi',
58
+ // ...
59
+ }
60
+ }
61
+ {
62
+ type: 'tool-call',
63
+ from: 'AGENT',
64
+ payload: {
65
+ toolCallId: 'call_jbhi3s1qvR6Aqt9axCfTBMsA',
66
+ toolName: 'testTool'
67
+ // ..
68
+ }
69
+ }
70
+ ```
71
+
72
+ ## Inspecting workflow streams
73
+
74
+ Iterate over the `stream` with a `for await` loop to inspect all emitted event chunks.
75
+
76
+ ```typescript {5,11} showLineNumbers copy
77
+ const testWorkflow = mastra.getWorkflow("testWorkflow");
78
+
79
+ const run = await testWorkflow.createRunAsync();
80
+
81
+ const stream = await run.streamVNext({
82
+ inputData: {
83
+ value: "initial data"
84
+ }
85
+ });
86
+
87
+ for await (const chunk of stream) {
88
+ console.log(chunk);
89
+ }
90
+ ```
91
+
92
+ ### Example workflow output
93
+
94
+ Below is an example of events that may be emitted. Each event always includes a `type` and can include additional fields like `from` and `payload`.
95
+
96
+ ```typescript {2,8,11}
97
+ {
98
+ type: 'start',
99
+ runId: '221333ed-d9ee-4737-922b-4ab4d9de73e6',
100
+ from: 'WORKFLOW',
101
+ // ...
102
+ }
103
+ {
104
+ type: 'step-start',
105
+ runId: '221333ed-d9ee-4737-922b-4ab4d9de73e6',
106
+ from: 'WORKFLOW',
107
+ payload: {
108
+ stepName: 'step-1',
109
+ args: { value: 'initial data' },
110
+ stepCallId: '9e8c5217-490b-4fe7-8c31-6e2353a3fc98',
111
+ startedAt: 1755269732792,
112
+ status: 'running'
113
+ }
114
+ }
115
+ ```
@@ -0,0 +1,137 @@
1
+ ---
2
+ title: "Streaming Overview | Streaming | Mastra"
3
+ description: "Streaming in Mastra enables real-time, incremental responses from both agents and workflows, providing immediate feedback as AI-generated content is produced."
4
+ ---
5
+
6
+ import { StreamVNextCallout } from "@/components/streamVNext-callout.tsx"
7
+
8
+ # Streaming Overview
9
+
10
+ <StreamVNextCallout />
11
+
12
+ Mastra supports real-time, incremental responses from agents and workflows, allowing users to see output as it’s generated instead of waiting for completion. This is useful for chat, long-form content, multi-step workflows, or any scenario where immediate feedback matters.
13
+
14
+ ## Getting started
15
+
16
+ Mastra currently supports two streaming methods, this page explains how to use `streamVNext()`.
17
+
18
+ 1. **`.stream()`**: Current stable API, supports **AI SDK v1**.
19
+ 2. **`.streamVNext()`**: Experimental API, supports **AI SDK v2**.
20
+
21
+ ## Streaming with agents
22
+
23
+ You can pass a single string for simple prompts, an array of strings when providing multiple pieces of context, or an array of message objects with `role` and `content` for precise control over roles and conversational flows.
24
+
25
+ ### Using `Agent.streamVNext()`
26
+
27
+ A `textStream` breaks the response into chunks as it's generated, allowing output to stream progressively instead of arriving all at once. Iterate over the `textStream` using a `for await` loop to inspect each stream chunk.
28
+
29
+ ```typescript {3,7} showLineNumbers copy
30
+ const testAgent = mastra.getAgent("testAgent");
31
+
32
+ const stream = await testAgent.streamVNext([
33
+ { role: "user", content: "Help me organize my day" },
34
+ ]);
35
+
36
+ for await (const chunk of stream.textStream) {
37
+ process.stdout.write(chunk);
38
+ }
39
+ ```
40
+
41
+ > See [Agent.streamVNext()](../../reference/agents/streamVNext.mdx) for more information.
42
+
43
+ ### Output from `Agent.streamVNext()`
44
+
45
+ The output streams the generated response from the agent.
46
+
47
+ ```text
48
+ Of course!
49
+ To help you organize your day effectively, I need a bit more information.
50
+ Here are some questions to consider:
51
+ ...
52
+ ```
53
+
54
+ ## Agent stream properties
55
+
56
+ An agent stream provides access to various response properties:
57
+
58
+ - **`stream.textStream`**: A readable stream that emits text chunks.
59
+ - **`stream.text`**: Promise that resolves to the full text response.
60
+ - **`stream.finishReason`**: The reason the agent stopped streaming.
61
+ - **`stream.usage`**: Token usage information.
62
+
63
+
64
+ ### AI SDK v5 Compatibility
65
+
66
+ For integration with AI SDK v5, use `format` 'aisdk' to get an `AISDKV5OutputStream`:
67
+
68
+ ```typescript {5} showLineNumbers copy
69
+ const testAgent = mastra.getAgent("testAgent");
70
+
71
+ const stream = await testAgent.streamVNext(
72
+ [{ role: "user", content: "Help me organize my day" }],
73
+ { format: "aisdk" }
74
+ );
75
+
76
+ for await (const chunk of stream.textStream) {
77
+ process.stdout.write(chunk);
78
+ }
79
+ ```
80
+
81
+ ## Streaming with workflows
82
+
83
+ Streaming from a workflow returns a sequence of structured events describing the run lifecycle, rather than incremental text chunks. This event-based format makes it possible to track and respond to workflow progress in real time once a run is created using `.createRunAsync()`.
84
+
85
+ ### Using `Run.streamVNext()`
86
+
87
+ This is the experimental API. It returns a `ReadableStream` of events directly.
88
+
89
+ ```typescript {3,9} showLineNumbers copy
90
+ const run = await testWorkflow.createRunAsync();
91
+
92
+ const stream = await run.streamVNext({
93
+ inputData: {
94
+ value: "initial data"
95
+ }
96
+ });
97
+
98
+ for await (const chunk of stream) {
99
+ console.log(chunk);
100
+ }
101
+ ```
102
+
103
+ > See [Run.streamVNext()](../../reference/workflows/run-methods/streamVNext.mdx) for more information.
104
+
105
+ ### Output from `Run.streamVNext()`
106
+
107
+ The experimental API event structure includes `runId` and `from` at the top level, making it easier to identify and track workflow runs without digging into the payload.
108
+
109
+ ```typescript
110
+ // ...
111
+ {
112
+ type: 'step-start',
113
+ runId: '1eeaf01a-d2bf-4e3f-8d1b-027795ccd3df',
114
+ from: 'WORKFLOW',
115
+ payload: {
116
+ stepName: 'step-1',
117
+ args: { value: 'initial data' },
118
+ stepCallId: '8e15e618-be0e-4215-a5d6-08e58c152068',
119
+ startedAt: 1755121710066,
120
+ status: 'running'
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## Workflow stream properties
126
+
127
+ A workflow stream provides access to various response properties:
128
+
129
+ - **`stream.status`**: The status of the workflow run.
130
+ - **`stream.result`**: The result of the workflow run.
131
+ - **`stream.usage`**: The total token usage of the workflow run.
132
+
133
+ ## Related
134
+
135
+ - [Streaming events](./events.mdx)
136
+ - [Using Agents](../agents/overview.mdx)
137
+ - [Workflows overview](../workflows/overview.mdx)
@@ -0,0 +1,107 @@
1
+ ---
2
+ title: "Tool Streaming | Streaming | Mastra"
3
+ description: "Learn how to use tool streaming in Mastra, including handling tool calls, tool results, and tool execution events during streaming."
4
+ ---
5
+
6
+ # Tool streaming
7
+
8
+ Tool streaming in Mastra enables tools to send incremental results while they run, rather than waiting until execution finishes. This allows you to surface partial progress, intermediate states, or progressive data directly to users or upstream agents and workflows.
9
+
10
+ Streams can be written to in two main ways:
11
+
12
+ - **From within a tool**: every tool receives a `writer` argument, which is a writable stream you can use to push updates as execution progresses.
13
+ - **From an agent stream**: you can also pipe an agent’s `streamVNext` output directly into a tool’s writer, making it easy to chain agent responses into tool results without extra glue code.
14
+
15
+ By combining writable tool streams with agent streaming, you gain fine grained control over how intermediate results flow through your system and into the user experience.
16
+
17
+ ## Agent using tool
18
+
19
+ Agent streaming can be combined with tool calls, allowing tool outputs to be written directly into the agent’s streaming response. This makes it possible to surface tool activity as part of the overall interaction.
20
+
21
+ ```typescript {4,10} showLineNumbers copy
22
+ import { openai } from "@ai-sdk/openai";
23
+ import { Agent } from "@mastra/core/agent";
24
+
25
+ import { testTool } from "../tools/test-tool";
26
+
27
+ export const testAgent = new Agent({
28
+ name: "test-agent",
29
+ instructions: "You are a weather agent.",
30
+ model: openai("gpt-4o-mini"),
31
+ tools: { testTool }
32
+ });
33
+ ```
34
+
35
+ ### Using the `writer` argument
36
+
37
+ The `writer` argument is passed to a tool’s `execute` function and can be used to emit custom events, data, or values into the active stream. This enables tools to provide intermediate results or status updates while execution is still in progress.
38
+
39
+ ```typescript {5,8,15} showLineNumbers copy
40
+ import { createTool } from "@mastra/core/tools";
41
+
42
+ export const testTool = createTool({
43
+ // ...
44
+ execute: async ({ context, writer }) => {
45
+ const { value } = context;
46
+
47
+ writer?.write({
48
+ type: "custom-event",
49
+ status: "pending"
50
+ });
51
+
52
+ const response = await fetch(...);
53
+
54
+ writer?.write({
55
+ type: "custom-event",
56
+ status: "success"
57
+ });
58
+
59
+ return {
60
+ value: ""
61
+ };
62
+ }
63
+ });
64
+ ```
65
+
66
+ ### Inspecting stream payloads
67
+
68
+ Events written to the stream are included in the emitted chunks. These chunks can be inspected to access any custom fields, such as event types, intermediate values, or tool-specific data.
69
+
70
+ ```typescript showLineNumbers copy
71
+ const stream = await testAgent.streamVNext([
72
+ "What is the weather in London?",
73
+ "Use the testTool"
74
+ ]);
75
+
76
+ for await (const chunk of stream) {
77
+ if (chunk.payload.output?.type === "custom-event") {
78
+ console.log(JSON.stringify(chunk, null, 2));
79
+ }
80
+ }
81
+ ```
82
+
83
+ ## Tool using an agent
84
+
85
+ Pipe an agent’s `textStream` to the tool’s `writer`. This streams partial output, and Mastra automatically aggregates the agent’s usage into the tool run.
86
+
87
+ ```typescript showLineNumbers copy
88
+ import { createTool } from "@mastra/core/tools";
89
+ import { z } from "zod";
90
+
91
+ export const testTool = createTool({
92
+ // ...
93
+ execute: async ({ context, mastra, writer }) => {
94
+ const { city } = context;
95
+
96
+ const testAgent = mastra?.getAgent("testAgent");
97
+ const stream = await testAgent?.streamVNext(`What is the weather in ${city}?`);
98
+
99
+ await stream!.textStream.pipeTo(writer!);
100
+
101
+ return {
102
+ value: await stream!.text
103
+ };
104
+ }
105
+ });
106
+ ```
107
+
@@ -0,0 +1,91 @@
1
+ ---
2
+ title: "Workflow Streaming | Streaming | Mastra"
3
+ description: "Learn how to use workflow streaming in Mastra, including handling workflow execution events, step streaming, and workflow integration with agents and tools."
4
+ ---
5
+
6
+ # Workflow streaming
7
+
8
+ Workflow streaming in Mastra enables workflows to send incremental results while they execute, rather than waiting until completion. This allows you to surface partial progress, intermediate states, or progressive data directly to users or upstream agents and workflows.
9
+
10
+ Streams can be written to in two main ways:
11
+
12
+ - **From within a workflow step**: every workflow step receives a `writer` argument, which is a writable stream you can use to push updates as execution progresses.
13
+ - **From an agent stream**: you can also pipe an agent's `streamVNext` output directly into a workflow step's writer, making it easy to chain agent responses into workflow results without extra glue code.
14
+
15
+ By combining writable workflow streams with agent streaming, you gain fine-grained control over how intermediate results flow through your system and into the user experience.
16
+
17
+ ### Using the `writer` argument
18
+
19
+ The `writer` argument is passed to a workflow step's `execute` function and can be used to emit custom events, data, or values into the active stream. This enables workflow steps to provide intermediate results or status updates while execution is still in progress.
20
+
21
+ ```typescript {5,8,15} showLineNumbers copy
22
+ import { createStep } from "@mastra/core/workflows";
23
+
24
+ export const testStep = createStep({
25
+ // ...
26
+ execute: async ({ inputData, writer }) => {
27
+ const { value } = inputData;
28
+
29
+ writer?.write({
30
+ type: "custom-event",
31
+ status: "pending"
32
+ });
33
+
34
+ const response = await fetch(...);
35
+
36
+ writer?.write({
37
+ type: "custom-event",
38
+ status: "success"
39
+ });
40
+
41
+ return {
42
+ value: ""
43
+ };
44
+ },
45
+ });
46
+ ```
47
+
48
+ ### Inspecting workflow stream payloads
49
+
50
+ Events written to the stream are included in the emitted chunks. These chunks can be inspected to access any custom fields, such as event types, intermediate values, or step-specific data.
51
+
52
+ ```typescript showLineNumbers copy
53
+ const testWorkflow = mastra.getWorkflow("testWorkflow");
54
+
55
+ const run = await testWorkflow.createRunAsync();
56
+
57
+ const stream = await run.streamVNext({
58
+ inputData: {
59
+ value: "initial data"
60
+ }
61
+ });
62
+
63
+ for await (const chunk of stream) {
64
+ console.log(chunk);
65
+ }
66
+ ```
67
+
68
+ ## Workflow using an agent
69
+
70
+ Pipe an agent's `textStream` to the workflow step's `writer`. This streams partial output, and Mastra automatically aggregates the agent's usage into the workflow run.
71
+
72
+ ```typescript showLineNumbers copy
73
+ import { createStep } from "@mastra/core/workflows";
74
+ import { z } from "zod";
75
+
76
+ export const testStep = createStep({
77
+ // ...
78
+ execute: async ({ inputData, mastra, writer }) => {
79
+ const { city } = inputData
80
+
81
+ const testAgent = mastra?.getAgent("testAgent");
82
+ const stream = await testAgent?.streamVNext(`What is the weather in ${city}$?`);
83
+
84
+ await stream!.textStream.pipeTo(writer!);
85
+
86
+ return {
87
+ value: await stream!.text,
88
+ };
89
+ },
90
+ });
91
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.13.17-alpha.1",
3
+ "version": "0.13.17-alpha.3",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "uuid": "^11.1.0",
33
33
  "zod": "^3.25.67",
34
34
  "zod-to-json-schema": "^3.24.5",
35
- "@mastra/core": "0.15.3-alpha.1",
35
+ "@mastra/core": "0.15.3-alpha.3",
36
36
  "@mastra/mcp": "^0.11.3-alpha.0"
37
37
  },
38
38
  "devDependencies": {
@@ -48,8 +48,8 @@
48
48
  "tsx": "^4.19.4",
49
49
  "typescript": "^5.8.3",
50
50
  "vitest": "^3.2.4",
51
- "@internal/lint": "0.0.34",
52
- "@mastra/core": "0.15.3-alpha.1"
51
+ "@mastra/core": "0.15.3-alpha.3",
52
+ "@internal/lint": "0.0.34"
53
53
  },
54
54
  "scripts": {
55
55
  "prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",
@@ -1,154 +0,0 @@
1
- ---
2
- title: "Using Agent Streaming | Agents | Mastra Docs"
3
- description: Documentation on how to stream agents
4
- ---
5
-
6
- import { Callout } from "nextra/components";
7
-
8
- # Agent Streaming (VNext)
9
-
10
- Agents in Mastra support streaming responses for real-time interaction with clients. This enables progressive rendering of responses and better user experience.
11
-
12
- <Callout type="info">
13
- **Experimental API**: The `streamVNext` method shown in this guide is an experimental feature with enhanced streaming format support. It will replace the current `stream()` method after additional testing and refinement. For production use, consider using the stable [`stream()` method](/docs/agents/overview#streaming-responses) until `streamVNext` is finalized.
14
- </Callout>
15
-
16
- ## Usage
17
-
18
- The experimental streaming protocol uses the `streamVNext` method on an agent. This method now supports multiple output stream formats, for Mastra (default) and AI SDK v5.
19
-
20
-
21
- ## Format Parameter
22
-
23
- The `format` parameter determines the output stream type:
24
-
25
- - **`'mastra'` (default)**: Returns `MastraModelOutput` - Mastra's native streaming format
26
- - **`'aisdk'`**: Returns `AISDKV5OutputStream` - Compatible with AI SDK v5 interfaces like useChat.
27
-
28
- ```typescript
29
- // Mastra format (default)
30
- const mastraStream = await agent.streamVNext("Hello");
31
-
32
- // AI SDK v5 format
33
- const aiSdkStream = await agent.streamVNext("Hello", {
34
- format: 'aisdk'
35
- });
36
- ```
37
-
38
- ### Default Mastra Format
39
-
40
- By default, `streamVNext` returns a `MastraModelOutput` stream:
41
-
42
- ```typescript
43
- const stream = await agent.streamVNext("Tell me a story.");
44
-
45
- // Access the text stream
46
- for await (const chunk of stream.textStream) {
47
- console.log(chunk);
48
- }
49
-
50
- // Or get the full text after streaming
51
- const fullText = await stream.text;
52
- ```
53
-
54
- ### AI SDK v5 Compatibility
55
-
56
- For integration with AI SDK v5, use the `format: 'aisdk'` parameter to get an `AISDKV5OutputStream`:
57
-
58
- ```typescript
59
- const stream = await agent.streamVNext("Tell me a story.", {
60
- format: 'aisdk'
61
- });
62
-
63
- // The stream is now compatible with AI SDK v5 interfaces
64
- for await (const chunk of stream.fullStream) {
65
- // Process AI SDK v5 formatted chunks
66
- console.log(chunk);
67
- }
68
- ```
69
-
70
- ## Stream Properties
71
-
72
- Both stream formats provide access to various response properties:
73
-
74
- - `stream.textStream` - A readable stream that emits text chunks
75
- - `stream.text` - Promise that resolves to the full text response
76
- - `stream.finishReason` - The reason the agent stopped streaming
77
- - `stream.usage` - Token usage information
78
-
79
- ### How to use the stream in a tool
80
-
81
- Each tool gets a `writer` argument, which is a writable stream with a custom write function. This write function is used to write the tool's response to the stream.
82
-
83
- ```typescript filename="src/mastra/tools/test-tool.ts" showLineNumbers copy
84
- import { createTool } from "@mastra/core/tools";
85
- import { z } from "zod";
86
-
87
- export const weatherInfo = createTool({
88
- id: "Get Weather Information",
89
- inputSchema: z.object({
90
- city: z.string(),
91
- }),
92
- outputSchema: z.object({
93
- conditions: z.string(),
94
- temperature: z.number(),
95
- }),
96
- description: `Fetches the current weather information for a given city`,
97
- execute: async ({ context: { city }, writer }) => {
98
- writer.write({
99
- type: "weather-data",
100
- args: {
101
- city
102
- },
103
- status: "pending"
104
- })
105
- // Tool logic here (e.g., API call)
106
- console.log("Using tool to fetch weather information for", city);
107
-
108
- writer.write({
109
- type: "weather-data",
110
- args: {
111
- city
112
- },
113
- status: "success",
114
- result: {
115
- temperature: 20,
116
- conditions: "Sunny"
117
- }
118
- })
119
-
120
- return { temperature: 20, conditions: "Sunny" }; // Example return
121
- },
122
- });
123
- ```
124
-
125
- To use streaming within an agent-based tool, call `streamVNext` on the agent and pipe it to the writer:
126
-
127
- ```typescript filename="src/mastra/tools/test-tool.ts" showLineNumbers copy
128
- import { createTool } from "@mastra/core/tools";
129
- import { z } from "zod";
130
-
131
- export const weatherInfo = createTool({
132
- id: "Get Weather Information",
133
- description: `Fetches the current weather information for a given city`,
134
- inputSchema: z.object({
135
- city: z.string(),
136
- }),
137
- outputSchema: z.object({
138
- text: z.string(),
139
- }),
140
- execute: async ({ context: { city }, writer, mastra }) => {
141
- const agent = mastra.getAgent('weatherAgent')
142
- const stream = await agent.streamVNext(`What is the weather in ${city}?`);
143
-
144
- await stream.pipeTo(writer);
145
-
146
- return {
147
- text: await stream.text,
148
- }
149
- },
150
- });
151
- ```
152
-
153
- Piping the stream to the writer enables automatic aggregation of token usage across nested agent calls.
154
-
@@ -1,115 +0,0 @@
1
- ---
2
- title: "Using Workflow Streaming | Workflows | Mastra Docs"
3
- description: Documentation on how to stream workflows
4
- ---
5
-
6
- # Workflow Streaming
7
-
8
- Workflows in Mastra have access to a powerful streaming protocol! With seamless integration into tools or agents as a step, you can stream responses directly back to your clients, creating a more interactive and engaging experience.
9
-
10
- ## Usage
11
-
12
- To use the new protocol, you can use the `streamVNext` method on an workflow. This method will return a custom MatraWorkflowStream. This stream extends a ReadableStream, so all basic stream methods are available.
13
-
14
- ```typescript
15
- const run = await myWorkflow.createRunAsync();
16
- const stream = await run.streamVNext({ inputData: { city: 'New York' } });
17
-
18
- for await (const chunk of stream) {
19
- console.log(chunk);
20
- }
21
- ```
22
-
23
- Each chunk is a JSON object with the following properties:
24
-
25
- ```json
26
- {
27
- type: string;
28
- runId: string;
29
- from: string;
30
- payload: Record<string, any>;
31
- }
32
- ```
33
-
34
- We have a couple of utility functions on the stream to help you with the streaming process.
35
-
36
- - `stream.status` - The status of the workflow run.
37
- - `stream.result` - The result of the workflow run.
38
- - `stream.usage` - The total token usage of the workflow run.
39
-
40
- ### How to use the stream in a tool
41
-
42
- Each tool gets a `writer` argument, which is a writable stream with a custom write function. This write function is used to write the tool's response to the stream.
43
-
44
- ```typescript filename="src/mastra/workflows/weather.ts" showLineNumbers copy
45
- import { createStep } from "@mastra/core/workflows";
46
- import { z } from "zod";
47
-
48
- export const weatherInfo = createStep({
49
- id: "weather-info",
50
- inputSchema: z.object({
51
- city: z.string(),
52
- }),
53
- outputSchema: z.object({
54
- conditions: z.string(),
55
- temperature: z.number(),
56
- }),
57
- description: `Fetches the current weather information for a given city`,
58
- execute: async ({ inputData: { city }, writer }) => {
59
- writer.write({
60
- type: "weather-data",
61
- args: {
62
- city
63
- },
64
- status: "pending"
65
- })
66
- // Tool logic here (e.g., API call)
67
- console.log("Using tool to fetch weather information for", city);
68
-
69
- writer.write({
70
- type: "weather-data",
71
- args: {
72
- city
73
- },
74
- status: "success",
75
- result: {
76
- temperature: 20,
77
- conditions: "Sunny"
78
- }
79
- })
80
-
81
- return { temperature: 20, conditions: "Sunny" }; // Example return
82
- },
83
- });
84
- ```
85
-
86
- If you want to use the stream in an agent, you can use the `streamVNext` method on the agent and pipe it to the agent's input stream.
87
-
88
- ```typescript filename="src/mastra/workflows/weather.ts" showLineNumbers copy
89
- import { createStep } from "@mastra/core/workflows";
90
- import { z } from "zod";
91
-
92
- export const weatherInfo = createStep({
93
- id: "weather-info",
94
- inputSchema: z.object({
95
- city: z.string(),
96
- }),
97
- outputSchema: z.object({
98
- text: z.string(),
99
- }),
100
- description: `Fetches the current weather information for a given city`,
101
- execute: async ({ inputData: { city }, writer, mastra }) => {
102
- const agent = mastra.getAgent('weatherAgent')
103
- const stream = await agent.streamVNext(`What is the weather in ${city}?`);
104
-
105
- await stream.pipeTo(writer);
106
-
107
- return {
108
- text: await stream.text,
109
- }
110
- },
111
- });
112
- ```
113
-
114
- Piping the stream to the agent's input stream will allow us to automatically sum up the usage of the agent so the total usage count can be calculated.
115
-