@mastra/libsql 1.15.1 → 1.16.0-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.
Files changed (31) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/docs/SKILL.md +4 -2
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/docs/references/docs-agent-builder-overview.md +4 -3
  5. package/dist/docs/references/docs-agents-agent-approval.md +25 -2
  6. package/dist/docs/references/docs-agents-networks.md +1 -1
  7. package/dist/docs/references/docs-memory-memory-processors.md +67 -0
  8. package/dist/docs/references/docs-memory-message-history.md +56 -2
  9. package/dist/docs/references/docs-memory-overview.md +8 -6
  10. package/dist/docs/references/docs-memory-semantic-recall.md +36 -2
  11. package/dist/docs/references/docs-memory-working-memory.md +3 -3
  12. package/dist/docs/references/docs-storage-overview.md +214 -0
  13. package/dist/docs/references/docs-workflows-snapshots.md +1 -1
  14. package/dist/docs/references/reference-core-mastra-class.md +1 -1
  15. package/dist/docs/references/reference-file-based-agents-memory.md +58 -0
  16. package/dist/docs/references/reference-file-based-agents-storage.md +30 -0
  17. package/dist/docs/references/reference-memory-memory-class.md +1 -1
  18. package/dist/docs/references/reference-storage-composite.md +64 -6
  19. package/dist/docs/references/reference-storage-dynamodb.md +1 -1
  20. package/dist/docs/references/reference-storage-retention.md +74 -6
  21. package/dist/index.cjs +148 -68
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.js +149 -69
  24. package/dist/index.js.map +1 -1
  25. package/dist/storage/db/index.d.ts +5 -0
  26. package/dist/storage/db/index.d.ts.map +1 -1
  27. package/dist/storage/domains/datasets/index.d.ts.map +1 -1
  28. package/dist/vector/index.d.ts +12 -0
  29. package/dist/vector/index.d.ts.map +1 -1
  30. package/package.json +10 -10
  31. package/dist/docs/references/docs-memory-storage.md +0 -267
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 1.16.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - Added atomic caller-defined dataset IDs for idempotent dataset creation across built-in storage adapters. Supplying `id` to `mastra.datasets.create()` now creates the dataset once and resolves compatible retries to the persisted record; incompatible immutable identity fields throw `DATASET_ID_CONFLICT`. ([#19370](https://github.com/mastra-ai/mastra/pull/19370))
8
+
9
+ - Added caller-defined dataset item identities for safe retries across all dataset storage adapters. ([#19384](https://github.com/mastra-ai/mastra/pull/19384))
10
+
11
+ Dataset items can now include an `externalId` when calling `addItem` or `addItems`:
12
+
13
+ ```ts
14
+ await dataset.addItem({
15
+ externalId: 'source-item-123',
16
+ input: { prompt: 'Hello' },
17
+ });
18
+ ```
19
+
20
+ Retrying with the same identity and payload returns the existing item. Reusing an identity with different content returns a typed conflict, including during concurrent writes. Updates and deletes preserve the identity, Spanner retries transactions without changing the outcome, and MySQL batch writes now preserve every supported dataset item field.
21
+
22
+ ### Patch Changes
23
+
24
+ - Raised the `@mastra/core` peer dependency floor to `>=1.51.0-0` so the dataset item identity helpers used by the storage adapters are available at runtime. ([#19384](https://github.com/mastra-ai/mastra/pull/19384))
25
+
26
+ - Updated dependencies [[`a99eae8`](https://github.com/mastra-ai/mastra/commit/a99eae8908e500c1b2d12f9d277be616b98617a5), [`fd13f8e`](https://github.com/mastra-ai/mastra/commit/fd13f8e21990f9904c3eedba3a626bb4a929cdb8), [`f703f87`](https://github.com/mastra-ai/mastra/commit/f703f878de072d51fda557f9c50867d8252bef05), [`0ad646f`](https://github.com/mastra-ai/mastra/commit/0ad646f71a530f2454664299e5e01bfd13fa12e5)]:
27
+ - @mastra/core@1.51.0-alpha.13
28
+
29
+ ## 1.16.0-alpha.0
30
+
31
+ ### Minor Changes
32
+
33
+ - Added `LibSQLVector.close()` to release the underlying libsql client. For local file databases it checkpoints the WAL and switches back to `journal_mode=DELETE` before closing (mirroring `LibSQLStore.close()`), so the `-wal`/`-shm` sidecar files and OS handles are released promptly. Safe to call more than once. ([#19059](https://github.com/mastra-ai/mastra/pull/19059))
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [[`e955965`](https://github.com/mastra-ai/mastra/commit/e955965dce575a903e37cf054d28ea99aa48785e), [`860ef7e`](https://github.com/mastra-ai/mastra/commit/860ef7e77d92b63469cbe5857aa1e626197e43e9), [`17e818c`](https://github.com/mastra-ai/mastra/commit/17e818c51a958ba90641b1a959dc38faf8c034e9), [`4451dfe`](https://github.com/mastra-ai/mastra/commit/4451dfe857428e7abcc0261a507a2e186dae6d47), [`1d39058`](https://github.com/mastra-ai/mastra/commit/1d39058e548efd691799985d5c8af2737f1c3bd2)]:
38
+ - @mastra/core@1.51.0-alpha.2
39
+
3
40
  ## 1.15.1
4
41
 
5
42
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.15.1"
6
+ version: "1.16.0-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -25,9 +25,9 @@ Read the individual reference documents for detailed explanations and code examp
25
25
  - [Multi-user threads](references/docs-memory-multi-user-threads.md) - Share one Mastra thread between multiple users by carrying speaker identity in the message body.
26
26
  - [Memory overview](references/docs-memory-overview.md) - Learn how Mastra's memory system works with working memory, message history, semantic recall, and observational memory.
27
27
  - [Semantic recall](references/docs-memory-semantic-recall.md) - Learn how to use semantic recall in Mastra to retrieve relevant messages from past conversations using vector search and embeddings.
28
- - [Storage](references/docs-memory-storage.md) - Configure storage for Mastra to persist conversations and other runtime state.
29
28
  - [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
30
29
  - [Retrieval, semantic search, reranking](references/docs-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
30
+ - [Storage overview](references/docs-storage-overview.md) - Configure storage for Mastra to persist runtime state across agents, workflows, observability, evals, schedules, and memory.
31
31
  - [Snapshots](references/docs-workflows-snapshots.md) - Learn how to save and resume workflow execution state with snapshots in Mastra
32
32
 
33
33
  ### Guides
@@ -39,6 +39,8 @@ Read the individual reference documents for detailed explanations and code examp
39
39
  - [Reference: Mastra.getMemory()](references/reference-core-getMemory.md) - Documentation for the `Mastra.getMemory()` method in Mastra, which retrieves a registered memory instance by its registry key.
40
40
  - [Reference: Mastra.listMemory()](references/reference-core-listMemory.md) - Documentation for the `Mastra.listMemory()` method in Mastra, which returns all registered memory instances.
41
41
  - [Reference: Mastra class](references/reference-core-mastra-class.md) - Documentation for the `Mastra` class in Mastra, the core entry point for managing agents, workflows, MCP servers, and server endpoints.
42
+ - [Memory](references/reference-file-based-agents-memory.md) - Give a file-based agent persistent memory with a memory.ts module.
43
+ - [Storage](references/reference-file-based-agents-storage.md) - Set the default Mastra store by file convention with storage.ts.
42
44
  - [Reference: Memory class](references/reference-memory-memory-class.md) - Documentation for the `Memory` class in Mastra, which provides a robust system for managing conversation history and thread-based message storage.
43
45
  - [Reference: Composite storage](references/reference-storage-composite.md) - Documentation for combining multiple storage backends in Mastra.
44
46
  - [Reference: DynamoDB storage](references/reference-storage-dynamodb.md) - Documentation for the DynamoDB storage implementation in Mastra, using a single-table design with ElectroDB.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.15.1",
2
+ "version": "1.16.0-alpha.1",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -4,10 +4,10 @@
4
4
 
5
5
  > **Note:** The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. [Contact sales](https://mastra.ai/contact) for more information.
6
6
 
7
- [YouTube video player](https://www.youtube-nocookie.com/embed/AbdgIu4Z07I)
8
-
9
7
  The Agent Builder lets you build, configure, and operate Mastra agents all within the UI. It runs inside your Mastra server, persists everything to `Mastra.storage`, and supports multi-tenant agent workflows with RBAC and channel integrations.
10
8
 
9
+ > **📹 Watch:** Watch [Mastra Agent Builder overview](https://www.youtube.com/watch?v=AbdgIu4Z07I) to see how teams create and configure agents from the UI.
10
+
11
11
  - [**Configuration**](https://mastra.ai/docs/agent-builder/configuration): Toggle UI sections and pin admin-controlled defaults for every new agent.
12
12
  - [**Model policy**](https://mastra.ai/docs/agent-builder/model-policy): Restrict which providers and models the Builder exposes, and pin a default.
13
13
  - [**Memory**](https://mastra.ai/docs/agent-builder/memory): Configure the default memory shape for every Builder-created agent.
@@ -108,4 +108,5 @@ Omitting the `builder` field has the same effect.
108
108
 
109
109
  - [Configuration](https://mastra.ai/docs/agent-builder/configuration): Toggle Builder surfaces and pin defaults for new agents.
110
110
  - [Access control](https://mastra.ai/docs/agent-builder/access-control): Gate the Builder with authentication and role-based access control.
111
- - [Deploying](https://mastra.ai/docs/agent-builder/deploying): Replace local development primitives with production-ready storage, filesystems, and sandboxes.
111
+ - [Deploying](https://mastra.ai/docs/agent-builder/deploying): Replace local development primitives with production-ready storage, filesystems, and sandboxes.
112
+ - 📹 [Mastra Agent Builder workshop](https://www.youtube.com/watch?v=p2p_wb-rUPg\&t=666s)
@@ -48,7 +48,7 @@ for await (const chunk of stream.fullStream) {
48
48
  }
49
49
  ```
50
50
 
51
- > **Note:** Agent approval uses snapshots to capture request state. Configure a [storage provider](https://mastra.ai/docs/memory/storage) on your Mastra instance or you'll see a "snapshot not found" error.
51
+ > **Note:** Agent approval uses snapshots to capture request state. Configure a [storage provider](https://mastra.ai/docs/storage/overview) on your Mastra instance or you'll see a "snapshot not found" error.
52
52
  >
53
53
  > Snapshots for agent runs are minimal resume artifacts: they hold only what's needed to resume the suspended run and are deleted once the run finishes. Use [tracing](https://mastra.ai/docs/observability/overview) for the execution record and [memory](https://mastra.ai/docs/memory/overview) for the conversation history.
54
54
 
@@ -110,6 +110,29 @@ A tool can also pause _during_ its `execute` function by calling `suspend()`. Th
110
110
 
111
111
  The stream emits a `tool-call-suspended` chunk with a custom payload defined by the tool's `suspendSchema`. You resume by calling `resumeStream()` with data matching the tool's `resumeSchema`.
112
112
 
113
+ ```typescript
114
+ const weatherTool = createTool({
115
+ id: 'get-weather',
116
+ inputSchema: z.object({
117
+ location: z.string().optional(),
118
+ }),
119
+ suspendSchema: z.object({
120
+ question: z.string(),
121
+ }),
122
+ resumeSchema: z.object({
123
+ location: z.string(),
124
+ }),
125
+ execute: async ({ location }, context) => {
126
+ if (!location) {
127
+ return await context?.agent?.suspend({
128
+ question: 'Which city would you like the weather for?',
129
+ })
130
+ }
131
+ return await fetchWeather(location)
132
+ },
133
+ })
134
+ ```
135
+
113
136
  > **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.
114
137
 
115
138
  ## Tool approval with `generate()`
@@ -397,7 +420,7 @@ Each returned run includes the suspended tool calls (`toolCallId`, `toolName`, `
397
420
 
398
421
  The same discovery is available over HTTP as `GET /agents/:agentId/suspended-runs` and in the client SDK as [`agent.listSuspendedRuns()`](https://mastra.ai/reference/client-js/agents), so browser-based approval UIs can rediscover pending runs directly.
399
422
 
400
- > **Note:** Suspended runs only survive restarts when your Mastra instance is configured with a persistent [storage provider](https://mastra.ai/docs/memory/storage). The default in-memory store loses snapshots when the process exits.
423
+ > **Note:** Suspended runs only survive restarts when your Mastra instance is configured with a persistent [storage provider](https://mastra.ai/docs/storage/overview). The default in-memory store loses snapshots when the process exits.
401
424
 
402
425
  ## Tool approval: Supervisor agents
403
426
 
@@ -95,7 +95,7 @@ console.log(final?.summary)
95
95
 
96
96
  When a primitive requires approval, the stream emits an `agent-execution-approval` or `tool-execution-approval` chunk. Use `approveNetworkToolCall()` or `declineNetworkToolCall()` to respond.
97
97
 
98
- Network approval uses snapshots to capture execution state. Ensure a [storage provider](https://mastra.ai/docs/memory/storage) is enabled in your Mastra instance.
98
+ Network approval uses snapshots to capture execution state. Ensure a [storage provider](https://mastra.ai/docs/storage/overview) is enabled in your Mastra instance.
99
99
 
100
100
  ```typescript
101
101
  const stream = await routingAgent.network('Perform some sensitive action', {
@@ -309,6 +309,73 @@ const agent = new Agent({
309
309
 
310
310
  Both scenarios are safe - guardrails prevent inappropriate content from being persisted to memory
311
311
 
312
+ ## Handling large attachments
313
+
314
+ Some storage providers enforce record size limits that base64-encoded file attachments can exceed:
315
+
316
+ | Provider | Record size limit |
317
+ | ------------------------------------------------------------------ | ----------------- |
318
+ | [DynamoDB](https://mastra.ai/reference/storage/dynamodb) | 400 KB |
319
+ | [Convex](https://mastra.ai/reference/storage/convex) | 1 MiB |
320
+ | [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1) | 1 MiB |
321
+
322
+ PostgreSQL, MongoDB, and libSQL have higher limits and are usually unaffected.
323
+
324
+ Use an input processor to upload attachments to external storage, then replace them with URL references before messages are persisted.
325
+
326
+ ```typescript
327
+ import type { Processor } from '@mastra/core/processors'
328
+ import type { MastraDBMessage } from '@mastra/core/memory'
329
+
330
+ export class AttachmentUploader implements Processor {
331
+ id = 'attachment-uploader'
332
+
333
+ async processInput({ messages }: { messages: MastraDBMessage[] }) {
334
+ return Promise.all(messages.map(message => this.processMessage(message)))
335
+ }
336
+
337
+ async processMessage(message: MastraDBMessage) {
338
+ const attachments = message.content.experimental_attachments
339
+ if (!attachments?.length) return message
340
+
341
+ const uploaded = await Promise.all(
342
+ attachments.map(async attachment => {
343
+ if (!attachment.url?.startsWith('data:')) return attachment
344
+
345
+ const url = await this.upload(attachment.url, attachment.contentType)
346
+ return { ...attachment, url }
347
+ }),
348
+ )
349
+
350
+ return { ...message, content: { ...message.content, experimental_attachments: uploaded } }
351
+ }
352
+
353
+ async upload(dataUri: string, contentType?: string): Promise<string> {
354
+ const base64 = dataUri.split(',')[1]
355
+ const buffer = Buffer.from(base64, 'base64')
356
+
357
+ throw new Error('Implement upload() with your storage provider')
358
+ }
359
+ }
360
+ ```
361
+
362
+ Use the processor with your agent:
363
+
364
+ ```typescript
365
+ import { Agent } from '@mastra/core/agent'
366
+ import { Memory } from '@mastra/memory'
367
+ import { AttachmentUploader } from '../processors/attachment-uploader'
368
+
369
+ export const supportAgent = new Agent({
370
+ id: 'support-agent',
371
+ name: 'Support agent',
372
+ instructions: 'Answer customer support questions.',
373
+ model: 'openai/gpt-5.5',
374
+ memory: new Memory({ lastMessages: 10 }),
375
+ inputProcessors: [new AttachmentUploader()],
376
+ })
377
+ ```
378
+
312
379
  ## Related documentation
313
380
 
314
381
  - [Processors](https://mastra.ai/docs/agents/processors): General processor concepts and custom processor creation
@@ -6,7 +6,7 @@ Message history is the most basic and important form of memory. It gives the LLM
6
6
 
7
7
  You can also retrieve message history to display past conversations in your UI.
8
8
 
9
- > **Info:** Each message belongs to a thread (the conversation) and a resource (the user or entity it's associated with). See [Threads and resources](https://mastra.ai/docs/memory/storage) for more detail.
9
+ > **Info:** Each message belongs to a thread (the conversation) and a resource (the user or entity it's associated with). See [Threads and resources](#threads-and-resources) for more detail.
10
10
 
11
11
  > **Warning:** When you use memory with a client application, send **only the new message** from the client instead of the full conversation history.
12
12
  >
@@ -14,9 +14,18 @@ You can also retrieve message history to display past conversations in your UI.
14
14
  >
15
15
  > For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/guides/build-your-ui/ai-sdk-ui).
16
16
 
17
+ ## Threads and resources
18
+
19
+ Mastra organizes conversations using two identifiers:
20
+
21
+ - **Thread**: A conversation session containing a sequence of messages.
22
+ - **Resource**: The entity that owns the thread, such as a user, organization, project, or another domain entity in your application.
23
+
24
+ Studio automatically generates a thread and resource ID for you. When calling `stream()` or `generate()` yourself, provide these identifiers explicitly.
25
+
17
26
  ## Getting started
18
27
 
19
- Install the Mastra memory module along with a [storage adapter](https://mastra.ai/docs/memory/storage) for your database. The examples below use `@mastra/libsql`, which stores data locally in a `mastra.db` file.
28
+ Install the Mastra memory module along with a [storage adapter](https://mastra.ai/docs/storage/overview) for your database. The examples below use `@mastra/libsql`, which stores data locally in a `mastra.db` file.
20
29
 
21
30
  **npm**:
22
31
 
@@ -113,6 +122,51 @@ You can use this history in two ways:
113
122
 
114
123
  > **Tip:** When memory is enabled, [Studio](https://mastra.ai/docs/studio/overview) uses message history to display past conversations in the chat sidebar.
115
124
 
125
+ ## Thread title generation
126
+
127
+ Mastra can automatically generate descriptive thread titles based on the user's first message when `generateTitle` is enabled. Use this option when you build a chat interface that renders conversation titles in a thread list or sidebar.
128
+
129
+ ```typescript
130
+ import { Agent } from '@mastra/core/agent'
131
+ import { Memory } from '@mastra/memory'
132
+
133
+ export const supportAgent = new Agent({
134
+ id: 'support-agent',
135
+ name: 'Support agent',
136
+ instructions: 'Answer customer support questions.',
137
+ model: 'openai/gpt-5.5',
138
+ memory: new Memory({
139
+ options: {
140
+ generateTitle: true,
141
+ },
142
+ }),
143
+ })
144
+ ```
145
+
146
+ Title generation runs asynchronously after the agent responds and doesn't affect response time.
147
+
148
+ To optimize cost or behavior, provide a smaller [`model`](https://mastra.ai/models) and custom `instructions`:
149
+
150
+ ```typescript
151
+ import { Agent } from '@mastra/core/agent'
152
+ import { Memory } from '@mastra/memory'
153
+
154
+ export const supportAgent = new Agent({
155
+ id: 'support-agent',
156
+ name: 'Support agent',
157
+ instructions: 'Answer customer support questions.',
158
+ model: 'openai/gpt-5.5',
159
+ memory: new Memory({
160
+ options: {
161
+ generateTitle: {
162
+ model: 'openai/gpt-5-mini',
163
+ instructions: 'Generate a one-word title.',
164
+ },
165
+ },
166
+ }),
167
+ })
168
+ ```
169
+
116
170
  ## Accessing memory
117
171
 
118
172
  To access memory functions for querying, cloning, or deleting threads and messages, call `getMemory()` on an agent:
@@ -13,7 +13,9 @@ Mastra agents can be configured to store [message history](https://mastra.ai/doc
13
13
 
14
14
  If the combined memory exceeds the model's context limit, [memory processors](https://mastra.ai/docs/memory/memory-processors) can filter, trim, or prioritize content so the most relevant information is preserved.
15
15
 
16
- Memory results will be stored in one or more of your configured [storage providers](https://mastra.ai/docs/memory/storage).
16
+ Memory results will be stored in one or more of your configured [storage providers](https://mastra.ai/docs/storage/overview).
17
+
18
+ > **📹 Watch:** Watch [Mastra memory concepts](https://www.youtube.com/watch?v=18iIHQtIPmc) for a conceptual overview of the memory layers agents can use.
17
19
 
18
20
  ## When to use memory
19
21
 
@@ -75,7 +77,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
75
77
  bun add @mastra/libsql@latest
76
78
  ```
77
79
 
78
- > **Note:** For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/memory/storage) documentation.
80
+ For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/storage/overview) documentation.
79
81
 
80
82
  3. Add the storage provider to your main Mastra instance to enable memory across all configured agents.
81
83
 
@@ -108,7 +110,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
108
110
  })
109
111
  ```
110
112
 
111
- > **Note:** Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
113
+ Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
112
114
 
113
115
  5. Call your agent, for example in [Studio](https://mastra.ai/docs/studio/overview). Inside Studio, start a new chat with your agent and take a look at the right sidebar. It'll now display various memory-related information.
114
116
 
@@ -164,7 +166,7 @@ export const memoryAgent = new Agent({
164
166
  })
165
167
  ```
166
168
 
167
- > **Note:** See [Observational Memory](https://mastra.ai/docs/memory/observational-memory) for details on how observations and reflections work, and [the reference](https://mastra.ai/reference/memory/observational-memory) for all configuration options.
169
+ See [Observational Memory](https://mastra.ai/docs/memory/observational-memory) for details on how observations and reflections work, and [the reference](https://mastra.ai/reference/memory/observational-memory) for all configuration options.
168
170
 
169
171
  ## Memory in multi-agent systems
170
172
 
@@ -178,7 +180,7 @@ Each delegation creates a fresh `threadId` and a deterministic `resourceId` for
178
180
  - **Resource ID**: Derived as `{parentResourceId}-{agentName}`. Because the resource ID is stable across delegations, resource-scoped memory persists between calls. A subagent remembers facts from previous delegations by the same user.
179
181
  - **Memory instance**: If a subagent has no memory configured, it inherits the supervisor's `Memory` instance, including all of its options. If the subagent defines its own, that takes precedence.
180
182
 
181
- > **Note:** Title generation (`generateTitle`) is a top-level thread concern and is **not** applied to inherited subagent threads. Because each delegation creates an ephemeral thread that no one sees, running title generation for it would waste an LLM call per delegation. To generate titles for a subagent's own threads, give that subagent its own memory configuration.
183
+ > **Note:** Title generation (`generateTitle`) is a top-level thread concern and **isn't** applied to inherited subagent threads. Because each delegation creates an ephemeral thread that no one sees, running title generation for it would waste an LLM call per delegation. To generate titles for a subagent's own threads, give that subagent its own memory configuration.
182
184
 
183
185
  The supervisor forwards its conversation context to the subagent so it has enough background to complete the task. Only the delegation prompt and the subagent's response are saved — the full parent conversation isn't stored. You can control which messages reach the subagent with the [`messageFilter`](https://mastra.ai/docs/agents/supervisor-agents) callback.
184
186
 
@@ -236,7 +238,7 @@ export const memoryAgent = new Agent({
236
238
  })
237
239
  ```
238
240
 
239
- > **Note:** Visit [Request Context](https://mastra.ai/docs/server/request-context) for more information.
241
+ Visit [Request Context](https://mastra.ai/docs/server/request-context) for more information.
240
242
 
241
243
  ## Related
242
244
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  If you ask your friend what they did last weekend, they will search in their memory for events associated with "last weekend" and then tell you what they did. That's sort of like how semantic recall works in Mastra.
6
6
 
7
- > **Watch 📹:** What semantic recall is, how it works, and how to configure it in Mastra [YouTube (5 minutes)](https://youtu.be/UVZtK8cK8xQ)
7
+ > **📹 Watch:** Watch [Mastra semantic recall](https://www.youtube.com/watch?v=UVZtK8cK8xQ\&pp=ygUVbWFzdHJhIHdvcmtpbmcgbWVtb3J5) to see how agents retrieve relevant messages from past conversations.
8
8
 
9
9
  ## How semantic recall works
10
10
 
@@ -22,6 +22,8 @@ After getting a response from the LLM, all new messages (user, assistant, and to
22
22
 
23
23
  Semantic recall is disabled by default. To enable it, set `semanticRecall: true` in `options` and provide a `vector` store and `embedder`:
24
24
 
25
+ **LibSQL**:
26
+
25
27
  ```typescript
26
28
  import { Agent } from '@mastra/core/agent'
27
29
  import { Memory } from '@mastra/memory'
@@ -50,6 +52,38 @@ const agent = new Agent({
50
52
  })
51
53
  ```
52
54
 
55
+ **MongoDB**:
56
+
57
+ ```typescript
58
+ import { Agent } from '@mastra/core/agent'
59
+ import { Memory } from '@mastra/memory'
60
+ import { MongoDBStore, MongoDBVector } from '@mastra/mongodb'
61
+ import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
62
+
63
+ const agent = new Agent({
64
+ id: 'support-agent',
65
+ name: 'SupportAgent',
66
+ instructions: 'You are a helpful support agent.',
67
+ model: 'openai/gpt-5.5',
68
+ memory: new Memory({
69
+ storage: new MongoDBStore({
70
+ id: 'agent-storage',
71
+ uri: process.env.MONGODB_URI,
72
+ dbName: process.env.MONGODB_DB_NAME,
73
+ }),
74
+ vector: new MongoDBVector({
75
+ id: 'agent-vector',
76
+ uri: process.env.MONGODB_URI,
77
+ dbName: process.env.MONGODB_DB_NAME,
78
+ }),
79
+ embedder: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
80
+ options: {
81
+ semanticRecall: true,
82
+ },
83
+ }),
84
+ })
85
+ ```
86
+
53
87
  ## Using the `recall()` method
54
88
 
55
89
  While `listMessages` retrieves messages by thread ID with basic pagination, [`recall()`](https://mastra.ai/reference/memory/recall) adds support for **semantic search**. When you need to find messages by meaning rather than recency, use `recall()` with a `vectorSearchString`:
@@ -146,7 +180,7 @@ const agent = new Agent({
146
180
  })
147
181
  ```
148
182
 
149
- > **Note:** `scope: 'resource'` is supported by the LibSQL, PostgreSQL, and Upstash storage adapters.
183
+ > **Note:** `scope: 'resource'` is supported by the LibSQL, PostgreSQL, MongoDB, and Upstash storage adapters.
150
184
 
151
185
  ### Metadata filtering
152
186
 
@@ -10,6 +10,8 @@ This is useful for maintaining ongoing state that's always relevant and should a
10
10
 
11
11
  If you use [Observational Memory](https://mastra.ai/docs/memory/observational-memory), `observationalMemory.observation.manageWorkingMemory` lets OM update working memory for the agent.
12
12
 
13
+ > **📹 Watch:** Watch [Mastra working memory](https://www.youtube.com/watch?v=UMy_JHLf1n8\&pp=ygUVbWFzdHJhIHdvcmtpbmcgbWVtb3J5) to see how agents keep persistent user context available across interactions.
14
+
13
15
  Working memory can persist at two different scopes:
14
16
 
15
17
  - **Resource-scoped** (default): Memory persists across all conversation threads for the same user
@@ -43,9 +45,7 @@ const agent = new Agent({
43
45
 
44
46
  ## How it works
45
47
 
46
- Working memory is a block of Markdown text that the agent is able to update over time to store continuously relevant information:
47
-
48
- [YouTube video player](https://www.youtube-nocookie.com/embed/UMy_JHLf1n8)
48
+ Working memory is a block of Markdown text that the agent is able to update over time to store continuously relevant information.
49
49
 
50
50
  ## Memory persistence scopes
51
51