@mastra/memory 1.17.1 → 1.17.2

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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.17.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed the recall tool so message browsing uses the current thread by default and explains when it does. ([#15807](https://github.com/mastra-ai/mastra/pull/15807))
8
+
9
+ - Updated dependencies [[`28caa5b`](https://github.com/mastra-ai/mastra/commit/28caa5b032358545af2589ed90636eccb4dd9d2f), [`c1ae974`](https://github.com/mastra-ai/mastra/commit/c1ae97491f6e57378ce880c3a397778c42adcdf1), [`b510d36`](https://github.com/mastra-ai/mastra/commit/b510d368f73dab6be2e2c2bc99035aaef1fb7d7a), [`13b4d7c`](https://github.com/mastra-ai/mastra/commit/13b4d7c16de34dff9095d1cd80f22f544b6cfe75), [`7a7b313`](https://github.com/mastra-ai/mastra/commit/7a7b3138fb3bcf0b0c740eaea07971e43d330ef3), [`c04417b`](https://github.com/mastra-ai/mastra/commit/c04417ba0a2e4ded66da4352331ef29cd4bd1d79), [`cf25a03`](https://github.com/mastra-ai/mastra/commit/cf25a03132164b9dc1e5dccf7394824e33007c51), [`8a71261`](https://github.com/mastra-ai/mastra/commit/8a71261e3954ae617c6f8e25767b951f99438ab2), [`9e973b0`](https://github.com/mastra-ai/mastra/commit/9e973b010dacfa15ac82b0072897319f5234b90a), [`dd934a0`](https://github.com/mastra-ai/mastra/commit/dd934a0982ce0f78712fbd559e4f2410bf594b39), [`ba6b0c5`](https://github.com/mastra-ai/mastra/commit/ba6b0c51bfce358554fd33c7f2bcd5593633f2ff), [`a6dac0a`](https://github.com/mastra-ai/mastra/commit/a6dac0a40c7181161b1add4e8534f962bcbc9aa7), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`6c8c6c7`](https://github.com/mastra-ai/mastra/commit/6c8c6c71518394321a4692614aa4b11f3bb0a343), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`7d056b6`](https://github.com/mastra-ai/mastra/commit/7d056b6ecf603cacaa0f663ff1df025ed885b6c1), [`9cef83b`](https://github.com/mastra-ai/mastra/commit/9cef83b8a642b8098747772921e3523b492bafbc), [`d30e215`](https://github.com/mastra-ai/mastra/commit/d30e2156c746bc9fd791745cec1cc24377b66789), [`021a60f`](https://github.com/mastra-ai/mastra/commit/021a60f1f3e0135a70ef23c58be7a9b3aaffe6b4), [`73f2809`](https://github.com/mastra-ai/mastra/commit/73f2809721db24e98cdf122539652a455211b450), [`aedeea4`](https://github.com/mastra-ai/mastra/commit/aedeea48a94f728323f040478775076b9574be50), [`26f1f94`](https://github.com/mastra-ai/mastra/commit/26f1f9490574b864ba1ecedf2c9632e0767a23bd), [`8126d86`](https://github.com/mastra-ai/mastra/commit/8126d8638411eacfafdc29036ac998e8757ea66f), [`73b45fa`](https://github.com/mastra-ai/mastra/commit/73b45facdef4fbcb8af710c50f0646f18619dbaa), [`ae97520`](https://github.com/mastra-ai/mastra/commit/ae975206fdb0f6ef03c4d5bf94f7dc7c3f706c02), [`7a7b313`](https://github.com/mastra-ai/mastra/commit/7a7b3138fb3bcf0b0c740eaea07971e43d330ef3), [`441670a`](https://github.com/mastra-ai/mastra/commit/441670a02c9dc7731c52674f55481e7848a84523)]:
10
+ - @mastra/core@1.29.0
11
+
12
+ ## 1.17.2-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Fixed Observational Memory duplicate assistant messages when a thread is rerun or an agent continues a long-running loop. ([#15774](https://github.com/mastra-ai/mastra/pull/15774))
17
+
18
+ - Fixed the recall tool so message browsing uses the current thread by default and explains when it does. ([#15807](https://github.com/mastra-ai/mastra/pull/15807))
19
+
20
+ - Updated dependencies [[`c1ae974`](https://github.com/mastra-ai/mastra/commit/c1ae97491f6e57378ce880c3a397778c42adcdf1), [`13b4d7c`](https://github.com/mastra-ai/mastra/commit/13b4d7c16de34dff9095d1cd80f22f544b6cfe75), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`6c8c6c7`](https://github.com/mastra-ai/mastra/commit/6c8c6c71518394321a4692614aa4b11f3bb0a343), [`5a4b1ee`](https://github.com/mastra-ai/mastra/commit/5a4b1ee80212969621228104995589c0fa59e575), [`ec4cb26`](https://github.com/mastra-ai/mastra/commit/ec4cb26919972eb2031fea510f8f013e1d5b7ee2)]:
21
+ - @mastra/core@1.29.0-alpha.6
22
+
3
23
  ## 1.17.1
4
24
 
5
25
  ### Patch Changes
@@ -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.17.1"
6
+ version: "1.17.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -17,6 +17,7 @@ Read the individual reference documents for detailed explanations and code examp
17
17
  ### Docs
18
18
 
19
19
  - [Agent approval](references/docs-agents-agent-approval.md) - Learn how to require approvals, suspend tool execution, and automatically resume suspended tools while keeping humans in control of agent workflows.
20
+ - [Background tasks](references/docs-agents-background-tasks.md) - Learn how to dispatch long-running tool calls in the background, keep the stream open until they complete, and orchestrate subagents asynchronously.
20
21
  - [Agent networks](references/docs-agents-networks.md) - Coordinate multiple agents, workflows, and tools using agent networks for complex, non-deterministic task execution.
21
22
  - [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
23
  - [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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.17.1",
2
+ "version": "1.17.2",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {
5
5
  "ModelByInputTokens": {
@@ -0,0 +1,242 @@
1
+ # Background tasks
2
+
3
+ **Added in:** `@mastra/core@1.28.0`
4
+
5
+ Background tasks let an agent dispatch a long-running tool call without blocking the agentic loop. The tool returns an immediate acknowledgement, the LLM continues responding, and the task runs to completion in the background. When it finishes, its result is written to memory and if you use [`streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) the agent is re-invoked automatically so the result is processed in the same call.
6
+
7
+ ## When to use background tasks
8
+
9
+ Use background tasks when a tool call may take long enough that the user shouldn't wait for it before seeing a response. Common cases:
10
+
11
+ - Subagent delegations that themselves run multi-step research or writing.
12
+ - Tool calls that hit slow external services, queues, or large data jobs.
13
+ - Workflows triggered from a tool call that may take minutes to complete.
14
+
15
+ For tool calls that return quickly, foreground execution using `agent.stream()` and `agent.generate()` is simpler.
16
+
17
+ > **Note:** Background tasks require a configured [storage](https://mastra.ai/docs/memory/storage) backend on the Mastra instance. Tasks are persisted so they survive process restarts.
18
+
19
+ ## Quickstart
20
+
21
+ Background tasks are off by default. Enable them by setting `backgroundTasks.enabled` on the Mastra instance:
22
+
23
+ ```typescript
24
+ import { Mastra } from '@mastra/core'
25
+ import { LibSQLStore } from '@mastra/libsql'
26
+
27
+ export const mastra = new Mastra({
28
+ storage: new LibSQLStore({ id: 'storage', url: 'file:mastra.db' }),
29
+ backgroundTasks: {
30
+ enabled: true,
31
+ globalConcurrency: 10,
32
+ perAgentConcurrency: 5,
33
+ backpressure: 'queue',
34
+ defaultTimeoutMs: 300_000,
35
+ },
36
+ })
37
+ ```
38
+
39
+ The full set of options is listed in the [backgroundTasks configuration reference](https://mastra.ai/reference/configuration).
40
+
41
+ ## Run a tool in the background
42
+
43
+ Enabling the manager doesn't run anything in the background by itself as every tool defaults to foreground execution. You can run a tool in the background at one of three layers, in priority order:
44
+
45
+ 1. **LLM per-call override**: the model decides it should run in the background and includes a `_background` field in the tool arguments.
46
+ 2. **Agent-level config**: the agent declares which of its tools are background-eligible.
47
+ 3. **Tool-level config**: the tool itself declares it as background-eligible.
48
+
49
+ ### Tool-level
50
+
51
+ Set `backgroundTasks.enabled: true` on the tool definition. Tools opted in at this layer run in the background whenever called by an agent that has the manager enabled.
52
+
53
+ ```typescript
54
+ import { createTool } from '@mastra/core/tools'
55
+ import { z } from 'zod'
56
+
57
+ export const researchTool = createTool({
58
+ id: 'research',
59
+ description: 'Run a long research job',
60
+ inputSchema: z.object({ topic: z.string() }),
61
+ backgroundTasks: {
62
+ enabled: true,
63
+ timeoutMs: 600_000,
64
+ maxRetries: 1,
65
+ },
66
+ execute: async ({ context }) => {
67
+ // ...
68
+ },
69
+ })
70
+ ```
71
+
72
+ ### Agent-level
73
+
74
+ Use `backgroundTasks.tools` on the agent to opt in specific tools, override timeouts for individual tools, or run all background-eligible tools in the background. Use `disabled: true` to short-circuit background dispatch for the agent entirely.
75
+
76
+ ```typescript
77
+ import { Agent } from '@mastra/core/agent'
78
+
79
+ export const researcher = new Agent({
80
+ id: 'researcher',
81
+ instructions: 'You research topics and answer questions.',
82
+ model: 'openai/gpt-5.4',
83
+ tools: { researchTool, summarizeTool },
84
+ backgroundTasks: {
85
+ tools: {
86
+ researchTool: { enabled: true, timeoutMs: 600_000 },
87
+ summarizeTool: false,
88
+ },
89
+ },
90
+ })
91
+ ```
92
+
93
+ Set `tools: 'all'` to opt in every tool the agent has.
94
+
95
+ ### LLM per-call override
96
+
97
+ When a tool is registered on an agent that has background tasks enabled, the model can include a `_background` field in the tool arguments to override the resolved configuration for that specific call. The model only includes what it wants to override, all fields in `_background` are optional. The override is stripped from the arguments before the tool runs.
98
+
99
+ ```json
100
+ {
101
+ "topic": "solana",
102
+ "_background": { "enabled": true, "timeoutMs": 900_000 }
103
+ }
104
+ ```
105
+
106
+ ### Resolution order
107
+
108
+ When a tool call is dispatched, the resolved background config is computed in this priority order:
109
+
110
+ 1. LLM `_background` override (if present in the call's arguments).
111
+ 2. Agent-level `backgroundTasks.tools` entry for the tool.
112
+ 3. Tool-level `backgroundTasks` config.
113
+ 4. Manager defaults (`defaultTimeoutMs`, `defaultRetries`).
114
+
115
+ If the agent has `backgroundTasks.disabled: true`, every tool call runs synchronously regardless of the layers above.
116
+
117
+ ## Background tasks related stream chunks
118
+
119
+ When a tool call dispatches as a background task, two streams may surface lifecycle events for it: the agent's own stream and the [`backgroundTaskManager.stream()`](https://mastra.ai/docs/streaming/background-task-streaming) SSE stream. Each stream covers a different set of chunk types:
120
+
121
+ | Chunk type | When it fires | Emitted by |
122
+ | --------------------------- | -------------------------------------------------------------------------------------- | -------------- |
123
+ | `background-task-started` | The task has been enqueued and assigned a `taskId`. | Agent stream |
124
+ | `background-task-running` | The task picked up a worker and started executing. | Manager stream |
125
+ | `background-task-progress` | Shows number of running background tasks. | Agent stream |
126
+ | `background-task-output` | A streamed output chunk from the task's `execute`. | Manager stream |
127
+ | `background-task-completed` | The task finished successfully. The `payload.result` matches the eventual tool result. | Manager stream |
128
+ | `background-task-failed` | The task threw or timed out. | Manager stream |
129
+ | `background-task-cancelled` | The task was cancelled before completing. | Manager stream |
130
+
131
+ `agent.stream().fullStream` only emits the agent-loop chunks (`background-task-started`, `background-task-progress`) on its own. `agent.streamUntilIdle()` emits the same two chunks and additionally subscribes to the manager pubsub for the run's memory scope and pipes the five manager chunks (`background-task-running`, `background-task-output`, `background-task-completed`, `background-task-failed`, `background-task-cancelled`) into the same `fullStream`, so consumers of `streamUntilIdle().fullStream` see all seven types.
132
+
133
+ `backgroundTaskManager.stream()` only emits the five manager chunks.
134
+
135
+ The full payload shapes are documented in the [background task chunks reference](https://mastra.ai/reference/streaming/ChunkType).
136
+
137
+ ## Keep the agent stream open with `streamUntilIdle()`
138
+
139
+ `agent.stream()` returns once the LLM emits a final response even if a background task is still running. Use `agent.streamUntilIdle()` when you want the stream to stay open until every dispatched background task has completed and the LLM has had a chance to respond to the result:
140
+
141
+ ```typescript
142
+ const stream = await agent.streamUntilIdle('Research solana for me', {
143
+ memory: { thread: 't1', resource: 'u1' },
144
+ maxIdleMs: 5 * 60_000,
145
+ })
146
+
147
+ for await (const chunk of stream.fullStream) {
148
+ // chunks from the initial turn AND any continuation turns triggered by
149
+ // background task completions flow through here
150
+ }
151
+ ```
152
+
153
+ When a background task completes, the result is injected into the agent memory, `streamUntilIdle()` re-enters the agentic loop so the LLM can react to it. The stream closes when no tasks are running and no completions are queued.
154
+
155
+ `maxIdleMs` caps how long the stream waits between turns. The timer only runs while the wrapper is between turns, so a slow first token won't close the stream. The default is 5 minutes.
156
+
157
+ > **Note:** Visit [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) for the full API.
158
+
159
+ ### Aggregate properties
160
+
161
+ `streamUntilIdle()` returns a `MastraModelOutput` that looks like the one from `stream()`, but only `fullStream` spans the initial turn **and** any auto-continuations. Aggregate properties (`text`, `toolCalls`, `toolResults`, `finishReason`, `messageList`, `getFullOutput()`) still resolve against the **first turn's** internal buffer. If you need an aggregate view across continuations, consume `fullStream` yourself and accumulate.
162
+
163
+ ## Subagents in the background
164
+
165
+ Subagent invocations are dispatched as tool calls under the hood, so the same background configuration applies. The recommended pattern is to opt each subagent in on the supervisor, it's clearer and lets you tune `timeoutMs` per subagent in one place:
166
+
167
+ ```typescript
168
+ import { Agent } from '@mastra/core/agent'
169
+
170
+ const supervisor = new Agent({
171
+ id: 'supervisor',
172
+ instructions: 'Coordinate research and writing using the available agents.',
173
+ model: 'openai/gpt-5.4',
174
+ agents: { researchAgent, writingAgent },
175
+ backgroundTasks: {
176
+ tools: {
177
+ researchAgent: { enabled: true, timeoutMs: 900_000 },
178
+ writingAgent: { enabled: true, timeoutMs: 900_000 },
179
+ },
180
+ },
181
+ })
182
+
183
+ const stream = await supervisor.streamUntilIdle('Research AI in education and write an article', {
184
+ memory: { thread: 't1', resource: 'u1' },
185
+ })
186
+ ```
187
+
188
+ ### Inheriting from the subagent
189
+
190
+ If a subagent isn't listed under the supervisor's `backgroundTasks.tools` but has background-eligible tools of its own (either via tool-level `backgroundTasks.enabled: true` or its own `backgroundTasks.tools` entry) the framework still dispatches the entire subagent invocation as a background task. The supervisor inherits the subagent's intent: the subagent itself becomes the background task, and its inner tools run in the foreground inside the subagent's loop.
191
+
192
+ The background config used for the inherited dispatch (for example `waitTimeoutMs`) is derived from the subagent's own `backgroundTasks` config.
193
+
194
+ ```typescript
195
+ const researchAgent = new Agent({
196
+ id: 'research-agent',
197
+ description: 'Gathers factual information.',
198
+ model: 'openai/gpt-5-mini',
199
+ tools: { deepResearchTool },
200
+ backgroundTasks: {
201
+ tools: {
202
+ deepResearchTool: { enabled: true, timeoutMs: 600_000 },
203
+ },
204
+ waitTimeoutMs: 900_000,
205
+ },
206
+ })
207
+ ```
208
+
209
+ When this `researchAgent` is delegated to from a supervisor that has no backgroundTask configuration for the `researchAgent`, the supervisor still dispatches the whole `researchAgent` invocation as a background task, and `deepResearchTool` runs in the foreground inside that invocation, instead of dispatching its own nested background task.
210
+
211
+ Use this pattern when you want a subagent to behave consistently in the background regardless of which supervisor invokes it. Use the supervisor-side opt-in (above) when you want to tune background behavior centrally per supervisor.
212
+
213
+ ## Lifecycle callbacks
214
+
215
+ Each layer can register terminal-state callbacks. They don't replace one another, and success/failure hooks fire for their respective outcomes:
216
+
217
+ - Tool-level `backgroundTasks.onComplete` / `onFailed`: scoped to one tool.
218
+ - Agent-level `backgroundTasks.onTaskComplete` / `onTaskFailed`: scoped to all tasks dispatched by this agent.
219
+ - Manager-level `onTaskComplete` / `onTaskFailed`: scoped globally.
220
+
221
+ ```typescript
222
+ export const mastra = new Mastra({
223
+ storage,
224
+ backgroundTasks: {
225
+ enabled: true,
226
+ onTaskComplete: task => {
227
+ logger.info('Background task complete', { taskId: task.id, toolName: task.toolName })
228
+ },
229
+ onTaskFailed: task => {
230
+ logger.error('Background task failed', { taskId: task.id, error: task.error })
231
+ },
232
+ },
233
+ })
234
+ ```
235
+
236
+ ## Related
237
+
238
+ - [`Agent.streamUntilIdle()` reference](https://mastra.ai/reference/streaming/agents/streamUntilIdle)
239
+ - [backgroundTasks configuration reference](https://mastra.ai/reference/configuration)
240
+ - [Supervisor agents](https://mastra.ai/docs/agents/supervisor-agents)
241
+ - [Stream chunk types](https://mastra.ai/reference/streaming/ChunkType)
242
+ - [Storage](https://mastra.ai/docs/memory/storage)
@@ -300,9 +300,38 @@ Success criteria:
300
300
  })
301
301
  ```
302
302
 
303
- ## Sub-agent versioning
303
+ ## Running subagents in the background
304
304
 
305
- When using the [editor](https://mastra.ai/docs/editor/overview), you can control which stored version of each sub-agent the supervisor uses at runtime. Set version overrides on the Mastra instance or per invocation:
305
+ Subagent invocations are dispatched as tool calls, so they can run as [background tasks](https://mastra.ai/docs/agents/background-tasks). This is useful when one or more delegations are long-running and you don't want them to block the supervisor's response.
306
+
307
+ Enable the [backgroundTasks manager](https://mastra.ai/reference/configuration) on the Mastra instance, then opt subagents in on the supervisor:
308
+
309
+ ```typescript
310
+ const supervisor = new Agent({
311
+ id: 'supervisor',
312
+ instructions: 'Coordinate research and writing using the available agents.',
313
+ model: 'openai/gpt-5.4',
314
+ agents: { researchAgent, writingAgent },
315
+ backgroundTasks: {
316
+ tools: {
317
+ researchAgent: { enabled: true, timeoutMs: 900_000 },
318
+ writingAgent: { enabled: true, timeoutMs: 900_000 },
319
+ },
320
+ },
321
+ })
322
+
323
+ const stream = await supervisor.streamUntilIdle('Research AI in education and write an article', {
324
+ memory: { thread: 't1', resource: 'u1' },
325
+ })
326
+ ```
327
+
328
+ Use [`streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) instead of `stream()` so the stream stays open until the subagents complete and the supervisor has had a chance to respond to their results.
329
+
330
+ If a subagent isn't listed on the supervisor but has its own background-eligible tools, the supervisor still dispatches the subagent as a background task and inherits its config. See [Inheriting from the subagent](https://mastra.ai/docs/agents/background-tasks) for details.
331
+
332
+ ## Subagent versioning
333
+
334
+ When using the [editor](https://mastra.ai/docs/editor/overview), you can control which stored version of each subagent the supervisor uses at runtime. Set version overrides on the Mastra instance or per invocation:
306
335
 
307
336
  ```typescript
308
337
  const result = await supervisor.generate('Research and write about AI safety', {
@@ -315,13 +344,15 @@ const result = await supervisor.generate('Research and write about AI safety', {
315
344
  })
316
345
  ```
317
346
 
318
- Version overrides propagate automatically through delegation. See [Sub-agent versioning](https://mastra.ai/docs/editor/overview) for details on resolution order and server API usage.
347
+ Version overrides propagate automatically through delegation. See [Subagent versioning](https://mastra.ai/docs/editor/overview) for details on resolution order and server API usage.
319
348
 
320
349
  ## Related
321
350
 
322
- - [Sub-agent versioning](https://mastra.ai/docs/editor/overview)
351
+ - [Background tasks](https://mastra.ai/docs/agents/background-tasks)
352
+ - [Subagent versioning](https://mastra.ai/docs/editor/overview)
323
353
  - [Guide: Research coordinator](https://mastra.ai/guides/guide/research-coordinator)
324
354
  - [Agent.stream() reference](https://mastra.ai/reference/streaming/agents/stream)
355
+ - [Agent.streamUntilIdle() reference](https://mastra.ai/reference/streaming/agents/streamUntilIdle)
325
356
  - [Agent.generate() reference](https://mastra.ai/reference/agents/generate)
326
357
  - [Agent approval](https://mastra.ai/docs/agents/agent-approval)
327
358
  - [Memory in multi-agent systems](https://mastra.ai/docs/memory/overview)
@@ -153,8 +153,10 @@ async function manageClones() {
153
153
 
154
154
  // Have a conversation...
155
155
  await agent.generate("Hello! Let's discuss project options.", {
156
- threadId: originalThread.id,
157
- resourceId: 'user-123',
156
+ memory: {
157
+ thread: originalThread.id,
158
+ resource: 'user-123',
159
+ },
158
160
  })
159
161
 
160
162
  // Create multiple branches (clones) to explore different paths
@@ -93,8 +93,10 @@ const { thread: dateFilteredClone } = await memory.cloneThread({
93
93
 
94
94
  // Continue conversation on the cloned thread
95
95
  const response = await agent.generate("Let's try a different approach", {
96
- threadId: fullClone.id,
97
- resourceId: fullClone.resourceId,
96
+ memory: {
97
+ thread: fullClone.id,
98
+ resource: fullClone.resourceId,
99
+ },
98
100
  })
99
101
  ```
100
102