@mastra/server 1.2.0-alpha.0 → 1.2.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.
- package/CHANGELOG.md +202 -0
- package/dist/{chunk-QL3KET2C.cjs → chunk-2ABZICAN.cjs} +6804 -476
- package/dist/chunk-2ABZICAN.cjs.map +1 -0
- package/dist/chunk-3NG2FRSI.js +41 -0
- package/dist/chunk-3NG2FRSI.js.map +1 -0
- package/dist/{chunk-7XIMPDJV.js → chunk-5A2J7TUN.js} +4 -3
- package/dist/chunk-5A2J7TUN.js.map +1 -0
- package/dist/chunk-5ZBS3CWT.cjs +43 -0
- package/dist/chunk-5ZBS3CWT.cjs.map +1 -0
- package/dist/{chunk-CRGRPMWI.js → chunk-7PYTUOM6.js} +4 -4
- package/dist/{chunk-CRGRPMWI.js.map → chunk-7PYTUOM6.js.map} +1 -1
- package/dist/chunk-7XBOJMBD.js +56 -0
- package/dist/chunk-7XBOJMBD.js.map +1 -0
- package/dist/{chunk-ADNT2PDV.cjs → chunk-CAPYNS3W.cjs} +9 -9
- package/dist/{chunk-ADNT2PDV.cjs.map → chunk-CAPYNS3W.cjs.map} +1 -1
- package/dist/chunk-CXL3KPGO.cjs +58 -0
- package/dist/chunk-CXL3KPGO.cjs.map +1 -0
- package/dist/{chunk-5P2VGES5.js → chunk-DURK4Z3A.js} +5 -5
- package/dist/chunk-DURK4Z3A.js.map +1 -0
- package/dist/{chunk-JANOIUVD.cjs → chunk-E2JHVKGO.cjs} +5 -5
- package/dist/chunk-E2JHVKGO.cjs.map +1 -0
- package/dist/{chunk-BV24MR2R.js → chunk-FJTSBRYT.js} +4 -4
- package/dist/chunk-FJTSBRYT.js.map +1 -0
- package/dist/{chunk-XC42BH7B.cjs → chunk-GQJJSFM3.cjs} +83 -83
- package/dist/chunk-GQJJSFM3.cjs.map +1 -0
- package/dist/{chunk-SONAXR2M.cjs → chunk-KPDZYFEE.cjs} +4 -3
- package/dist/chunk-KPDZYFEE.cjs.map +1 -0
- package/dist/{chunk-A2K5ZL47.cjs → chunk-LHQBSFTY.cjs} +18 -18
- package/dist/{chunk-A2K5ZL47.cjs.map → chunk-LHQBSFTY.cjs.map} +1 -1
- package/dist/{chunk-K2SXZLA3.cjs → chunk-LHWGX4IO.cjs} +4 -3
- package/dist/chunk-LHWGX4IO.cjs.map +1 -0
- package/dist/{chunk-KPHPNRVH.js → chunk-LTEIJ6D3.js} +174 -124
- package/dist/chunk-LTEIJ6D3.js.map +1 -0
- package/dist/{chunk-LFNP3ACE.js → chunk-MDKUY3AV.js} +4 -3
- package/dist/chunk-MDKUY3AV.js.map +1 -0
- package/dist/{chunk-F2WTCJ5C.js → chunk-MSI7KYQL.js} +4 -4
- package/dist/{chunk-F2WTCJ5C.js.map → chunk-MSI7KYQL.js.map} +1 -1
- package/dist/{chunk-AO7LIZRK.cjs → chunk-OGSBJMPX.cjs} +17 -17
- package/dist/chunk-OGSBJMPX.cjs.map +1 -0
- package/dist/{chunk-MZRJNOYJ.cjs → chunk-RGMLSZHU.cjs} +11 -11
- package/dist/{chunk-MZRJNOYJ.cjs.map → chunk-RGMLSZHU.cjs.map} +1 -1
- package/dist/{chunk-33WUKZ5N.cjs → chunk-SEE2MAOJ.cjs} +25 -25
- package/dist/{chunk-33WUKZ5N.cjs.map → chunk-SEE2MAOJ.cjs.map} +1 -1
- package/dist/{chunk-MGJLH2AB.cjs → chunk-T4ZBRGJU.cjs} +26 -26
- package/dist/{chunk-MGJLH2AB.cjs.map → chunk-T4ZBRGJU.cjs.map} +1 -1
- package/dist/{chunk-JG46WVHC.js → chunk-TGPGUUET.js} +4 -4
- package/dist/{chunk-JG46WVHC.js.map → chunk-TGPGUUET.js.map} +1 -1
- package/dist/{chunk-ED6NQBHF.js → chunk-UABQC3SK.js} +3 -3
- package/dist/{chunk-ED6NQBHF.js.map → chunk-UABQC3SK.js.map} +1 -1
- package/dist/{chunk-AN42MFD5.cjs → chunk-XI35WFHZ.cjs} +249 -9
- package/dist/chunk-XI35WFHZ.cjs.map +1 -0
- package/dist/{chunk-G75NUKBO.js → chunk-Z3ZWANXZ.js} +6672 -344
- package/dist/chunk-Z3ZWANXZ.js.map +1 -0
- package/dist/{chunk-KPNL6ZFK.js → chunk-ZIAEKNPT.js} +5 -5
- package/dist/chunk-ZIAEKNPT.js.map +1 -0
- package/dist/{chunk-BEMGUJPC.js → chunk-ZVYEL4VO.js} +4 -4
- package/dist/{chunk-BEMGUJPC.js.map → chunk-ZVYEL4VO.js.map} +1 -1
- package/dist/{chunk-L6AKFVEX.cjs → chunk-ZWYF2ADF.cjs} +175 -125
- package/dist/chunk-ZWYF2ADF.cjs.map +1 -0
- package/dist/{chunk-4JAEBN6N.js → chunk-ZX4RYNOP.js} +249 -10
- package/dist/chunk-ZX4RYNOP.js.map +1 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/observational-memory-VXLHOSDZ-H2TJ6BI4.js +3439 -0
- package/dist/observational-memory-VXLHOSDZ-H2TJ6BI4.js.map +1 -0
- package/dist/observational-memory-VXLHOSDZ-YUXHRMDP.cjs +3451 -0
- package/dist/observational-memory-VXLHOSDZ-YUXHRMDP.cjs.map +1 -0
- package/dist/server/handlers/a2a.cjs +9 -9
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +14 -14
- package/dist/server/handlers/agent-versions.d.ts +591 -76
- package/dist/server/handlers/agent-versions.d.ts.map +1 -1
- package/dist/server/handlers/agent-versions.js +1 -1
- package/dist/server/handlers/agents.cjs +32 -32
- package/dist/server/handlers/agents.d.ts +140 -4
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/memory.cjs +29 -25
- package/dist/server/handlers/memory.d.ts +85 -0
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.d.ts +2 -2
- package/dist/server/handlers/observability.d.ts.map +1 -1
- package/dist/server/handlers/processors.cjs +4 -4
- package/dist/server/handlers/processors.d.ts.map +1 -1
- package/dist/server/handlers/processors.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +6 -6
- package/dist/server/handlers/stored-agents.d.ts +1082 -78
- package/dist/server/handlers/stored-agents.d.ts.map +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +24 -24
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers/workspace.d.ts +4 -4
- package/dist/server/handlers.cjs +16 -16
- package/dist/server/handlers.js +8 -8
- package/dist/server/schemas/agent-versions.d.ts +4433 -321
- package/dist/server/schemas/agent-versions.d.ts.map +1 -1
- package/dist/server/schemas/agents.d.ts +1031 -11
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/default-options.d.ts +256 -0
- package/dist/server/schemas/default-options.d.ts.map +1 -0
- package/dist/server/schemas/memory-config.d.ts +188 -0
- package/dist/server/schemas/memory-config.d.ts.map +1 -0
- package/dist/server/schemas/memory.d.ts +401 -1
- package/dist/server/schemas/memory.d.ts.map +1 -1
- package/dist/server/schemas/stored-agents.d.ts +4800 -341
- package/dist/server/schemas/stored-agents.d.ts.map +1 -1
- package/dist/server/schemas/workspace.d.ts +2 -2
- package/dist/server/server-adapter/index.cjs +134 -133
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.js +14 -13
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/memory.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-4JAEBN6N.js.map +0 -1
- package/dist/chunk-5P2VGES5.js.map +0 -1
- package/dist/chunk-7XIMPDJV.js.map +0 -1
- package/dist/chunk-AN42MFD5.cjs.map +0 -1
- package/dist/chunk-AO7LIZRK.cjs.map +0 -1
- package/dist/chunk-BV24MR2R.js.map +0 -1
- package/dist/chunk-G75NUKBO.js.map +0 -1
- package/dist/chunk-JANOIUVD.cjs.map +0 -1
- package/dist/chunk-K2SXZLA3.cjs.map +0 -1
- package/dist/chunk-KPHPNRVH.js.map +0 -1
- package/dist/chunk-KPNL6ZFK.js.map +0 -1
- package/dist/chunk-L6AKFVEX.cjs.map +0 -1
- package/dist/chunk-LFNP3ACE.js.map +0 -1
- package/dist/chunk-QL3KET2C.cjs.map +0 -1
- package/dist/chunk-SONAXR2M.cjs.map +0 -1
- package/dist/chunk-XC42BH7B.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,207 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added Observational Memory — a new memory system that keeps your agent's context window small while preserving long-term memory across conversations. ([#12599](https://github.com/mastra-ai/mastra/pull/12599))
|
|
8
|
+
|
|
9
|
+
**Why:** Long conversations cause context rot and waste tokens. Observational Memory compresses conversation history into observations (5–40x compression) and periodically condenses those into reflections. Your agent stays fast and focused, even after thousands of messages.
|
|
10
|
+
|
|
11
|
+
**Usage:**
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Memory } from '@mastra/memory';
|
|
15
|
+
import { PostgresStore } from '@mastra/pg';
|
|
16
|
+
|
|
17
|
+
const memory = new Memory({
|
|
18
|
+
storage: new PostgresStore({ connectionString: process.env.DATABASE_URL }),
|
|
19
|
+
options: {
|
|
20
|
+
observationalMemory: true,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const agent = new Agent({
|
|
25
|
+
name: 'my-agent',
|
|
26
|
+
model: openai('gpt-4o'),
|
|
27
|
+
memory,
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**What's new:**
|
|
32
|
+
- `observationalMemory: true` enables the three-tier memory system (recent messages → observations → reflections)
|
|
33
|
+
- Thread-scoped (per-conversation) and resource-scoped (shared across all threads for a user) modes
|
|
34
|
+
- Manual `observe()` API for triggering observation outside the normal agent loop
|
|
35
|
+
- New OM storage methods for pg, libsql, and mongodb adapters (conditionally enabled)
|
|
36
|
+
- `Agent.findProcessor()` method for looking up processors by ID
|
|
37
|
+
- `processorStates` for persisting processor state across loop iterations
|
|
38
|
+
- Abort signal propagation to processors
|
|
39
|
+
- `ProcessorStreamWriter` for custom stream events from processors
|
|
40
|
+
|
|
41
|
+
- Added skills.sh proxy endpoints for browsing, searching, and installing skills from the community registry. ([#12492](https://github.com/mastra-ai/mastra/pull/12492))
|
|
42
|
+
|
|
43
|
+
**New endpoints:**
|
|
44
|
+
- GET /api/workspaces/:id/skills-sh/search - Search skills
|
|
45
|
+
- GET /api/workspaces/:id/skills-sh/popular - Browse popular skills
|
|
46
|
+
- GET /api/workspaces/:id/skills-sh/preview - Preview skill SKILL.md content
|
|
47
|
+
- POST /api/workspaces/:id/skills-sh/install - Install a skill from GitHub
|
|
48
|
+
- POST /api/workspaces/:id/skills-sh/update - Update installed skills
|
|
49
|
+
- POST /api/workspaces/:id/skills-sh/remove - Remove an installed skill
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Created @mastra/editor package for managing and resolving stored agent configurations ([#12631](https://github.com/mastra-ai/mastra/pull/12631))
|
|
54
|
+
|
|
55
|
+
This major addition introduces the editor package, which provides a complete solution for storing, versioning, and instantiating agent configurations from a database. The editor seamlessly integrates with Mastra's storage layer to enable dynamic agent management.
|
|
56
|
+
|
|
57
|
+
**Key Features:**
|
|
58
|
+
- **Agent Storage & Retrieval**: Store complete agent configurations including instructions, model settings, tools, workflows, nested agents, scorers, processors, and memory configuration
|
|
59
|
+
- **Version Management**: Create and manage multiple versions of agents, with support for activating specific versions
|
|
60
|
+
- **Dependency Resolution**: Automatically resolves and instantiates all agent dependencies (tools, workflows, sub-agents, etc.) from the Mastra registry
|
|
61
|
+
- **Caching**: Built-in caching for improved performance when repeatedly accessing stored agents
|
|
62
|
+
- **Type Safety**: Full TypeScript support with proper typing for stored configurations
|
|
63
|
+
|
|
64
|
+
**Usage Example:**
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { MastraEditor } from '@mastra/editor';
|
|
68
|
+
import { Mastra } from '@mastra/core';
|
|
69
|
+
|
|
70
|
+
// Initialize editor with Mastra
|
|
71
|
+
const mastra = new Mastra({
|
|
72
|
+
/* config */
|
|
73
|
+
editor: new MastraEditor(),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Store an agent configuration
|
|
77
|
+
const agentId = await mastra.storage.stores?.agents?.createAgent({
|
|
78
|
+
name: 'customer-support',
|
|
79
|
+
instructions: 'Help customers with inquiries',
|
|
80
|
+
model: { provider: 'openai', name: 'gpt-4' },
|
|
81
|
+
tools: ['search-kb', 'create-ticket'],
|
|
82
|
+
workflows: ['escalation-flow'],
|
|
83
|
+
memory: { vector: 'pinecone-db' },
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Retrieve and use the stored agent
|
|
87
|
+
const agent = await mastra.getEditor()?.getStoredAgentById(agentId);
|
|
88
|
+
const response = await agent?.generate('How do I reset my password?');
|
|
89
|
+
|
|
90
|
+
// List all stored agents
|
|
91
|
+
const agents = await mastra.getEditor()?.listStoredAgents({ pageSize: 10 });
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Storage Improvements:**
|
|
95
|
+
- Fixed JSONB handling in LibSQL, PostgreSQL, and MongoDB adapters
|
|
96
|
+
- Improved agent resolution queries to properly merge version data
|
|
97
|
+
- Enhanced type safety for serialized configurations
|
|
98
|
+
|
|
99
|
+
- Fixed custom gateway provider detection in Studio. ([#11815](https://github.com/mastra-ai/mastra/pull/11815))
|
|
100
|
+
|
|
101
|
+
**What changed:**
|
|
102
|
+
- Studio now correctly detects connected custom gateway providers (e.g., providers registered as `acme/custom` are now found when the agent uses model `acme/custom/gpt-4o`)
|
|
103
|
+
- The model selector properly displays and updates models for custom gateway providers
|
|
104
|
+
- "Enhance prompt" feature works correctly with custom gateway providers
|
|
105
|
+
|
|
106
|
+
**Why:**
|
|
107
|
+
Custom gateway providers are stored with a gateway prefix (e.g., `acme/custom`), but the model router extracts just the provider part (e.g., `custom`). The lookups were failing because they only did exact matching. Now both backend and frontend use fallback logic to find providers with gateway prefixes.
|
|
108
|
+
|
|
109
|
+
Fixes #11732
|
|
110
|
+
|
|
111
|
+
- Improved workspace filesystem error handling: return 404 for not-found errors instead of 500, show user-friendly error messages in UI, and add MastraClientError class with status/body properties for better error handling ([#12533](https://github.com/mastra-ai/mastra/pull/12533))
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [[`e6fc281`](https://github.com/mastra-ai/mastra/commit/e6fc281896a3584e9e06465b356a44fe7faade65), [`97be6c8`](https://github.com/mastra-ai/mastra/commit/97be6c8963130fca8a664fcf99d7b3a38e463595), [`2770921`](https://github.com/mastra-ai/mastra/commit/2770921eec4d55a36b278d15c3a83f694e462ee5), [`b1695db`](https://github.com/mastra-ai/mastra/commit/b1695db2d7be0c329d499619c7881899649188d0), [`5fe1fe0`](https://github.com/mastra-ai/mastra/commit/5fe1fe0109faf2c87db34b725d8a4571a594f80e), [`4133d48`](https://github.com/mastra-ai/mastra/commit/4133d48eaa354cdb45920dc6265732ffbc96788d), [`5dd01cc`](https://github.com/mastra-ai/mastra/commit/5dd01cce68d61874aa3ecbd91ee17884cfd5aca2), [`13e0a2a`](https://github.com/mastra-ai/mastra/commit/13e0a2a2bcec01ff4d701274b3727d5e907a6a01), [`f6673b8`](https://github.com/mastra-ai/mastra/commit/f6673b893b65b7d273ad25ead42e990704cc1e17), [`cd6be8a`](https://github.com/mastra-ai/mastra/commit/cd6be8ad32741cd41cabf508355bb31b71e8a5bd), [`9eb4e8e`](https://github.com/mastra-ai/mastra/commit/9eb4e8e39efbdcfff7a40ff2ce07ce2714c65fa8), [`c987384`](https://github.com/mastra-ai/mastra/commit/c987384d6c8ca844a9701d7778f09f5a88da7f9f), [`cb8cc12`](https://github.com/mastra-ai/mastra/commit/cb8cc12bfadd526aa95a01125076f1da44e4afa7), [`aa37c84`](https://github.com/mastra-ai/mastra/commit/aa37c84d29b7db68c72517337932ef486c316275), [`62f5d50`](https://github.com/mastra-ai/mastra/commit/62f5d5043debbba497dacb7ab008fe86b38b8de3), [`47eba72`](https://github.com/mastra-ai/mastra/commit/47eba72f0397d0d14fbe324b97940c3d55e5a525)]:
|
|
114
|
+
- @mastra/core@1.2.0
|
|
115
|
+
|
|
116
|
+
## 1.2.0-alpha.1
|
|
117
|
+
|
|
118
|
+
### Minor Changes
|
|
119
|
+
|
|
120
|
+
- Added Observational Memory — a new memory system that keeps your agent's context window small while preserving long-term memory across conversations. ([#12599](https://github.com/mastra-ai/mastra/pull/12599))
|
|
121
|
+
|
|
122
|
+
**Why:** Long conversations cause context rot and waste tokens. Observational Memory compresses conversation history into observations (5–40x compression) and periodically condenses those into reflections. Your agent stays fast and focused, even after thousands of messages.
|
|
123
|
+
|
|
124
|
+
**Usage:**
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { Memory } from '@mastra/memory';
|
|
128
|
+
import { PostgresStore } from '@mastra/pg';
|
|
129
|
+
|
|
130
|
+
const memory = new Memory({
|
|
131
|
+
storage: new PostgresStore({ connectionString: process.env.DATABASE_URL }),
|
|
132
|
+
options: {
|
|
133
|
+
observationalMemory: true,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const agent = new Agent({
|
|
138
|
+
name: 'my-agent',
|
|
139
|
+
model: openai('gpt-4o'),
|
|
140
|
+
memory,
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**What's new:**
|
|
145
|
+
- `observationalMemory: true` enables the three-tier memory system (recent messages → observations → reflections)
|
|
146
|
+
- Thread-scoped (per-conversation) and resource-scoped (shared across all threads for a user) modes
|
|
147
|
+
- Manual `observe()` API for triggering observation outside the normal agent loop
|
|
148
|
+
- New OM storage methods for pg, libsql, and mongodb adapters (conditionally enabled)
|
|
149
|
+
- `Agent.findProcessor()` method for looking up processors by ID
|
|
150
|
+
- `processorStates` for persisting processor state across loop iterations
|
|
151
|
+
- Abort signal propagation to processors
|
|
152
|
+
- `ProcessorStreamWriter` for custom stream events from processors
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- Created @mastra/editor package for managing and resolving stored agent configurations ([#12631](https://github.com/mastra-ai/mastra/pull/12631))
|
|
157
|
+
|
|
158
|
+
This major addition introduces the editor package, which provides a complete solution for storing, versioning, and instantiating agent configurations from a database. The editor seamlessly integrates with Mastra's storage layer to enable dynamic agent management.
|
|
159
|
+
|
|
160
|
+
**Key Features:**
|
|
161
|
+
- **Agent Storage & Retrieval**: Store complete agent configurations including instructions, model settings, tools, workflows, nested agents, scorers, processors, and memory configuration
|
|
162
|
+
- **Version Management**: Create and manage multiple versions of agents, with support for activating specific versions
|
|
163
|
+
- **Dependency Resolution**: Automatically resolves and instantiates all agent dependencies (tools, workflows, sub-agents, etc.) from the Mastra registry
|
|
164
|
+
- **Caching**: Built-in caching for improved performance when repeatedly accessing stored agents
|
|
165
|
+
- **Type Safety**: Full TypeScript support with proper typing for stored configurations
|
|
166
|
+
|
|
167
|
+
**Usage Example:**
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { MastraEditor } from '@mastra/editor';
|
|
171
|
+
import { Mastra } from '@mastra/core';
|
|
172
|
+
|
|
173
|
+
// Initialize editor with Mastra
|
|
174
|
+
const mastra = new Mastra({
|
|
175
|
+
/* config */
|
|
176
|
+
editor: new MastraEditor(),
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Store an agent configuration
|
|
180
|
+
const agentId = await mastra.storage.stores?.agents?.createAgent({
|
|
181
|
+
name: 'customer-support',
|
|
182
|
+
instructions: 'Help customers with inquiries',
|
|
183
|
+
model: { provider: 'openai', name: 'gpt-4' },
|
|
184
|
+
tools: ['search-kb', 'create-ticket'],
|
|
185
|
+
workflows: ['escalation-flow'],
|
|
186
|
+
memory: { vector: 'pinecone-db' },
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// Retrieve and use the stored agent
|
|
190
|
+
const agent = await mastra.getEditor()?.getStoredAgentById(agentId);
|
|
191
|
+
const response = await agent?.generate('How do I reset my password?');
|
|
192
|
+
|
|
193
|
+
// List all stored agents
|
|
194
|
+
const agents = await mastra.getEditor()?.listStoredAgents({ pageSize: 10 });
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Storage Improvements:**
|
|
198
|
+
- Fixed JSONB handling in LibSQL, PostgreSQL, and MongoDB adapters
|
|
199
|
+
- Improved agent resolution queries to properly merge version data
|
|
200
|
+
- Enhanced type safety for serialized configurations
|
|
201
|
+
|
|
202
|
+
- Updated dependencies [[`2770921`](https://github.com/mastra-ai/mastra/commit/2770921eec4d55a36b278d15c3a83f694e462ee5), [`b1695db`](https://github.com/mastra-ai/mastra/commit/b1695db2d7be0c329d499619c7881899649188d0), [`4133d48`](https://github.com/mastra-ai/mastra/commit/4133d48eaa354cdb45920dc6265732ffbc96788d), [`5dd01cc`](https://github.com/mastra-ai/mastra/commit/5dd01cce68d61874aa3ecbd91ee17884cfd5aca2), [`13e0a2a`](https://github.com/mastra-ai/mastra/commit/13e0a2a2bcec01ff4d701274b3727d5e907a6a01), [`c987384`](https://github.com/mastra-ai/mastra/commit/c987384d6c8ca844a9701d7778f09f5a88da7f9f), [`cb8cc12`](https://github.com/mastra-ai/mastra/commit/cb8cc12bfadd526aa95a01125076f1da44e4afa7), [`62f5d50`](https://github.com/mastra-ai/mastra/commit/62f5d5043debbba497dacb7ab008fe86b38b8de3)]:
|
|
203
|
+
- @mastra/core@1.2.0-alpha.1
|
|
204
|
+
|
|
3
205
|
## 1.2.0-alpha.0
|
|
4
206
|
|
|
5
207
|
### Minor Changes
|