@mastra/memory 0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260720232722 → 0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150
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 +60 -3
- package/dist/docs/SKILL.md +6 -6
- package/dist/docs/assets/SOURCE_MAP.json +3 -205
- package/dist/docs/references/docs-agents-agent-approval.md +85 -11
- package/dist/docs/references/docs-agents-networks.md +2 -2
- package/dist/docs/references/docs-agents-supervisor-agents.md +19 -13
- package/dist/docs/references/docs-evals-evals-with-memory.md +4 -4
- package/dist/docs/references/docs-long-running-agents-background-tasks.md +10 -10
- package/dist/docs/references/docs-long-running-agents-goals.md +18 -12
- package/dist/docs/references/docs-memory-memory-processors.md +10 -10
- package/dist/docs/references/docs-memory-message-history.md +29 -5
- package/dist/docs/references/docs-memory-multi-user-threads.md +6 -6
- package/dist/docs/references/docs-memory-observational-memory.md +27 -25
- package/dist/docs/references/docs-memory-overview.md +10 -10
- package/dist/docs/references/docs-memory-semantic-recall.md +3 -3
- package/dist/docs/references/docs-memory-working-memory.md +8 -8
- package/dist/docs/references/docs-storage-overview.md +2 -2
- package/dist/docs/references/reference-memory-clone-utilities.md +1 -1
- package/dist/docs/references/reference-memory-cloneThread.md +3 -3
- package/dist/docs/references/reference-memory-listThreads.md +1 -1
- package/dist/docs/references/reference-memory-memory-class.md +5 -5
- package/dist/docs/references/reference-memory-observational-memory.md +15 -15
- package/dist/docs/references/reference-memory-summarizeConversation.md +3 -3
- package/dist/docs/references/reference-memory-summarizeThread.md +3 -3
- package/dist/docs/references/reference-processors-token-limiter-processor.md +5 -7
- package/dist/docs/references/reference-storage-dsql.md +3 -3
- package/dist/docs/references/reference-storage-dynamodb.md +7 -7
- package/dist/docs/references/reference-storage-mongodb.md +2 -2
- package/dist/docs/references/reference-storage-postgresql.md +2 -2
- package/dist/docs/references/reference-storage-redis.md +1 -1
- package/dist/docs/references/reference-storage-upstash.md +1 -1
- package/dist/docs/references/reference-vectors-libsql.md +2 -2
- package/dist/docs/references/reference-vectors-mongodb.md +188 -7
- package/dist/docs/references/reference-vectors-pg.md +5 -5
- package/dist/docs/references/reference-vectors-upstash.md +1 -1
- package/dist/index.cjs +30 -72
- package/dist/index.d.ts +2 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/processors/index.cjs +32 -129
- package/dist/processors/index.js +2 -4
- package/dist/src-Ci_GvBVm.js +28106 -0
- package/dist/src-Ci_GvBVm.js.map +1 -0
- package/dist/src-VD6qMn-H.cjs +28360 -0
- package/dist/src-VD6qMn-H.cjs.map +1 -0
- package/package.json +15 -14
- package/dist/chunk-43FJOLKM.cjs +0 -108
- package/dist/chunk-43FJOLKM.cjs.map +0 -1
- package/dist/chunk-BHNJWTWU.cjs +0 -31496
- package/dist/chunk-BHNJWTWU.cjs.map +0 -1
- package/dist/chunk-D4J4XPGM.cjs +0 -111
- package/dist/chunk-D4J4XPGM.cjs.map +0 -1
- package/dist/chunk-EGRHWZRV.js +0 -3
- package/dist/chunk-EGRHWZRV.js.map +0 -1
- package/dist/chunk-LSJJAJAF.js +0 -105
- package/dist/chunk-LSJJAJAF.js.map +0 -1
- package/dist/chunk-NKIQRCOM.cjs +0 -4
- package/dist/chunk-NKIQRCOM.cjs.map +0 -1
- package/dist/chunk-WCGXQIEN.js +0 -103
- package/dist/chunk-WCGXQIEN.js.map +0 -1
- package/dist/chunk-ZVJFY7RZ.js +0 -31429
- package/dist/chunk-ZVJFY7RZ.js.map +0 -1
- package/dist/constants-RMCTOZE3.js +0 -3
- package/dist/constants-RMCTOZE3.js.map +0 -1
- package/dist/constants-ZEKSZ4UM.cjs +0 -28
- package/dist/constants-ZEKSZ4UM.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/observational-memory-JWRLDIIB.cjs +0 -129
- package/dist/observational-memory-JWRLDIIB.cjs.map +0 -1
- package/dist/observational-memory-WEMT6UPS.js +0 -4
- package/dist/observational-memory-WEMT6UPS.js.map +0 -1
- package/dist/processors/index.cjs.map +0 -1
- package/dist/processors/index.js.map +0 -1
- package/dist/working-memory-state-LDPWYVCG.cjs +0 -24
- package/dist/working-memory-state-LDPWYVCG.cjs.map +0 -1
- package/dist/working-memory-state-OMSMSYAW.js +0 -3
- package/dist/working-memory-state-OMSMSYAW.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-thread-subscription-multi-instance-redis-streams-
|
|
3
|
+
## 0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c5e56ff`](https://github.com/mastra-ai/mastra/commit/c5e56ff3bcabdf062708f2d48744fec304df6792), [`7f4e26d`](https://github.com/mastra-ai/mastra/commit/7f4e26dd57bd9b23c278ea21235ab823a3810a6c), [`322daa6`](https://github.com/mastra-ai/mastra/commit/322daa6d90552909204044790d850958f6745fed), [`cadaa13`](https://github.com/mastra-ai/mastra/commit/cadaa1372e1077c8e85eb64c5499ba8803caa323), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c), [`06000d7`](https://github.com/mastra-ai/mastra/commit/06000d73712911572e913b8a83339270296d0a22), [`cf24430`](https://github.com/mastra-ai/mastra/commit/cf24430226a6ecb104bc1d54d6e401defd7cb53f), [`4e35a56`](https://github.com/mastra-ai/mastra/commit/4e35a56cdf8d74a5ff6d5eda01f2c1deaf6cc7be), [`3de0188`](https://github.com/mastra-ai/mastra/commit/3de0188bfaf9a9c09c95fe322b53838cf52c70b6), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c)]:
|
|
8
|
+
- @mastra/core@0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150
|
|
9
|
+
|
|
10
|
+
## 1.24.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- Added exact metadata filtering to message history queries across Memory APIs and supported storage providers. ([#19991](https://github.com/mastra-ai/mastra/pull/19991))
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
const messages = await memory.recall({
|
|
18
|
+
threadId: 'thread-1',
|
|
19
|
+
filter: {
|
|
20
|
+
metadata: {
|
|
21
|
+
status: 'done',
|
|
22
|
+
priority: 'high',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Multiple fields use AND semantics. Supported values are strings, finite numbers, booleans, and `null`.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`ce93a3c`](https://github.com/mastra-ai/mastra/commit/ce93a3c114ea1cbfbd576f3db41d7c26c9844f5b), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`a211d09`](https://github.com/mastra-ai/mastra/commit/a211d09185dc65a746534914cf38b67f21ee9bac), [`0dca9d0`](https://github.com/mastra-ai/mastra/commit/0dca9d0b1356024a53b72ea6f040db528b126caa), [`6218217`](https://github.com/mastra-ai/mastra/commit/62182171b6cfca0b099f1c6a77a2e65e7639ab86), [`5807d3a`](https://github.com/mastra-ai/mastra/commit/5807d3ae1d259b8b7d6df7e5bf2b485c694af9c8), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`05db566`](https://github.com/mastra-ai/mastra/commit/05db566fcbdcbf33d0bffca0c72ec30129e2e3ca), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`d1b7e3a`](https://github.com/mastra-ai/mastra/commit/d1b7e3a978a309a5653eeaa490d2d6c7c53bd093), [`29c584a`](https://github.com/mastra-ai/mastra/commit/29c584a13a88831e5ed1fdeb0ff8e82eae180433), [`c093146`](https://github.com/mastra-ai/mastra/commit/c0931466404d3c521308ea119cb165bb7e695155), [`8124754`](https://github.com/mastra-ai/mastra/commit/8124754ae89fbc69f8136d1df4a91904d0f84c4e), [`d12b2e4`](https://github.com/mastra-ai/mastra/commit/d12b2e4023fd9e3d3e93a9169f5088bcee2a849c)]:
|
|
33
|
+
- @mastra/core@1.54.0
|
|
34
|
+
|
|
35
|
+
## 1.24.0-alpha.0
|
|
36
|
+
|
|
37
|
+
### Minor Changes
|
|
38
|
+
|
|
39
|
+
- Added exact metadata filtering to message history queries across Memory APIs and supported storage providers. ([#19991](https://github.com/mastra-ai/mastra/pull/19991))
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
const messages = await memory.recall({
|
|
43
|
+
threadId: 'thread-1',
|
|
44
|
+
filter: {
|
|
45
|
+
metadata: {
|
|
46
|
+
status: 'done',
|
|
47
|
+
priority: 'high',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Multiple fields use AND semantics. Supported values are strings, finite numbers, booleans, and `null`.
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`0dca9d0`](https://github.com/mastra-ai/mastra/commit/0dca9d0b1356024a53b72ea6f040db528b126caa)]:
|
|
58
|
+
- @mastra/core@1.54.0-alpha.0
|
|
59
|
+
|
|
60
|
+
## 1.23.1
|
|
4
61
|
|
|
5
62
|
### Patch Changes
|
|
6
63
|
|
|
@@ -8,8 +65,8 @@
|
|
|
8
65
|
|
|
9
66
|
- Updated the async-buffering compatibility error to include `@mastra/convex` in the list of storage adapters that support Observational Memory. ([#19474](https://github.com/mastra-ai/mastra/pull/19474))
|
|
10
67
|
|
|
11
|
-
- Updated dependencies [[`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`1426af2`](https://github.com/mastra-ai/mastra/commit/1426af24975879c000d13ac75673f630fcc970c1), [`a40adeb`](https://github.com/mastra-ai/mastra/commit/a40adeb222b961a56a58af56a106106525721b74), [`8a0d145`](https://github.com/mastra-ai/mastra/commit/8a0d145aadbdf7278665aceaaec364b35dd9bd94), [`bd2f1d2`](https://github.com/mastra-ai/mastra/commit/bd2f1d274d05e60e2366f005ea0d94d5cea0d5ff), [`e1f2fae`](https://github.com/mastra-ai/mastra/commit/e1f2faebaf048c3d4c2e2c01d293767c195d5794), [`63aa799`](https://github.com/mastra-ai/mastra/commit/63aa799c6b44eacc7806cda6846b7c5bbee06b37), [`b7e79c3`](https://github.com/mastra-ai/mastra/commit/b7e79c3c02ac5cd415db34ba0975ceafc1464333), [`21a0eb8`](https://github.com/mastra-ai/mastra/commit/21a0eb86746ba0b703acea360d4f84c6a5a493f2), [`8b20926`](https://github.com/mastra-ai/mastra/commit/8b20926cd59e2ba3d66458e062fa0e6e2ada3e68), [`975295d`](https://github.com/mastra-ai/mastra/commit/975295d418552f0d46a59edfef4c3ee555f9930a), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`4cfdd64`](https://github.com/mastra-ai/mastra/commit/4cfdd645794feaea0c4ea711e70ecdfbef0c5b8e), [`b75d749`](https://github.com/mastra-ai/mastra/commit/b75d749621ff5d17e86bcb4ee809d301fb4f7cf3), [`821648b`](https://github.com/mastra-ai/mastra/commit/821648bf2871ef840100c7bacbecf676010bd12a), [`de86fd7`](https://github.com/mastra-ai/mastra/commit/de86fd7119f0438381d1a642e3d258143c0b9c29), [`2745031`](https://github.com/mastra-ai/mastra/commit/2745031d1d4a4978f037092da371428c32e2842a), [`74faf8b`](https://github.com/mastra-ai/mastra/commit/74faf8bd9c1018f2492653c06b1e25fc8300e9e6), [`
|
|
12
|
-
- @mastra/core@
|
|
68
|
+
- Updated dependencies [[`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`d7385ad`](https://github.com/mastra-ai/mastra/commit/d7385ad9e88f9e4f33d15c0ec0bfebedde0cbc2e), [`41a5392`](https://github.com/mastra-ai/mastra/commit/41a5392d9f6c5e18d6b227f0fc0ddf49c50774e9), [`3d6e539`](https://github.com/mastra-ai/mastra/commit/3d6e539272eb2ea0407034605ee1906b3be06b39), [`1426af2`](https://github.com/mastra-ai/mastra/commit/1426af24975879c000d13ac75673f630fcc970c1), [`a40adeb`](https://github.com/mastra-ai/mastra/commit/a40adeb222b961a56a58af56a106106525721b74), [`8a0d145`](https://github.com/mastra-ai/mastra/commit/8a0d145aadbdf7278665aceaaec364b35dd9bd94), [`bd2f1d2`](https://github.com/mastra-ai/mastra/commit/bd2f1d274d05e60e2366f005ea0d94d5cea0d5ff), [`e1f2fae`](https://github.com/mastra-ai/mastra/commit/e1f2faebaf048c3d4c2e2c01d293767c195d5794), [`63aa799`](https://github.com/mastra-ai/mastra/commit/63aa799c6b44eacc7806cda6846b7c5bbee06b37), [`b7e79c3`](https://github.com/mastra-ai/mastra/commit/b7e79c3c02ac5cd415db34ba0975ceafc1464333), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`da009e1`](https://github.com/mastra-ai/mastra/commit/da009e1aacd89ed94b8d1b2af09c9d4fe7c4db49), [`3b77e77`](https://github.com/mastra-ai/mastra/commit/3b77e7704936522e4769d29de1b5ea6901f302bd), [`c7d30cd`](https://github.com/mastra-ai/mastra/commit/c7d30cd86009c407df91105591f03cd6e3d2854d), [`21a0eb8`](https://github.com/mastra-ai/mastra/commit/21a0eb86746ba0b703acea360d4f84c6a5a493f2), [`8b20926`](https://github.com/mastra-ai/mastra/commit/8b20926cd59e2ba3d66458e062fa0e6e2ada3e68), [`975295d`](https://github.com/mastra-ai/mastra/commit/975295d418552f0d46a59edfef4c3ee555f9930a), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`6b1bf3b`](https://github.com/mastra-ai/mastra/commit/6b1bf3b9494bd51aa8f654c68c9355d6046fa2a1), [`35c2181`](https://github.com/mastra-ai/mastra/commit/35c2181e6a50e47c90ba36260db7c9723d54696f), [`0a2c22c`](https://github.com/mastra-ai/mastra/commit/0a2c22c902604439ec490319e14c17f331e0c84c), [`4cfdd64`](https://github.com/mastra-ai/mastra/commit/4cfdd645794feaea0c4ea711e70ecdfbef0c5b8e), [`b75d749`](https://github.com/mastra-ai/mastra/commit/b75d749621ff5d17e86bcb4ee809d301fb4f7cf3), [`821648b`](https://github.com/mastra-ai/mastra/commit/821648bf2871ef840100c7bacbecf676010bd12a), [`de86fd7`](https://github.com/mastra-ai/mastra/commit/de86fd7119f0438381d1a642e3d258143c0b9c29), [`2745031`](https://github.com/mastra-ai/mastra/commit/2745031d1d4a4978f037092da371428c32e2842a), [`b4b7ea8`](https://github.com/mastra-ai/mastra/commit/b4b7ea8733f033fc441ea47ed03f6afb17ec2248), [`3a8024c`](https://github.com/mastra-ai/mastra/commit/3a8024ce615f8aa89479c0d71fe61d10bb0040be), [`35865a5`](https://github.com/mastra-ai/mastra/commit/35865a53e194aa9634d6a70a97010e7a6b9d58b1), [`74faf8b`](https://github.com/mastra-ai/mastra/commit/74faf8bd9c1018f2492653c06b1e25fc8300e9e6), [`ef03fbc`](https://github.com/mastra-ai/mastra/commit/ef03fbcc556bcbc04c9b3d06fab88771ecaa043c), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`70687f7`](https://github.com/mastra-ai/mastra/commit/70687f7e495a322a02070b4a67cb0c77a5ca91ec), [`1fadac4`](https://github.com/mastra-ai/mastra/commit/1fadac44537caeefe81f9f775ae2f2f3d94e9069), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`76b7181`](https://github.com/mastra-ai/mastra/commit/76b71810366e6d90b9d3973149d1c7ba3659ffb9), [`792ec9a`](https://github.com/mastra-ai/mastra/commit/792ec9a0869bab8274cf5e0ed2840738737a1607), [`712b864`](https://github.com/mastra-ai/mastra/commit/712b864aa1ed12b14c54390ec17b69de163c37f7), [`85e4fb5`](https://github.com/mastra-ai/mastra/commit/85e4fb50087a81c74df3a762f53b56373db0b912), [`0c0e8d7`](https://github.com/mastra-ai/mastra/commit/0c0e8d7becd4d1445c656b78d5d845f606c1ff9d), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`72e437c`](https://github.com/mastra-ai/mastra/commit/72e437c515942c80b9def5b026e0bdee61b469d9), [`8f7a5de`](https://github.com/mastra-ai/mastra/commit/8f7a5dedc246cdc938bb65516703cf9b27b03756), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`11f6cd9`](https://github.com/mastra-ai/mastra/commit/11f6cd96fe42582403416608beb212cc1a2cc79e), [`ef03c0c`](https://github.com/mastra-ai/mastra/commit/ef03c0cfc62367a458e4cc56462e2148b35681c5), [`4fb4d88`](https://github.com/mastra-ai/mastra/commit/4fb4d881bc107acee13890ad4d78661016c510ed), [`4e68363`](https://github.com/mastra-ai/mastra/commit/4e683634f94ebd062d26a3bb6093a8dfc7263d37), [`c328769`](https://github.com/mastra-ai/mastra/commit/c3287698ff8ef98dba86d415faa566fa3e5f4d56), [`9f7c67a`](https://github.com/mastra-ai/mastra/commit/9f7c67abeeb52c41c51a9b5edee60b62afe7cd8d), [`3b65e68`](https://github.com/mastra-ai/mastra/commit/3b65e68d7f1c771c7a70eea42d83fefdd28cad88), [`4eba27a`](https://github.com/mastra-ai/mastra/commit/4eba27adcf60f991df0e62f94b3e75b4e67f3b4b), [`c701be3`](https://github.com/mastra-ai/mastra/commit/c701be32d7d9aa94a66da8c6cc38dcac6856f464), [`db650ce`](https://github.com/mastra-ai/mastra/commit/db650ce490348914e85b93651d83acdf8f2a4c31), [`232fcbc`](https://github.com/mastra-ai/mastra/commit/232fcbc14fce625dd672ba043329c0b732c62be2), [`6354eeb`](https://github.com/mastra-ai/mastra/commit/6354eeb32efa9f5f68f51dda394e90e2ee76f1fb), [`a8799bb`](https://github.com/mastra-ai/mastra/commit/a8799bb8e44f4a60d01e4e2acd3448ff80bf14f8), [`3d6e539`](https://github.com/mastra-ai/mastra/commit/3d6e539272eb2ea0407034605ee1906b3be06b39), [`e3868e2`](https://github.com/mastra-ai/mastra/commit/e3868e22babfffd0133771669ca724501c2dd58e), [`9251370`](https://github.com/mastra-ai/mastra/commit/9251370ad413af464aa22d7566338bec5613e8de), [`3491666`](https://github.com/mastra-ai/mastra/commit/34916663c4fdd43b48c21f4ab2d5fb6dcccc94f9), [`c0bec73`](https://github.com/mastra-ai/mastra/commit/c0bec732c93d1a22ae5e51ed66cf8cacca8bd6a6)]:
|
|
69
|
+
- @mastra/core@1.52.0
|
|
13
70
|
|
|
14
71
|
## 1.23.1-alpha.1
|
|
15
72
|
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-memory
|
|
|
3
3
|
description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/memory"
|
|
6
|
-
version: "0.0.0-fix-thread-subscription-multi-instance-redis-streams-
|
|
6
|
+
version: "0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -16,11 +16,11 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
16
16
|
|
|
17
17
|
### Docs
|
|
18
18
|
|
|
19
|
-
- [Agent approval](references/docs-agents-agent-approval.md) - Learn how to require approvals
|
|
19
|
+
- [Agent approval](references/docs-agents-agent-approval.md) - Learn how to require approvals and suspend tool execution, plus automatically resume suspended tools while keeping humans in control of agent workflows.
|
|
20
20
|
- [Agent networks](references/docs-agents-networks.md) - Coordinate multiple agents, workflows, and tools using agent networks for complex, non-deterministic task execution.
|
|
21
21
|
- [Supervisor agents](references/docs-agents-supervisor-agents.md) - Learn how to coordinate multiple agents with delegation hooks, iteration monitoring, message filtering, and task completion scoring.
|
|
22
|
-
- [Evals with memory](references/docs-evals-evals-with-memory.md) - Run scorers against memory-enabled agents
|
|
23
|
-
- [Background tasks](references/docs-long-running-agents-background-tasks.md) - Learn how to dispatch long-running tool calls in the background
|
|
22
|
+
- [Evals with memory](references/docs-evals-evals-with-memory.md) - Run scorers against memory-enabled agents, including observational memory in thread scope, using runEvals and dataset experiments.
|
|
23
|
+
- [Background tasks](references/docs-long-running-agents-background-tasks.md) - Learn how to dispatch long-running tool calls in the background and keep the stream open until they complete, plus orchestrate subagents asynchronously.
|
|
24
24
|
- [Goals](references/docs-long-running-agents-goals.md) - Learn how to set a durable objective on an agent that's judged in the execution loop, so the agent keeps working until the goal is complete or the run budget is exhausted.
|
|
25
25
|
- [Memory processors](references/docs-memory-memory-processors.md) - Learn how to use memory processors in Mastra to filter, trim, and transform messages before they're sent to the language model to manage context window limits.
|
|
26
26
|
- [Message history](references/docs-memory-message-history.md) - Learn how to configure message history in Mastra to store recent messages from the current conversation.
|
|
@@ -41,8 +41,8 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
41
41
|
- [Reference: Memory.createThread()](references/reference-memory-createThread.md) - Documentation for the `Memory.createThread()` method in Mastra, which creates a new conversation thread in the memory system.
|
|
42
42
|
- [Reference: Memory.getThreadById()](references/reference-memory-getThreadById.md) - Documentation for the `Memory.getThreadById()` method in Mastra, which retrieves a specific thread by its ID.
|
|
43
43
|
- [Reference: Memory.listThreads()](references/reference-memory-listThreads.md) - Documentation for the `Memory.listThreads()` method in Mastra, which retrieves threads with optional filtering by resourceId and/or metadata.
|
|
44
|
-
- [Reference: Memory class](references/reference-memory-memory-class.md) - Documentation for the `Memory` class in Mastra, which provides a
|
|
45
|
-
- [Reference: Observational Memory](references/reference-memory-observational-memory.md) - API reference for Observational Memory in Mastra
|
|
44
|
+
- [Reference: Memory class](references/reference-memory-memory-class.md) - Documentation for the `Memory` class in Mastra, which provides a reliable system for managing conversation history and thread-based message storage.
|
|
45
|
+
- [Reference: Observational Memory](references/reference-memory-observational-memory.md) - API reference for Observational Memory in Mastra: a three-tier memory system that uses Observer and Reflector agents to maintain long-term memory across conversations.
|
|
46
46
|
- [Reference: summarizeConversation()](references/reference-memory-summarizeConversation.md) - Documentation for the standalone `summarizeConversation()` function in Mastra, which summarizes messages you pass in and extracts structured values from them.
|
|
47
47
|
- [Reference: Memory.summarizeThread()](references/reference-memory-summarizeThread.md) - Documentation for the `Memory.summarizeThread()` method in Mastra, which summarizes a thread's conversation in one shot and extracts structured values from it.
|
|
48
48
|
- [Reference: TokenLimiterProcessor](references/reference-processors-token-limiter-processor.md) - Documentation for the TokenLimiterProcessor in Mastra, which limits the number of tokens in messages.
|
|
@@ -1,213 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.0-fix-thread-subscription-multi-instance-redis-streams-
|
|
2
|
+
"version": "0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150",
|
|
3
3
|
"package": "@mastra/memory",
|
|
4
|
-
"exports": {
|
|
5
|
-
"Extractor": {
|
|
6
|
-
"types": "dist/processors/index.d.ts",
|
|
7
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
8
|
-
"line": 316
|
|
9
|
-
},
|
|
10
|
-
"ModelByInputTokens": {
|
|
11
|
-
"types": "dist/processors/index.d.ts",
|
|
12
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
13
|
-
"line": 1354
|
|
14
|
-
},
|
|
15
|
-
"OBSERVER_SYSTEM_PROMPT": {
|
|
16
|
-
"types": "dist/processors/index.d.ts",
|
|
17
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js"
|
|
18
|
-
},
|
|
19
|
-
"ObservationalMemory": {
|
|
20
|
-
"types": "dist/processors/index.d.ts",
|
|
21
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
22
|
-
"line": 28549
|
|
23
|
-
},
|
|
24
|
-
"ObservationalMemoryProcessor": {
|
|
25
|
-
"types": "dist/processors/index.d.ts",
|
|
26
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
27
|
-
"line": 31183
|
|
28
|
-
},
|
|
29
|
-
"TokenCounter": {
|
|
30
|
-
"types": "dist/processors/index.d.ts",
|
|
31
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
32
|
-
"line": 22331
|
|
33
|
-
},
|
|
34
|
-
"WorkingMemoryExtractor": {
|
|
35
|
-
"types": "dist/processors/index.d.ts",
|
|
36
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
37
|
-
"line": 22998
|
|
38
|
-
},
|
|
39
|
-
"buildObserverPrompt": {
|
|
40
|
-
"types": "dist/processors/index.d.ts",
|
|
41
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
42
|
-
"line": 4504
|
|
43
|
-
},
|
|
44
|
-
"buildObserverSystemPrompt": {
|
|
45
|
-
"types": "dist/processors/index.d.ts",
|
|
46
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
47
|
-
"line": 3771
|
|
48
|
-
},
|
|
49
|
-
"combineObservationGroupRanges": {
|
|
50
|
-
"types": "dist/processors/index.d.ts",
|
|
51
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
52
|
-
"line": 1446
|
|
53
|
-
},
|
|
54
|
-
"deriveObservationGroupProvenance": {
|
|
55
|
-
"types": "dist/processors/index.d.ts",
|
|
56
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
57
|
-
"line": 1480
|
|
58
|
-
},
|
|
59
|
-
"extractCurrentTask": {
|
|
60
|
-
"types": "dist/processors/index.d.ts",
|
|
61
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
62
|
-
"line": 4627
|
|
63
|
-
},
|
|
64
|
-
"formatMessagesForObserver": {
|
|
65
|
-
"types": "dist/processors/index.d.ts",
|
|
66
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
67
|
-
"line": 4226
|
|
68
|
-
},
|
|
69
|
-
"getObservationsAsOf": {
|
|
70
|
-
"types": "dist/processors/index.d.ts",
|
|
71
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
72
|
-
"line": 31405
|
|
73
|
-
},
|
|
74
|
-
"hasCurrentTaskSection": {
|
|
75
|
-
"types": "dist/processors/index.d.ts",
|
|
76
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
77
|
-
"line": 4615
|
|
78
|
-
},
|
|
79
|
-
"injectAnchorIds": {
|
|
80
|
-
"types": "dist/processors/index.d.ts",
|
|
81
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
82
|
-
"line": 3326
|
|
83
|
-
},
|
|
84
|
-
"optimizeObservationsForContext": {
|
|
85
|
-
"types": "dist/processors/index.d.ts",
|
|
86
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
87
|
-
"line": 4638
|
|
88
|
-
},
|
|
89
|
-
"parseAnchorId": {
|
|
90
|
-
"types": "dist/processors/index.d.ts",
|
|
91
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
92
|
-
"line": 3299
|
|
93
|
-
},
|
|
94
|
-
"parseObservationGroups": {
|
|
95
|
-
"types": "dist/processors/index.d.ts",
|
|
96
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
97
|
-
"line": 1415
|
|
98
|
-
},
|
|
99
|
-
"parseObserverOutput": {
|
|
100
|
-
"types": "dist/processors/index.d.ts",
|
|
101
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
102
|
-
"line": 4518
|
|
103
|
-
},
|
|
104
|
-
"reconcileObservationGroupsFromReflection": {
|
|
105
|
-
"types": "dist/processors/index.d.ts",
|
|
106
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
107
|
-
"line": 1504
|
|
108
|
-
},
|
|
109
|
-
"renderObservationGroupsForReflection": {
|
|
110
|
-
"types": "dist/processors/index.d.ts",
|
|
111
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
112
|
-
"line": 1460
|
|
113
|
-
},
|
|
114
|
-
"stripEphemeralAnchorIds": {
|
|
115
|
-
"types": "dist/processors/index.d.ts",
|
|
116
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
117
|
-
"line": 3356
|
|
118
|
-
},
|
|
119
|
-
"stripObservationGroups": {
|
|
120
|
-
"types": "dist/processors/index.d.ts",
|
|
121
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
122
|
-
"line": 1437
|
|
123
|
-
},
|
|
124
|
-
"summarizeConversation": {
|
|
125
|
-
"types": "dist/processors/index.d.ts",
|
|
126
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js"
|
|
127
|
-
},
|
|
128
|
-
"wrapInObservationGroup": {
|
|
129
|
-
"types": "dist/processors/index.d.ts",
|
|
130
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
131
|
-
"line": 1408
|
|
132
|
-
},
|
|
133
|
-
"OBSERVATIONAL_MEMORY_DEFAULTS": {
|
|
134
|
-
"types": "dist/processors/index.d.ts",
|
|
135
|
-
"implementation": "dist/chunk-LSJJAJAF.js"
|
|
136
|
-
},
|
|
137
|
-
"OBSERVATION_CONTEXT_INSTRUCTIONS": {
|
|
138
|
-
"types": "dist/processors/index.d.ts",
|
|
139
|
-
"implementation": "dist/chunk-LSJJAJAF.js"
|
|
140
|
-
},
|
|
141
|
-
"OBSERVATION_CONTEXT_PROMPT": {
|
|
142
|
-
"types": "dist/processors/index.d.ts",
|
|
143
|
-
"implementation": "dist/chunk-LSJJAJAF.js"
|
|
144
|
-
},
|
|
145
|
-
"OBSERVATION_CONTINUATION_HINT": {
|
|
146
|
-
"types": "dist/processors/index.d.ts",
|
|
147
|
-
"implementation": "dist/chunk-LSJJAJAF.js"
|
|
148
|
-
},
|
|
149
|
-
"Memory": {
|
|
150
|
-
"types": "dist/index.d.ts",
|
|
151
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
152
|
-
"line": 24423
|
|
153
|
-
},
|
|
154
|
-
"MessageHistory": {
|
|
155
|
-
"types": "dist/index.d.ts",
|
|
156
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js"
|
|
157
|
-
},
|
|
158
|
-
"SUMMARIZE_THREAD_DEFAULTS": {
|
|
159
|
-
"types": "dist/index.d.ts",
|
|
160
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js"
|
|
161
|
-
},
|
|
162
|
-
"SemanticRecall": {
|
|
163
|
-
"types": "dist/index.d.ts",
|
|
164
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js"
|
|
165
|
-
},
|
|
166
|
-
"WorkingMemory": {
|
|
167
|
-
"types": "dist/index.d.ts",
|
|
168
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js"
|
|
169
|
-
},
|
|
170
|
-
"deepMergeWorkingMemory": {
|
|
171
|
-
"types": "dist/index.d.ts",
|
|
172
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
173
|
-
"line": 24062
|
|
174
|
-
},
|
|
175
|
-
"extractWorkingMemoryContent": {
|
|
176
|
-
"types": "dist/index.d.ts",
|
|
177
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
178
|
-
"line": 24378
|
|
179
|
-
},
|
|
180
|
-
"extractWorkingMemoryTags": {
|
|
181
|
-
"types": "dist/index.d.ts",
|
|
182
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
183
|
-
"line": 24346
|
|
184
|
-
},
|
|
185
|
-
"removeWorkingMemoryTags": {
|
|
186
|
-
"types": "dist/index.d.ts",
|
|
187
|
-
"implementation": "dist/chunk-ZVJFY7RZ.js",
|
|
188
|
-
"line": 24359
|
|
189
|
-
},
|
|
190
|
-
"WORKING_MEMORY_STATE_ID": {
|
|
191
|
-
"types": "dist/index.d.ts",
|
|
192
|
-
"implementation": "dist/chunk-WCGXQIEN.js"
|
|
193
|
-
},
|
|
194
|
-
"WORKING_MEMORY_STATE_PROCESSOR_ID": {
|
|
195
|
-
"types": "dist/index.d.ts",
|
|
196
|
-
"implementation": "dist/chunk-WCGXQIEN.js"
|
|
197
|
-
},
|
|
198
|
-
"WorkingMemoryStateProcessor": {
|
|
199
|
-
"types": "dist/index.d.ts",
|
|
200
|
-
"implementation": "dist/chunk-WCGXQIEN.js",
|
|
201
|
-
"line": 7
|
|
202
|
-
}
|
|
203
|
-
},
|
|
4
|
+
"exports": {},
|
|
204
5
|
"modules": {
|
|
205
6
|
"processors": {
|
|
206
7
|
"index": "dist/processors/index.js",
|
|
207
|
-
"chunks": [
|
|
208
|
-
"chunk-ZVJFY7RZ.js",
|
|
209
|
-
"chunk-LSJJAJAF.js"
|
|
210
|
-
]
|
|
8
|
+
"chunks": []
|
|
211
9
|
}
|
|
212
10
|
}
|
|
213
11
|
}
|
|
@@ -6,7 +6,7 @@ Agents sometimes require the same [human-in-the-loop](https://mastra.ai/docs/wor
|
|
|
6
6
|
|
|
7
7
|
## When to use agent approval
|
|
8
8
|
|
|
9
|
-
- **Destructive or irreversible actions** such as deleting records
|
|
9
|
+
- **Destructive or irreversible actions** such as deleting records or sending emails, or alternatively processing payments.
|
|
10
10
|
- **Cost-heavy operations** like calling expensive third-party APIs where you want to verify arguments first.
|
|
11
11
|
- **Conditional confirmation** where a tool starts executing and then discovers it needs the user to confirm or supply extra data before finishing.
|
|
12
12
|
|
|
@@ -60,7 +60,7 @@ Mastra offers two distinct mechanisms for pausing tool calls: **pre-execution ap
|
|
|
60
60
|
|
|
61
61
|
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.
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
The flags control this, combined with OR logic. If _either_ is `true`, the call pauses:
|
|
64
64
|
|
|
65
65
|
| Flag | Where to set it | Scope |
|
|
66
66
|
| --------------------------- | --------------------------------- | ------------------------------------------- |
|
|
@@ -92,7 +92,7 @@ for await (const chunk of stream.fullStream) {
|
|
|
92
92
|
|
|
93
93
|
#### Conditional approval with a function
|
|
94
94
|
|
|
95
|
-
Instead of a boolean, `requireToolApproval` accepts a function that decides per tool call. It receives the `toolName`, the `args` the model passed, the `requestContext`, and the `workspace`. Return `true` to require approval for that call, or `false` to allow it. This lets you gate approval
|
|
95
|
+
Instead of a boolean, `requireToolApproval` accepts a function that decides per tool call. It receives the `toolName`, the `args` the model passed, the `requestContext`, and the `workspace`. Return `true` to require approval for that call, or `false` to allow it. This lets you gate approval at runtime, for example, only for tools whose name matches a pattern:
|
|
96
96
|
|
|
97
97
|
```typescript
|
|
98
98
|
const stream = await agent.stream('Clean up old records', {
|
|
@@ -100,10 +100,82 @@ const stream = await agent.stream('Clean up old records', {
|
|
|
100
100
|
})
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
A tool's own `requireApproval` setting
|
|
103
|
+
A tool's own `requireApproval` setting takes precedence over the function above. Its rule decides whether that tool needs approval. If the function throws, the call requires approval as a fail-safe.
|
|
104
104
|
|
|
105
105
|
> **Note:** Function-based `requireToolApproval` is only available on regular `stream()` / `generate()` calls. Durable agents and stored agents persist their options, and a function can't be serialized, so they accept only a boolean. If you pass a function in those contexts it falls back to requiring approval for every tool call.
|
|
106
106
|
|
|
107
|
+
#### Bind approval to the exact tool arguments
|
|
108
|
+
|
|
109
|
+
For sensitive tools, bind the approval to the exact tool name and arguments that were shown to the reviewer. If those arguments drift before execution, the tool shouldn't run under the old approval.
|
|
110
|
+
|
|
111
|
+
The `tool-call-approval` chunk already includes `toolName`, `toolCallId`, and `args`. You can fingerprint those fields when the approval request is shown. The example below uses a simple JSON string as the fingerprint, but in production you should use a stable hash of the tool name and arguments:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { Agent } from '@mastra/core/agent'
|
|
115
|
+
|
|
116
|
+
// For your production usecase, build a stable hash of the tool name and args
|
|
117
|
+
function actionFingerprint(toolName: string, args: unknown) {
|
|
118
|
+
const payload = JSON.stringify({ toolName, args })
|
|
119
|
+
return `fingerprint-${payload}`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const sensitiveTools = new Set(['issue_refund', 'delete_record'])
|
|
123
|
+
const approvedFingerprints = new Set<string>()
|
|
124
|
+
|
|
125
|
+
export const approvalBoundAgent = new Agent({
|
|
126
|
+
id: 'approval-bound-agent',
|
|
127
|
+
name: 'Approval Bound Agent',
|
|
128
|
+
model: 'openai/gpt-5.6-sol',
|
|
129
|
+
tools: { issueRefundTool, deleteRecordTool },
|
|
130
|
+
hooks: {
|
|
131
|
+
beforeToolCall: ({ toolName, input }) => {
|
|
132
|
+
if (!sensitiveTools.has(toolName)) return
|
|
133
|
+
|
|
134
|
+
const fingerprint = actionFingerprint(toolName, input)
|
|
135
|
+
if (!approvedFingerprints.delete(fingerprint)) {
|
|
136
|
+
return {
|
|
137
|
+
proceed: false,
|
|
138
|
+
output: `Tool call blocked: approval did not match ${toolName} arguments.`,
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
const stream = await approvalBoundAgent.stream('Refund order ord-1042', {
|
|
148
|
+
requireToolApproval: ({ toolName }) => sensitiveTools.has(toolName),
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
async function consumeApprovalStream(currentStream: typeof stream) {
|
|
152
|
+
for await (const chunk of currentStream.fullStream) {
|
|
153
|
+
if (chunk.type === 'tool-call-approval') {
|
|
154
|
+
const { toolName, toolCallId, args } = chunk.payload
|
|
155
|
+
const fingerprint = actionFingerprint(toolName, args)
|
|
156
|
+
|
|
157
|
+
// Present toolName, args, and fingerprint to your approval UI.
|
|
158
|
+
const approved = await showApprovalDialog({ toolName, args, fingerprint })
|
|
159
|
+
|
|
160
|
+
const nextStream = approved
|
|
161
|
+
? await approveReviewedToolCall(currentStream.runId, toolCallId, fingerprint)
|
|
162
|
+
: await approvalBoundAgent.declineToolCall({ runId: currentStream.runId, toolCallId })
|
|
163
|
+
|
|
164
|
+
await consumeApprovalStream(nextStream)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async function approveReviewedToolCall(runId: string, toolCallId: string, fingerprint: string) {
|
|
170
|
+
approvedFingerprints.add(fingerprint)
|
|
171
|
+
return approvalBoundAgent.approveToolCall({ runId, toolCallId })
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
await consumeApprovalStream(stream)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
In production, store the approved fingerprint in durable storage scoped to the user, run, tool call, and policy version. The `Set` above is intentionally small so the boundary is easy to see: the approval is consumed once, and only for the same canonical tool arguments that were reviewed.
|
|
178
|
+
|
|
107
179
|
### Runtime suspension with `suspend()`
|
|
108
180
|
|
|
109
181
|
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.
|
|
@@ -133,7 +205,7 @@ const weatherTool = createTool({
|
|
|
133
205
|
})
|
|
134
206
|
```
|
|
135
207
|
|
|
136
|
-
> **Note:** `suspend()` doesn't throw
|
|
208
|
+
> **Note:** `suspend()` doesn't throw, return immediately after calling it (e.g. `return await suspend({ ... })`). Code after `await suspend(...)` still runs before the tool pauses.
|
|
137
209
|
|
|
138
210
|
## Tool approval with `generate()`
|
|
139
211
|
|
|
@@ -172,11 +244,11 @@ if (output.finishReason === 'suspended') {
|
|
|
172
244
|
| Decline method | `declineToolCall({ runId })` | `declineToolCallGenerate({ runId, toolCallId })` |
|
|
173
245
|
| Result | Stream to iterate | Full output object |
|
|
174
246
|
|
|
175
|
-
> **Note:** `toolCallId` is optional on all four methods. Pass it when multiple tool calls may be pending
|
|
247
|
+
> **Note:** `toolCallId` is optional on all four methods. Pass it when multiple tool calls may be pending (common in supervisor agents). When omitted, the agent resumes the most recent suspended tool call.
|
|
176
248
|
|
|
177
249
|
## Tool-level approval
|
|
178
250
|
|
|
179
|
-
Instead of pausing every tool call at the agent level, you can mark individual tools as requiring approval.
|
|
251
|
+
Instead of pausing every tool call at the agent level, you can mark individual tools as requiring approval. You get fine-grained control: only specific tools pause, while others execute immediately.
|
|
180
252
|
|
|
181
253
|
### Approval using `requireApproval`
|
|
182
254
|
|
|
@@ -303,7 +375,9 @@ const agent = new Agent({
|
|
|
303
375
|
})
|
|
304
376
|
```
|
|
305
377
|
|
|
306
|
-
When enabled, the agent detects suspended tools from message history on the next user message
|
|
378
|
+
When enabled, the agent detects suspended tools from message history on the next user message. It extracts `resumeData` based on the tool's `resumeSchema`, then automatically resumes the tool.
|
|
379
|
+
|
|
380
|
+
The following example shows a complete conversational flow:
|
|
307
381
|
|
|
308
382
|
```typescript
|
|
309
383
|
import { createTool } from '@mastra/core/tools'
|
|
@@ -386,7 +460,7 @@ Both approaches work with the same tool definitions. Automatic resumption trigge
|
|
|
386
460
|
|
|
387
461
|
## Resuming after a restart
|
|
388
462
|
|
|
389
|
-
The examples above hold on to `stream.runId` between suspension and approval. That works while the process stays alive, but in production the approval often arrives later
|
|
463
|
+
The examples above hold on to `stream.runId` between suspension and approval. That works while the process stays alive, but in production the approval often arrives later, after a page refresh, a server restart, or on a different server instance behind a load balancer.
|
|
390
464
|
|
|
391
465
|
Use [`listSuspendedRuns()`](https://mastra.ai/reference/agents/listSuspendedRuns) to rediscover the pending run for a conversation from storage:
|
|
392
466
|
|
|
@@ -414,7 +488,7 @@ if (run && toolCall) {
|
|
|
414
488
|
}
|
|
415
489
|
```
|
|
416
490
|
|
|
417
|
-
Each returned run includes the suspended tool calls (`toolCallId`, `toolName`, `args`, and `requiresApproval`). Approval suspensions (`requiresApproval: true`) are answered with `approveToolCall()` / `declineToolCall()`, while `suspend()`-based suspensions carry their `suspendPayload` and expect `resumeStream()` with resume data
|
|
491
|
+
Each returned run includes the suspended tool calls (`toolCallId`, `toolName`, `args`, and `requiresApproval`). Approval suspensions (`requiresApproval: true`) are answered with `approveToolCall()` / `declineToolCall()`, while `suspend()`-based suspensions carry their `suspendPayload` and expect `resumeStream()` with resume data, so you can rebuild the right UI for either flow without keeping any state in memory.
|
|
418
492
|
|
|
419
493
|
`sendToolApproval()` uses the same storage-backed discovery automatically: when no active run is found in memory for the thread, it looks up the suspended run in storage before failing. If several suspended runs match the thread, pass a `toolCallId` to disambiguate.
|
|
420
494
|
|
|
@@ -477,7 +551,7 @@ const supervisorAgent = new Agent({
|
|
|
477
551
|
name: 'Supervisor Agent',
|
|
478
552
|
instructions: `You coordinate data retrieval tasks.
|
|
479
553
|
Delegate to data-agent for user lookups.`,
|
|
480
|
-
model: 'openai/gpt-5.
|
|
554
|
+
model: 'openai/gpt-5.6-sol',
|
|
481
555
|
agents: { dataAgent },
|
|
482
556
|
memory: new Memory(),
|
|
483
557
|
})
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Agent networks
|
|
4
4
|
|
|
5
|
-
> **Deprecated
|
|
5
|
+
> **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/agents/supervisor-agents) using `agent.stream()` or `agent.generate()` are now the recommended approach. It provides the same multi-agent coordination with better control, a simpler API, and easier debugging.
|
|
6
6
|
>
|
|
7
7
|
> See the [migration guide](https://mastra.ai/guides/migrations/network-to-supervisor) to upgrade.
|
|
8
8
|
|
|
@@ -29,7 +29,7 @@ export const routingAgent = new Agent({
|
|
|
29
29
|
name: 'Routing Agent',
|
|
30
30
|
instructions: `
|
|
31
31
|
You are a network of writers and researchers. The user will ask you to research a topic. Always respond with a complete report—no bullet points. Write in full paragraphs, like a blog post. Do not answer with incomplete or uncertain information.`,
|
|
32
|
-
model: 'openai/gpt-5.
|
|
32
|
+
model: 'openai/gpt-5.6-sol',
|
|
33
33
|
agents: {
|
|
34
34
|
researchAgent,
|
|
35
35
|
writingAgent,
|