@mastra/memory 1.39.0 → 1.39.1-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/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +56 -56
- package/dist/docs/references/docs-agents-human-in-the-loop.md +18 -5
- package/dist/docs/references/docs-agents-networks.md +1 -1
- package/dist/docs/references/docs-guides-context-engineering.md +13 -6
- package/dist/docs/references/docs-harness-background-tasks.md +3 -3
- package/dist/docs/references/docs-harness-goals.md +5 -5
- package/dist/docs/references/docs-memory-memory-processors.md +7 -7
- package/dist/docs/references/docs-memory-message-history.md +5 -5
- package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +14 -14
- package/dist/docs/references/docs-memory-semantic-recall.md +2 -2
- package/dist/docs/references/docs-memory-working-memory.md +2 -2
- package/dist/docs/references/docs-signals-overview.md +94 -0
- package/dist/docs/references/docs-storage.md +1 -1
- package/dist/docs/references/docs-subagents.md +6 -6
- package/dist/docs/references/integrations-channels-github.md +2 -2
- package/dist/docs/references/integrations-databases-aurora-dsql.md +1 -1
- package/dist/docs/references/integrations-databases-elasticsearch.md +1 -1
- package/dist/docs/references/integrations-databases-mongodb.md +1 -1
- package/dist/docs/references/integrations-databases-oracledb.md +1 -1
- package/dist/docs/references/integrations-databases-postgresql.md +1 -1
- package/dist/docs/references/integrations-databases-redis.md +1 -1
- package/dist/docs/references/integrations-databases-upstash.md +1 -1
- package/dist/docs/references/reference-memory-memory-class.md +3 -3
- package/dist/docs/references/reference-memory-observational-memory.md +16 -16
- 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-migrations-agentnetwork.md +4 -4
- package/dist/docs/references/reference-processors-token-limiter-processor.md +4 -4
- package/dist/docs/references/reference-vectors-libsql.md +1 -1
- package/dist/docs/references/reference-vectors-mongodb.md +2 -2
- package/dist/docs/references/reference-vectors-oracledb.md +2 -2
- package/dist/docs/references/reference-vectors-pg.md +1 -1
- package/dist/docs/references/reference-vectors-upstash.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/persistence-projection.test-utils.d.ts +3 -0
- package/dist/persistence-projection.test-utils.d.ts.map +1 -0
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/measure-image-buffer.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-turn/step.d.ts +7 -0
- package/dist/processors/observational-memory/observation-turn/step.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-turn/turn.d.ts +0 -6
- package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts +1 -0
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/{src-DxZ7N8nO.js → src-BUWL69LT.js} +129 -31
- package/dist/{src-DxZ7N8nO.js.map → src-BUWL69LT.js.map} +1 -1
- package/dist/{src-IWcrqO0n.cjs → src-BjH9gT88.cjs} +129 -31
- package/dist/{src-IWcrqO0n.cjs.map → src-BjH9gT88.cjs.map} +1 -1
- package/package.json +10 -10
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: "1.39.
|
|
6
|
+
version: "1.39.1-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -29,6 +29,7 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
29
29
|
- [Memory](references/docs-memory-overview.md) - Add memory to Mastra agents with message history, semantic recall, working memory, and observational memory across threads and multi-agent delegation.
|
|
30
30
|
- [Semantic recall](references/docs-memory-semantic-recall.md) - Retrieve relevant messages from past Mastra conversations with semantic recall, vector search, embeddings, metadata filters, and configurable storage.
|
|
31
31
|
- [Working memory](references/docs-memory-working-memory.md) - Persist user profiles, preferences, and application data with Mastra working memory using resource- or thread-scoped templates and storage adapters.
|
|
32
|
+
- [Signals](references/docs-signals-overview.md) - Send asynchronous input into a Mastra agent thread while Mastra manages whether the agent is active or idle.
|
|
32
33
|
- [Storage](references/docs-storage.md) - Configure Mastra storage to persist memory, workflow state, observability data, evals, schedules, and long-running agent state across restarts.
|
|
33
34
|
- [Subagents](references/docs-subagents.md) - Build Mastra supervisor agents that delegate work to specialized subagents with hooks, request context, message filtering, and completion scoring.
|
|
34
35
|
|
|
@@ -1,229 +1,229 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.39.
|
|
2
|
+
"version": "1.39.1-alpha.1",
|
|
3
3
|
"package": "@mastra/memory",
|
|
4
4
|
"exports": {
|
|
5
5
|
"d": {
|
|
6
6
|
"types": "dist/processors/index.d.ts",
|
|
7
|
-
"implementation": "dist/src-
|
|
7
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
8
8
|
},
|
|
9
9
|
"et": {
|
|
10
10
|
"types": "dist/processors/index.d.ts",
|
|
11
|
-
"implementation": "dist/src-
|
|
11
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
12
12
|
},
|
|
13
13
|
"K": {
|
|
14
14
|
"types": "dist/processors/index.d.ts",
|
|
15
|
-
"implementation": "dist/src-
|
|
15
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
16
16
|
},
|
|
17
17
|
"Y": {
|
|
18
18
|
"types": "dist/processors/index.d.ts",
|
|
19
|
-
"implementation": "dist/src-
|
|
19
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
20
20
|
},
|
|
21
21
|
"z": {
|
|
22
22
|
"types": "dist/processors/index.d.ts",
|
|
23
|
-
"implementation": "dist/src-
|
|
23
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
24
24
|
},
|
|
25
25
|
"B": {
|
|
26
26
|
"types": "dist/processors/index.d.ts",
|
|
27
|
-
"implementation": "dist/src-
|
|
27
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
28
28
|
},
|
|
29
29
|
"V": {
|
|
30
30
|
"types": "dist/processors/index.d.ts",
|
|
31
|
-
"implementation": "dist/src-
|
|
31
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
32
32
|
},
|
|
33
33
|
"H": {
|
|
34
34
|
"types": "dist/processors/index.d.ts",
|
|
35
|
-
"implementation": "dist/src-
|
|
35
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
36
36
|
},
|
|
37
37
|
"U": {
|
|
38
38
|
"types": "dist/processors/index.d.ts",
|
|
39
|
-
"implementation": "dist/src-
|
|
39
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
40
40
|
},
|
|
41
41
|
"O": {
|
|
42
42
|
"types": "dist/processors/index.d.ts",
|
|
43
|
-
"implementation": "dist/src-
|
|
43
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
44
44
|
},
|
|
45
45
|
"u": {
|
|
46
46
|
"types": "dist/processors/index.d.ts",
|
|
47
|
-
"implementation": "dist/src-
|
|
47
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
48
48
|
},
|
|
49
49
|
"l": {
|
|
50
50
|
"types": "dist/processors/index.d.ts",
|
|
51
|
-
"implementation": "dist/src-
|
|
51
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
52
52
|
},
|
|
53
53
|
"X": {
|
|
54
54
|
"types": "dist/processors/index.d.ts",
|
|
55
|
-
"implementation": "dist/src-
|
|
55
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
56
56
|
},
|
|
57
57
|
"q": {
|
|
58
58
|
"types": "dist/processors/index.d.ts",
|
|
59
|
-
"implementation": "dist/src-
|
|
59
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
60
60
|
},
|
|
61
61
|
"G": {
|
|
62
62
|
"types": "dist/processors/index.d.ts",
|
|
63
|
-
"implementation": "dist/src-
|
|
63
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
64
64
|
},
|
|
65
65
|
"J": {
|
|
66
66
|
"types": "dist/processors/index.d.ts",
|
|
67
|
-
"implementation": "dist/src-
|
|
67
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
68
68
|
},
|
|
69
69
|
"D": {
|
|
70
70
|
"types": "dist/processors/index.d.ts",
|
|
71
|
-
"implementation": "dist/src-
|
|
71
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
72
72
|
},
|
|
73
73
|
"C": {
|
|
74
74
|
"types": "dist/processors/index.d.ts",
|
|
75
|
-
"implementation": "dist/src-
|
|
75
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
76
76
|
},
|
|
77
77
|
"k": {
|
|
78
78
|
"types": "dist/processors/index.d.ts",
|
|
79
|
-
"implementation": "dist/src-
|
|
79
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
80
80
|
},
|
|
81
81
|
"A": {
|
|
82
82
|
"types": "dist/processors/index.d.ts",
|
|
83
|
-
"implementation": "dist/src-
|
|
83
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
84
84
|
},
|
|
85
85
|
"Z": {
|
|
86
86
|
"types": "dist/processors/index.d.ts",
|
|
87
|
-
"implementation": "dist/src-
|
|
87
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
88
88
|
},
|
|
89
89
|
"g": {
|
|
90
90
|
"types": "dist/processors/index.d.ts",
|
|
91
|
-
"implementation": "dist/src-
|
|
91
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
92
92
|
},
|
|
93
93
|
"_": {
|
|
94
94
|
"types": "dist/processors/index.d.ts",
|
|
95
|
-
"implementation": "dist/src-
|
|
95
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
96
96
|
},
|
|
97
97
|
"j": {
|
|
98
98
|
"types": "dist/processors/index.d.ts",
|
|
99
|
-
"implementation": "dist/src-
|
|
99
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
100
100
|
},
|
|
101
101
|
"M": {
|
|
102
102
|
"types": "dist/processors/index.d.ts",
|
|
103
|
-
"implementation": "dist/src-
|
|
103
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
104
104
|
},
|
|
105
105
|
"W": {
|
|
106
106
|
"types": "dist/processors/index.d.ts",
|
|
107
|
-
"implementation": "dist/src-
|
|
107
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
108
108
|
},
|
|
109
109
|
"c": {
|
|
110
110
|
"types": "dist/processors/index.d.ts",
|
|
111
|
-
"implementation": "dist/src-
|
|
111
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
112
112
|
},
|
|
113
113
|
"N": {
|
|
114
114
|
"types": "dist/processors/index.d.ts",
|
|
115
|
-
"implementation": "dist/src-
|
|
115
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
116
116
|
},
|
|
117
117
|
"I": {
|
|
118
118
|
"types": "dist/processors/index.d.ts",
|
|
119
|
-
"implementation": "dist/src-
|
|
119
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
120
120
|
},
|
|
121
121
|
"P": {
|
|
122
122
|
"types": "dist/processors/index.d.ts",
|
|
123
|
-
"implementation": "dist/src-
|
|
123
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
124
124
|
},
|
|
125
125
|
"L": {
|
|
126
126
|
"types": "dist/processors/index.d.ts",
|
|
127
|
-
"implementation": "dist/src-
|
|
127
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
128
128
|
},
|
|
129
129
|
"v": {
|
|
130
130
|
"types": "dist/processors/index.d.ts",
|
|
131
|
-
"implementation": "dist/src-
|
|
131
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
132
132
|
},
|
|
133
133
|
"F": {
|
|
134
134
|
"types": "dist/processors/index.d.ts",
|
|
135
|
-
"implementation": "dist/src-
|
|
135
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
136
136
|
},
|
|
137
137
|
"Q": {
|
|
138
138
|
"types": "dist/processors/index.d.ts",
|
|
139
|
-
"implementation": "dist/src-
|
|
139
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
140
140
|
},
|
|
141
141
|
"y": {
|
|
142
142
|
"types": "dist/processors/index.d.ts",
|
|
143
|
-
"implementation": "dist/src-
|
|
143
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
144
144
|
},
|
|
145
145
|
"b": {
|
|
146
146
|
"types": "dist/processors/index.d.ts",
|
|
147
|
-
"implementation": "dist/src-
|
|
147
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
148
148
|
},
|
|
149
149
|
"$": {
|
|
150
150
|
"types": "dist/processors/index.d.ts",
|
|
151
|
-
"implementation": "dist/src-
|
|
151
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
152
152
|
},
|
|
153
153
|
"f": {
|
|
154
154
|
"types": "dist/processors/index.d.ts",
|
|
155
|
-
"implementation": "dist/src-
|
|
155
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
156
156
|
},
|
|
157
157
|
"R": {
|
|
158
158
|
"types": "dist/processors/index.d.ts",
|
|
159
|
-
"implementation": "dist/src-
|
|
159
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
160
160
|
},
|
|
161
161
|
"x": {
|
|
162
162
|
"types": "dist/processors/index.d.ts",
|
|
163
|
-
"implementation": "dist/src-
|
|
163
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
164
164
|
},
|
|
165
165
|
"E": {
|
|
166
166
|
"types": "dist/processors/index.d.ts",
|
|
167
|
-
"implementation": "dist/src-
|
|
167
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
168
168
|
},
|
|
169
169
|
"S": {
|
|
170
170
|
"types": "dist/processors/index.d.ts",
|
|
171
|
-
"implementation": "dist/src-
|
|
171
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
172
172
|
},
|
|
173
173
|
"t": {
|
|
174
174
|
"types": "dist/index.d.ts",
|
|
175
|
-
"implementation": "dist/src-
|
|
175
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
176
176
|
},
|
|
177
177
|
"n": {
|
|
178
178
|
"types": "dist/index.d.ts",
|
|
179
|
-
"implementation": "dist/src-
|
|
179
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
180
180
|
},
|
|
181
181
|
"T": {
|
|
182
182
|
"types": "dist/index.d.ts",
|
|
183
|
-
"implementation": "dist/src-
|
|
183
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
184
184
|
},
|
|
185
185
|
"r": {
|
|
186
186
|
"types": "dist/index.d.ts",
|
|
187
|
-
"implementation": "dist/src-
|
|
187
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
188
188
|
},
|
|
189
189
|
"p": {
|
|
190
190
|
"types": "dist/index.d.ts",
|
|
191
|
-
"implementation": "dist/src-
|
|
191
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
192
192
|
},
|
|
193
193
|
"m": {
|
|
194
194
|
"types": "dist/index.d.ts",
|
|
195
|
-
"implementation": "dist/src-
|
|
195
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
196
196
|
},
|
|
197
197
|
"i": {
|
|
198
198
|
"types": "dist/index.d.ts",
|
|
199
|
-
"implementation": "dist/src-
|
|
199
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
200
200
|
},
|
|
201
201
|
"h": {
|
|
202
202
|
"types": "dist/index.d.ts",
|
|
203
|
-
"implementation": "dist/src-
|
|
203
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
204
204
|
},
|
|
205
205
|
"w": {
|
|
206
206
|
"types": "dist/index.d.ts",
|
|
207
|
-
"implementation": "dist/src-
|
|
207
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
208
208
|
},
|
|
209
209
|
"a": {
|
|
210
210
|
"types": "dist/index.d.ts",
|
|
211
|
-
"implementation": "dist/src-
|
|
211
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
212
212
|
},
|
|
213
213
|
"o": {
|
|
214
214
|
"types": "dist/index.d.ts",
|
|
215
|
-
"implementation": "dist/src-
|
|
215
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
216
216
|
},
|
|
217
217
|
"s": {
|
|
218
218
|
"types": "dist/index.d.ts",
|
|
219
|
-
"implementation": "dist/src-
|
|
219
|
+
"implementation": "dist/src-BUWL69LT.js"
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
"modules": {
|
|
223
223
|
"processors": {
|
|
224
224
|
"index": "dist/processors/index.js",
|
|
225
225
|
"chunks": [
|
|
226
|
-
"src-
|
|
226
|
+
"src-BUWL69LT.js"
|
|
227
227
|
]
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -36,7 +36,7 @@ const deleteTool = createTool({
|
|
|
36
36
|
const agent = new Agent({
|
|
37
37
|
id: 'my-agent',
|
|
38
38
|
name: 'My Agent',
|
|
39
|
-
model: 'openai/gpt-
|
|
39
|
+
model: 'openai/gpt-6-luna',
|
|
40
40
|
tools: { deleteTool },
|
|
41
41
|
})
|
|
42
42
|
|
|
@@ -179,7 +179,7 @@ const approvedFingerprints = new Set<string>()
|
|
|
179
179
|
export const approvalBoundAgent = new Agent({
|
|
180
180
|
id: 'approval-bound-agent',
|
|
181
181
|
name: 'Approval Bound Agent',
|
|
182
|
-
model: 'openai/gpt-
|
|
182
|
+
model: 'openai/gpt-6.1-sol',
|
|
183
183
|
tools: { issueRefundTool, deleteRecordTool },
|
|
184
184
|
hooks: {
|
|
185
185
|
beforeToolCall: ({ toolName, input }) => {
|
|
@@ -410,6 +410,19 @@ const handleResume = async () => {
|
|
|
410
410
|
}
|
|
411
411
|
```
|
|
412
412
|
|
|
413
|
+
With `generate()`, the result has `finishReason: 'suspended'`. The tool's data from `suspend()` is in `suspendPayload.suspendPayload`. Call `resumeGenerate()` with the `resumeSchema` data and `runId`:
|
|
414
|
+
|
|
415
|
+
```typescript
|
|
416
|
+
const output = await agent.generate("What's the weather in London?")
|
|
417
|
+
|
|
418
|
+
if (output.finishReason === 'suspended') {
|
|
419
|
+
console.log(output.suspendPayload.suspendPayload) // { reason: 'Approval required.' }
|
|
420
|
+
|
|
421
|
+
const resumed = await agent.resumeGenerate({ approved: true }, { runId: output.runId! })
|
|
422
|
+
console.log(resumed.text)
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
413
426
|
When a suspended or approval-gated tool call resumes, the stream emits a `tool-call-resumed` chunk with the same `toolCallId` before the call's `tool-result`. Its `payload.kind` is `'suspension'` or `'approval'`, and the payload repeats the original `args`, `suspendPayload`, and `resumeSchema`. The chunk is only emitted when a real suspension or approval request is cleared.
|
|
414
427
|
|
|
415
428
|
With `@mastra/ai-sdk`, it arrives as a `data-tool-call-suspended` part (or `data-tool-call-approval` part for approvals) with `resumed: true`, which replaces the original part and keeps its payload. Use this signal to mark a question as answered. Don't infer it from the shape of the tool output: when the suspension came from a sub-agent, the output of the delegation call is the sub-agent's result, not your answer.
|
|
@@ -426,7 +439,7 @@ const agent = new Agent({
|
|
|
426
439
|
id: 'my-agent',
|
|
427
440
|
name: 'My Agent',
|
|
428
441
|
instructions: 'You are a helpful assistant',
|
|
429
|
-
model: 'openai/gpt-
|
|
442
|
+
model: 'openai/gpt-6-luna',
|
|
430
443
|
tools: { weatherTool },
|
|
431
444
|
memory: new Memory(),
|
|
432
445
|
defaultOptions: {
|
|
@@ -604,7 +617,7 @@ const dataAgent = new Agent({
|
|
|
604
617
|
id: 'data-agent',
|
|
605
618
|
name: 'Data Agent',
|
|
606
619
|
description: 'Handles database queries and user data retrieval',
|
|
607
|
-
model: 'openai/gpt-
|
|
620
|
+
model: 'openai/gpt-6-luna',
|
|
608
621
|
tools: { findUserTool },
|
|
609
622
|
})
|
|
610
623
|
|
|
@@ -613,7 +626,7 @@ const supervisorAgent = new Agent({
|
|
|
613
626
|
name: 'Supervisor Agent',
|
|
614
627
|
instructions: `You coordinate data retrieval tasks.
|
|
615
628
|
Delegate to data-agent for user lookups.`,
|
|
616
|
-
model: 'openai/gpt-
|
|
629
|
+
model: 'openai/gpt-6.1-sol',
|
|
617
630
|
agents: { dataAgent },
|
|
618
631
|
memory: new Memory(),
|
|
619
632
|
})
|
|
@@ -31,7 +31,7 @@ export const routingAgent = new Agent({
|
|
|
31
31
|
name: 'Routing Agent',
|
|
32
32
|
instructions: `
|
|
33
33
|
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.`,
|
|
34
|
-
model: 'openai/gpt-
|
|
34
|
+
model: 'openai/gpt-6.1-sol',
|
|
35
35
|
agents: {
|
|
36
36
|
researchAgent,
|
|
37
37
|
writingAgent,
|
|
@@ -33,9 +33,8 @@ export const supportAgent = new Agent({
|
|
|
33
33
|
id: 'support-agent',
|
|
34
34
|
name: 'Support Agent',
|
|
35
35
|
instructions: `You help customers understand their account.
|
|
36
|
-
Today is ${new Date().toDateString()}.
|
|
37
36
|
Use plain language and don't invent account details.`,
|
|
38
|
-
model: 'openai/gpt-
|
|
37
|
+
model: 'openai/gpt-6.1-sol',
|
|
39
38
|
})
|
|
40
39
|
```
|
|
41
40
|
|
|
@@ -51,7 +50,15 @@ instructions: ({ requestContext }) => {
|
|
|
51
50
|
}
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
Use `RequestContext` when instructions depend on data that changes with each request, such as the current user, tenant, locale, role, or feature flags.
|
|
53
|
+
Use `RequestContext` when instructions depend on data that changes with each request, such as the current user, tenant, locale, role, or feature flags. Anything evaluated when the agent is constructed, including an interpolated `new Date()`, is fixed for the life of the process, so compute time-dependent values inside a callback and pass an explicit timezone:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
instructions: () =>
|
|
57
|
+
`You help customers understand their account.
|
|
58
|
+
Today is ${new Date().toLocaleDateString('en-US', { timeZone: 'America/New_York' })}.`
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Resolving the date in the callback means a long-running server picks up the new day after midnight, and the explicit `timeZone` keeps the date stable regardless of the host's timezone. If the date must refresh across tool continuations or coexist with Studio instruction overrides, use a [`processInputStep`](https://mastra.ai/reference/processors/processor-interface) processor instead.
|
|
55
62
|
|
|
56
63
|
> **Tip:** If the resolved instructions change often, the model provider may not be able to reuse the same prompt cache prefix. Keep the stable part first, and pass frequently changing background through messages or signals instead.
|
|
57
64
|
>
|
|
@@ -160,7 +167,7 @@ import { Memory } from '@mastra/memory'
|
|
|
160
167
|
export const assistant = new Agent({
|
|
161
168
|
id: 'assistant',
|
|
162
169
|
name: 'Assistant',
|
|
163
|
-
model: 'openai/gpt-
|
|
170
|
+
model: 'openai/gpt-6.1-sol',
|
|
164
171
|
memory: new Memory({
|
|
165
172
|
options: {
|
|
166
173
|
lastMessages: 20,
|
|
@@ -195,7 +202,7 @@ import { Memory } from '@mastra/memory'
|
|
|
195
202
|
export const assistant = new Agent({
|
|
196
203
|
id: 'assistant',
|
|
197
204
|
name: 'Assistant',
|
|
198
|
-
model: 'openai/gpt-
|
|
205
|
+
model: 'openai/gpt-6.1-sol',
|
|
199
206
|
memory: new Memory({
|
|
200
207
|
options: {
|
|
201
208
|
observationalMemory: true,
|
|
@@ -210,7 +217,7 @@ Observations are added in stable chunks, which helps providers reuse the existin
|
|
|
210
217
|
|
|
211
218
|
## Signals
|
|
212
219
|
|
|
213
|
-
[Signals](https://mastra.ai/docs/
|
|
220
|
+
[Signals](https://mastra.ai/docs/signals/overview) add messages or system-generated context to a memory-backed thread. Delivery depends on the thread's state: a signal can wake an idle agent or enter an active loop. It can also wait for the next turn or persist without waking the agent.
|
|
214
221
|
|
|
215
222
|
State signals require memory and an existing thread. Notification inbox signals require a storage adapter with notification support.
|
|
216
223
|
|
|
@@ -85,7 +85,7 @@ import { Agent } from '@mastra/core/agent'
|
|
|
85
85
|
export const researcher = new Agent({
|
|
86
86
|
id: 'researcher',
|
|
87
87
|
instructions: 'You research topics and answer questions.',
|
|
88
|
-
model: 'openai/gpt-
|
|
88
|
+
model: 'openai/gpt-6.1-sol',
|
|
89
89
|
tools: { researchTool, summarizeTool },
|
|
90
90
|
backgroundTasks: {
|
|
91
91
|
tools: {
|
|
@@ -201,7 +201,7 @@ import { Agent } from '@mastra/core/agent'
|
|
|
201
201
|
const supervisor = new Agent({
|
|
202
202
|
id: 'supervisor',
|
|
203
203
|
instructions: 'Coordinate research and writing using the available agents.',
|
|
204
|
-
model: 'openai/gpt-
|
|
204
|
+
model: 'openai/gpt-6.1-sol',
|
|
205
205
|
agents: { researchAgent, writingAgent },
|
|
206
206
|
backgroundTasks: {
|
|
207
207
|
tools: {
|
|
@@ -227,7 +227,7 @@ The background config used for the inherited dispatch (for example `waitTimeoutM
|
|
|
227
227
|
const researchAgent = new Agent({
|
|
228
228
|
id: 'research-agent',
|
|
229
229
|
description: 'Gathers factual information.',
|
|
230
|
-
model: 'openai/gpt-
|
|
230
|
+
model: 'openai/gpt-6-luna',
|
|
231
231
|
tools: { deepResearchTool },
|
|
232
232
|
backgroundTasks: {
|
|
233
233
|
tools: {
|
|
@@ -33,10 +33,10 @@ const worker = new Agent({
|
|
|
33
33
|
id: 'worker',
|
|
34
34
|
name: 'worker',
|
|
35
35
|
instructions: 'You complete software tasks end to end.',
|
|
36
|
-
model: 'openai/gpt-
|
|
36
|
+
model: 'openai/gpt-6.1-sol',
|
|
37
37
|
memory,
|
|
38
38
|
goal: {
|
|
39
|
-
judge: 'openai/gpt-
|
|
39
|
+
judge: 'openai/gpt-6-luna',
|
|
40
40
|
maxRuns: 50,
|
|
41
41
|
},
|
|
42
42
|
})
|
|
@@ -91,7 +91,7 @@ const worker = new Agent({
|
|
|
91
91
|
id: 'worker',
|
|
92
92
|
name: 'worker',
|
|
93
93
|
instructions: 'You complete software tasks end to end.',
|
|
94
|
-
model: 'openai/gpt-
|
|
94
|
+
model: 'openai/gpt-6.1-sol',
|
|
95
95
|
memory,
|
|
96
96
|
goal: {
|
|
97
97
|
// A resolver function lets you inject provider credentials and read the
|
|
@@ -108,7 +108,7 @@ To hand the decision to your own scorer, pass it as `scorer` and keep `judge` se
|
|
|
108
108
|
|
|
109
109
|
```typescript
|
|
110
110
|
goal: {
|
|
111
|
-
judge: 'openai/gpt-
|
|
111
|
+
judge: 'openai/gpt-6-luna',
|
|
112
112
|
// Replaces the built-in judge pipeline. `prompt`, `tools`, and `maxSteps` no longer apply.
|
|
113
113
|
scorer: 'tests-pass',
|
|
114
114
|
}
|
|
@@ -137,6 +137,6 @@ Per-objective values written by `setObjective` / `updateObjectiveOptions` take p
|
|
|
137
137
|
## Related
|
|
138
138
|
|
|
139
139
|
- [Supervisor agents](https://mastra.ai/docs/subagents): `isTaskComplete` and the rubric scorer
|
|
140
|
-
- [Signal providers](https://mastra.ai/docs/
|
|
140
|
+
- [Signal providers](https://mastra.ai/docs/signals/signal-providers): How the objective is projected into context
|
|
141
141
|
- [Memory storage](https://mastra.ai/docs/storage): The storage backend goals require
|
|
142
142
|
- [Mastra Factory](https://factory.mastra.ai) and [Mastra Code](https://code.mastra.ai): Examples of goal-driven coding agents
|
|
@@ -57,7 +57,7 @@ const agent = new Agent({
|
|
|
57
57
|
id: 'test-agent',
|
|
58
58
|
name: 'Test Agent',
|
|
59
59
|
instructions: 'You are a helpful assistant',
|
|
60
|
-
model: 'openai/gpt-
|
|
60
|
+
model: 'openai/gpt-6.1-sol',
|
|
61
61
|
memory: new Memory({
|
|
62
62
|
storage: new LibSQLStore({
|
|
63
63
|
id: 'memory-store',
|
|
@@ -109,7 +109,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
109
109
|
const agent = new Agent({
|
|
110
110
|
name: 'semantic-agent',
|
|
111
111
|
instructions: 'You are a helpful assistant with semantic memory',
|
|
112
|
-
model: 'openai/gpt-
|
|
112
|
+
model: 'openai/gpt-6.1-sol',
|
|
113
113
|
memory: new Memory({
|
|
114
114
|
storage: new LibSQLStore({
|
|
115
115
|
id: 'memory-store',
|
|
@@ -159,7 +159,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
159
159
|
const agent = new Agent({
|
|
160
160
|
name: 'working-memory-agent',
|
|
161
161
|
instructions: 'You are an assistant with working memory',
|
|
162
|
-
model: 'openai/gpt-
|
|
162
|
+
model: 'openai/gpt-6.1-sol',
|
|
163
163
|
memory: new Memory({
|
|
164
164
|
storage: new LibSQLStore({
|
|
165
165
|
id: 'memory-store',
|
|
@@ -191,7 +191,7 @@ const customMessageHistory = new MessageHistory({
|
|
|
191
191
|
const agent = new Agent({
|
|
192
192
|
name: 'custom-memory-agent',
|
|
193
193
|
instructions: 'You are a helpful assistant',
|
|
194
|
-
model: 'openai/gpt-
|
|
194
|
+
model: 'openai/gpt-6.1-sol',
|
|
195
195
|
memory: new Memory({
|
|
196
196
|
storage: new LibSQLStore({ id: 'memory-store', url: 'file:memory.db' }),
|
|
197
197
|
options: {
|
|
@@ -264,7 +264,7 @@ const agent = new Agent({
|
|
|
264
264
|
id: 'safe-agent',
|
|
265
265
|
name: 'safe-agent',
|
|
266
266
|
instructions: 'You are a helpful assistant',
|
|
267
|
-
model: 'openai/gpt-
|
|
267
|
+
model: 'openai/gpt-6.1-sol',
|
|
268
268
|
memory: new Memory({ options: { lastMessages: 10 } }),
|
|
269
269
|
// Your guardrail runs BEFORE memory saves
|
|
270
270
|
outputProcessors: [contentBlocker],
|
|
@@ -304,7 +304,7 @@ const agent = new Agent({
|
|
|
304
304
|
id: 'validated-agent',
|
|
305
305
|
name: 'validated-agent',
|
|
306
306
|
instructions: 'You are a helpful assistant',
|
|
307
|
-
model: 'openai/gpt-
|
|
307
|
+
model: 'openai/gpt-6.1-sol',
|
|
308
308
|
memory: new Memory({ options: { lastMessages: 10 } }),
|
|
309
309
|
// Your guardrail runs AFTER memory loads history
|
|
310
310
|
inputProcessors: [inputValidator],
|
|
@@ -381,7 +381,7 @@ export const supportAgent = new Agent({
|
|
|
381
381
|
id: 'support-agent',
|
|
382
382
|
name: 'Support agent',
|
|
383
383
|
instructions: 'Answer customer support questions.',
|
|
384
|
-
model: 'openai/gpt-
|
|
384
|
+
model: 'openai/gpt-6.1-sol',
|
|
385
385
|
memory: new Memory({ options: { lastMessages: 10 } }),
|
|
386
386
|
inputProcessors: [new AttachmentUploader()],
|
|
387
387
|
})
|
|
@@ -116,7 +116,7 @@ You can use this history in two ways:
|
|
|
116
116
|
- **Automatic inclusion**: Mastra automatically includes recent messages in the context window. The default of 10 messages keeps agents grounded in the conversation. Adjust it with `lastMessages` when needed.
|
|
117
117
|
- [**Manual querying**](#querying): For more control, query threads and messages directly with `recall()`. Use the results to choose which memories enter the context window or to render conversation history in your UI.
|
|
118
118
|
|
|
119
|
-
> **Note:** `lastMessages` counts every stored message, including tool calls, tool results, and [signals](https://mastra.ai/docs/
|
|
119
|
+
> **Note:** `lastMessages` counts every stored message, including tool calls, tool results, and [signals](https://mastra.ai/docs/signals/sending-signals) of any kind, so a single turn can add several messages to the count. The window also slides forward on every request: once a thread grows past the limit, the oldest message leaves context on each turn, which changes the start of the prompt and invalidates the provider prompt cache. For long-running conversations, use [Observational Memory](https://mastra.ai/docs/memory/observational-memory), which keeps the prompt prefix stable.
|
|
120
120
|
|
|
121
121
|
### Sending messages from a client
|
|
122
122
|
|
|
@@ -168,7 +168,7 @@ export const supportAgent = new Agent({
|
|
|
168
168
|
id: 'support-agent',
|
|
169
169
|
name: 'Support agent',
|
|
170
170
|
instructions: 'Answer customer support questions.',
|
|
171
|
-
model: 'openai/gpt-
|
|
171
|
+
model: 'openai/gpt-6.1-sol',
|
|
172
172
|
memory: new Memory({
|
|
173
173
|
options: {
|
|
174
174
|
generateTitle: true,
|
|
@@ -191,7 +191,7 @@ export const supportAgent = new Agent({
|
|
|
191
191
|
id: 'support-agent',
|
|
192
192
|
name: 'Support agent',
|
|
193
193
|
instructions: 'Answer customer support questions.',
|
|
194
|
-
model: 'openai/gpt-
|
|
194
|
+
model: 'openai/gpt-6.1-sol',
|
|
195
195
|
memory: new Memory({
|
|
196
196
|
options: {
|
|
197
197
|
generateTitle: {
|
|
@@ -226,11 +226,11 @@ export const supportAgent = new Agent({
|
|
|
226
226
|
id: 'support-agent',
|
|
227
227
|
name: 'Support agent',
|
|
228
228
|
instructions: 'Answer customer support questions.',
|
|
229
|
-
model: 'openai/gpt-
|
|
229
|
+
model: 'openai/gpt-6.1-sol',
|
|
230
230
|
memory: new Memory({
|
|
231
231
|
options: {
|
|
232
232
|
generateTitle: {
|
|
233
|
-
model: 'openai/gpt-
|
|
233
|
+
model: 'openai/gpt-6-luna',
|
|
234
234
|
instructions: 'Generate a one-word title.',
|
|
235
235
|
},
|
|
236
236
|
},
|
|
@@ -69,7 +69,7 @@ const memory = new Memory({
|
|
|
69
69
|
export const collabAgent = new Agent({
|
|
70
70
|
id: 'collab',
|
|
71
71
|
name: 'CollabAgent',
|
|
72
|
-
model: 'openai/gpt-
|
|
72
|
+
model: 'openai/gpt-6-luna',
|
|
73
73
|
memory,
|
|
74
74
|
instructions: `
|
|
75
75
|
You are a collaborative document assistant. Multiple users talk to you in the SAME thread.
|