@mastra/mcp-docs-server 0.13.28 → 0.13.29-alpha.1
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.
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +3 -1
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +9 -9
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +13 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +66 -66
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Freact.md +29 -0
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +30 -30
- package/.docs/organized/changelogs/create-mastra.md +32 -32
- package/.docs/organized/changelogs/mastra.md +63 -63
- package/.docs/organized/code-examples/heads-up-game.md +3 -3
- package/.docs/raw/agents/runtime-context.mdx +59 -89
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +5 -3
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +5 -3
- package/.docs/raw/server-db/middleware.mdx +27 -1
- package/.docs/raw/workflows/control-flow.mdx +54 -0
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
- package/.docs/raw/agents/dynamic-agents.mdx +0 -121
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# create-mastra
|
|
2
2
|
|
|
3
|
+
## 0.15.1-alpha.1
|
|
4
|
+
|
|
5
|
+
## 0.15.1-alpha.0
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- Improve the overall flow of the `create-mastra` CLI by first asking all questions and then creating the project structure. If you skip entering an API key during the wizard, the `your-api-key` placeholder will now be added to an `.env.example` file instead of `.env`. ([#8603](https://github.com/mastra-ai/mastra/pull/8603))
|
|
10
|
+
|
|
11
|
+
## 0.15.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Mutable shared workflow run state ([#8545](https://github.com/mastra-ai/mastra/pull/8545))
|
|
16
|
+
|
|
17
|
+
- streamLegacy/generateLegacy clarification in playground ([#8468](https://github.com/mastra-ai/mastra/pull/8468))
|
|
18
|
+
|
|
19
|
+
- avoid refetching memory threads and messages on window focus ([#8519](https://github.com/mastra-ai/mastra/pull/8519))
|
|
20
|
+
|
|
21
|
+
- add tripwire reason in playground ([#8568](https://github.com/mastra-ai/mastra/pull/8568))
|
|
22
|
+
|
|
23
|
+
- Save waiting step status in snapshot ([#8576](https://github.com/mastra-ai/mastra/pull/8576))
|
|
24
|
+
|
|
25
|
+
- Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai ([#8559](https://github.com/mastra-ai/mastra/pull/8559))
|
|
26
|
+
|
|
27
|
+
- Convert WorkflowWatchResult to WorkflowResult in workflow graph ([#8541](https://github.com/mastra-ai/mastra/pull/8541))
|
|
28
|
+
|
|
29
|
+
- Fixed an issue where model router was adding /chat/completions to API urls when it shouldn't. ([#8589](https://github.com/mastra-ai/mastra/pull/8589))
|
|
30
|
+
fixed an issue with provider ID rendering in playground UI
|
|
31
|
+
|
|
32
|
+
- Fix useStreamWorkflow unmounting breaking stream call ([#8449](https://github.com/mastra-ai/mastra/pull/8449))
|
|
33
|
+
|
|
3
34
|
## 0.15.0-alpha.3
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -267,36 +298,5 @@
|
|
|
267
298
|
|
|
268
299
|
## 0.12.3-alpha.1
|
|
269
300
|
|
|
270
|
-
### Patch Changes
|
|
271
|
-
|
|
272
|
-
- Client SDK Agents, Mastra server - support runtimeContext with GET requests ([#7734](https://github.com/mastra-ai/mastra/pull/7734))
|
|
273
|
-
|
|
274
|
-
## 0.12.3-alpha.0
|
|
275
|
-
|
|
276
|
-
## 0.12.2
|
|
277
|
-
|
|
278
|
-
## 0.12.2-alpha.0
|
|
279
|
-
|
|
280
|
-
## 0.12.1
|
|
281
|
-
|
|
282
|
-
### Patch Changes
|
|
283
|
-
|
|
284
|
-
- dependencies updates: ([#7544](https://github.com/mastra-ai/mastra/pull/7544))
|
|
285
|
-
- Updated dependency [`fs-extra@^11.3.1` ↗︎](https://www.npmjs.com/package/fs-extra/v/11.3.1) (from `^11.3.0`, in `dependencies`)
|
|
286
|
-
|
|
287
|
-
- add workflow streaming in agent thread ([#7506](https://github.com/mastra-ai/mastra/pull/7506))
|
|
288
|
-
|
|
289
|
-
- Fix template slug when getting template environment variables ([#7650](https://github.com/mastra-ai/mastra/pull/7650))
|
|
290
|
-
|
|
291
|
-
- Update cli dev copy from "Local" - ([#7579](https://github.com/mastra-ai/mastra/pull/7579))
|
|
292
|
-
|
|
293
|
-
## 0.12.1-alpha.2
|
|
294
|
-
|
|
295
|
-
### Patch Changes
|
|
296
|
-
|
|
297
|
-
- Fix template slug when getting template environment variables ([#7650](https://github.com/mastra-ai/mastra/pull/7650))
|
|
298
|
-
|
|
299
|
-
## 0.12.1-alpha.1
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 1676 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.15.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Marked telemetry as disabled in the default template, in preperation for the Nov 4th deprecation. ([#8618](https://github.com/mastra-ai/mastra/pull/8618))
|
|
8
|
+
|
|
9
|
+
## 0.15.1-alpha.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Improve the overall flow of the `create-mastra` CLI by first asking all questions and then creating the project structure. If you skip entering an API key during the wizard, the `your-api-key` placeholder will now be added to an `.env.example` file instead of `.env`. ([#8603](https://github.com/mastra-ai/mastra/pull/8603))
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`0d71771`](https://github.com/mastra-ai/mastra/commit/0d71771f5711164c79f8e80919bc84d6bffeb6bc), [`0d6e55e`](https://github.com/mastra-ai/mastra/commit/0d6e55ecc5a2e689cd4fc9c86525e0eb54d82372)]:
|
|
16
|
+
- @mastra/core@0.20.2-alpha.0
|
|
17
|
+
- @mastra/deployer@0.20.2-alpha.0
|
|
18
|
+
|
|
19
|
+
## 0.15.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- Update peer dependencies to match core package version bump (0.20.1) ([#8589](https://github.com/mastra-ai/mastra/pull/8589))
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- workflow run thread more visible ([#8539](https://github.com/mastra-ai/mastra/pull/8539))
|
|
28
|
+
|
|
29
|
+
- Mutable shared workflow run state ([#8545](https://github.com/mastra-ai/mastra/pull/8545))
|
|
30
|
+
|
|
31
|
+
- streamLegacy/generateLegacy clarification in playground ([#8468](https://github.com/mastra-ai/mastra/pull/8468))
|
|
32
|
+
|
|
33
|
+
- avoid refetching memory threads and messages on window focus ([#8519](https://github.com/mastra-ai/mastra/pull/8519))
|
|
34
|
+
|
|
35
|
+
- add tripwire reason in playground ([#8568](https://github.com/mastra-ai/mastra/pull/8568))
|
|
36
|
+
|
|
37
|
+
- Save waiting step status in snapshot ([#8576](https://github.com/mastra-ai/mastra/pull/8576))
|
|
38
|
+
|
|
39
|
+
- Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai ([#8559](https://github.com/mastra-ai/mastra/pull/8559))
|
|
40
|
+
|
|
41
|
+
- Convert WorkflowWatchResult to WorkflowResult in workflow graph ([#8541](https://github.com/mastra-ai/mastra/pull/8541))
|
|
42
|
+
|
|
43
|
+
- add new deploy to cloud button ([#8549](https://github.com/mastra-ai/mastra/pull/8549))
|
|
44
|
+
|
|
45
|
+
- remove icons in entity lists ([#8520](https://github.com/mastra-ai/mastra/pull/8520))
|
|
46
|
+
|
|
47
|
+
- add client search to all entities ([#8523](https://github.com/mastra-ai/mastra/pull/8523))
|
|
48
|
+
|
|
49
|
+
- Fixed an issue where model router was adding /chat/completions to API urls when it shouldn't. ([#8589](https://github.com/mastra-ai/mastra/pull/8589))
|
|
50
|
+
fixed an issue with provider ID rendering in playground UI
|
|
51
|
+
|
|
52
|
+
- Fix useStreamWorkflow unmounting breaking stream call ([#8449](https://github.com/mastra-ai/mastra/pull/8449))
|
|
53
|
+
|
|
54
|
+
- Remove shell from dev ([#8466](https://github.com/mastra-ai/mastra/pull/8466))
|
|
55
|
+
|
|
56
|
+
- UX for the agents page ([#8517](https://github.com/mastra-ai/mastra/pull/8517))
|
|
57
|
+
|
|
58
|
+
- add icons into playground titles + a link to the entity doc ([#8518](https://github.com/mastra-ai/mastra/pull/8518))
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [[`c621613`](https://github.com/mastra-ai/mastra/commit/c621613069173c69eb2c3ef19a5308894c6549f0), [`ee17cec`](https://github.com/mastra-ai/mastra/commit/ee17cec065f4454740c9cc8f8a841027a5990f57), [`12b1189`](https://github.com/mastra-ai/mastra/commit/12b118942445e4de0dd916c593e33ec78dc3bc73), [`42ffed3`](https://github.com/mastra-ai/mastra/commit/42ffed311b9d8750652bbc55c773be62c989fcc6), [`4783b30`](https://github.com/mastra-ai/mastra/commit/4783b3063efea887825514b783ba27f67912c26d), [`076b092`](https://github.com/mastra-ai/mastra/commit/076b0924902ff0f49d5712d2df24c4cca683713f), [`2aee9e7`](https://github.com/mastra-ai/mastra/commit/2aee9e7d188b8b256a4ddc203ccefb366b4867fa), [`c582906`](https://github.com/mastra-ai/mastra/commit/c5829065a346260f96c4beb8af131b94804ae3ad), [`fa2eb96`](https://github.com/mastra-ai/mastra/commit/fa2eb96af16c7d433891a73932764960d3235c1d), [`ee9108f`](https://github.com/mastra-ai/mastra/commit/ee9108fa29bb8368fc23df158c9f0645b2d7b65c), [`4783b30`](https://github.com/mastra-ai/mastra/commit/4783b3063efea887825514b783ba27f67912c26d), [`a739d0c`](https://github.com/mastra-ai/mastra/commit/a739d0c8b37cd89569e04a6ca0827083c6167e19), [`a9c4cb7`](https://github.com/mastra-ai/mastra/commit/a9c4cb7d6a35de23ca51066f166a66e0e4cca418), [`603e927`](https://github.com/mastra-ai/mastra/commit/603e9279db8bf8a46caf83881c6b7389ccffff7e), [`cd45982`](https://github.com/mastra-ai/mastra/commit/cd4598291cda128a88738734ae6cbef076ebdebd), [`874f74d`](https://github.com/mastra-ai/mastra/commit/874f74da4b1acf6517f18132d035612c3ecc394a), [`b728a45`](https://github.com/mastra-ai/mastra/commit/b728a45ab3dba59da0f5ee36b81fe246659f305d), [`0baf2ba`](https://github.com/mastra-ai/mastra/commit/0baf2bab8420277072ef1f95df5ea7b0a2f61fe7), [`10e633a`](https://github.com/mastra-ai/mastra/commit/10e633a07d333466d9734c97acfc3dbf757ad2d0), [`a6d69c5`](https://github.com/mastra-ai/mastra/commit/a6d69c5fb50c0875b46275811fece5862f03c6a0), [`84199af`](https://github.com/mastra-ai/mastra/commit/84199af8673f6f9cb59286ffb5477a41932775de), [`7f431af`](https://github.com/mastra-ai/mastra/commit/7f431afd586b7d3265075e73106eb73167edbb86), [`26e968d`](https://github.com/mastra-ai/mastra/commit/26e968db2171ded9e4d47aa1b4f19e1e771158d0), [`cbd3fb6`](https://github.com/mastra-ai/mastra/commit/cbd3fb65adb03a7c0df193cb998aed5ac56675ee)]:
|
|
61
|
+
- @mastra/core@0.20.1
|
|
62
|
+
- @mastra/deployer@0.20.1
|
|
63
|
+
- @mastra/mcp@0.13.4
|
|
64
|
+
|
|
3
65
|
## 0.15.0-alpha.3
|
|
4
66
|
|
|
5
67
|
### Minor Changes
|
|
@@ -236,67 +298,5 @@
|
|
|
236
298
|
- Updated dependencies [[`5089c84`](https://github.com/mastra-ai/mastra/commit/5089c84a2f535ad12e79b5aa524ad7d8ca5e2b4c), [`5f4e677`](https://github.com/mastra-ai/mastra/commit/5f4e67757bc23f2694d83af10f88cfccdc6013ff), [`5c98f03`](https://github.com/mastra-ai/mastra/commit/5c98f03ae76d9a93cd6be206b4abb7bf186b3163), [`dc099b4`](https://github.com/mastra-ai/mastra/commit/dc099b40fb31147ba3f362f98d991892033c4c67), [`57b75b0`](https://github.com/mastra-ai/mastra/commit/57b75b01c0c64d91c50d7384c700afda89456fe8), [`4c5e65d`](https://github.com/mastra-ai/mastra/commit/4c5e65de746fbdab23eb6072cb999f4c7aeef9f3), [`504438b`](https://github.com/mastra-ai/mastra/commit/504438b961bde211071186bba63a842c4e3db879), [`57b6dd5`](https://github.com/mastra-ai/mastra/commit/57b6dd50f9e6d92c0ed3e7199e6a92752025e3a1), [`b342a68`](https://github.com/mastra-ai/mastra/commit/b342a68e1399cf1ece9ba11bda112db89d21118c), [`a7243e2`](https://github.com/mastra-ai/mastra/commit/a7243e2e58762667a6e3921e755e89d6bb0a3282), [`504438b`](https://github.com/mastra-ai/mastra/commit/504438b961bde211071186bba63a842c4e3db879), [`7fceb0a`](https://github.com/mastra-ai/mastra/commit/7fceb0a327d678e812f90f5387c5bc4f38bd039e), [`303a9c0`](https://github.com/mastra-ai/mastra/commit/303a9c0d7dd58795915979f06a0512359e4532fb), [`df64f9e`](https://github.com/mastra-ai/mastra/commit/df64f9ef814916fff9baedd861c988084e7c41de), [`370f8a6`](https://github.com/mastra-ai/mastra/commit/370f8a6480faec70fef18d72e5f7538f27004301), [`809eea0`](https://github.com/mastra-ai/mastra/commit/809eea092fa80c3f69b9eaf078d843b57fd2a88e), [`683e5a1`](https://github.com/mastra-ai/mastra/commit/683e5a1466e48b686825b2c11f84680f296138e4), [`3679378`](https://github.com/mastra-ai/mastra/commit/3679378673350aa314741dc826f837b1984149bc), [`7775bc2`](https://github.com/mastra-ai/mastra/commit/7775bc20bb1ad1ab24797fb420e4f96c65b0d8ec), [`623ffaf`](https://github.com/mastra-ai/mastra/commit/623ffaf2d969e11e99a0224633cf7b5a0815c857), [`9fc1613`](https://github.com/mastra-ai/mastra/commit/9fc16136400186648880fd990119ac15f7c02ee4), [`61f62aa`](https://github.com/mastra-ai/mastra/commit/61f62aa31bc88fe4ddf8da6240dbcfbeb07358bd), [`db1891a`](https://github.com/mastra-ai/mastra/commit/db1891a4707443720b7cd8a260dc7e1d49b3609c), [`e8f379d`](https://github.com/mastra-ai/mastra/commit/e8f379d390efa264c4e0874f9ac0cf8839b07777), [`652066b`](https://github.com/mastra-ai/mastra/commit/652066bd1efc6bb6813ba950ed1d7573e8b7d9d4), [`3e292ba`](https://github.com/mastra-ai/mastra/commit/3e292ba00837886d5d68a34cbc0d9b703c991883), [`418c136`](https://github.com/mastra-ai/mastra/commit/418c1366843d88e491bca3f87763899ce855ca29), [`ea8d386`](https://github.com/mastra-ai/mastra/commit/ea8d386cd8c5593664515fd5770c06bf2aa980ef), [`67b0f00`](https://github.com/mastra-ai/mastra/commit/67b0f005b520335c71fb85cbaa25df4ce8484a81), [`c2a4919`](https://github.com/mastra-ai/mastra/commit/c2a4919ba6797d8bdb1509e02287496eef69303e), [`c84b7d0`](https://github.com/mastra-ai/mastra/commit/c84b7d093c4657772140cbfd2b15ef72f3315ed5), [`6f67656`](https://github.com/mastra-ai/mastra/commit/6f676562276926e2982401574d1e07157579be30), [`0130986`](https://github.com/mastra-ai/mastra/commit/0130986fc62d0edcc626dd593282661dbb9af141), [`5dc8e9a`](https://github.com/mastra-ai/mastra/commit/5dc8e9a7f8472298cd3d4e8a0cf6d265529f287d)]:
|
|
237
299
|
- @mastra/deployer@0.19.0
|
|
238
300
|
- @mastra/mcp@0.13.2
|
|
239
|
-
- @mastra/core@0.19.0
|
|
240
|
-
- @mastra/loggers@0.10.14
|
|
241
|
-
|
|
242
|
-
## 0.13.3-alpha.1
|
|
243
|
-
|
|
244
|
-
### Patch Changes
|
|
245
|
-
|
|
246
|
-
- Update peer deps ([#8154](https://github.com/mastra-ai/mastra/pull/8154))
|
|
247
|
-
|
|
248
|
-
- Fixed an issue in playground where text-start/end parts were ignored in handleStreamChunk and tool ordering vs text wasn't retained ([#8234](https://github.com/mastra-ai/mastra/pull/8234))
|
|
249
|
-
|
|
250
|
-
- Add conditional chaining to scorer.agentNames return ([#8199](https://github.com/mastra-ai/mastra/pull/8199))
|
|
251
|
-
|
|
252
|
-
- Show model that worked when there are model fallbacks ([#8167](https://github.com/mastra-ai/mastra/pull/8167))
|
|
253
|
-
|
|
254
|
-
- Updated dependencies [[`5089c84`](https://github.com/mastra-ai/mastra/commit/5089c84a2f535ad12e79b5aa524ad7d8ca5e2b4c), [`5f4e677`](https://github.com/mastra-ai/mastra/commit/5f4e67757bc23f2694d83af10f88cfccdc6013ff), [`5c98f03`](https://github.com/mastra-ai/mastra/commit/5c98f03ae76d9a93cd6be206b4abb7bf186b3163), [`57b75b0`](https://github.com/mastra-ai/mastra/commit/57b75b01c0c64d91c50d7384c700afda89456fe8), [`4c5e65d`](https://github.com/mastra-ai/mastra/commit/4c5e65de746fbdab23eb6072cb999f4c7aeef9f3), [`504438b`](https://github.com/mastra-ai/mastra/commit/504438b961bde211071186bba63a842c4e3db879), [`57b6dd5`](https://github.com/mastra-ai/mastra/commit/57b6dd50f9e6d92c0ed3e7199e6a92752025e3a1), [`a7243e2`](https://github.com/mastra-ai/mastra/commit/a7243e2e58762667a6e3921e755e89d6bb0a3282), [`504438b`](https://github.com/mastra-ai/mastra/commit/504438b961bde211071186bba63a842c4e3db879), [`7fceb0a`](https://github.com/mastra-ai/mastra/commit/7fceb0a327d678e812f90f5387c5bc4f38bd039e), [`df64f9e`](https://github.com/mastra-ai/mastra/commit/df64f9ef814916fff9baedd861c988084e7c41de), [`809eea0`](https://github.com/mastra-ai/mastra/commit/809eea092fa80c3f69b9eaf078d843b57fd2a88e), [`683e5a1`](https://github.com/mastra-ai/mastra/commit/683e5a1466e48b686825b2c11f84680f296138e4), [`3679378`](https://github.com/mastra-ai/mastra/commit/3679378673350aa314741dc826f837b1984149bc), [`7775bc2`](https://github.com/mastra-ai/mastra/commit/7775bc20bb1ad1ab24797fb420e4f96c65b0d8ec), [`db1891a`](https://github.com/mastra-ai/mastra/commit/db1891a4707443720b7cd8a260dc7e1d49b3609c), [`e8f379d`](https://github.com/mastra-ai/mastra/commit/e8f379d390efa264c4e0874f9ac0cf8839b07777), [`652066b`](https://github.com/mastra-ai/mastra/commit/652066bd1efc6bb6813ba950ed1d7573e8b7d9d4), [`ea8d386`](https://github.com/mastra-ai/mastra/commit/ea8d386cd8c5593664515fd5770c06bf2aa980ef), [`c2a4919`](https://github.com/mastra-ai/mastra/commit/c2a4919ba6797d8bdb1509e02287496eef69303e), [`6f67656`](https://github.com/mastra-ai/mastra/commit/6f676562276926e2982401574d1e07157579be30), [`0130986`](https://github.com/mastra-ai/mastra/commit/0130986fc62d0edcc626dd593282661dbb9af141), [`5dc8e9a`](https://github.com/mastra-ai/mastra/commit/5dc8e9a7f8472298cd3d4e8a0cf6d265529f287d)]:
|
|
255
|
-
- @mastra/deployer@0.19.0-alpha.1
|
|
256
|
-
- @mastra/mcp@0.13.2-alpha.0
|
|
257
|
-
- @mastra/core@0.19.0-alpha.1
|
|
258
|
-
- @mastra/loggers@0.10.14-alpha.0
|
|
259
|
-
|
|
260
|
-
## 0.13.3-alpha.0
|
|
261
|
-
|
|
262
|
-
### Patch Changes
|
|
263
|
-
|
|
264
|
-
- Remove legacy helpers ([#8017](https://github.com/mastra-ai/mastra/pull/8017))
|
|
265
|
-
|
|
266
|
-
- add a way to hide the deploy mastra cloud button ([#8137](https://github.com/mastra-ai/mastra/pull/8137))
|
|
267
|
-
|
|
268
|
-
- Add types in the streamVNext codepath, fixes for various issues across multiple packages surfaced from type issues, align return types. ([#8010](https://github.com/mastra-ai/mastra/pull/8010))
|
|
269
|
-
|
|
270
|
-
- Add model fallbacks to playground ([#7427](https://github.com/mastra-ai/mastra/pull/7427))
|
|
271
|
-
|
|
272
|
-
- Updated dependencies [[`dc099b4`](https://github.com/mastra-ai/mastra/commit/dc099b40fb31147ba3f362f98d991892033c4c67), [`b342a68`](https://github.com/mastra-ai/mastra/commit/b342a68e1399cf1ece9ba11bda112db89d21118c), [`303a9c0`](https://github.com/mastra-ai/mastra/commit/303a9c0d7dd58795915979f06a0512359e4532fb), [`370f8a6`](https://github.com/mastra-ai/mastra/commit/370f8a6480faec70fef18d72e5f7538f27004301), [`623ffaf`](https://github.com/mastra-ai/mastra/commit/623ffaf2d969e11e99a0224633cf7b5a0815c857), [`9fc1613`](https://github.com/mastra-ai/mastra/commit/9fc16136400186648880fd990119ac15f7c02ee4), [`61f62aa`](https://github.com/mastra-ai/mastra/commit/61f62aa31bc88fe4ddf8da6240dbcfbeb07358bd), [`3e292ba`](https://github.com/mastra-ai/mastra/commit/3e292ba00837886d5d68a34cbc0d9b703c991883), [`418c136`](https://github.com/mastra-ai/mastra/commit/418c1366843d88e491bca3f87763899ce855ca29), [`c84b7d0`](https://github.com/mastra-ai/mastra/commit/c84b7d093c4657772140cbfd2b15ef72f3315ed5)]:
|
|
273
|
-
- @mastra/core@0.18.1-alpha.0
|
|
274
|
-
- @mastra/deployer@0.18.1-alpha.0
|
|
275
|
-
|
|
276
|
-
## 0.13.2
|
|
277
|
-
|
|
278
|
-
### Patch Changes
|
|
279
|
-
|
|
280
|
-
- feat: implement trace scoring with batch processing capabilities ([#8033](https://github.com/mastra-ai/mastra/pull/8033))
|
|
281
|
-
|
|
282
|
-
- Add model fallback handlers and apis ([#7378](https://github.com/mastra-ai/mastra/pull/7378))
|
|
283
|
-
|
|
284
|
-
- dependencies updates: ([#8007](https://github.com/mastra-ai/mastra/pull/8007))
|
|
285
|
-
- Updated dependency [`fs-extra@^11.3.2` ↗︎](https://www.npmjs.com/package/fs-extra/v/11.3.2) (from `^11.3.1`, in `dependencies`)
|
|
286
|
-
|
|
287
|
-
- show the tool-output stream in the playground for streamVNext ([#7983](https://github.com/mastra-ai/mastra/pull/7983))
|
|
288
|
-
|
|
289
|
-
- Get rid off swr one for all ([#7931](https://github.com/mastra-ai/mastra/pull/7931))
|
|
290
|
-
|
|
291
|
-
- Fix DateTimePicker style issue ([#8106](https://github.com/mastra-ai/mastra/pull/8106))
|
|
292
|
-
|
|
293
|
-
- Fix navigating between scores and entity types ([#8129](https://github.com/mastra-ai/mastra/pull/8129))
|
|
294
|
-
|
|
295
|
-
- Fix getting tool link path from agent in playground ui tools page ([#8135](https://github.com/mastra-ai/mastra/pull/8135))
|
|
296
|
-
|
|
297
|
-
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
298
|
-
|
|
299
|
-
- Updated dependencies [[`288745a`](https://github.com/mastra-ai/mastra/commit/288745a19aa9557db3ab3c877d667ff59f14d79c), [`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`8f56160`](https://github.com/mastra-ai/mastra/commit/8f56160fd45c740076529148b9c225f6842d43b0), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`2d29ad9`](https://github.com/mastra-ai/mastra/commit/2d29ad92763cac02fc1d80c221ac93c39c0c5caf), [`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a), [`5b1ee71`](https://github.com/mastra-ai/mastra/commit/5b1ee71dc3ac92383226dc1e375642ca5f9b4224), [`282379f`](https://github.com/mastra-ai/mastra/commit/282379fafed80c6417fe1e791087110decd481ca)]:
|
|
300
|
-
- @mastra/deployer@0.18.0
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 6084 more lines hidden. See full changelog in package directory.
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@ai-sdk/openai": "^1.3.23",
|
|
10
|
-
"@mastra/core": "^0.20.
|
|
10
|
+
"@mastra/core": "^0.20.1",
|
|
11
11
|
"@mastra/libsql": "^0.15.1",
|
|
12
12
|
"@mastra/loggers": "^0.10.15",
|
|
13
|
-
"@mastra/memory": "^0.15.
|
|
13
|
+
"@mastra/memory": "^0.15.6",
|
|
14
14
|
"zod": "^3.25.76"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^24.3.0",
|
|
18
|
-
"mastra": "^0.
|
|
18
|
+
"mastra": "^0.15.0",
|
|
19
19
|
"typescript": "^5.9.2"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -5,129 +5,99 @@ description: Learn how to use Mastra's RuntimeContext to provide dynamic, reques
|
|
|
5
5
|
|
|
6
6
|
# Runtime Context
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Agents use `RuntimeContext` to access request-specific values sent alongside user messages. These values let a single agent change its behavior, functionality, model, tools, or memory usage based on the needs of each request.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+

|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## When to use `RuntimeContext`
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
2. Access these variables within tool execution contexts
|
|
16
|
-
3. Modify agent behavior without changing the underlying code
|
|
17
|
-
4. Share configuration across multiple tools within the same agent
|
|
14
|
+
Use `RuntimeContext` when an agent's behavior should change based on the request or environment. For example, you might switch models or storage providers based on user details, or adjust instructions or tool selection based on the user's language.
|
|
18
15
|
|
|
19
|
-
##
|
|
16
|
+
## Configuring agents with `RuntimeContext`
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
You can access the `runtimeContext` argument from any of the agent’s supported parameters. These functions can be sync or `async`, allowing you to use context values to fetch data, apply logic, or adjust behavior at runtime.
|
|
22
19
|
|
|
23
|
-
```typescript {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import { testWeatherTool } from "../tools/test-weather-tool";
|
|
27
|
-
|
|
28
|
-
export const testWeatherAgent = new Agent({
|
|
29
|
-
name: "test-weather-agent",
|
|
20
|
+
```typescript {3,6,9,12} filename="src/dynamic-agent.ts" showLineNumbers copy
|
|
21
|
+
export const dynamicAgent = new Agent({
|
|
22
|
+
name: "dynamic-agent",
|
|
30
23
|
instructions: async ({ runtimeContext }) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
// ...
|
|
25
|
+
},
|
|
26
|
+
model: ({ runtimeContext }) => {
|
|
27
|
+
// ...
|
|
28
|
+
},
|
|
29
|
+
tools: ({ runtimeContext }) => {
|
|
30
|
+
// ...
|
|
31
|
+
},
|
|
32
|
+
memory: ({ runtimeContext }) => {
|
|
33
|
+
// ...
|
|
41
34
|
},
|
|
42
|
-
model: openai("gpt-4o-mini"),
|
|
43
|
-
tools: { testWeatherTool }
|
|
44
35
|
});
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
|
|
38
|
+
You can also use `runtimeContext` with other parameters like `agents`, `workflows`, `scorers`, `inputProcessors`, and `outputProcessors`.
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
> See [Agent](../../reference/agents/agent.mdx) for a full list of configuration options.
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
import { createTool } from "@mastra/core/tools";
|
|
53
|
-
import { z } from "zod";
|
|
42
|
+
## Setting values
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
"temperature-unit": "celsius" | "fahrenheit";
|
|
57
|
-
};
|
|
44
|
+
To set variables in `runtimeContext`, create a new instance using `new RuntimeContext()` and call `.set()` to define the values you want to include.
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
id: "test-weather-tool",
|
|
61
|
-
description: "Fetches the current weather for a given city",
|
|
62
|
-
inputSchema: z.object({
|
|
63
|
-
city: z.string()
|
|
64
|
-
}),
|
|
65
|
-
execute: async ({ context, runtimeContext }) => {
|
|
66
|
-
const { city } = context;
|
|
67
|
-
const unit = runtimeContext.get("temperature-unit") as WeatherRuntimeContext["temperature-unit"];
|
|
68
|
-
|
|
69
|
-
const response = await fetch(`https://weather.service?city=${city}`);
|
|
70
|
-
const { temperature, conditions } = await response.json();
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
metric: unit === "celsius" ? "°C" : "°F",
|
|
74
|
-
temperature,
|
|
75
|
-
conditions
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
```
|
|
46
|
+
The `.set()` method takes two arguments:
|
|
80
47
|
|
|
81
|
-
|
|
48
|
+
1. **key**: The name used to identify the value.
|
|
49
|
+
2. **value**: The data to associate with that key.
|
|
82
50
|
|
|
83
|
-
|
|
51
|
+
After setting the values, pass the `runtimeContext` to `.generate()` or `.stream()` to make them available to the agent.
|
|
84
52
|
|
|
85
|
-
```typescript {
|
|
53
|
+
```typescript {8,11} filename="src/test-dynamic-agent.ts" showLineNumbers copy
|
|
86
54
|
import { mastra } from "./mastra";
|
|
87
55
|
import { RuntimeContext } from "@mastra/core/runtime-context";
|
|
88
|
-
import {
|
|
56
|
+
import { UserTier } from "./mastra/agents/dynamic-agent"
|
|
89
57
|
|
|
90
|
-
const agent = mastra.getAgent("
|
|
58
|
+
const agent = mastra.getAgent("dynamicAgent");
|
|
91
59
|
|
|
92
|
-
const runtimeContext = new RuntimeContext<
|
|
60
|
+
const runtimeContext = new RuntimeContext<UserTier>();
|
|
61
|
+
runtimeContext.set("user-tier", "enterprise");
|
|
93
62
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const response = await agent.generate("What's the weather in London?", {
|
|
63
|
+
const response = await agent.generate("Help plan my day.", {
|
|
97
64
|
runtimeContext
|
|
98
65
|
});
|
|
99
|
-
|
|
100
|
-
console.log(response.text);
|
|
101
66
|
```
|
|
102
67
|
|
|
103
|
-
## Accessing
|
|
68
|
+
## Accessing values
|
|
104
69
|
|
|
105
|
-
|
|
70
|
+
The example below accesses a `user-tier` value from `runtimeContext` to determine which model and instructions to use. The context is typed to provide safety and autocomplete when working with `.get()` and `.set()`.
|
|
106
71
|
|
|
107
|
-
```typescript {
|
|
108
|
-
import {
|
|
72
|
+
```typescript {12,19} filename="src/mastra/agents/dynamic-agent.ts" showLineNumbers copy
|
|
73
|
+
import { openai } from "@ai-sdk/openai";
|
|
74
|
+
import { Agent } from "@mastra/core/agent";
|
|
109
75
|
import { RuntimeContext } from "@mastra/core/runtime-context";
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
76
|
+
|
|
77
|
+
export type UserTier = {
|
|
78
|
+
"user-tier": "enterprise" | "pro";
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const dynamicAgent = new Agent({
|
|
82
|
+
name: "dynamic-agent",
|
|
83
|
+
instructions: async ({ runtimeContext }: { runtimeContext: RuntimeContext<UserTier> }) => {
|
|
84
|
+
const userTier = runtimeContext.get("user-tier");
|
|
85
|
+
|
|
86
|
+
const result = await db.query("SELECT instructions FROM config WHERE tier = ?", [userTier]);
|
|
87
|
+
|
|
88
|
+
return result[0].instructions;
|
|
89
|
+
},
|
|
90
|
+
model: ({ runtimeContext }: { runtimeContext: RuntimeContext<UserTier> }) => {
|
|
91
|
+
const userTier = runtimeContext.get("user-tier");
|
|
92
|
+
|
|
93
|
+
return userTier === "enterprise"
|
|
94
|
+
? openai("gpt-4o-mini")
|
|
95
|
+
: openai("gpt-4.1-nano");
|
|
126
96
|
}
|
|
127
97
|
});
|
|
128
98
|
```
|
|
129
99
|
|
|
130
100
|
## Related
|
|
131
101
|
|
|
132
|
-
- [Dynamic Agents](./dynamic-agents.mdx)
|
|
133
102
|
- [Tool Runtime Context](../tools-mcp/runtime-context.mdx)
|
|
103
|
+
- [Server Middleware Runtime Context](../server-db/middleware.mdx)
|
|
@@ -5,7 +5,7 @@ description: Documentation for the `Workflow.dountil()` method in workflows, whi
|
|
|
5
5
|
|
|
6
6
|
# Workflow.dountil()
|
|
7
7
|
|
|
8
|
-
The `.dountil()` method
|
|
8
|
+
The `.dountil()` method executes a step until a condition is met. It always runs the step at least once before evaluating the condition. The first time the condition is evaluated, `iterationCount` is `1`.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
@@ -25,9 +25,9 @@ workflow.dountil(step1, async ({ inputData }) => true);
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: "condition",
|
|
28
|
-
type: "(params : {
|
|
28
|
+
type: "(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>",
|
|
29
29
|
description:
|
|
30
|
-
"A function that returns a boolean indicating whether to continue the loop",
|
|
30
|
+
"A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count.",
|
|
31
31
|
isOptional: false,
|
|
32
32
|
},
|
|
33
33
|
]}
|
|
@@ -48,3 +48,5 @@ workflow.dountil(step1, async ({ inputData }) => true);
|
|
|
48
48
|
## Related
|
|
49
49
|
|
|
50
50
|
- [Control Flow](../../../docs/workflows/control-flow.mdx)
|
|
51
|
+
|
|
52
|
+
- [ExecuteParams](../step.mdx#ExecuteParams)
|
|
@@ -5,7 +5,7 @@ description: Documentation for the `Workflow.dowhile()` method in workflows, whi
|
|
|
5
5
|
|
|
6
6
|
# Workflow.dowhile()
|
|
7
7
|
|
|
8
|
-
The `.dowhile()` method
|
|
8
|
+
The `.dowhile()` method executes a step while a condition is met. It always runs the step at least once before evaluating the condition. The first time the condition is evaluated, `iterationCount` is `1`.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
@@ -25,9 +25,9 @@ workflow.dowhile(step1, async ({ inputData }) => true);
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: "condition",
|
|
28
|
-
type: "(params : {
|
|
28
|
+
type: "(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>",
|
|
29
29
|
description:
|
|
30
|
-
"A function that returns a boolean indicating whether to continue the loop",
|
|
30
|
+
"A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count.",
|
|
31
31
|
isOptional: false,
|
|
32
32
|
},
|
|
33
33
|
]}
|
|
@@ -48,3 +48,5 @@ workflow.dowhile(step1, async ({ inputData }) => true);
|
|
|
48
48
|
## Related
|
|
49
49
|
|
|
50
50
|
- [Control Flow](../../../docs/workflows/control-flow.mdx)
|
|
51
|
+
|
|
52
|
+
- [ExecuteParams](../step.mdx#ExecuteParams)
|
|
@@ -138,7 +138,33 @@ be inspected by middleware to tailor behaviour:
|
|
|
138
138
|
},
|
|
139
139
|
}
|
|
140
140
|
```
|
|
141
|
-
|
|
142
141
|
- `x-mastra-cloud`: request originates from Mastra Cloud
|
|
143
142
|
- `x-mastra-client-type`: identifies the client SDK, e.g. `js` or `python`
|
|
144
143
|
- `x-mastra-dev-playground`: request triggered from a local playground
|
|
144
|
+
|
|
145
|
+
### Setting `runtimeContext`
|
|
146
|
+
|
|
147
|
+
You can populate `runtimeContext` dynamically in server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
|
|
148
|
+
|
|
149
|
+
```typescript filename="src/mastra/index.ts" showLineNumbers copy
|
|
150
|
+
import { Mastra } from "@mastra/core/mastra";
|
|
151
|
+
import { RuntimeContext } from "@mastra/core/runtime-context";
|
|
152
|
+
import { testWeatherAgent } from "./agents/test-weather-agent";
|
|
153
|
+
import { WeatherRuntimeContext } from "./mastra/tools/test-weather-tool";
|
|
154
|
+
|
|
155
|
+
export const mastra = new Mastra({
|
|
156
|
+
agents: { testWeatherAgent },
|
|
157
|
+
server: {
|
|
158
|
+
middleware: [
|
|
159
|
+
async (context, next) => {
|
|
160
|
+
const country = context.req.header("CF-IPCountry");
|
|
161
|
+
const runtimeContext = context.get("runtimeContext") as RuntimeContext<WeatherRuntimeContext>;
|
|
162
|
+
|
|
163
|
+
runtimeContext.set("temperature-unit", country === "US" ? "fahrenheit" : "celsius");
|
|
164
|
+
|
|
165
|
+
await next();
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
```
|
|
@@ -125,6 +125,60 @@ export const testWorkflow = createWorkflow({...})
|
|
|
125
125
|
.commit();
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
### Loop management
|
|
129
|
+
|
|
130
|
+
Loop conditions can be implemented in different ways depending on how you want the loop to end. Common patterns include checking values returned in `inputData`, setting a maximum number of iterations, or aborting execution when a limit is reached.
|
|
131
|
+
|
|
132
|
+
#### Conditional loops
|
|
133
|
+
|
|
134
|
+
The `inputData` for a loop step is the output of a previous step. Use the values in `inputData` to determine whether the loop should continue or stop.
|
|
135
|
+
|
|
136
|
+
```typescript {7} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
137
|
+
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
138
|
+
import { z } from "zod";
|
|
139
|
+
|
|
140
|
+
const counterStep = createStep({...});
|
|
141
|
+
|
|
142
|
+
export const testWorkflow = createWorkflow({...})
|
|
143
|
+
.dountil(nestedWorkflowStep, async ({ inputData: { userResponse } }) => userResponse === "yes")
|
|
144
|
+
.commit();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Limiting loops
|
|
148
|
+
|
|
149
|
+
The `iterationCount` tracks how many times the loop step has run. You can use this to limit the number of iterations and prevent infinite loops. Combine it with `inputData` values to stop the loop after a set number of attempts.
|
|
150
|
+
|
|
151
|
+
```typescript {7} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
152
|
+
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
153
|
+
import { z } from "zod";
|
|
154
|
+
|
|
155
|
+
const counterStep = createStep({...});
|
|
156
|
+
|
|
157
|
+
export const testWorkflow = createWorkflow({...})
|
|
158
|
+
.dountil(nestedWorkflowStep, async ({ inputData: { userResponse, iterationCount } }) => userResponse === "yes" || iterationCount >= 10)
|
|
159
|
+
.commit();
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Aborting loops
|
|
163
|
+
|
|
164
|
+
Use `iterationCount` to limit how many times a loop runs. If the count exceeds your threshold, throw an error to fail the step and stop the workflow.
|
|
165
|
+
|
|
166
|
+
```typescript {7} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
167
|
+
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
168
|
+
import { z } from "zod";
|
|
169
|
+
|
|
170
|
+
const counterStep = createStep({...});
|
|
171
|
+
|
|
172
|
+
export const testWorkflow = createWorkflow({...})
|
|
173
|
+
.dountil(nestedWorkflowStep, async ({ inputData: { userResponse, iterationCount } }) => {
|
|
174
|
+
if (iterationCount >= 10) {
|
|
175
|
+
throw new Error("Maximum iterations reached");
|
|
176
|
+
}
|
|
177
|
+
return userResponse === "yes";
|
|
178
|
+
})
|
|
179
|
+
.commit();
|
|
180
|
+
```
|
|
181
|
+
|
|
128
182
|
### Repeating with `.foreach()`
|
|
129
183
|
|
|
130
184
|
Sequentially executes the same step for each item from the `inputSchema`.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 0.13.29-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`07eaf25`](https://github.com/mastra-ai/mastra/commit/07eaf25aada9e42235dbf905854de53da4d8121b), [`68b1111`](https://github.com/mastra-ai/mastra/commit/68b11118a1303f93e9c0c157850c0751309304c5)]:
|
|
8
|
+
- @mastra/core@0.20.2-alpha.1
|
|
9
|
+
|
|
10
|
+
## 0.13.29-alpha.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`0d71771`](https://github.com/mastra-ai/mastra/commit/0d71771f5711164c79f8e80919bc84d6bffeb6bc), [`0d6e55e`](https://github.com/mastra-ai/mastra/commit/0d6e55ecc5a2e689cd4fc9c86525e0eb54d82372)]:
|
|
15
|
+
- @mastra/core@0.20.2-alpha.0
|
|
16
|
+
|
|
3
17
|
## 0.13.28
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|