@mastra/libsql 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/docs/SKILL.md +2 -2
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-agent-approval.md +4 -4
- package/dist/docs/references/docs-agents-network-approval.md +1 -1
- package/dist/docs/references/docs-agents-networks.md +1 -1
- package/dist/docs/references/docs-memory-memory-processors.md +6 -6
- package/dist/docs/references/docs-memory-overview.md +3 -3
- package/dist/docs/references/docs-memory-semantic-recall.md +1 -1
- package/dist/docs/references/docs-memory-storage.md +6 -6
- package/dist/docs/references/docs-memory-working-memory.md +2 -2
- package/dist/docs/references/docs-rag-retrieval.md +12 -12
- package/dist/docs/references/reference-core-mastra-class.md +1 -1
- package/dist/docs/references/reference-memory-memory-class.md +3 -3
- package/dist/docs/references/reference-storage-composite.md +11 -3
- package/dist/docs/references/reference-vectors-libsql.md +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 1.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added dated message boundary delimiters when activating buffered observations for improved cache stability. ([#14367](https://github.com/mastra-ai/mastra/pull/14367))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`51970b3`](https://github.com/mastra-ai/mastra/commit/51970b3828494d59a8dd4df143b194d37d31e3f5), [`4444280`](https://github.com/mastra-ai/mastra/commit/444428094253e916ec077e66284e685fde67021e), [`085e371`](https://github.com/mastra-ai/mastra/commit/085e3718a7d0fe9a210fe7dd1c867b9bdfe8d16b), [`b77aa19`](https://github.com/mastra-ai/mastra/commit/b77aa1981361c021f2c881bee8f0c703687f00da), [`dbb879a`](https://github.com/mastra-ai/mastra/commit/dbb879af0b809c668e9b3a9d8bac97d806caa267), [`8b4ce84`](https://github.com/mastra-ai/mastra/commit/8b4ce84aed0808b9805cc4fd7147c1f8a2ef7a36), [`8d4cfe6`](https://github.com/mastra-ai/mastra/commit/8d4cfe6b9a7157d3876206227ec9f04cde6dbc4a), [`dd6ca1c`](https://github.com/mastra-ai/mastra/commit/dd6ca1cdea3b8b6182f4cf61df41070ba0cc0deb), [`ce26fe2`](https://github.com/mastra-ai/mastra/commit/ce26fe2166dd90254f8bee5776e55977143e97de), [`68a019d`](https://github.com/mastra-ai/mastra/commit/68a019d30d22251ddd628a2947d60215c03c350a), [`4cb4edf`](https://github.com/mastra-ai/mastra/commit/4cb4edf3c909d197ec356c1790d13270514ffef6), [`8de3555`](https://github.com/mastra-ai/mastra/commit/8de355572c6fd838f863a3e7e6fe24d0947b774f), [`b26307f`](https://github.com/mastra-ai/mastra/commit/b26307f050df39629511b0e831b8fc26973ce8b1), [`68a019d`](https://github.com/mastra-ai/mastra/commit/68a019d30d22251ddd628a2947d60215c03c350a)]:
|
|
10
|
+
- @mastra/core@1.14.0
|
|
11
|
+
|
|
12
|
+
## 1.7.1-alpha.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Added dated message boundary delimiters when activating buffered observations for improved cache stability. ([#14367](https://github.com/mastra-ai/mastra/pull/14367))
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`4444280`](https://github.com/mastra-ai/mastra/commit/444428094253e916ec077e66284e685fde67021e), [`dbb879a`](https://github.com/mastra-ai/mastra/commit/dbb879af0b809c668e9b3a9d8bac97d806caa267), [`8de3555`](https://github.com/mastra-ai/mastra/commit/8de355572c6fd838f863a3e7e6fe24d0947b774f)]:
|
|
19
|
+
- @mastra/core@1.14.0-alpha.2
|
|
20
|
+
|
|
3
21
|
## 1.7.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.7.
|
|
6
|
+
version: "1.7.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -24,7 +24,7 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
24
24
|
- [Message history](references/docs-memory-message-history.md) - Learn how to configure message history in Mastra to store recent messages from the current conversation.
|
|
25
25
|
- [Memory overview](references/docs-memory-overview.md) - Learn how Mastra's memory system works with working memory, message history, semantic recall, and observational memory.
|
|
26
26
|
- [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.
|
|
27
|
-
- [Storage](references/docs-memory-storage.md) - Configure storage for Mastra
|
|
27
|
+
- [Storage](references/docs-memory-storage.md) - Configure storage for Mastra to persist conversations and other runtime state.
|
|
28
28
|
- [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
|
|
29
29
|
- [Observability overview](references/docs-observability-overview.md) - Monitor and debug applications with Mastra's Observability features.
|
|
30
30
|
- [Default exporter](references/docs-observability-tracing-exporters-default.md) - Store traces locally for development and debugging
|
|
@@ -278,7 +278,7 @@ const agent = new Agent({
|
|
|
278
278
|
id: 'my-agent',
|
|
279
279
|
name: 'My Agent',
|
|
280
280
|
instructions: 'You are a helpful assistant',
|
|
281
|
-
model: 'openai/gpt-
|
|
281
|
+
model: 'openai/gpt-5-mini',
|
|
282
282
|
tools: { weatherTool },
|
|
283
283
|
memory: new Memory(),
|
|
284
284
|
defaultOptions: {
|
|
@@ -343,7 +343,7 @@ const agent = new Agent({
|
|
|
343
343
|
id: 'my-agent',
|
|
344
344
|
name: 'My Agent',
|
|
345
345
|
instructions: 'You are a helpful assistant',
|
|
346
|
-
model: 'openai/gpt-
|
|
346
|
+
model: 'openai/gpt-5-mini',
|
|
347
347
|
tools: { weatherTool },
|
|
348
348
|
memory: new Memory(),
|
|
349
349
|
defaultOptions: {
|
|
@@ -445,7 +445,7 @@ const dataAgent = new Agent({
|
|
|
445
445
|
id: 'data-agent',
|
|
446
446
|
name: 'Data Agent',
|
|
447
447
|
description: 'Handles database queries and user data retrieval',
|
|
448
|
-
model: 'openai/gpt-
|
|
448
|
+
model: 'openai/gpt-5-mini',
|
|
449
449
|
tools: { findUserTool },
|
|
450
450
|
})
|
|
451
451
|
|
|
@@ -454,7 +454,7 @@ const supervisorAgent = new Agent({
|
|
|
454
454
|
name: 'Supervisor Agent',
|
|
455
455
|
instructions: `You coordinate data retrieval tasks.
|
|
456
456
|
Delegate to data-agent for user lookups.`,
|
|
457
|
-
model: 'openai/gpt-5.
|
|
457
|
+
model: 'openai/gpt-5.4',
|
|
458
458
|
agents: { dataAgent },
|
|
459
459
|
memory: new Memory(),
|
|
460
460
|
})
|
|
@@ -176,7 +176,7 @@ const routingAgent = new Agent({
|
|
|
176
176
|
id: 'routing-agent',
|
|
177
177
|
name: 'Routing Agent',
|
|
178
178
|
instructions: 'You coordinate tasks across multiple agents',
|
|
179
|
-
model: 'openai/gpt-
|
|
179
|
+
model: 'openai/gpt-5-mini',
|
|
180
180
|
tools: { confirmationTool },
|
|
181
181
|
memory: new Memory(),
|
|
182
182
|
defaultNetworkOptions: {
|
|
@@ -48,7 +48,7 @@ export const routingAgent = new Agent({
|
|
|
48
48
|
Always respond with a complete report—no bullet points.
|
|
49
49
|
Write in full paragraphs, like a blog post.
|
|
50
50
|
Do not answer with incomplete or uncertain information.`,
|
|
51
|
-
model: 'openai/gpt-5.
|
|
51
|
+
model: 'openai/gpt-5.4',
|
|
52
52
|
agents: {
|
|
53
53
|
researchAgent,
|
|
54
54
|
writingAgent,
|
|
@@ -45,7 +45,7 @@ const agent = new Agent({
|
|
|
45
45
|
id: 'test-agent',
|
|
46
46
|
name: 'Test Agent',
|
|
47
47
|
instructions: 'You are a helpful assistant',
|
|
48
|
-
model: 'openai/gpt-
|
|
48
|
+
model: 'openai/gpt-5.4',
|
|
49
49
|
memory: new Memory({
|
|
50
50
|
storage: new LibSQLStore({
|
|
51
51
|
id: 'memory-store',
|
|
@@ -95,7 +95,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
95
95
|
const agent = new Agent({
|
|
96
96
|
name: 'semantic-agent',
|
|
97
97
|
instructions: 'You are a helpful assistant with semantic memory',
|
|
98
|
-
model: 'openai/gpt-
|
|
98
|
+
model: 'openai/gpt-5.4',
|
|
99
99
|
memory: new Memory({
|
|
100
100
|
storage: new LibSQLStore({
|
|
101
101
|
id: 'memory-store',
|
|
@@ -148,7 +148,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
148
148
|
const agent = new Agent({
|
|
149
149
|
name: 'working-memory-agent',
|
|
150
150
|
instructions: 'You are an assistant with working memory',
|
|
151
|
-
model: 'openai/gpt-
|
|
151
|
+
model: 'openai/gpt-5.4',
|
|
152
152
|
memory: new Memory({
|
|
153
153
|
storage: new LibSQLStore({
|
|
154
154
|
id: 'memory-store',
|
|
@@ -180,7 +180,7 @@ const customMessageHistory = new MessageHistory({
|
|
|
180
180
|
const agent = new Agent({
|
|
181
181
|
name: 'custom-memory-agent',
|
|
182
182
|
instructions: 'You are a helpful assistant',
|
|
183
|
-
model: 'openai/gpt-
|
|
183
|
+
model: 'openai/gpt-5.4',
|
|
184
184
|
memory: new Memory({
|
|
185
185
|
storage: new LibSQLStore({ id: 'memory-store', url: 'file:memory.db' }),
|
|
186
186
|
lastMessages: 10, // This would normally add MessageHistory(10)
|
|
@@ -250,7 +250,7 @@ const contentBlocker = {
|
|
|
250
250
|
const agent = new Agent({
|
|
251
251
|
name: 'safe-agent',
|
|
252
252
|
instructions: 'You are a helpful assistant',
|
|
253
|
-
model: 'openai/gpt-
|
|
253
|
+
model: 'openai/gpt-5.4',
|
|
254
254
|
memory: new Memory({ lastMessages: 10 }),
|
|
255
255
|
// Your guardrail runs BEFORE memory saves
|
|
256
256
|
outputProcessors: [contentBlocker],
|
|
@@ -289,7 +289,7 @@ const inputValidator = {
|
|
|
289
289
|
const agent = new Agent({
|
|
290
290
|
name: 'validated-agent',
|
|
291
291
|
instructions: 'You are a helpful assistant',
|
|
292
|
-
model: 'openai/gpt-
|
|
292
|
+
model: 'openai/gpt-5.4',
|
|
293
293
|
memory: new Memory({ lastMessages: 10 }),
|
|
294
294
|
// Your guardrail runs AFTER memory loads history
|
|
295
295
|
inputProcessors: [inputValidator],
|
|
@@ -5,9 +5,9 @@ Memory enables your agent to remember user messages, agent replies, and tool res
|
|
|
5
5
|
Mastra supports four complementary memory types:
|
|
6
6
|
|
|
7
7
|
- [**Message history**](https://mastra.ai/docs/memory/message-history) - keeps recent messages from the current conversation so they can be rendered in the UI and used to maintain short-term continuity within the exchange.
|
|
8
|
+
- [**Observational memory**](https://mastra.ai/docs/memory/observational-memory) - uses background Observer and Reflector agents to maintain a dense observation log that replaces raw message history as it grows, keeping the context window small while preserving long-term memory across conversations.
|
|
8
9
|
- [**Working memory**](https://mastra.ai/docs/memory/working-memory) - stores persistent, structured user data such as names, preferences, and goals.
|
|
9
10
|
- [**Semantic recall**](https://mastra.ai/docs/memory/semantic-recall) - retrieves relevant messages from older conversations based on semantic meaning rather than exact keywords, mirroring how humans recall information by association. Requires a [vector database](https://mastra.ai/docs/memory/semantic-recall) and an [embedding model](https://mastra.ai/docs/memory/semantic-recall).
|
|
10
|
-
- [**Observational memory**](https://mastra.ai/docs/memory/observational-memory) - uses background Observer and Reflector agents to maintain a dense observation log that replaces raw message history as it grows, keeping the context window small while preserving long-term memory across conversations.
|
|
11
11
|
|
|
12
12
|
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.
|
|
13
13
|
|
|
@@ -16,9 +16,9 @@ If the combined memory exceeds the model's context limit, [memory processors](ht
|
|
|
16
16
|
Choose a memory option to get started:
|
|
17
17
|
|
|
18
18
|
- [Message history](https://mastra.ai/docs/memory/message-history)
|
|
19
|
+
- [Observational memory](https://mastra.ai/docs/memory/observational-memory)
|
|
19
20
|
- [Working memory](https://mastra.ai/docs/memory/working-memory)
|
|
20
21
|
- [Semantic recall](https://mastra.ai/docs/memory/semantic-recall)
|
|
21
|
-
- [Observational memory](https://mastra.ai/docs/memory/observational-memory)
|
|
22
22
|
|
|
23
23
|
## Storage
|
|
24
24
|
|
|
@@ -41,5 +41,5 @@ This visibility helps you understand why an agent made specific decisions and ve
|
|
|
41
41
|
## Next steps
|
|
42
42
|
|
|
43
43
|
- Learn more about [Storage](https://mastra.ai/docs/memory/storage) providers and configuration options
|
|
44
|
-
- Add [Message history](https://mastra.ai/docs/memory/message-history), [
|
|
44
|
+
- Add [Message history](https://mastra.ai/docs/memory/message-history), [Observational memory](https://mastra.ai/docs/memory/observational-memory), [Working memory](https://mastra.ai/docs/memory/working-memory), or [Semantic recall](https://mastra.ai/docs/memory/semantic-recall)
|
|
45
45
|
- Visit [Memory configuration reference](https://mastra.ai/reference/memory/memory-class) for all available options
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Storage
|
|
2
2
|
|
|
3
|
-
For agents to remember previous interactions, Mastra needs a
|
|
3
|
+
For agents to remember previous interactions, Mastra needs a storage adapter. Use one of the [supported providers](#supported-providers) and pass it to your Mastra instance.
|
|
4
4
|
|
|
5
5
|
```typescript
|
|
6
6
|
import { Mastra } from '@mastra/core'
|
|
@@ -24,7 +24,7 @@ export const mastra = new Mastra({
|
|
|
24
24
|
|
|
25
25
|
This configures instance-level storage, which all agents share by default. You can also configure [agent-level storage](#agent-level-storage) for isolated data boundaries.
|
|
26
26
|
|
|
27
|
-
Mastra automatically
|
|
27
|
+
Mastra automatically initializes the necessary storage structures on first interaction. See [Storage Overview](https://mastra.ai/reference/storage/overview) for domain coverage and the schema used by the built-in database-backed domains.
|
|
28
28
|
|
|
29
29
|
## Supported providers
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ Each provider page includes installation instructions, configuration parameters,
|
|
|
35
35
|
- [MongoDB](https://mastra.ai/reference/storage/mongodb)
|
|
36
36
|
- [Upstash](https://mastra.ai/reference/storage/upstash)
|
|
37
37
|
- [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
|
|
38
|
-
- [Cloudflare Durable Objects](https://mastra.ai/reference/storage/cloudflare)
|
|
38
|
+
- [Cloudflare KV & Durable Objects](https://mastra.ai/reference/storage/cloudflare)
|
|
39
39
|
- [Convex](https://mastra.ai/reference/storage/convex)
|
|
40
40
|
- [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
|
|
41
41
|
- [LanceDB](https://mastra.ai/reference/storage/lance)
|
|
@@ -49,7 +49,7 @@ Storage can be configured at the instance level (shared by all agents) or at the
|
|
|
49
49
|
|
|
50
50
|
### Instance-level storage
|
|
51
51
|
|
|
52
|
-
Add storage to your Mastra instance so all agents, workflows, observability traces and scores share the same
|
|
52
|
+
Add storage to your Mastra instance so all agents, workflows, observability traces, and scores share the same storage backend:
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
import { Mastra } from '@mastra/core'
|
|
@@ -71,7 +71,7 @@ This is useful when all primitives share the same storage backend and have simil
|
|
|
71
71
|
|
|
72
72
|
#### Composite storage
|
|
73
73
|
|
|
74
|
-
[Composite storage](https://mastra.ai/reference/storage/composite) is an alternative way to configure instance-level storage. Use `MastraCompositeStore` to
|
|
74
|
+
[Composite storage](https://mastra.ai/reference/storage/composite) is an alternative way to configure instance-level storage. Use `MastraCompositeStore` to route `memory` and any other [supported domains](https://mastra.ai/reference/storage/composite) to different storage providers.
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
import { Mastra } from '@mastra/core'
|
|
@@ -180,7 +180,7 @@ export const agent = new Agent({
|
|
|
180
180
|
memory: new Memory({
|
|
181
181
|
options: {
|
|
182
182
|
generateTitle: {
|
|
183
|
-
model: 'openai/gpt-
|
|
183
|
+
model: 'openai/gpt-5-mini',
|
|
184
184
|
instructions: 'Generate a 1 word title',
|
|
185
185
|
},
|
|
186
186
|
},
|
|
@@ -26,7 +26,7 @@ const agent = new Agent({
|
|
|
26
26
|
id: 'personal-assistant',
|
|
27
27
|
name: 'PersonalAssistant',
|
|
28
28
|
instructions: 'You are a helpful personal assistant.',
|
|
29
|
-
model: 'openai/gpt-5.
|
|
29
|
+
model: 'openai/gpt-5.4',
|
|
30
30
|
memory: new Memory({
|
|
31
31
|
options: {
|
|
32
32
|
workingMemory: {
|
|
@@ -268,7 +268,7 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
|
|
|
268
268
|
## Choosing between template and schema
|
|
269
269
|
|
|
270
270
|
- 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.
|
|
271
|
-
- Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. Schemas use **merge semantics** — the agent only provides fields to update, and existing fields are preserved.
|
|
271
|
+
- 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.
|
|
272
272
|
- Only one mode can be active at a time: setting both `template` and `schema` isn't supported.
|
|
273
273
|
|
|
274
274
|
## Example: Multi-step retention
|
|
@@ -272,7 +272,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
|
|
|
272
272
|
export const ragAgent = new Agent({
|
|
273
273
|
id: 'rag-agent',
|
|
274
274
|
name: 'RAG Agent',
|
|
275
|
-
model: 'openai/gpt-5.
|
|
275
|
+
model: 'openai/gpt-5.4',
|
|
276
276
|
instructions: `
|
|
277
277
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
278
278
|
${PGVECTOR_PROMPT}
|
|
@@ -289,7 +289,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
|
289
289
|
export const ragAgent = new Agent({
|
|
290
290
|
id: 'rag-agent',
|
|
291
291
|
name: 'RAG Agent',
|
|
292
|
-
model: 'openai/gpt-5.
|
|
292
|
+
model: 'openai/gpt-5.4',
|
|
293
293
|
instructions: `
|
|
294
294
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
295
295
|
${PINECONE_PROMPT}
|
|
@@ -306,7 +306,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
|
306
306
|
export const ragAgent = new Agent({
|
|
307
307
|
id: 'rag-agent',
|
|
308
308
|
name: 'RAG Agent',
|
|
309
|
-
model: 'openai/gpt-5.
|
|
309
|
+
model: 'openai/gpt-5.4',
|
|
310
310
|
instructions: `
|
|
311
311
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
312
312
|
${QDRANT_PROMPT}
|
|
@@ -323,7 +323,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
|
323
323
|
export const ragAgent = new Agent({
|
|
324
324
|
id: 'rag-agent',
|
|
325
325
|
name: 'RAG Agent',
|
|
326
|
-
model: 'openai/gpt-5.
|
|
326
|
+
model: 'openai/gpt-5.4',
|
|
327
327
|
instructions: `
|
|
328
328
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
329
329
|
${CHROMA_PROMPT}
|
|
@@ -340,7 +340,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
|
|
|
340
340
|
export const ragAgent = new Agent({
|
|
341
341
|
id: 'rag-agent',
|
|
342
342
|
name: 'RAG Agent',
|
|
343
|
-
model: 'openai/gpt-5.
|
|
343
|
+
model: 'openai/gpt-5.4',
|
|
344
344
|
instructions: `
|
|
345
345
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
346
346
|
${ASTRA_PROMPT}
|
|
@@ -357,7 +357,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
|
357
357
|
export const ragAgent = new Agent({
|
|
358
358
|
id: 'rag-agent',
|
|
359
359
|
name: 'RAG Agent',
|
|
360
|
-
model: 'openai/gpt-5.
|
|
360
|
+
model: 'openai/gpt-5.4',
|
|
361
361
|
instructions: `
|
|
362
362
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
363
363
|
${LIBSQL_PROMPT}
|
|
@@ -374,7 +374,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
|
374
374
|
export const ragAgent = new Agent({
|
|
375
375
|
id: 'rag-agent',
|
|
376
376
|
name: 'RAG Agent',
|
|
377
|
-
model: 'openai/gpt-5.
|
|
377
|
+
model: 'openai/gpt-5.4',
|
|
378
378
|
instructions: `
|
|
379
379
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
380
380
|
${UPSTASH_PROMPT}
|
|
@@ -391,7 +391,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
|
391
391
|
export const ragAgent = new Agent({
|
|
392
392
|
id: 'rag-agent',
|
|
393
393
|
name: 'RAG Agent',
|
|
394
|
-
model: 'openai/gpt-5.
|
|
394
|
+
model: 'openai/gpt-5.4',
|
|
395
395
|
instructions: `
|
|
396
396
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
397
397
|
${VECTORIZE_PROMPT}
|
|
@@ -408,7 +408,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
|
408
408
|
export const ragAgent = new Agent({
|
|
409
409
|
id: 'rag-agent',
|
|
410
410
|
name: 'RAG Agent',
|
|
411
|
-
model: 'openai/gpt-5.
|
|
411
|
+
model: 'openai/gpt-5.4',
|
|
412
412
|
instructions: `
|
|
413
413
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
414
414
|
${MONGODB_PROMPT}
|
|
@@ -425,7 +425,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
|
425
425
|
export const ragAgent = new Agent({
|
|
426
426
|
id: 'rag-agent',
|
|
427
427
|
name: 'RAG Agent',
|
|
428
|
-
model: 'openai/gpt-5.
|
|
428
|
+
model: 'openai/gpt-5.4',
|
|
429
429
|
instructions: `
|
|
430
430
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
431
431
|
${OPENSEARCH_PROMPT}
|
|
@@ -442,7 +442,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
|
442
442
|
export const ragAgent = new Agent({
|
|
443
443
|
id: 'rag-agent',
|
|
444
444
|
name: 'RAG Agent',
|
|
445
|
-
model: 'openai/gpt-5.
|
|
445
|
+
model: 'openai/gpt-5.4',
|
|
446
446
|
instructions: `
|
|
447
447
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
448
448
|
${S3VECTORS_PROMPT}
|
|
@@ -472,7 +472,7 @@ const initialResults = await pgVector.query({
|
|
|
472
472
|
})
|
|
473
473
|
|
|
474
474
|
// Create a relevance scorer
|
|
475
|
-
const relevanceProvider = new MastraAgentRelevanceScorer('relevance-scorer', 'openai/gpt-5.
|
|
475
|
+
const relevanceProvider = new MastraAgentRelevanceScorer('relevance-scorer', 'openai/gpt-5.4')
|
|
476
476
|
|
|
477
477
|
// Re-rank the results
|
|
478
478
|
const rerankedResults = await rerank({
|
|
@@ -55,7 +55,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
55
55
|
|
|
56
56
|
**mcpServers** (`Record<string, MCPServerBase>`): An object where keys are registry keys (used for getMCPServer()) and values are instances of MCPServer or classes extending MCPServerBase. Each MCPServer must have an id property. Servers can be retrieved by registry key using getMCPServer() or by their intrinsic id using getMCPServerById().
|
|
57
57
|
|
|
58
|
-
**bundler** (`BundlerConfig`): Configuration for the asset bundler with options for externals, sourcemap, and transpilePackages
|
|
58
|
+
**bundler** (`BundlerConfig`): Configuration for the asset bundler with options for externals, sourcemap, transpilePackages, and dynamicPackages. (Default: `{ externals: [], sourcemap: false, transpilePackages: [], dynamicPackages: [] }`)
|
|
59
59
|
|
|
60
60
|
**scorers** (`Record<string, Scorer>`): Scorers for evaluating agent responses and workflow outputs (Default: `{}`)
|
|
61
61
|
|
|
@@ -11,7 +11,7 @@ import { Agent } from '@mastra/core/agent'
|
|
|
11
11
|
export const agent = new Agent({
|
|
12
12
|
name: 'test-agent',
|
|
13
13
|
instructions: 'You are an agent with memory.',
|
|
14
|
-
model: 'openai/gpt-5.
|
|
14
|
+
model: 'openai/gpt-5.4',
|
|
15
15
|
memory: new Memory({
|
|
16
16
|
options: {
|
|
17
17
|
workingMemory: {
|
|
@@ -60,7 +60,7 @@ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
|
|
|
60
60
|
export const agent = new Agent({
|
|
61
61
|
name: 'test-agent',
|
|
62
62
|
instructions: 'You are an agent with memory.',
|
|
63
|
-
model: 'openai/gpt-5.
|
|
63
|
+
model: 'openai/gpt-5.4',
|
|
64
64
|
memory: new Memory({
|
|
65
65
|
storage: new LibSQLStore({
|
|
66
66
|
id: 'test-agent-storage',
|
|
@@ -97,7 +97,7 @@ import { PgStore, PgVector } from '@mastra/pg'
|
|
|
97
97
|
export const agent = new Agent({
|
|
98
98
|
name: 'pg-agent',
|
|
99
99
|
instructions: 'You are an agent with optimized PostgreSQL memory.',
|
|
100
|
-
model: 'openai/gpt-5.
|
|
100
|
+
model: 'openai/gpt-5.4',
|
|
101
101
|
memory: new Memory({
|
|
102
102
|
storage: new PgStore({
|
|
103
103
|
id: 'pg-agent-storage',
|
|
@@ -58,7 +58,7 @@ bun add @mastra/pg@latest @mastra/libsql@latest
|
|
|
58
58
|
|
|
59
59
|
## Storage domains
|
|
60
60
|
|
|
61
|
-
Mastra organizes storage into
|
|
61
|
+
Mastra organizes storage into domains, each handling a specific type of data. Each domain can be backed by a different storage adapter, and domain classes are exported from each storage package.
|
|
62
62
|
|
|
63
63
|
| Domain | Description |
|
|
64
64
|
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -67,6 +67,10 @@ Mastra organizes storage into five specialized domains, each handling a specific
|
|
|
67
67
|
| `scores` | Evaluation results from Mastra's evals system. Scores and metrics are persisted here for analysis and comparison over time. |
|
|
68
68
|
| `observability` | Telemetry data including traces and spans. Agent interactions, tool calls, and LLM requests generate spans collected into traces for debugging and performance analysis. |
|
|
69
69
|
| `agents` | Agent configurations for stored agents. Enables agents to be defined and updated at runtime without code deployments. |
|
|
70
|
+
| `datasets` | Evaluation datasets used for experiment runs. Stores dataset definitions, schemas, and versioned items. |
|
|
71
|
+
| `experiments` | Experiment runs and per-item experiment results linked to datasets and targets. |
|
|
72
|
+
|
|
73
|
+
> **Note:** `MastraCompositeStore` accepts all of the domain keys above, but storage adapter support varies by package. You can mix adapters per domain, but only for domains implemented and exported by those adapters. For example, `memory: new MemoryLibSQL(...)` and `workflows: new WorkflowsPG(...)` is valid because both packages export those domain classes.
|
|
70
74
|
|
|
71
75
|
## Usage
|
|
72
76
|
|
|
@@ -124,7 +128,9 @@ export const mastra = new Mastra({
|
|
|
124
128
|
|
|
125
129
|
**default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in \`domains\` will use this storage's domains as fallbacks.
|
|
126
130
|
|
|
127
|
-
**
|
|
131
|
+
**disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
|
|
132
|
+
|
|
133
|
+
**domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both \`editor\` and \`default\` storage.
|
|
128
134
|
|
|
129
135
|
**domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
|
|
130
136
|
|
|
@@ -136,7 +142,9 @@ export const mastra = new Mastra({
|
|
|
136
142
|
|
|
137
143
|
**domains.agents** (`AgentsStorage`): Storage for stored agent configurations.
|
|
138
144
|
|
|
139
|
-
**
|
|
145
|
+
**domains.datasets** (`DatasetsStorage`): Storage for dataset metadata, dataset items, and dataset versions.
|
|
146
|
+
|
|
147
|
+
**domains.experiments** (`ExperimentsStorage`): Storage for experiment runs and per-item experiment results.
|
|
140
148
|
|
|
141
149
|
## Initialization
|
|
142
150
|
|
|
@@ -277,7 +277,7 @@ export const libsqlAgent = new Agent({
|
|
|
277
277
|
name: 'libSQL Agent',
|
|
278
278
|
instructions:
|
|
279
279
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
280
|
-
model: 'openai/gpt-5.
|
|
280
|
+
model: 'openai/gpt-5.4',
|
|
281
281
|
memory: new Memory({
|
|
282
282
|
storage: new LibSQLStore({
|
|
283
283
|
id: 'libsql-agent-storage',
|
package/dist/index.cjs
CHANGED
|
@@ -6994,15 +6994,15 @@ var MemoryLibSQL = class extends storage.MemoryStorage {
|
|
|
6994
6994
|
let bestUnderTokens = 0;
|
|
6995
6995
|
for (let i = 0; i < chunks.length; i++) {
|
|
6996
6996
|
cumulativeMessageTokens += chunks[i].messageTokens ?? 0;
|
|
6997
|
-
const
|
|
6997
|
+
const boundary2 = i + 1;
|
|
6998
6998
|
if (cumulativeMessageTokens >= targetMessageTokens) {
|
|
6999
6999
|
if (bestOverBoundary === 0 || cumulativeMessageTokens < bestOverTokens) {
|
|
7000
|
-
bestOverBoundary =
|
|
7000
|
+
bestOverBoundary = boundary2;
|
|
7001
7001
|
bestOverTokens = cumulativeMessageTokens;
|
|
7002
7002
|
}
|
|
7003
7003
|
} else {
|
|
7004
7004
|
if (cumulativeMessageTokens > bestUnderTokens) {
|
|
7005
|
-
bestUnderBoundary =
|
|
7005
|
+
bestUnderBoundary = boundary2;
|
|
7006
7006
|
bestUnderTokens = cumulativeMessageTokens;
|
|
7007
7007
|
}
|
|
7008
7008
|
}
|
|
@@ -7037,9 +7037,12 @@ var MemoryLibSQL = class extends storage.MemoryStorage {
|
|
|
7037
7037
|
const lastObservedAtStr = lastObservedAt.toISOString();
|
|
7038
7038
|
const existingActive = row.activeObservations || "";
|
|
7039
7039
|
const existingTokenCount = Number(row.observationTokenCount || 0);
|
|
7040
|
-
const
|
|
7040
|
+
const boundary = `
|
|
7041
7041
|
|
|
7042
|
-
${
|
|
7042
|
+
--- message boundary (${lastObservedAt.toISOString()}) ---
|
|
7043
|
+
|
|
7044
|
+
`;
|
|
7045
|
+
const newActive = existingActive ? `${existingActive}${boundary}${activatedContent}` : activatedContent;
|
|
7043
7046
|
const newTokenCount = existingTokenCount + activatedTokens;
|
|
7044
7047
|
const existingPending = Number(row.pendingMessageTokens || 0);
|
|
7045
7048
|
const newPending = Math.max(0, existingPending - activatedMessageTokens);
|