@mastra/libsql 0.0.0-fix-cloudflare-rest-api-20260225162901 → 0.0.0-fix-windows-shell-20260306004111
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/CHANGELOG.md +65 -3
- package/LICENSE.md +15 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-agent-approval.md +238 -27
- package/dist/docs/references/docs-agents-networks.md +15 -2
- package/dist/docs/references/docs-memory-semantic-recall.md +17 -1
- package/dist/docs/references/reference-core-getMemory.md +2 -2
- package/dist/docs/references/reference-core-listMemory.md +1 -1
- package/dist/docs/references/reference-core-mastra-class.md +17 -17
- package/dist/docs/references/reference-memory-memory-class.md +12 -14
- package/dist/docs/references/reference-storage-composite.md +9 -9
- package/dist/docs/references/reference-storage-dynamodb.md +9 -9
- package/dist/docs/references/reference-storage-libsql.md +2 -2
- package/dist/docs/references/reference-vectors-libsql.md +31 -31
- package/dist/index.cjs +92 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +92 -7
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/experiments/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,73 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-windows-shell-20260306004111
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @mastra/core@0.0.0-fix-
|
|
7
|
+
- Updated dependencies [[`155215a`](https://github.com/mastra-ai/mastra/commit/155215aada884e6a543be0445a412ba26700cb03), [`0c09eac`](https://github.com/mastra-ai/mastra/commit/0c09eacb1926f64cfdc9ae5c6d63385cf8c9f72c)]:
|
|
8
|
+
- @mastra/core@0.0.0-fix-windows-shell-20260306004111
|
|
9
|
+
|
|
10
|
+
## 1.6.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- - Fixed experiment pending count showing negative values when experiments are triggered from the Studio ([#13831](https://github.com/mastra-ai/mastra/pull/13831))
|
|
15
|
+
- Fixed scorer prompt metadata (analysis context, generated prompts) being lost when saving experiment scores
|
|
16
|
+
- Updated dependencies [[`41e48c1`](https://github.com/mastra-ai/mastra/commit/41e48c198eee846478e60c02ec432c19d322a517), [`82469d3`](https://github.com/mastra-ai/mastra/commit/82469d3135d5a49dd8dc8feec0ff398b4e0225a0), [`33e2fd5`](https://github.com/mastra-ai/mastra/commit/33e2fd5088f83666df17401e2da68c943dbc0448), [`7ef6e2c`](https://github.com/mastra-ai/mastra/commit/7ef6e2c61be5a42e26f55d15b5902866fc76634f), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`fa37d39`](https://github.com/mastra-ai/mastra/commit/fa37d39910421feaf8847716292e3d65dd4f30c2), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`71c38bf`](https://github.com/mastra-ai/mastra/commit/71c38bf905905148ecd0e75c07c1f9825d299b76), [`f993c38`](https://github.com/mastra-ai/mastra/commit/f993c3848c97479b813231be872443bedeced6ab), [`f51849a`](https://github.com/mastra-ai/mastra/commit/f51849a568935122b5100b7ee69704e6d680cf7b), [`9bf3a0d`](https://github.com/mastra-ai/mastra/commit/9bf3a0dac602787925f1762f1f0387d7b4a59620), [`cafa045`](https://github.com/mastra-ai/mastra/commit/cafa0453c9de141ad50c09a13894622dffdd9978), [`1fd9ddb`](https://github.com/mastra-ai/mastra/commit/1fd9ddbb3fe83b281b12bd2e27e426ae86288266), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443), [`d9d228c`](https://github.com/mastra-ai/mastra/commit/d9d228c0c6ae82ae6ce3b540a3a56b2b1c2b8d98), [`5576507`](https://github.com/mastra-ai/mastra/commit/55765071e360fb97e443aa0a91ccf7e1cd8d92aa), [`79d69c9`](https://github.com/mastra-ai/mastra/commit/79d69c9d5f842ff1c31352fb6026f04c1f6190f3), [`94f44b8`](https://github.com/mastra-ai/mastra/commit/94f44b827ce57b179e50f4916a84c0fa6e7f3b8c), [`13187db`](https://github.com/mastra-ai/mastra/commit/13187dbac880174232dedc5a501ff6c5d0fe59bc), [`2ae5311`](https://github.com/mastra-ai/mastra/commit/2ae531185fff66a80fa165c0999e3d801900e89d), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443)]:
|
|
17
|
+
- @mastra/core@1.10.0
|
|
18
|
+
|
|
19
|
+
## 1.6.4-alpha.0
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- - Fixed experiment pending count showing negative values when experiments are triggered from the Studio ([#13831](https://github.com/mastra-ai/mastra/pull/13831))
|
|
24
|
+
- Fixed scorer prompt metadata (analysis context, generated prompts) being lost when saving experiment scores
|
|
25
|
+
- Updated dependencies [[`41e48c1`](https://github.com/mastra-ai/mastra/commit/41e48c198eee846478e60c02ec432c19d322a517), [`82469d3`](https://github.com/mastra-ai/mastra/commit/82469d3135d5a49dd8dc8feec0ff398b4e0225a0), [`33e2fd5`](https://github.com/mastra-ai/mastra/commit/33e2fd5088f83666df17401e2da68c943dbc0448), [`7ef6e2c`](https://github.com/mastra-ai/mastra/commit/7ef6e2c61be5a42e26f55d15b5902866fc76634f), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`fa37d39`](https://github.com/mastra-ai/mastra/commit/fa37d39910421feaf8847716292e3d65dd4f30c2), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`71c38bf`](https://github.com/mastra-ai/mastra/commit/71c38bf905905148ecd0e75c07c1f9825d299b76), [`f993c38`](https://github.com/mastra-ai/mastra/commit/f993c3848c97479b813231be872443bedeced6ab), [`f51849a`](https://github.com/mastra-ai/mastra/commit/f51849a568935122b5100b7ee69704e6d680cf7b), [`9bf3a0d`](https://github.com/mastra-ai/mastra/commit/9bf3a0dac602787925f1762f1f0387d7b4a59620), [`cafa045`](https://github.com/mastra-ai/mastra/commit/cafa0453c9de141ad50c09a13894622dffdd9978), [`1fd9ddb`](https://github.com/mastra-ai/mastra/commit/1fd9ddbb3fe83b281b12bd2e27e426ae86288266), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443), [`d9d228c`](https://github.com/mastra-ai/mastra/commit/d9d228c0c6ae82ae6ce3b540a3a56b2b1c2b8d98), [`5576507`](https://github.com/mastra-ai/mastra/commit/55765071e360fb97e443aa0a91ccf7e1cd8d92aa), [`79d69c9`](https://github.com/mastra-ai/mastra/commit/79d69c9d5f842ff1c31352fb6026f04c1f6190f3), [`94f44b8`](https://github.com/mastra-ai/mastra/commit/94f44b827ce57b179e50f4916a84c0fa6e7f3b8c), [`13187db`](https://github.com/mastra-ai/mastra/commit/13187dbac880174232dedc5a501ff6c5d0fe59bc), [`2ae5311`](https://github.com/mastra-ai/mastra/commit/2ae531185fff66a80fa165c0999e3d801900e89d), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443)]:
|
|
26
|
+
- @mastra/core@1.10.0-alpha.0
|
|
27
|
+
|
|
28
|
+
## 1.6.3
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Added atomic `updateWorkflowResults` and `updateWorkflowState` to safely merge concurrent step results into workflow snapshots. ([#12575](https://github.com/mastra-ai/mastra/pull/12575))
|
|
33
|
+
|
|
34
|
+
- Added `insertObservationalMemoryRecord()` to PostgreSQL, LibSQL, MongoDB, and Upstash adapters for OM cloning support. ([#13569](https://github.com/mastra-ai/mastra/pull/13569))
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`504fc8b`](https://github.com/mastra-ai/mastra/commit/504fc8b9d0ddab717577ad3bf9c95ea4bd5377bd), [`f9c150b`](https://github.com/mastra-ai/mastra/commit/f9c150b7595ad05ad9cc9a11098e2944361e8c22), [`88de7e8`](https://github.com/mastra-ai/mastra/commit/88de7e8dfe4b7e1951a9e441bb33136e705ce24e), [`edee4b3`](https://github.com/mastra-ai/mastra/commit/edee4b37dff0af515fc7cc0e8d71ee39e6a762f0), [`3790c75`](https://github.com/mastra-ai/mastra/commit/3790c7578cc6a47d854eb12d89e6b1912867fe29), [`e7a235b`](https://github.com/mastra-ai/mastra/commit/e7a235be6472e0c870ed6c791ddb17c492dc188b), [`d51d298`](https://github.com/mastra-ai/mastra/commit/d51d298953967aab1f58ec965b644d109214f085), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d5f0d8d`](https://github.com/mastra-ai/mastra/commit/d5f0d8d6a03e515ddaa9b5da19b7e44b8357b07b), [`09c3b18`](https://github.com/mastra-ai/mastra/commit/09c3b1802ff14e243a8a8baea327440bc8cc2e32), [`b896379`](https://github.com/mastra-ai/mastra/commit/b8963791c6afa79484645fcec596a201f936b9a2), [`85c84eb`](https://github.com/mastra-ai/mastra/commit/85c84ebb78aebfcba9d209c8e152b16d7a00cb71), [`a89272a`](https://github.com/mastra-ai/mastra/commit/a89272a5d71939b9fcd284e6a6dc1dd091a6bdcf), [`ee9c8df`](https://github.com/mastra-ai/mastra/commit/ee9c8df644f19d055af5f496bf4942705f5a47b7), [`77b4a25`](https://github.com/mastra-ai/mastra/commit/77b4a254e51907f8ff3a3ba95596a18e93ae4b35), [`276246e`](https://github.com/mastra-ai/mastra/commit/276246e0b9066a1ea48bbc70df84dbe528daaf99), [`08ecfdb`](https://github.com/mastra-ai/mastra/commit/08ecfdbdad6fb8285deef86a034bdf4a6047cfca), [`d5f628c`](https://github.com/mastra-ai/mastra/commit/d5f628ca86c6f6f3ff1035d52f635df32dd81cab), [`524c0f3`](https://github.com/mastra-ai/mastra/commit/524c0f3c434c3d9d18f66338dcef383d6161b59c), [`c18a0e9`](https://github.com/mastra-ai/mastra/commit/c18a0e9cef1e4ca004b2963d35e4cfc031971eac), [`4bd21ea`](https://github.com/mastra-ai/mastra/commit/4bd21ea43d44d0a0427414fc047577f9f0aa3bec), [`115a7a4`](https://github.com/mastra-ai/mastra/commit/115a7a47db5e9896fec12ae6507501adb9ec89bf), [`22a48ae`](https://github.com/mastra-ai/mastra/commit/22a48ae2513eb54d8d79dad361fddbca97a155e8), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9311c17`](https://github.com/mastra-ai/mastra/commit/9311c17d7a0640d9c4da2e71b814dc67c57c6369), [`7edf78f`](https://github.com/mastra-ai/mastra/commit/7edf78f80422c43e84585f08ba11df0d4d0b73c5), [`1c4221c`](https://github.com/mastra-ai/mastra/commit/1c4221cf6032ec98d0e094d4ee11da3e48490d96), [`d25b9ea`](https://github.com/mastra-ai/mastra/commit/d25b9eabd400167255a97b690ffbc4ee4097ded5), [`fe1ce5c`](https://github.com/mastra-ai/mastra/commit/fe1ce5c9211c03d561606fda95cbfe7df1d9a9b5), [`b03c0e0`](https://github.com/mastra-ai/mastra/commit/b03c0e0389a799523929a458b0509c9e4244d562), [`0a8366b`](https://github.com/mastra-ai/mastra/commit/0a8366b0a692fcdde56c4d526e4cf03c502ae4ac), [`85664e9`](https://github.com/mastra-ai/mastra/commit/85664e9fd857320fbc245e301f764f45f66f32a3), [`bc79650`](https://github.com/mastra-ai/mastra/commit/bc796500c6e0334faa158a96077e3fb332274869), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`3a3a59e`](https://github.com/mastra-ai/mastra/commit/3a3a59e8ffaa6a985fe3d9a126a3f5ade11a6724), [`3108d4e`](https://github.com/mastra-ai/mastra/commit/3108d4e649c9fddbf03253a6feeb388a5fa9fa5a), [`0c33b2c`](https://github.com/mastra-ai/mastra/commit/0c33b2c9db537f815e1c59e2c898ffce2e395a79), [`191e5bd`](https://github.com/mastra-ai/mastra/commit/191e5bd29b82f5bda35243945790da7bc7b695c2), [`f77cd94`](https://github.com/mastra-ai/mastra/commit/f77cd94c44eabed490384e7d19232a865e13214c), [`e8135c7`](https://github.com/mastra-ai/mastra/commit/e8135c7e300dac5040670eec7eab896ac6092e30), [`daca48f`](https://github.com/mastra-ai/mastra/commit/daca48f0fb17b7ae0b62a2ac40cf0e491b2fd0b7), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`352f25d`](https://github.com/mastra-ai/mastra/commit/352f25da316b24cdd5b410fd8dddf6a8b763da2a), [`93477d0`](https://github.com/mastra-ai/mastra/commit/93477d0769b8a13ea5ed73d508d967fb23eaeed9), [`31c78b3`](https://github.com/mastra-ai/mastra/commit/31c78b3eb28f58a8017f1dcc795c33214d87feac), [`0bc0720`](https://github.com/mastra-ai/mastra/commit/0bc07201095791858087cc56f353fcd65e87ab54), [`36516ac`](https://github.com/mastra-ai/mastra/commit/36516aca1021cbeb42e74751b46a2614101f37c8), [`e947652`](https://github.com/mastra-ai/mastra/commit/e9476527fdecb4449e54570e80dfaf8466901254), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`ec248f6`](https://github.com/mastra-ai/mastra/commit/ec248f6b56e8a037c066c49b2178e2507471d988)]:
|
|
37
|
+
- @mastra/core@1.9.0
|
|
38
|
+
|
|
39
|
+
## 1.6.3-alpha.0
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Added atomic `updateWorkflowResults` and `updateWorkflowState` to safely merge concurrent step results into workflow snapshots. ([#12575](https://github.com/mastra-ai/mastra/pull/12575))
|
|
44
|
+
|
|
45
|
+
- Added `insertObservationalMemoryRecord()` to PostgreSQL, LibSQL, MongoDB, and Upstash adapters for OM cloning support. ([#13569](https://github.com/mastra-ai/mastra/pull/13569))
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`504fc8b`](https://github.com/mastra-ai/mastra/commit/504fc8b9d0ddab717577ad3bf9c95ea4bd5377bd), [`f9c150b`](https://github.com/mastra-ai/mastra/commit/f9c150b7595ad05ad9cc9a11098e2944361e8c22), [`88de7e8`](https://github.com/mastra-ai/mastra/commit/88de7e8dfe4b7e1951a9e441bb33136e705ce24e), [`edee4b3`](https://github.com/mastra-ai/mastra/commit/edee4b37dff0af515fc7cc0e8d71ee39e6a762f0), [`3790c75`](https://github.com/mastra-ai/mastra/commit/3790c7578cc6a47d854eb12d89e6b1912867fe29), [`e7a235b`](https://github.com/mastra-ai/mastra/commit/e7a235be6472e0c870ed6c791ddb17c492dc188b), [`d51d298`](https://github.com/mastra-ai/mastra/commit/d51d298953967aab1f58ec965b644d109214f085), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d5f0d8d`](https://github.com/mastra-ai/mastra/commit/d5f0d8d6a03e515ddaa9b5da19b7e44b8357b07b), [`09c3b18`](https://github.com/mastra-ai/mastra/commit/09c3b1802ff14e243a8a8baea327440bc8cc2e32), [`b896379`](https://github.com/mastra-ai/mastra/commit/b8963791c6afa79484645fcec596a201f936b9a2), [`85c84eb`](https://github.com/mastra-ai/mastra/commit/85c84ebb78aebfcba9d209c8e152b16d7a00cb71), [`a89272a`](https://github.com/mastra-ai/mastra/commit/a89272a5d71939b9fcd284e6a6dc1dd091a6bdcf), [`ee9c8df`](https://github.com/mastra-ai/mastra/commit/ee9c8df644f19d055af5f496bf4942705f5a47b7), [`77b4a25`](https://github.com/mastra-ai/mastra/commit/77b4a254e51907f8ff3a3ba95596a18e93ae4b35), [`276246e`](https://github.com/mastra-ai/mastra/commit/276246e0b9066a1ea48bbc70df84dbe528daaf99), [`08ecfdb`](https://github.com/mastra-ai/mastra/commit/08ecfdbdad6fb8285deef86a034bdf4a6047cfca), [`d5f628c`](https://github.com/mastra-ai/mastra/commit/d5f628ca86c6f6f3ff1035d52f635df32dd81cab), [`524c0f3`](https://github.com/mastra-ai/mastra/commit/524c0f3c434c3d9d18f66338dcef383d6161b59c), [`c18a0e9`](https://github.com/mastra-ai/mastra/commit/c18a0e9cef1e4ca004b2963d35e4cfc031971eac), [`4bd21ea`](https://github.com/mastra-ai/mastra/commit/4bd21ea43d44d0a0427414fc047577f9f0aa3bec), [`115a7a4`](https://github.com/mastra-ai/mastra/commit/115a7a47db5e9896fec12ae6507501adb9ec89bf), [`22a48ae`](https://github.com/mastra-ai/mastra/commit/22a48ae2513eb54d8d79dad361fddbca97a155e8), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9311c17`](https://github.com/mastra-ai/mastra/commit/9311c17d7a0640d9c4da2e71b814dc67c57c6369), [`7edf78f`](https://github.com/mastra-ai/mastra/commit/7edf78f80422c43e84585f08ba11df0d4d0b73c5), [`1c4221c`](https://github.com/mastra-ai/mastra/commit/1c4221cf6032ec98d0e094d4ee11da3e48490d96), [`d25b9ea`](https://github.com/mastra-ai/mastra/commit/d25b9eabd400167255a97b690ffbc4ee4097ded5), [`fe1ce5c`](https://github.com/mastra-ai/mastra/commit/fe1ce5c9211c03d561606fda95cbfe7df1d9a9b5), [`b03c0e0`](https://github.com/mastra-ai/mastra/commit/b03c0e0389a799523929a458b0509c9e4244d562), [`0a8366b`](https://github.com/mastra-ai/mastra/commit/0a8366b0a692fcdde56c4d526e4cf03c502ae4ac), [`85664e9`](https://github.com/mastra-ai/mastra/commit/85664e9fd857320fbc245e301f764f45f66f32a3), [`bc79650`](https://github.com/mastra-ai/mastra/commit/bc796500c6e0334faa158a96077e3fb332274869), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`3a3a59e`](https://github.com/mastra-ai/mastra/commit/3a3a59e8ffaa6a985fe3d9a126a3f5ade11a6724), [`3108d4e`](https://github.com/mastra-ai/mastra/commit/3108d4e649c9fddbf03253a6feeb388a5fa9fa5a), [`0c33b2c`](https://github.com/mastra-ai/mastra/commit/0c33b2c9db537f815e1c59e2c898ffce2e395a79), [`191e5bd`](https://github.com/mastra-ai/mastra/commit/191e5bd29b82f5bda35243945790da7bc7b695c2), [`f77cd94`](https://github.com/mastra-ai/mastra/commit/f77cd94c44eabed490384e7d19232a865e13214c), [`e8135c7`](https://github.com/mastra-ai/mastra/commit/e8135c7e300dac5040670eec7eab896ac6092e30), [`daca48f`](https://github.com/mastra-ai/mastra/commit/daca48f0fb17b7ae0b62a2ac40cf0e491b2fd0b7), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`352f25d`](https://github.com/mastra-ai/mastra/commit/352f25da316b24cdd5b410fd8dddf6a8b763da2a), [`93477d0`](https://github.com/mastra-ai/mastra/commit/93477d0769b8a13ea5ed73d508d967fb23eaeed9), [`31c78b3`](https://github.com/mastra-ai/mastra/commit/31c78b3eb28f58a8017f1dcc795c33214d87feac), [`0bc0720`](https://github.com/mastra-ai/mastra/commit/0bc07201095791858087cc56f353fcd65e87ab54), [`36516ac`](https://github.com/mastra-ai/mastra/commit/36516aca1021cbeb42e74751b46a2614101f37c8), [`e947652`](https://github.com/mastra-ai/mastra/commit/e9476527fdecb4449e54570e80dfaf8466901254), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`ec248f6`](https://github.com/mastra-ai/mastra/commit/ec248f6b56e8a037c066c49b2178e2507471d988)]:
|
|
48
|
+
- @mastra/core@1.9.0-alpha.0
|
|
49
|
+
|
|
50
|
+
## 1.6.2
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Fixed observation activation to always preserve a minimum amount of context. Previously, swapping buffered observation chunks could unexpectedly drop the context window to near-zero tokens. ([#13476](https://github.com/mastra-ai/mastra/pull/13476))
|
|
55
|
+
|
|
56
|
+
- Add a clear runtime error when `queryVector` is omitted for vector stores that require a vector for queries. Previously, omitting `queryVector` would produce confusing SDK-level errors; now each store throws a structured `MastraError` with `ErrorCategory.USER` explaining that metadata-only queries are not supported by that backend. ([#13286](https://github.com/mastra-ai/mastra/pull/13286))
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
|
|
59
|
+
- @mastra/core@1.8.0
|
|
60
|
+
|
|
61
|
+
## 1.6.2-alpha.0
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Fixed observation activation to always preserve a minimum amount of context. Previously, swapping buffered observation chunks could unexpectedly drop the context window to near-zero tokens. ([#13476](https://github.com/mastra-ai/mastra/pull/13476))
|
|
66
|
+
|
|
67
|
+
- Add a clear runtime error when `queryVector` is omitted for vector stores that require a vector for queries. Previously, omitting `queryVector` would produce confusing SDK-level errors; now each store throws a structured `MastraError` with `ErrorCategory.USER` explaining that metadata-only queries are not supported by that backend. ([#13286](https://github.com/mastra-ai/mastra/pull/13286))
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
|
|
70
|
+
- @mastra/core@1.8.0-alpha.0
|
|
9
71
|
|
|
10
72
|
## 1.6.1
|
|
11
73
|
|
package/LICENSE.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
Portions of this software are licensed as follows:
|
|
2
|
+
|
|
3
|
+
- All content that resides under any directory named "ee/" within this
|
|
4
|
+
repository, including but not limited to:
|
|
5
|
+
- `packages/core/src/auth/ee/`
|
|
6
|
+
- `packages/server/src/server/auth/ee/`
|
|
7
|
+
is licensed under the license defined in `ee/LICENSE`.
|
|
8
|
+
|
|
9
|
+
- All third-party components incorporated into the Mastra Software are
|
|
10
|
+
licensed under the original license provided by the owner of the
|
|
11
|
+
applicable component.
|
|
12
|
+
|
|
13
|
+
- Content outside of the above-mentioned directories or restrictions is
|
|
14
|
+
available under the "Apache License 2.0" as defined below.
|
|
15
|
+
|
|
1
16
|
# Apache License 2.0
|
|
2
17
|
|
|
3
18
|
Copyright (c) 2025 Kepler Software, Inc.
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-libsql
|
|
|
3
3
|
description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/libsql"
|
|
6
|
-
version: "0.0.0-fix-
|
|
6
|
+
version: "0.0.0-fix-windows-shell-20260306004111"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
# Agent
|
|
1
|
+
# Agent approval
|
|
2
2
|
|
|
3
|
-
Agents sometimes require the same [human-in-the-loop](https://mastra.ai/docs/workflows/human-in-the-loop) oversight used in workflows when calling tools that handle sensitive operations, like deleting resources or
|
|
3
|
+
Agents sometimes require the same [human-in-the-loop](https://mastra.ai/docs/workflows/human-in-the-loop) oversight used in workflows when calling tools that handle sensitive operations, like deleting resources or running long processes. With agent approval you can suspend a tool call before it executes so a human can approve or decline it, or let tools suspend themselves to request additional context from the user.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## How approval works
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Mastra offers two distinct mechanisms for pausing tool calls: **pre-execution approval** and **runtime suspension**.
|
|
8
|
+
|
|
9
|
+
### Pre-execution approval
|
|
10
|
+
|
|
11
|
+
Pre-execution approval pauses a tool call _before_ its `execute` function runs. The LLM still decides which tool to call and provides arguments, but `execute` doesn't run until you explicitly approve.
|
|
12
|
+
|
|
13
|
+
Two flags control this, combined with OR logic. If _either_ is `true`, the call pauses:
|
|
14
|
+
|
|
15
|
+
| Flag | Where to set it | Scope |
|
|
16
|
+
| --------------------------- | --------------------------------- | ------------------------------------------- |
|
|
17
|
+
| `requireToolApproval: true` | `stream()` / `generate()` options | Pauses **every** tool call for that request |
|
|
18
|
+
| `requireApproval: true` | `createTool()` definition | Pauses calls to **that specific tool** |
|
|
19
|
+
|
|
20
|
+
The stream emits a `tool-call-approval` chunk when a call is paused this way. You then call `approveToolCall()` or `declineToolCall()` to continue.
|
|
21
|
+
|
|
22
|
+
### Runtime suspension with `suspend()`
|
|
23
|
+
|
|
24
|
+
A tool can also pause _during_ its `execute` function by calling `suspend()`. This is useful when the tool starts running and then discovers it needs additional user input or confirmation before it can finish.
|
|
25
|
+
|
|
26
|
+
The stream emits a `tool-call-suspended` chunk with a custom payload defined by the tool's `suspendSchema`. You resume by calling `resumeStream()` with data matching the tool's `resumeSchema`.
|
|
8
27
|
|
|
9
28
|
### Storage
|
|
10
29
|
|
|
@@ -24,7 +43,7 @@ export const mastra = new Mastra({
|
|
|
24
43
|
|
|
25
44
|
## Agent-level approval
|
|
26
45
|
|
|
27
|
-
|
|
46
|
+
Pass `requireToolApproval: true` to `stream()` or `generate()` to pause every tool call before execution. The LLM still decides which tools to call and with what arguments but no tool runs until you approve or decline.
|
|
28
47
|
|
|
29
48
|
```typescript
|
|
30
49
|
const stream = await agent.stream("What's the weather in London?", {
|
|
@@ -32,9 +51,20 @@ const stream = await agent.stream("What's the weather in London?", {
|
|
|
32
51
|
})
|
|
33
52
|
```
|
|
34
53
|
|
|
54
|
+
When a tool call is paused, the stream emits a `tool-call-approval` chunk containing the `toolCallId`, `toolName`, and `args`. Use this to inspect the pending call and decide whether to approve or decline:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
for await (const chunk of stream.fullStream) {
|
|
58
|
+
if (chunk.type === 'tool-call-approval') {
|
|
59
|
+
console.log('Tool:', chunk.payload.toolName)
|
|
60
|
+
console.log('Args:', chunk.payload.args)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
35
65
|
### Approving tool calls
|
|
36
66
|
|
|
37
|
-
|
|
67
|
+
Call `approveToolCall()` on the agent with the `runId` of the stream to resume the suspended tool call and let it execute:
|
|
38
68
|
|
|
39
69
|
```typescript
|
|
40
70
|
const handleApproval = async () => {
|
|
@@ -49,7 +79,7 @@ const handleApproval = async () => {
|
|
|
49
79
|
|
|
50
80
|
### Declining tool calls
|
|
51
81
|
|
|
52
|
-
|
|
82
|
+
Call `declineToolCall()` on the agent to skip the tool call. The agent continues without executing the tool and responds accordingly:
|
|
53
83
|
|
|
54
84
|
```typescript
|
|
55
85
|
const handleDecline = async () => {
|
|
@@ -64,19 +94,19 @@ const handleDecline = async () => {
|
|
|
64
94
|
|
|
65
95
|
## Tool approval with generate()
|
|
66
96
|
|
|
67
|
-
Tool approval also works with the `generate()` method for non-streaming use cases. When
|
|
97
|
+
Tool approval also works with the `generate()` method for non-streaming use cases. When a tool requires approval during a `generate()` call, the method returns immediately instead of executing the tool.
|
|
68
98
|
|
|
69
99
|
### How it works
|
|
70
100
|
|
|
71
101
|
When a tool requires approval during a `generate()` call, the response includes:
|
|
72
102
|
|
|
73
|
-
- `finishReason: 'suspended'
|
|
74
|
-
- `suspendPayload
|
|
75
|
-
- `runId
|
|
103
|
+
- `finishReason: 'suspended'`: Indicates the agent is waiting for approval
|
|
104
|
+
- `suspendPayload`: Contains tool call details (`toolCallId`, `toolName`, `args`)
|
|
105
|
+
- `runId`: Needed to approve or decline the tool call
|
|
76
106
|
|
|
77
107
|
### Approving tool calls
|
|
78
108
|
|
|
79
|
-
|
|
109
|
+
Use `approveToolCallGenerate()` to approve the tool call and get the final result:
|
|
80
110
|
|
|
81
111
|
```typescript
|
|
82
112
|
const output = await agent.generate('Find user John', {
|
|
@@ -99,7 +129,7 @@ if (output.finishReason === 'suspended') {
|
|
|
99
129
|
|
|
100
130
|
### Declining tool calls
|
|
101
131
|
|
|
102
|
-
|
|
132
|
+
Use `declineToolCallGenerate()` to skip the tool call:
|
|
103
133
|
|
|
104
134
|
```typescript
|
|
105
135
|
if (output.finishReason === 'suspended') {
|
|
@@ -108,12 +138,12 @@ if (output.finishReason === 'suspended') {
|
|
|
108
138
|
toolCallId: output.suspendPayload.toolCallId,
|
|
109
139
|
})
|
|
110
140
|
|
|
111
|
-
// Agent
|
|
141
|
+
// Agent responds acknowledging the declined tool
|
|
112
142
|
console.log(result.text)
|
|
113
143
|
}
|
|
114
144
|
```
|
|
115
145
|
|
|
116
|
-
### Stream vs
|
|
146
|
+
### Stream vs generate comparison
|
|
117
147
|
|
|
118
148
|
| Aspect | `stream()` | `generate()` |
|
|
119
149
|
| ------------------ | ---------------------------- | ------------------------------------------------ |
|
|
@@ -125,11 +155,11 @@ if (output.finishReason === 'suspended') {
|
|
|
125
155
|
|
|
126
156
|
## Tool-level approval
|
|
127
157
|
|
|
128
|
-
|
|
158
|
+
Instead of pausing every tool call at the agent level, you can mark individual tools as requiring approval. This gives you granular control — only specific tools pause, while others execute immediately.
|
|
129
159
|
|
|
130
|
-
###
|
|
160
|
+
### Approval using `requireApproval`
|
|
131
161
|
|
|
132
|
-
|
|
162
|
+
Set `requireApproval: true` on a tool definition. The tool pauses before execution regardless of whether `requireToolApproval` is set on the agent:
|
|
133
163
|
|
|
134
164
|
```typescript
|
|
135
165
|
export const testTool = createTool({
|
|
@@ -154,30 +184,30 @@ export const testTool = createTool({
|
|
|
154
184
|
})
|
|
155
185
|
```
|
|
156
186
|
|
|
157
|
-
When `requireApproval` is true
|
|
187
|
+
When `requireApproval` is `true`, the stream emits `tool-call-approval` chunks the same way agent-level approval does. Use `approveToolCall()` or `declineToolCall()` to continue:
|
|
158
188
|
|
|
159
189
|
```typescript
|
|
160
190
|
const stream = await agent.stream("What's the weather in London?")
|
|
161
191
|
|
|
162
192
|
for await (const chunk of stream.fullStream) {
|
|
163
193
|
if (chunk.type === 'tool-call-approval') {
|
|
164
|
-
console.log('Approval required.
|
|
194
|
+
console.log('Approval required for:', chunk.payload.toolName)
|
|
165
195
|
}
|
|
166
196
|
}
|
|
167
197
|
|
|
168
|
-
const
|
|
169
|
-
const
|
|
198
|
+
const handleApproval = async () => {
|
|
199
|
+
const approvedStream = await agent.approveToolCall({ runId: stream.runId })
|
|
170
200
|
|
|
171
|
-
for await (const chunk of
|
|
201
|
+
for await (const chunk of approvedStream.textStream) {
|
|
172
202
|
process.stdout.write(chunk)
|
|
173
203
|
}
|
|
174
204
|
process.stdout.write('\n')
|
|
175
205
|
}
|
|
176
206
|
```
|
|
177
207
|
|
|
178
|
-
###
|
|
208
|
+
### Approval using `suspend`
|
|
179
209
|
|
|
180
|
-
With this approach, neither the agent nor the tool uses `requireApproval`. Instead, the tool
|
|
210
|
+
With this approach, neither the agent nor the tool uses `requireApproval`. Instead, the tool's `execute` function calls `suspend` to pause at a specific point and return context or confirmation prompts to the user. This is useful when approval depends on runtime conditions rather than being unconditional.
|
|
181
211
|
|
|
182
212
|
```typescript
|
|
183
213
|
export const testToolB = createTool({
|
|
@@ -210,7 +240,7 @@ export const testToolB = createTool({
|
|
|
210
240
|
})
|
|
211
241
|
```
|
|
212
242
|
|
|
213
|
-
With this approach the stream
|
|
243
|
+
With this approach the stream includes a `tool-call-suspended` chunk, and the `suspendPayload` contains the `reason` defined by the tool's `suspendSchema`. Call `resumeStream` with the `resumeSchema` data and `runId` to continue:
|
|
214
244
|
|
|
215
245
|
```typescript
|
|
216
246
|
const stream = await agent.stream("What's the weather in London?")
|
|
@@ -349,7 +379,7 @@ User: "San Francisco"
|
|
|
349
379
|
Agent: "The weather in San Francisco is: San Francisco: ☀️ +72°F"
|
|
350
380
|
```
|
|
351
381
|
|
|
352
|
-
The second message automatically resumes the suspended tool
|
|
382
|
+
The second message automatically resumes the suspended tool, the agent extracts `{ city: "San Francisco" }` from the user's message and passes it as `resumeData`.
|
|
353
383
|
|
|
354
384
|
### Requirements
|
|
355
385
|
|
|
@@ -368,6 +398,187 @@ For automatic tool resumption to work:
|
|
|
368
398
|
|
|
369
399
|
Both approaches work with the same tool definitions. Automatic resumption triggers only when suspended tools exist in the message history and the user sends a new message on the same thread.
|
|
370
400
|
|
|
401
|
+
## Tool approval: Supervisor pattern
|
|
402
|
+
|
|
403
|
+
The [supervisor pattern](https://mastra.ai/docs/agents/networks) lets a supervisor agent coordinate multiple subagents using `.stream()` or `.generate()`. The supervisor delegates tasks to subagents, which may use tools that require approval. When this happens, tool approvals properly propagate through the delegation chain — the approval request surfaces at the supervisor level where you can handle it, regardless of which subagent triggered it.
|
|
404
|
+
|
|
405
|
+
### How it works
|
|
406
|
+
|
|
407
|
+
1. The supervisor agent delegates a task to a subagent.
|
|
408
|
+
2. The subagent calls a tool that has `requireApproval: true` or uses `suspend()`.
|
|
409
|
+
3. The approval request bubbles up through the delegation chain to the supervisor.
|
|
410
|
+
4. You handle the approval or decline at the supervisor level.
|
|
411
|
+
5. The decision propagates back down to the subagent, which continues or terminates accordingly.
|
|
412
|
+
|
|
413
|
+
### Example
|
|
414
|
+
|
|
415
|
+
The following example creates a subagent with a database lookup tool that requires approval. The supervisor delegates to this subagent, and when the tool triggers an approval request, it surfaces in the supervisor's stream as a `tool-call-approval` chunk. You then approve the tool call using `approveToolCall` with the stream's `runId`.
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
import { Agent } from '@mastra/core/agent'
|
|
419
|
+
import { createTool } from '@mastra/core/tools'
|
|
420
|
+
import { Memory } from '@mastra/memory'
|
|
421
|
+
import { z } from 'zod'
|
|
422
|
+
|
|
423
|
+
// subagent with approval-required tool
|
|
424
|
+
const findUserTool = createTool({
|
|
425
|
+
id: 'find-user',
|
|
426
|
+
description: 'Finds user by ID in the database',
|
|
427
|
+
inputSchema: z.object({
|
|
428
|
+
userId: z.string(),
|
|
429
|
+
}),
|
|
430
|
+
outputSchema: z.object({
|
|
431
|
+
user: z.object({
|
|
432
|
+
id: z.string(),
|
|
433
|
+
name: z.string(),
|
|
434
|
+
email: z.string(),
|
|
435
|
+
}),
|
|
436
|
+
}),
|
|
437
|
+
requireApproval: true, // Requires approval before execution
|
|
438
|
+
execute: async input => {
|
|
439
|
+
const user = await database.findUser(input.userId)
|
|
440
|
+
return { user }
|
|
441
|
+
},
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
const dataAgent = new Agent({
|
|
445
|
+
id: 'data-agent',
|
|
446
|
+
name: 'Data Agent',
|
|
447
|
+
description: 'Handles database queries and user data retrieval',
|
|
448
|
+
model: 'openai/gpt-4o-mini',
|
|
449
|
+
tools: { findUserTool },
|
|
450
|
+
})
|
|
451
|
+
|
|
452
|
+
const supervisorAgent = new Agent({
|
|
453
|
+
id: 'supervisor',
|
|
454
|
+
name: 'Supervisor Agent',
|
|
455
|
+
instructions: `You coordinate data retrieval tasks.
|
|
456
|
+
Delegate to data-agent for user lookups.`,
|
|
457
|
+
model: 'openai/gpt-5.1',
|
|
458
|
+
agents: { dataAgent },
|
|
459
|
+
memory: new Memory(),
|
|
460
|
+
})
|
|
461
|
+
|
|
462
|
+
// When supervisor delegates to dataAgent and tool requires approval
|
|
463
|
+
const stream = await supervisorAgent.stream('Find user with ID 12345')
|
|
464
|
+
|
|
465
|
+
for await (const chunk of stream.fullStream) {
|
|
466
|
+
if (chunk.type === 'tool-call-approval') {
|
|
467
|
+
console.log('Tool requires approval:', chunk.payload.toolName)
|
|
468
|
+
console.log('Arguments:', chunk.payload.args)
|
|
469
|
+
|
|
470
|
+
// Approve the tool call
|
|
471
|
+
const resumeStream = await supervisorAgent.approveToolCall({
|
|
472
|
+
runId: stream.runId,
|
|
473
|
+
toolCallId: chunk.payload.toolCallId,
|
|
474
|
+
})
|
|
475
|
+
|
|
476
|
+
// Process resumed stream
|
|
477
|
+
for await (const resumeChunk of resumeStream.textStream) {
|
|
478
|
+
process.stdout.write(resumeChunk)
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Declining tool calls in supervisor pattern
|
|
485
|
+
|
|
486
|
+
Decline tool calls at the supervisor level by calling `declineToolCall`. The supervisor responds acknowledging the declined tool without executing it:
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
for await (const chunk of stream.fullStream) {
|
|
490
|
+
if (chunk.type === 'tool-call-approval') {
|
|
491
|
+
console.log('Declining tool call:', chunk.payload.toolName)
|
|
492
|
+
|
|
493
|
+
// Decline the tool call
|
|
494
|
+
const declineStream = await supervisorAgent.declineToolCall({
|
|
495
|
+
runId: stream.runId,
|
|
496
|
+
toolCallId: chunk.payload.toolCallId,
|
|
497
|
+
})
|
|
498
|
+
|
|
499
|
+
// The supervisor responds acknowledging the declined tool
|
|
500
|
+
for await (const declineChunk of declineStream.textStream) {
|
|
501
|
+
process.stdout.write(declineChunk)
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Using suspend() in supervisor pattern
|
|
508
|
+
|
|
509
|
+
Tools can also use [`suspend()`](#approval-using-suspend) to pause execution and return context to the user. This approach works through the supervisor delegation chain the same way `requireApproval` does — the suspension surfaces at the supervisor level:
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
const conditionalTool = createTool({
|
|
513
|
+
id: 'conditional-operation',
|
|
514
|
+
description: 'Performs an operation that may require confirmation',
|
|
515
|
+
inputSchema: z.object({
|
|
516
|
+
operation: z.string(),
|
|
517
|
+
}),
|
|
518
|
+
suspendSchema: z.object({
|
|
519
|
+
message: z.string(),
|
|
520
|
+
}),
|
|
521
|
+
resumeSchema: z.object({
|
|
522
|
+
confirmed: z.boolean(),
|
|
523
|
+
}),
|
|
524
|
+
execute: async (input, context) => {
|
|
525
|
+
const { resumeData } = context?.agent ?? {}
|
|
526
|
+
|
|
527
|
+
if (!resumeData?.confirmed) {
|
|
528
|
+
return context?.agent?.suspend({
|
|
529
|
+
message: `Confirm: ${input.operation}?`,
|
|
530
|
+
})
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Proceed with operation
|
|
534
|
+
return await performOperation(input.operation)
|
|
535
|
+
},
|
|
536
|
+
})
|
|
537
|
+
|
|
538
|
+
// When using this tool through a subagent in supervisor pattern
|
|
539
|
+
for await (const chunk of stream.fullStream) {
|
|
540
|
+
if (chunk.type === 'tool-call-suspended') {
|
|
541
|
+
console.log('Tool suspended:', chunk.payload.suspendPayload.message)
|
|
542
|
+
|
|
543
|
+
// Resume with confirmation
|
|
544
|
+
const resumeStream = await supervisorAgent.resumeStream(
|
|
545
|
+
{ confirmed: true },
|
|
546
|
+
{ runId: stream.runId },
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
for await (const resumeChunk of resumeStream.textStream) {
|
|
550
|
+
process.stdout.write(resumeChunk)
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Tool approval with generate()
|
|
557
|
+
|
|
558
|
+
Tool approval propagation also works with `generate()` in supervisor pattern:
|
|
559
|
+
|
|
560
|
+
```typescript
|
|
561
|
+
const output = await supervisorAgent.generate('Find user with ID 12345', {
|
|
562
|
+
maxSteps: 10,
|
|
563
|
+
})
|
|
564
|
+
|
|
565
|
+
if (output.finishReason === 'suspended') {
|
|
566
|
+
console.log('Tool requires approval:', output.suspendPayload.toolName)
|
|
567
|
+
|
|
568
|
+
// Approve
|
|
569
|
+
const result = await supervisorAgent.approveToolCallGenerate({
|
|
570
|
+
runId: output.runId,
|
|
571
|
+
toolCallId: output.suspendPayload.toolCallId,
|
|
572
|
+
})
|
|
573
|
+
|
|
574
|
+
console.log('Final result:', result.text)
|
|
575
|
+
}
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### Multi-level delegation
|
|
579
|
+
|
|
580
|
+
Tool approvals propagate through multiple levels of delegation. For example, if a supervisor delegates to subagent A, which in turn delegates to subagent B that has a tool with `requireApproval: true`, the approval request still surfaces at the top-level supervisor. You handle the approval or decline there, and the result flows back down through the entire delegation chain to the tool that requested it.
|
|
581
|
+
|
|
371
582
|
## Related
|
|
372
583
|
|
|
373
584
|
- [Using Tools](https://mastra.ai/docs/agents/using-tools)
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Agent Networks
|
|
2
2
|
|
|
3
|
+
> **Supervisor Pattern Recommended:** The [supervisor pattern](https://mastra.ai/docs/agents/supervisor-agents) using `agent.stream()` or `agent.generate()` is now the recommended approach for coordinating multiple agents. It provides the same multi-agent coordination capabilities as `.network()` with significant improvements:
|
|
4
|
+
>
|
|
5
|
+
> - **Better control**: Iteration hooks, delegation hooks, and task completion scoring give you fine-grained control over execution
|
|
6
|
+
> - **Simpler API**: Uses familiar `stream()` and `generate()` methods instead of a separate `.network()` API
|
|
7
|
+
> - **More flexible**: Stop execution early, modify delegations, filter context, and provide feedback to guide the agent
|
|
8
|
+
> - **Type-safe**: Full TypeScript support for all hooks and callbacks
|
|
9
|
+
> - **Easier debugging**: Monitor progress with `onIterationComplete`, track delegations with `onDelegationStart`/`onDelegationComplete`
|
|
10
|
+
>
|
|
11
|
+
> See the [migration guide](https://mastra.ai/guides/migrations/network-to-supervisor) to upgrade from `.network()`.
|
|
12
|
+
|
|
3
13
|
Agent networks in Mastra coordinate multiple agents, workflows, and tools to handle tasks that aren't clearly defined upfront but can be inferred from the user's message or context. A top-level **routing agent** (a Mastra agent with other agents, workflows, and tools configured) uses an LLM to interpret the request and decide which primitives (subagents, workflows, or tools) to call, in what order, and with what data.
|
|
4
14
|
|
|
5
15
|
## When to use networks
|
|
@@ -280,7 +290,10 @@ const final = await stream.object
|
|
|
280
290
|
|
|
281
291
|
## Related
|
|
282
292
|
|
|
293
|
+
- [Supervisor Agents](https://mastra.ai/docs/agents/supervisor-agents)
|
|
294
|
+
- [Migration: .network() to Supervisor Pattern](https://mastra.ai/guides/migrations/network-to-supervisor)
|
|
295
|
+
- [Guide: Research Coordinator](https://mastra.ai/guides/guide/research-coordinator)
|
|
283
296
|
- [Agent Memory](https://mastra.ai/docs/agents/agent-memory)
|
|
297
|
+
- [Agent Approval](https://mastra.ai/docs/agents/agent-approval)
|
|
284
298
|
- [Workflows Overview](https://mastra.ai/docs/workflows/overview)
|
|
285
|
-
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
286
|
-
- [Supervisor example](https://github.com/mastra-ai/mastra/tree/main/examples/supervisor-agent)
|
|
299
|
+
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
@@ -147,8 +147,24 @@ Supported embedding models:
|
|
|
147
147
|
|
|
148
148
|
- **OpenAI**: `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`
|
|
149
149
|
- **Google**: `gemini-embedding-001`
|
|
150
|
+
- **OpenRouter**: Access embedding models from various providers
|
|
150
151
|
|
|
151
|
-
|
|
152
|
+
```ts
|
|
153
|
+
import { Agent } from '@mastra/core/agent'
|
|
154
|
+
import { Memory } from '@mastra/memory'
|
|
155
|
+
import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
|
|
156
|
+
|
|
157
|
+
const agent = new Agent({
|
|
158
|
+
memory: new Memory({
|
|
159
|
+
embedder: new ModelRouterEmbeddingModel({
|
|
160
|
+
providerId: 'openrouter',
|
|
161
|
+
modelId: 'openai/text-embedding-3-small',
|
|
162
|
+
}),
|
|
163
|
+
}),
|
|
164
|
+
})
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The model router automatically handles API key detection from environment variables (`OPENAI_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`, `OPENROUTER_API_KEY`).
|
|
152
168
|
|
|
153
169
|
### Using AI SDK Packages
|
|
154
170
|
|
|
@@ -16,11 +16,11 @@ const thread = await memory.createThread({
|
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
**key
|
|
19
|
+
**key** (`TMemoryKey extends keyof TMemory`): The registry key of the memory instance to retrieve. Must match a key used when registering memory in the Mastra constructor.
|
|
20
20
|
|
|
21
21
|
## Returns
|
|
22
22
|
|
|
23
|
-
**memory
|
|
23
|
+
**memory** (`TMemory[TMemoryKey]`): The memory instance with the specified key. Throws an error if the memory is not found.
|
|
24
24
|
|
|
25
25
|
## Example: Registering and Retrieving Memory
|
|
26
26
|
|
|
@@ -18,7 +18,7 @@ This method takes no parameters.
|
|
|
18
18
|
|
|
19
19
|
## Returns
|
|
20
20
|
|
|
21
|
-
**memory
|
|
21
|
+
**memory** (`Record<string, MastraMemory>`): An object containing all registered memory instances, keyed by their registry keys.
|
|
22
22
|
|
|
23
23
|
## Example: Checking Registered Memory
|
|
24
24
|
|