@mastra/libsql 1.18.0-alpha.1 → 1.19.0-alpha.0

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 (30) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/docs/SKILL.md +4 -3
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/docs/references/docs-agent-builder-deploying.md +2 -2
  5. package/dist/docs/references/docs-agent-builder-overview.md +1 -1
  6. package/dist/docs/references/docs-agents-agent-approval.md +85 -11
  7. package/dist/docs/references/docs-agents-networks.md +2 -2
  8. package/dist/docs/references/docs-deployment-workers.md +137 -0
  9. package/dist/docs/references/docs-memory-memory-processors.md +10 -10
  10. package/dist/docs/references/docs-memory-message-history.md +11 -5
  11. package/dist/docs/references/docs-memory-multi-user-threads.md +6 -6
  12. package/dist/docs/references/docs-memory-overview.md +10 -10
  13. package/dist/docs/references/docs-memory-semantic-recall.md +3 -3
  14. package/dist/docs/references/docs-memory-working-memory.md +8 -8
  15. package/dist/docs/references/docs-rag-retrieval.md +18 -18
  16. package/dist/docs/references/docs-storage-overview.md +2 -2
  17. package/dist/docs/references/docs-workflows-snapshots.md +3 -3
  18. package/dist/docs/references/reference-core-mastra-class.md +48 -1
  19. package/dist/docs/references/reference-file-based-agents-storage.md +1 -1
  20. package/dist/docs/references/reference-memory-memory-class.md +4 -4
  21. package/dist/docs/references/reference-storage-dynamodb.md +7 -7
  22. package/dist/docs/references/reference-storage-retention.md +33 -33
  23. package/dist/docs/references/reference-vectors-libsql.md +2 -2
  24. package/dist/index.cjs +24 -6
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.js +24 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/storage/domains/datasets/index.d.ts.map +1 -1
  29. package/dist/storage/domains/experiments/index.d.ts.map +1 -1
  30. package/package.json +5 -5
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Memory
4
4
 
5
- Memory enables your agent to remember user messages, agent replies, and tool results across interactions, giving it the context it needs to stay consistent, maintain conversation flow, and produce better answers over time.
5
+ Memory enables your agent to remember user messages and agent replies, and tool results across interactions, giving it the context it needs to stay consistent, maintain conversation flow, plus produce better answers over time.
6
6
 
7
7
  Mastra agents can be configured to store [message history](https://mastra.ai/docs/memory/message-history). Additionally, you can enable:
8
8
 
@@ -19,7 +19,7 @@ Memory results will be stored in one or more of your configured [storage provide
19
19
 
20
20
  ## When to use memory
21
21
 
22
- Use memory when your agent needs to maintain multi-turn conversations that reference prior exchanges, recall user preferences or facts from earlier in a session, or build context over time within a conversation thread. Skip memory for single-turn requests where each interaction is independent.
22
+ Use memory when your agent needs to maintain multi-turn conversations that reference prior exchanges or recall user preferences or facts from earlier in a session, or alternatively build context over time within a conversation thread. Skip memory for single-turn requests where each interaction is independent.
23
23
 
24
24
  ## Quickstart
25
25
 
@@ -182,21 +182,21 @@ Each delegation creates a fresh `threadId` and a deterministic `resourceId` for
182
182
 
183
183
  - **Thread ID**: Unique per delegation. The subagent starts with a clean message history every time it's called.
184
184
  - **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.
185
- - **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.
185
+ - **Memory instance**: A subagent without its own memory inherits the supervisor's `Memory` instance and all configured options. If the subagent defines its own, that takes precedence.
186
186
 
187
187
  > **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.
188
188
 
189
- 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.
189
+ 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.
190
190
 
191
- > **Note:** Subagent resource IDs are always suffixed with the agent name (`{parentResourceId}-{agentName}`). Two different subagents under the same supervisor never share a resource ID through delegation.
191
+ > **Note:** Subagent resource IDs are always suffixed with the agent name (`{parentResourceId}-{agentName}`). Different subagents under the same supervisor never share a resource ID through delegation.
192
192
 
193
193
  To go beyond this default isolation, you can share memory between agents by passing matching identifiers when you call them directly.
194
194
 
195
195
  ### Share memory between agents
196
196
 
197
- When you call agents directly (outside the delegation flow), memory sharing is controlled by two identifiers: `resourceId` and `threadId`. Agents that use the same values read and write to the same data. This is useful when agents collaborate on a shared context for example, a researcher that saves notes and a writer that reads them.
197
+ When you call agents directly (outside the delegation flow), memory sharing is controlled by two identifiers: `resourceId` and `threadId`. Agents that use the same values read and write to the same data. This is useful when agents collaborate on a shared context, for example, a researcher that saves notes and a writer that reads them.
198
198
 
199
- **Resource-scoped sharing** is the most common pattern. [Working memory](https://mastra.ai/docs/memory/working-memory) and [semantic recall](https://mastra.ai/docs/memory/semantic-recall) default to `scope: 'resource'`. If two agents share a `resourceId`, they share observations, working memory, and embeddings even across different threads:
199
+ **Resource-scoped sharing** is the most common pattern. [Working memory](https://mastra.ai/docs/memory/working-memory) and [semantic recall](https://mastra.ai/docs/memory/semantic-recall) default to `scope: 'resource'`. If two agents share a `resourceId`, they share observations, working memory, and embeddings, even across different threads:
200
200
 
201
201
  ```typescript
202
202
  // Both agents share the same resource-scoped memory
@@ -209,15 +209,15 @@ await writer.generate('Write a summary from the research notes.', {
209
209
  })
210
210
  ```
211
211
 
212
- Because both calls use `resource: 'project-42'`, the writer can access the researcher's observations, working memory, and semantic embeddings. Each agent still has its own thread, so message histories stay separate.
212
+ Because both calls use `resource: 'project-42'`, the writer can access the researcher's observations and working memory. Semantic embeddings are also shared through the resource. Each agent still has its own thread, so message histories stay separate.
213
213
 
214
- **Thread-scoped sharing** gives tighter coupling. [Observational Memory](https://mastra.ai/docs/memory/observational-memory) uses `scope: 'thread'` by default. If two agents use the same `resource` _and_ `thread`, they share the full message history. Each agent sees every message the other has written. This is useful when agents need to build on each other's exact outputs.
214
+ **Thread-scoped sharing** gives tighter coupling. [Observational Memory](https://mastra.ai/docs/memory/observational-memory) uses `scope: 'thread'` by default. If two agents use the same `resource` and `thread`, they share the full message history. Each agent sees every message the other has written. This is useful when agents need to build on each other's exact outputs.
215
215
 
216
216
  ## Observability
217
217
 
218
218
  Enable [Tracing](https://mastra.ai/docs/observability/tracing/overview) to monitor and debug memory in action. Traces show you exactly which messages and observations the agent included in its context for each request, helping you understand agent behavior and verify that memory retrieval is working as expected.
219
219
 
220
- Open [Studio](https://mastra.ai/docs/studio/overview) and select the **Observability** tab in the sidebar. Open the trace of a recent agent request, then look for spans of LLMs calls.
220
+ Open [Studio](https://mastra.ai/docs/studio/overview) and select the **Observability** tab in the sidebar. Open the trace of a recent agent request and look for its LLM call spans.
221
221
 
222
222
  ## Switch memory per request
223
223
 
@@ -10,7 +10,7 @@ If you ask your friend what they did last weekend, they will search in their mem
10
10
 
11
11
  Semantic recall is RAG-based search that helps agents maintain context across longer interactions when messages are no longer within [recent message history](https://mastra.ai/docs/memory/message-history).
12
12
 
13
- It uses vector embeddings of messages for similarity search, integrates with various vector stores, and has configurable context windows around retrieved messages.
13
+ It uses vector embeddings of messages for similarity search and integrates with vector stores, plus has configurable context windows around retrieved messages.
14
14
 
15
15
  ![Diagram showing Mastra Memory semantic recall](/assets/images/semantic-recall-fd7b9336a6d0d18019216cb6d3dbe710.png)
16
16
 
@@ -34,7 +34,7 @@ const agent = new Agent({
34
34
  id: 'support-agent',
35
35
  name: 'SupportAgent',
36
36
  instructions: 'You are a helpful support agent.',
37
- model: 'openai/gpt-5.5',
37
+ model: 'openai/gpt-5.6-sol',
38
38
  memory: new Memory({
39
39
  storage: new LibSQLStore({
40
40
  id: 'agent-storage',
@@ -64,7 +64,7 @@ const agent = new Agent({
64
64
  id: 'support-agent',
65
65
  name: 'SupportAgent',
66
66
  instructions: 'You are a helpful support agent.',
67
- model: 'openai/gpt-5.5',
67
+ model: 'openai/gpt-5.6-sol',
68
68
  memory: new Memory({
69
69
  storage: new MongoDBStore({
70
70
  id: 'agent-storage',
@@ -4,7 +4,7 @@
4
4
 
5
5
  While [message history](https://mastra.ai/docs/memory/message-history) and [semantic recall](https://mastra.ai/docs/memory/semantic-recall) help agents remember conversations, working memory allows them to maintain persistent information about users across interactions.
6
6
 
7
- Think of it as the agent's active thoughts or scratchpad – the key information they keep available about the user or task. It's similar to how a person would naturally remember someone's name, preferences, or important details during a conversation.
7
+ Working memory is the agent's active scratchpad: key information it keeps available about the user or task. It can retain a person's name, preferences, or other important details during a conversation.
8
8
 
9
9
  This is useful for maintaining ongoing state that's always relevant and should always be available to the agent.
10
10
 
@@ -17,7 +17,7 @@ Working memory can persist at two different scopes:
17
17
  - **Resource-scoped** (default): Memory persists across all conversation threads for the same user
18
18
  - **Thread-scoped**: Memory is isolated per conversation thread
19
19
 
20
- **Important:** Switching between scopes means the agent won't see memory from the other scope - thread-scoped memory is completely separate from resource-scoped memory.
20
+ **Requirement:** Switching between scopes means the agent won't see memory from the other scope - thread-scoped memory is completely separate from resource-scoped memory.
21
21
 
22
22
  ## Quickstart
23
23
 
@@ -32,7 +32,7 @@ const agent = new Agent({
32
32
  id: 'personal-assistant',
33
33
  name: 'PersonalAssistant',
34
34
  instructions: 'You are a helpful personal assistant.',
35
- model: 'openai/gpt-5.5',
35
+ model: 'openai/gpt-5.6-sol',
36
36
  memory: new Memory({
37
37
  options: {
38
38
  workingMemory: {
@@ -45,7 +45,7 @@ const agent = new Agent({
45
45
 
46
46
  ## How it works
47
47
 
48
- Working memory is a block of Markdown text that the agent is able to update over time to store continuously relevant information.
48
+ Working memory is a block of Markdown text that the agent can update over time to store continuously relevant information.
49
49
 
50
50
  ## Memory persistence scopes
51
51
 
@@ -134,7 +134,7 @@ Resource-scoped working memory requires specific storage adapters that support t
134
134
 
135
135
  ## Custom templates
136
136
 
137
- Templates guide the agent on what information to track and update in working memory. While a default template is used if none is provided, you'll typically want to define a custom template tailored to your agent's specific use case to ensure it remembers the most relevant information. For threads shared by multiple users, see [Multi-user threads](https://mastra.ai/docs/memory/multi-user-threads).
137
+ Templates guide the agent on what information to track and update in working memory. Mastra uses a default template when you don't provide one. Define a custom template for your agent's use case so it remembers the most relevant information. For threads shared by multiple users, see [Multi-user threads](https://mastra.ai/docs/memory/multi-user-threads).
138
138
 
139
139
  Here's an example of a custom template. In this example the agent will store the users name, location, timezone, etc as soon as the user sends a message containing any of the info:
140
140
 
@@ -214,7 +214,7 @@ const paragraphMemory = new Memory({
214
214
 
215
215
  Working memory can also be defined using a structured schema instead of a Markdown template. This allows you to specify the exact fields and types that should be tracked, using a [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.). When using a schema, the agent will see and update working memory as a JSON object matching your schema.
216
216
 
217
- **Important:** You must specify either `template` or `schema`, but not both.
217
+ **Requirement:** You must specify either `template` or `schema`, but not both.
218
218
 
219
219
  ### Example: Schema-Based Working Memory
220
220
 
@@ -271,8 +271,8 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
271
271
 
272
272
  ## Choosing between template and schema
273
273
 
274
- - Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics** the agent must provide the complete memory content on each update.
275
- - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics** the agent only provides fields to update, and existing fields are preserved.
274
+ - Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics**: the agent must provide the complete memory content on each update.
275
+ - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics**: the agent only provides fields to update, and existing fields are preserved.
276
276
  - Only one mode can be active at a time: setting both `template` and `schema` isn't supported.
277
277
 
278
278
  ## Example: Multi-step retention
@@ -160,15 +160,15 @@ When creating the tool, pay special attention to the tool's name and description
160
160
 
161
161
  This is particularly useful when:
162
162
 
163
- - Your agent needs to dynamically decide what information to retrieve
163
+ - Your agent needs to decide at runtime what information to retrieve
164
164
  - The retrieval process requires complex decision-making
165
165
  - You want the agent to combine multiple retrieval strategies based on context
166
166
 
167
167
  #### Database-Specific Configurations
168
168
 
169
- The Vector Query Tool supports database-specific configurations that enable you to leverage unique features and optimizations of different vector stores.
169
+ The Vector Query Tool supports database-specific configurations that enable you to use unique features and optimizations of different vector stores.
170
170
 
171
- > **Note:** These configurations are for **query-time options** like namespaces, performance tuning, and filteringnot for database connection setup.
171
+ > **Note:** These configurations are for **query-time options** like namespaces, performance tuning, and filtering, not for database connection setup.
172
172
  >
173
173
  > Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ url: '...' })`).
174
174
 
@@ -235,7 +235,7 @@ const lanceQueryTool = createVectorQueryTool({
235
235
  - **pgVector optimization**: Control search accuracy and speed with ef/probes parameters
236
236
  - **Quality filtering**: Set minimum similarity thresholds to improve result relevance
237
237
  - **LanceDB tables**: Separate data into tables for better organization and performance
238
- - **Runtime flexibility**: Override configurations dynamically based on context
238
+ - **Runtime flexibility**: Override configurations at runtime based on context
239
239
 
240
240
  **Common Use Cases:**
241
241
 
@@ -274,7 +274,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
274
274
  export const ragAgent = new Agent({
275
275
  id: 'rag-agent',
276
276
  name: 'RAG Agent',
277
- model: 'openai/gpt-5.5',
277
+ model: 'openai/gpt-5.6-sol',
278
278
  instructions: `
279
279
  Process queries using the provided context. Structure responses to be concise and relevant.
280
280
  ${PGVECTOR_PROMPT}
@@ -291,7 +291,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
291
291
  export const ragAgent = new Agent({
292
292
  id: 'rag-agent',
293
293
  name: 'RAG Agent',
294
- model: 'openai/gpt-5.5',
294
+ model: 'openai/gpt-5.6-sol',
295
295
  instructions: `
296
296
  Process queries using the provided context. Structure responses to be concise and relevant.
297
297
  ${PINECONE_PROMPT}
@@ -308,7 +308,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
308
308
  export const ragAgent = new Agent({
309
309
  id: 'rag-agent',
310
310
  name: 'RAG Agent',
311
- model: 'openai/gpt-5.5',
311
+ model: 'openai/gpt-5.6-sol',
312
312
  instructions: `
313
313
  Process queries using the provided context. Structure responses to be concise and relevant.
314
314
  ${QDRANT_PROMPT}
@@ -325,7 +325,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
325
325
  export const ragAgent = new Agent({
326
326
  id: 'rag-agent',
327
327
  name: 'RAG Agent',
328
- model: 'openai/gpt-5.5',
328
+ model: 'openai/gpt-5.6-sol',
329
329
  instructions: `
330
330
  Process queries using the provided context. Structure responses to be concise and relevant.
331
331
  ${CHROMA_PROMPT}
@@ -342,7 +342,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
342
342
  export const ragAgent = new Agent({
343
343
  id: 'rag-agent',
344
344
  name: 'RAG Agent',
345
- model: 'openai/gpt-5.5',
345
+ model: 'openai/gpt-5.6-sol',
346
346
  instructions: `
347
347
  Process queries using the provided context. Structure responses to be concise and relevant.
348
348
  ${ASTRA_PROMPT}
@@ -359,7 +359,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
359
359
  export const ragAgent = new Agent({
360
360
  id: 'rag-agent',
361
361
  name: 'RAG Agent',
362
- model: 'openai/gpt-5.5',
362
+ model: 'openai/gpt-5.6-sol',
363
363
  instructions: `
364
364
  Process queries using the provided context. Structure responses to be concise and relevant.
365
365
  ${LIBSQL_PROMPT}
@@ -376,7 +376,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
376
376
  export const ragAgent = new Agent({
377
377
  id: 'rag-agent',
378
378
  name: 'RAG Agent',
379
- model: 'openai/gpt-5.5',
379
+ model: 'openai/gpt-5.6-sol',
380
380
  instructions: `
381
381
  Process queries using the provided context. Structure responses to be concise and relevant.
382
382
  ${UPSTASH_PROMPT}
@@ -393,7 +393,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
393
393
  export const ragAgent = new Agent({
394
394
  id: 'rag-agent',
395
395
  name: 'RAG Agent',
396
- model: 'openai/gpt-5.5',
396
+ model: 'openai/gpt-5.6-sol',
397
397
  instructions: `
398
398
  Process queries using the provided context. Structure responses to be concise and relevant.
399
399
  ${VECTORIZE_PROMPT}
@@ -410,7 +410,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
410
410
  export const ragAgent = new Agent({
411
411
  id: 'rag-agent',
412
412
  name: 'RAG Agent',
413
- model: 'openai/gpt-5.5',
413
+ model: 'openai/gpt-5.6-sol',
414
414
  instructions: `
415
415
  Process queries using the provided context. Structure responses to be concise and relevant.
416
416
  ${MONGODB_PROMPT}
@@ -427,7 +427,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
427
427
  export const ragAgent = new Agent({
428
428
  id: 'rag-agent',
429
429
  name: 'RAG Agent',
430
- model: 'openai/gpt-5.5',
430
+ model: 'openai/gpt-5.6-sol',
431
431
  instructions: `
432
432
  Process queries using the provided context. Structure responses to be concise and relevant.
433
433
  ${OPENSEARCH_PROMPT}
@@ -444,7 +444,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
444
444
  export const ragAgent = new Agent({
445
445
  id: 'rag-agent',
446
446
  name: 'RAG Agent',
447
- model: 'openai/gpt-5.5',
447
+ model: 'openai/gpt-5.6-sol',
448
448
  instructions: `
449
449
  Process queries using the provided context. Structure responses to be concise and relevant.
450
450
  ${S3VECTORS_PROMPT}
@@ -455,10 +455,10 @@ export const ragAgent = new Agent({
455
455
 
456
456
  ### Re-ranking
457
457
 
458
- Initial vector similarity search can sometimes miss nuanced relevance. Re-ranking is a more computationally expensive process, but more accurate algorithm that improves results by:
458
+ Initial vector similarity search can sometimes miss detailed relevance. Re-ranking is a more computationally expensive process, but more accurate algorithm that improves results by:
459
459
 
460
460
  - Considering word order and exact matches
461
- - Applying more sophisticated relevance scoring
461
+ - Applying more advanced relevance scoring
462
462
  - Using a method called cross-attention between query and documents
463
463
 
464
464
  Here's how to use re-ranking:
@@ -476,7 +476,7 @@ const initialResults = await pgVector.query({
476
476
  // Create a relevance scorer
477
477
  const relevanceProvider = new MastraAgentRelevanceScorer(
478
478
  'relevance-scorer',
479
- 'openai/gpt-5.5',
479
+ 'openai/gpt-5.6-sol',
480
480
  )
481
481
 
482
482
  // Re-rank the results
@@ -14,7 +14,7 @@ Storage powers:
14
14
 
15
15
  ## When to configure storage
16
16
 
17
- Configure a persistent storage adapter when state must survive restarts, be shared across processes, or be visible in Studio across sessions. The default in-memory store is useful for tests and short local experiments, but it loses data when the process exits.
17
+ Configure a persistent storage adapter when state must survive restarts or be shared across processes. Persistent storage also keeps state visible in Studio across sessions. The default in-memory store is useful for tests and short local experiments, but it loses data when the process exits.
18
18
 
19
19
  Use storage when your application needs any of these behaviors:
20
20
 
@@ -144,7 +144,7 @@ export const supportAgent = new Agent({
144
144
  id: 'support-agent',
145
145
  name: 'Support agent',
146
146
  instructions: 'Answer customer support questions.',
147
- model: 'openai/gpt-5.5',
147
+ model: 'openai/gpt-5.6-sol',
148
148
  memory: new Memory({
149
149
  storage: new PostgresStore({
150
150
  id: 'support-agent-storage',
@@ -24,11 +24,11 @@ Snapshots are the key mechanism enabling Mastra's suspend and resume capabilitie
24
24
  5. Later, when `resume()` is called on the suspended step, the snapshot is retrieved
25
25
  6. The workflow execution resumes from exactly where it left off
26
26
 
27
- This mechanism provides a powerful way to implement human-in-the-loop workflows, handle rate limiting, wait for external resources, and implement complex branching workflows that may need to pause for extended periods.
27
+ The mechanism provides a powerful way to implement human-in-the-loop workflows, handle rate limiting, wait for external resources, and implement complex branching workflows that may need to pause for extended periods.
28
28
 
29
29
  ## Snapshot anatomy
30
30
 
31
- Each snapshot includes the `runId`, input, step status (`success`, `suspended`, etc.), any suspend and resume payloads, and the final output. This ensures full context is available when resuming execution.
31
+ Each snapshot includes the `runId`, input, step status (`success`, `suspended`, etc.), any suspend and resume payloads, and the final output. As a result, full context is available when resuming execution.
32
32
 
33
33
  ```json
34
34
  {
@@ -152,7 +152,7 @@ export const mastra = new Mastra({
152
152
  1. **Ensure Serializability**: Any data that needs to be included in the snapshot must be serializable (convertible to JSON).
153
153
  2. **Minimize Snapshot Size**: Avoid storing large data objects directly in the workflow context. Instead, store references to them (like IDs) and retrieve the data when needed.
154
154
  3. **Handle Resume Context Carefully**: When resuming a workflow, carefully consider what context to provide. This will be merged with the existing snapshot data.
155
- 4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows, especially long-running ones, to ensure they're properly resumed.
155
+ 4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows and especially long-running ones, plus to ensure they're properly resumed.
156
156
  5. **Consider Storage Scaling**: For applications with many suspended workflows, ensure your storage solution is appropriately scaled.
157
157
 
158
158
  ## Custom snapshot metadata
@@ -103,4 +103,51 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
103
103
 
104
104
  **versions.agents.versionId** (`string`): The ID of a specific version to use.
105
105
 
106
- **versions.agents.status** (`'draft' | 'published'`): Select the latest version with this publication status.
106
+ **versions.agents.status** (`'draft' | 'published'`): Select the latest version with this publication status.
107
+
108
+ **workers** (`MastraWorker[] | false`): Configure which workers run in this Mastra instance. When omitted, Mastra auto-creates default workers based on your PubSub and config. Pass false to disable all event processing (useful when running standalone workers separately). Pass a MastraWorker\[] to add custom workers — they are merged with the auto-created defaults, and a custom worker with the same name as a default replaces it.
109
+
110
+ **backgroundTasks** (`BackgroundTaskManagerConfig`): Configure background task execution for agents. See background tasks configuration reference for all options.
111
+
112
+ **backgroundTasks.enabled** (`boolean`): Enable background task dispatch.
113
+
114
+ **backgroundTasks.globalConcurrency** (`number`): Max concurrent tasks across all agents.
115
+
116
+ **backgroundTasks.perAgentConcurrency** (`number`): Max concurrent tasks per agent.
117
+
118
+ **backgroundTasks.backpressure** (`'queue' | 'reject' | 'fallback-sync'`): Behavior when concurrency limit is reached.
119
+
120
+ **backgroundTasks.defaultTimeoutMs** (`number`): Default task timeout in milliseconds.
121
+
122
+ **backgroundTasks.defaultRetries** (`RetryConfig`): Default retry configuration.
123
+
124
+ **scheduler** (`object`): Configure the scheduler worker for cron-driven workflow triggers. Auto-enables when any workflow declares a schedule. See Scheduled workflows.
125
+
126
+ **scheduler.enabled** (`boolean`): Explicitly enable or disable the scheduler.
127
+
128
+ **recovery** (`MastraRecoveryConfig`): Boot-time recovery behavior for orphaned agent and workflow runs. See Crash recovery. (Default: `{ durableAgents: 'off' }`)
129
+
130
+ **recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. Recovery re-issues LLM calls and re-executes tool calls, so tools must be idempotent. See Crash recovery.
131
+
132
+ ## Methods
133
+
134
+ ### `recoverAllDurableAgents()`
135
+
136
+ Re-drives every orphaned `running` durable-agent run across all registered durable agents. Called automatically on boot when `recovery.durableAgents` is `'auto'`. You can also call it directly for manual recovery or from a scheduled task.
137
+
138
+ Requires persistent storage — with an in-memory store there is nothing to recover after a process restart.
139
+
140
+ ```typescript
141
+ const result = await mastra.recoverAllDurableAgents()
142
+ // { agents: 2, recovered: 3, succeeded: 3, failed: 0 }
143
+ ```
144
+
145
+ Returns:
146
+
147
+ **agents** (`number`): Number of durable agents scanned.
148
+
149
+ **recovered** (`number`): Total number of runs that were re-driven.
150
+
151
+ **succeeded** (`number`): Runs that restarted successfully.
152
+
153
+ **failed** (`number`): Runs whose restart threw an error.
@@ -27,4 +27,4 @@ Mastra registers the store before file-based agents and workflows, so storage-de
27
27
 
28
28
  ## Precedence with code
29
29
 
30
- Code-registered storage wins over `storage.ts`. Use `storage.ts` when one project-wide store is enough; use code registration when setup depends on runtime wiring in `src/mastra/index.ts`.
30
+ Code-registered storage wins over `storage.ts`. Use `storage.ts` when one project-wide store is enough. Use code registration when setup depends on runtime wiring in `src/mastra/index.ts`.
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Memory class
4
4
 
5
- The `Memory` class provides a robust system for managing conversation history and thread-based message storage in Mastra. It enables persistent storage of conversations, semantic search capabilities, and efficient message retrieval. You must configure a storage provider for conversation history, and if you enable semantic recall you will also need to provide a vector store and embedder.
5
+ The `Memory` class provides a reliable system for managing conversation history and thread-based message storage in Mastra. It enables persistent storage of conversations, semantic search capabilities, and efficient message retrieval. You must configure a storage provider for conversation history, and if you enable semantic recall you will also need to provide a vector store and embedder.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -14,7 +14,7 @@ export const agent = new Agent({
14
14
  id: 'test-agent',
15
15
  name: 'test-agent',
16
16
  instructions: 'You are an agent with memory.',
17
- model: 'openai/gpt-5.5',
17
+ model: 'openai/gpt-5.6-sol',
18
18
  memory: new Memory({
19
19
  options: {
20
20
  workingMemory: {
@@ -63,7 +63,7 @@ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
63
63
  export const agent = new Agent({
64
64
  name: 'test-agent',
65
65
  instructions: 'You are an agent with memory.',
66
- model: 'openai/gpt-5.5',
66
+ model: 'openai/gpt-5.6-sol',
67
67
  memory: new Memory({
68
68
  storage: new LibSQLStore({
69
69
  id: 'test-agent-storage',
@@ -100,7 +100,7 @@ import { PgStore, PgVector } from '@mastra/pg'
100
100
  export const agent = new Agent({
101
101
  name: 'pg-agent',
102
102
  instructions: 'You are an agent with optimized PostgreSQL memory.',
103
- model: 'openai/gpt-5.5',
103
+ model: 'openai/gpt-5.6-sol',
104
104
  memory: new Memory({
105
105
  storage: new PgStore({
106
106
  id: 'pg-agent-storage',
@@ -2,7 +2,7 @@
2
2
 
3
3
  # DynamoDB storage
4
4
 
5
- The DynamoDB storage implementation provides a scalable and performant NoSQL database solution for Mastra, leveraging a single-table design pattern with [ElectroDB](https://electrodb.dev/).
5
+ The DynamoDB storage implementation provides a high-capacity and performant NoSQL database solution for Mastra, using a single-table design pattern with [ElectroDB](https://electrodb.dev/).
6
6
 
7
7
  > **Observability Not Supported:** DynamoDB storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted to DynamoDB, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with DynamoDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
8
8
 
@@ -124,7 +124,7 @@ For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/
124
124
 
125
125
  ## TTL (time to live) configuration
126
126
 
127
- DynamoDB TTL allows you to automatically delete items after a specified time period. This is useful for:
127
+ DynamoDB TTL allows you to automatically delete items after a specified duration for these use cases:
128
128
 
129
129
  - **Cost optimization**: Automatically remove old data to reduce storage costs
130
130
  - **Data lifecycle management**: Implement retention policies for compliance
@@ -259,19 +259,19 @@ Before diving into the architectural details, keep these key points in mind when
259
259
 
260
260
  ## Architectural approach
261
261
 
262
- This storage adapter utilizes a **single-table design pattern** leveraging [ElectroDB](https://electrodb.dev/), a common and recommended approach for DynamoDB. This differs architecturally from relational database adapters (like `@mastra/pg` or `@mastra/libsql`) that typically use multiple tables, each dedicated to a specific entity (threads, messages, etc.).
262
+ This storage adapter utilizes a **single-table design pattern** with [ElectroDB](https://electrodb.dev/), a common and recommended approach for DynamoDB. This differs architecturally from relational database adapters (like `@mastra/pg` or `@mastra/libsql`) that typically use multiple tables, each dedicated to a specific entity (threads, messages, etc.).
263
263
 
264
264
  Key aspects of this approach:
265
265
 
266
- - **DynamoDB Native:** The single-table design is optimized for DynamoDB's key-value and query capabilities, often leading to better performance and scalability compared to mimicking relational models.
266
+ - **DynamoDB Native:** The single-table design is optimized for DynamoDB's key-value and query capabilities, often leading to better performance and capacity compared to mimicking relational models.
267
267
  - **External Table Management:** Unlike some adapters that might offer helper functions to create tables via code, this adapter **expects the DynamoDB table and its associated Global Secondary Indexes (GSIs) to be provisioned externally** before use. Please refer to [TABLE\_SETUP.md](https://github.com/mastra-ai/mastra/blob/main/stores/dynamodb/TABLE_SETUP.md) for detailed instructions using tools like AWS CloudFormation or CDK. The adapter focuses solely on interacting with the pre-existing table structure.
268
268
  - **Consistency via Interface:** While the underlying storage model differs, this adapter adheres to the same `MastraStorage` interface as other adapters, ensuring it can be used interchangeably within the Mastra `Memory` component.
269
269
 
270
270
  ### Mastra Data in the Single Table
271
271
 
272
- Within the single DynamoDB table, different Mastra data entities (such as Threads, Messages, Traces, Evals, and Workflows) are managed and distinguished using ElectroDB. ElectroDB defines specific models for each entity type, which include unique key structures and attributes. This allows the adapter to store and retrieve diverse data types efficiently within the same table.
272
+ Within the single DynamoDB table, different Mastra data entities (such as Threads, Messages, Traces, Evals, and Workflows) are managed and distinguished using ElectroDB. ElectroDB defines specific models for each entity type, which include unique key structures and attributes. It allows the adapter to store and retrieve diverse data types efficiently within the same table.
273
273
 
274
- For example, a `Thread` item might have a primary key like `THREAD#<threadId>`, while a `Message` item belonging to that thread might use `THREAD#<threadId>` as a partition key and `MESSAGE#<messageId>` as a sort key. The Global Secondary Indexes (GSIs), detailed in `TABLE_SETUP.md`, are strategically designed to support common access patterns across these different entities, such as fetching all messages for a thread or querying traces associated with a particular workflow.
274
+ For example, a `Thread` item might have a primary key like `THREAD#<threadId>`, while a `Message` item belonging to that thread might use `THREAD#<threadId>` as a partition key and `MESSAGE#<messageId>` as a sort key. The Global Secondary Indexes (GSIs), detailed in `TABLE_SETUP.md`, are strategically designed to support common access patterns across these different entities, such as fetching all messages for a thread or querying traces associated with a workflow.
275
275
 
276
276
  ### Advantages of Single-Table Design
277
277
 
@@ -279,6 +279,6 @@ This implementation uses a single-table design pattern with ElectroDB, which off
279
279
 
280
280
  1. **Lower cost (potentially):** Fewer tables can simplify Read/Write Capacity Unit (RCU/WCU) provisioning and management, especially with on-demand capacity.
281
281
  2. **Better performance:** Related data can be co-located or accessed efficiently through GSIs, enabling fast lookups for common access patterns.
282
- 3. **Simplified administration:** Fewer distinct tables to monitor, back up, and manage.
282
+ 3. **Simplified administration:** Fewer distinct tables to monitor and back up, with less to manage.
283
283
  4. **Reduced complexity in access patterns:** ElectroDB helps manage the complexity of item types and access patterns on a single table.
284
284
  5. **Transaction support:** DynamoDB transactions can be used across different "entity" types stored within the same table if needed.