@mastra/mcp-docs-server 0.13.34-alpha.0 → 0.13.35-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 (43) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +2 -0
  2. package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +2 -0
  3. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +9 -9
  4. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +10 -10
  6. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +19 -19
  7. package/.docs/organized/changelogs/%40mastra%2Fcore.md +37 -37
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +17 -17
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +17 -17
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +17 -17
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +17 -17
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +27 -27
  13. package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
  14. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +15 -15
  15. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +11 -11
  16. package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
  17. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +27 -27
  18. package/.docs/organized/changelogs/%40mastra%2Freact.md +17 -9
  19. package/.docs/organized/changelogs/%40mastra%2Fserver.md +21 -21
  20. package/.docs/organized/changelogs/create-mastra.md +5 -5
  21. package/.docs/organized/changelogs/mastra.md +17 -17
  22. package/.docs/organized/code-examples/memory-with-mongodb.md +208 -0
  23. package/.docs/raw/getting-started/project-structure.mdx +1 -1
  24. package/.docs/raw/getting-started/studio.mdx +4 -4
  25. package/.docs/raw/memory/overview.mdx +1 -1
  26. package/.docs/raw/memory/semantic-recall.mdx +4 -3
  27. package/.docs/raw/memory/storage/memory-with-libsql.mdx +141 -0
  28. package/.docs/raw/memory/storage/memory-with-pg.mdx +138 -0
  29. package/.docs/raw/memory/storage/memory-with-upstash.mdx +147 -0
  30. package/.docs/raw/observability/ai-tracing/exporters/arize.mdx +201 -0
  31. package/.docs/raw/observability/ai-tracing/overview.mdx +12 -8
  32. package/.docs/raw/reference/observability/ai-tracing/exporters/arize.mdx +160 -0
  33. package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +2 -2
  34. package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +1 -1
  35. package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +2 -2
  36. package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +1 -1
  37. package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +48 -21
  38. package/.docs/raw/reference/storage/mongodb.mdx +146 -0
  39. package/.docs/raw/server-db/storage.mdx +1 -0
  40. package/.docs/raw/workflows/agents-and-tools.mdx +15 -1
  41. package/.docs/raw/workflows/human-in-the-loop.mdx +268 -0
  42. package/CHANGELOG.md +14 -0
  43. package/package.json +11 -4
@@ -1,5 +1,31 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 6.7.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update peer dependencies to match core package version bump (0.22.1) ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
8
+
9
+ ### Patch Changes
10
+
11
+ - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
12
+
13
+ - Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3)]:
14
+ - @mastra/core@0.23.0-alpha.0
15
+ - @mastra/client-js@0.16.5-alpha.0
16
+ - @mastra/react@0.0.11-alpha.0
17
+
18
+ ## 6.6.2
19
+
20
+ ### Patch Changes
21
+
22
+ - Move all the fetching hooks that should be shared with cloud into playground-ui ([#9133](https://github.com/mastra-ai/mastra/pull/9133))
23
+
24
+ - Updated dependencies [[`2b031e2`](https://github.com/mastra-ai/mastra/commit/2b031e25ca10cd3e4d63e6a27f909cba26d91405)]:
25
+ - @mastra/core@0.22.2
26
+ - @mastra/client-js@0.16.4
27
+ - @mastra/react@0.0.10
28
+
3
29
  ## 6.6.2-alpha.0
4
30
 
5
31
  ### Patch Changes
@@ -272,31 +298,5 @@
272
298
 
273
299
  - Updated dependencies [[`0d71771`](https://github.com/mastra-ai/mastra/commit/0d71771f5711164c79f8e80919bc84d6bffeb6bc), [`0d6e55e`](https://github.com/mastra-ai/mastra/commit/0d6e55ecc5a2e689cd4fc9c86525e0eb54d82372)]:
274
300
  - @mastra/core@0.20.2-alpha.0
275
- - @mastra/client-js@0.15.2-alpha.0
276
- - @mastra/react@0.0.5-alpha.0
277
-
278
- ## 6.4.0
279
-
280
- ### Minor Changes
281
-
282
- - Update peer dependencies to match core package version bump (0.20.1) ([#8589](https://github.com/mastra-ai/mastra/pull/8589))
283
-
284
- ### Patch Changes
285
-
286
- - workflow run thread more visible ([#8539](https://github.com/mastra-ai/mastra/pull/8539))
287
-
288
- - Mutable shared workflow run state ([#8545](https://github.com/mastra-ai/mastra/pull/8545))
289
-
290
- - streamLegacy/generateLegacy clarification in playground ([#8468](https://github.com/mastra-ai/mastra/pull/8468))
291
-
292
- - add tripwire reason in playground ([#8568](https://github.com/mastra-ai/mastra/pull/8568))
293
-
294
- - Save waiting step status in snapshot ([#8576](https://github.com/mastra-ai/mastra/pull/8576))
295
-
296
- - Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai ([#8559](https://github.com/mastra-ai/mastra/pull/8559))
297
-
298
- - type fixes and missing changeset ([#8545](https://github.com/mastra-ai/mastra/pull/8545))
299
-
300
- - Convert WorkflowWatchResult to WorkflowResult in workflow graph ([#8541](https://github.com/mastra-ai/mastra/pull/8541))
301
301
 
302
- ... 3803 more lines hidden. See full changelog in package directory.
302
+ ... 3829 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,21 @@
1
1
  # @mastra/react-hooks
2
2
 
3
+ ## 0.0.11-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
8
+
9
+ - Updated dependencies [[`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18)]:
10
+ - @mastra/client-js@0.16.5-alpha.0
11
+
12
+ ## 0.0.10
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies []:
17
+ - @mastra/client-js@0.16.4
18
+
3
19
  ## 0.0.10-alpha.0
4
20
 
5
21
  ### Patch Changes
@@ -283,12 +299,4 @@
283
299
 
284
300
  - modify the useMastraChat hook to useChat ([#8265](https://github.com/mastra-ai/mastra/pull/8265))
285
301
 
286
- - Updated dependencies [[`5cb4596`](https://github.com/mastra-ai/mastra/commit/5cb4596c644104ea817bb0c5a07b8b1f8de595a8), [`86be6be`](https://github.com/mastra-ai/mastra/commit/86be6bee7e64b7d828a6b4eec283265c820dfa43), [`57b6dd5`](https://github.com/mastra-ai/mastra/commit/57b6dd50f9e6d92c0ed3e7199e6a92752025e3a1), [`ea8d386`](https://github.com/mastra-ai/mastra/commit/ea8d386cd8c5593664515fd5770c06bf2aa980ef), [`6f67656`](https://github.com/mastra-ai/mastra/commit/6f676562276926e2982401574d1e07157579be30)]:
287
- - @mastra/client-js@0.14.0-alpha.1
288
-
289
- ## 0.0.1-alpha.1
290
-
291
- ### Patch Changes
292
-
293
- - Updated dependencies [[`dc099b4`](https://github.com/mastra-ai/mastra/commit/dc099b40fb31147ba3f362f98d991892033c4c67)]:
294
- - @mastra/client-js@0.14.0-alpha.0
302
+ ... 11 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,25 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 0.23.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update peer dependencies to match core package version bump (0.22.1) ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
8
+
9
+ ### Patch Changes
10
+
11
+ - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
12
+
13
+ - Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3)]:
14
+ - @mastra/core@0.23.0-alpha.0
15
+
16
+ ## 0.22.2
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [[`2b031e2`](https://github.com/mastra-ai/mastra/commit/2b031e25ca10cd3e4d63e6a27f909cba26d91405)]:
21
+ - @mastra/core@0.22.2
22
+
3
23
  ## 0.22.2-alpha.0
4
24
 
5
25
  ### Patch Changes
@@ -278,25 +298,5 @@
278
298
 
279
299
  - Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
280
300
 
281
- ### Patch Changes
282
-
283
- - Add approve and decline tool calls to mastra server pkg ([#8360](https://github.com/mastra-ai/mastra/pull/8360))
284
-
285
- - Fix/8219 preserve resourceid on resume ([#8359](https://github.com/mastra-ai/mastra/pull/8359))
286
-
287
- - Add observe strean to get streans after workflow has been interrupted ([#8318](https://github.com/mastra-ai/mastra/pull/8318))
288
-
289
- - Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
290
- - @mastra/core@0.20.0-alpha.0
291
-
292
- ## 0.19.1
293
-
294
- ### Patch Changes
295
-
296
- - Added Mastra model router to Playground UI ([#8332](https://github.com/mastra-ai/mastra/pull/8332))
297
-
298
- - Updated dependencies [[`4a70ccc`](https://github.com/mastra-ai/mastra/commit/4a70ccc5cfa12ae9c2b36545a5814cd98e5a0ead), [`0992b8b`](https://github.com/mastra-ai/mastra/commit/0992b8bf0f4f1ba7ad9940883ec4bb8d867d3105), [`283bea0`](https://github.com/mastra-ai/mastra/commit/283bea07adbaf04a27fa3ad2df611095e0825195)]:
299
- - @mastra/core@0.19.1
300
-
301
301
 
302
- ... 3846 more lines hidden. See full changelog in package directory.
302
+ ... 3866 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,9 @@
1
1
  # create-mastra
2
2
 
3
+ ## 0.17.4-alpha.0
4
+
5
+ ## 0.17.3
6
+
3
7
  ## 0.17.3-alpha.0
4
8
 
5
9
  ## 0.17.2
@@ -294,9 +298,5 @@
294
298
 
295
299
  - Add conditional chaining to scorer.agentNames return ([#8199](https://github.com/mastra-ai/mastra/pull/8199))
296
300
 
297
- - Show model that worked when there are model fallbacks ([#8167](https://github.com/mastra-ai/mastra/pull/8167))
298
-
299
- ## 0.13.3-alpha.0
300
-
301
301
 
302
- ... 1774 more lines hidden. See full changelog in package directory.
302
+ ... 1778 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,21 @@
1
1
  # mastra
2
2
 
3
+ ## 0.17.4-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18), [`2060766`](https://github.com/mastra-ai/mastra/commit/20607667bf78ea104cca3e15dfb93ae0b62c9d18), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3)]:
8
+ - @mastra/core@0.23.0-alpha.0
9
+ - @mastra/deployer@0.23.0-alpha.0
10
+
11
+ ## 0.17.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`2b031e2`](https://github.com/mastra-ai/mastra/commit/2b031e25ca10cd3e4d63e6a27f909cba26d91405)]:
16
+ - @mastra/core@0.22.2
17
+ - @mastra/deployer@0.22.2
18
+
3
19
  ## 0.17.3-alpha.0
4
20
 
5
21
  ### Patch Changes
@@ -282,21 +298,5 @@
282
298
 
283
299
  ## 0.14.2-alpha.2
284
300
 
285
- ### Patch Changes
286
-
287
- - Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai ([#8559](https://github.com/mastra-ai/mastra/pull/8559))
288
-
289
- - Updated dependencies [[`42ffed3`](https://github.com/mastra-ai/mastra/commit/42ffed311b9d8750652bbc55c773be62c989fcc6), [`ee9108f`](https://github.com/mastra-ai/mastra/commit/ee9108fa29bb8368fc23df158c9f0645b2d7b65c)]:
290
- - @mastra/deployer@0.20.1-alpha.2
291
- - @mastra/core@0.20.1-alpha.2
292
-
293
- ## 0.14.2-alpha.1
294
-
295
- ### Patch Changes
296
-
297
- - workflow run thread more visible ([#8539](https://github.com/mastra-ai/mastra/pull/8539))
298
-
299
- - Mutable shared workflow run state ([#8545](https://github.com/mastra-ai/mastra/pull/8545))
300
-
301
301
 
302
- ... 6288 more lines hidden. See full changelog in package directory.
302
+ ... 6304 more lines hidden. See full changelog in package directory.
@@ -0,0 +1,208 @@
1
+ ### package.json
2
+ ```json
3
+ {
4
+ "name": "memory-with-mongodb",
5
+ "dependencies": {
6
+ "@ai-sdk/openai": "latest",
7
+ "@mastra/core": "latest",
8
+ "@mastra/memory": "latest",
9
+ "@mastra/mongodb": "latest"
10
+ },
11
+ "devDependencies": {
12
+ "dotenv": "^17.0.0",
13
+ "tsx": "^4.19.3"
14
+ }
15
+ }
16
+ ```
17
+
18
+ ### chat.ts
19
+ ```typescript
20
+ import { randomUUID } from 'crypto';
21
+ import Readline from 'readline';
22
+
23
+ import 'dotenv/config';
24
+
25
+ import { mastra } from './mastra';
26
+
27
+ const agent = mastra.getAgent('memoryAgent');
28
+
29
+ let thread = randomUUID();
30
+ // use this to play with a long running conversation. comment it out to get a new thread id every time
31
+ thread = `39873fbf-84d6-425e-8c1b-8afd798d72a4`;
32
+ // thread = `12569b14-3e16-4e31-8130-8d9676f1932c`;
33
+ console.log(thread);
34
+
35
+ const resource = 'SOME_USER_ID';
36
+
37
+ async function logRes(res: Awaited<ReturnType<typeof agent.stream>>) {
38
+ console.log(`\n🤖 Agent:`);
39
+ for await (const chunk of res.textStream) {
40
+ process.stdout.write(chunk);
41
+ }
42
+ console.log(`\n\n`);
43
+ }
44
+
45
+ async function main() {
46
+ await logRes(
47
+ await agent.stream(
48
+ [
49
+ {
50
+ role: 'system',
51
+ content: `Chat with user started now ${new Date().toISOString()}. Don't mention this message. This means some time may have passed between this message and the one before. The user left and came back again. Say something to start the conversation up again.`,
52
+ },
53
+ ],
54
+ { memory: { resource, thread } },
55
+ ),
56
+ );
57
+
58
+ const rl = Readline.createInterface({
59
+ input: process.stdin,
60
+ output: process.stdout,
61
+ });
62
+
63
+ while (true) {
64
+ const prompt: string = await new Promise(res => {
65
+ rl.question('Message: ', answer => {
66
+ res(answer);
67
+ });
68
+ });
69
+
70
+ await logRes(
71
+ await agent.stream(prompt, {
72
+ memory: { thread, resource },
73
+ }),
74
+ );
75
+ }
76
+ }
77
+
78
+ main();
79
+
80
+ ```
81
+
82
+ ### index.ts
83
+ ```typescript
84
+ import { randomUUID } from 'crypto';
85
+
86
+ import { mastra } from './mastra';
87
+
88
+ function log(message: string) {
89
+ console.log(`\n>>Prompt: ${message}`);
90
+ return message;
91
+ }
92
+
93
+ const agent = mastra.getAgent('chefAgent');
94
+ const threadId = randomUUID();
95
+ const resourceId = 'SOME_USER_ID';
96
+
97
+ async function logRes(res: Awaited<ReturnType<typeof agent.stream>>) {
98
+ console.log(`\n👨‍🍳 Chef:`);
99
+ for await (const chunk of res.textStream) {
100
+ process.stdout.write(chunk);
101
+ }
102
+ console.log(`\n\n`);
103
+ }
104
+
105
+ async function main() {
106
+ await logRes(
107
+ await agent.stream(
108
+ log(
109
+ 'In my kitchen I have: pasta, canned tomatoes, garlic, olive oil, and some dried herbs (basil and oregano). What can I make? Please keep your answer brief, only give me the high level steps.',
110
+ ),
111
+ {
112
+ threadId,
113
+ resourceId,
114
+ },
115
+ ),
116
+ );
117
+
118
+ await logRes(
119
+ await agent.stream(
120
+ log(
121
+ "Now I'm over at my friend's house, and they have: chicken thighs, coconut milk, sweet potatoes, and some curry powder.",
122
+ ),
123
+ {
124
+ threadId,
125
+ resourceId,
126
+ },
127
+ ),
128
+ );
129
+
130
+ await logRes(
131
+ await agent.stream(log('What did we cook before I went to my friends house?'), {
132
+ threadId,
133
+ resourceId,
134
+ memoryOptions: {
135
+ lastMessages: 3,
136
+ },
137
+ }),
138
+ );
139
+
140
+ process.exit(0);
141
+ }
142
+
143
+ main();
144
+
145
+ ```
146
+
147
+ ### mastra/agents/index.ts
148
+ ```typescript
149
+ import { openai } from '@ai-sdk/openai';
150
+ import { Agent } from '@mastra/core/agent';
151
+ import { Memory } from '@mastra/memory';
152
+ import { MongoDBStore, MongoDBVector } from '@mastra/mongodb';
153
+
154
+ // This URI must be an Atlas MongoDB deployment in order to work with vector search
155
+ // in the format mongodb+srv://<username>:<password>@<cluster>.mongodb.net
156
+ const uri = process.env.MONGODB_URI;
157
+ const dbName = process.env.MONGODB_DB_NAME || 'mastra_memory';
158
+
159
+ export const memory = new Memory({
160
+ storage: new MongoDBStore({
161
+ url: uri,
162
+ dbName,
163
+ }),
164
+ vector: new MongoDBVector({
165
+ uri,
166
+ dbName,
167
+ }),
168
+ options: {
169
+ lastMessages: 10,
170
+ semanticRecall: {
171
+ topK: 3,
172
+ messageRange: 2,
173
+ },
174
+ },
175
+ embedder: openai.embedding('text-embedding-3-small'),
176
+ });
177
+
178
+ export const chefAgent = new Agent({
179
+ name: 'chefAgent',
180
+ instructions:
181
+ 'You are Michel, a practical and experienced home chef who helps people cook great meals with whatever ingredients they have available. Your first priority is understanding what ingredients and equipment the user has access to, then suggesting achievable recipes. You explain cooking steps clearly and offer substitutions when needed, maintaining a friendly and encouraging tone throughout.',
182
+ model: openai('gpt-4o'),
183
+ memory,
184
+ });
185
+
186
+ export const memoryAgent = new Agent({
187
+ name: 'Memory Agent',
188
+ instructions:
189
+ "You are an AI agent with the ability to automatically recall memories from previous interactions. You may have conversations that last hours, days, months, or years. If you don't know it already you should ask for the users name and some info about them.",
190
+ model: openai('gpt-4o'),
191
+ memory,
192
+ });
193
+
194
+ ```
195
+
196
+ ### mastra/index.ts
197
+ ```typescript
198
+ import { Mastra } from '@mastra/core';
199
+
200
+ import 'dotenv/config';
201
+
202
+ import { chefAgent, memoryAgent } from './agents';
203
+
204
+ export const mastra = new Mastra({
205
+ agents: { chefAgent, memoryAgent },
206
+ });
207
+
208
+ ```
@@ -63,7 +63,7 @@ Top-level files define how your Mastra project is configured, built, and connect
63
63
  | File | Description |
64
64
  | --------------------- | ------------ |
65
65
  | `src/mastra/index.ts` | Central entry point where you configure and initialize Mastra. |
66
- | `.env.example` | Template for environment variables copy and rename to `.env` to add your secret [model provider](/models) keys. |
66
+ | `.env.example` | Template for environment variables - copy and rename to `.env` to add your secret [model provider](/models) keys. |
67
67
  | `package.json` | Defines project metadata, dependencies, and available npm scripts. |
68
68
  | `tsconfig.json` | Configures TypeScript options such as path aliases, compiler settings, and build output. |
69
69
 
@@ -10,15 +10,15 @@ import { Callout } from "nextra/components";
10
10
 
11
11
  # Playground
12
12
 
13
- Playground helps you build agents quickly. It provides an interactive UI for testing your agents and workflows, along with a REST API that exposes your Mastra application as a local service. This lets you start building without having to integrate Mastra into your project right away.
13
+ Playground provides an interactive UI for building and testing your agents, along with a REST API that exposes your Mastra application as a local service. This lets you start building without worrying about integration right away.
14
14
 
15
- As your project evolves, Playground enables you to iterate quickly. Features like Observability and Scorers give you visibility into performance at every stage of development.
15
+ As your project evolves, Playground's development environment helps you iterate on your agent quickly. Meanwhile, Observability and Scorer features give you visibility into performance at every stage.
16
16
 
17
- To get started, run Playground locally using the instructions below, or [deploy to Mastra Cloud](/docs/mastra-cloud/setting-up) to access the Playground remotely and collaborate with your team.
17
+ To get started, run Playground locally using the instructions below, or [deploy to Mastra Cloud](https://mastra.ai/docs/mastra-cloud/setting-up) to collaborate with your team.
18
18
 
19
19
  <YouTube id="spGlcTEjuXY" startTime={126}/>
20
20
 
21
- ## Launch Playground
21
+ ## Start Playground
22
22
 
23
23
  If you created your application with `create mastra`, start the local development server using the `dev` script. You can also run it directly with `mastra dev`.
24
24
 
@@ -69,7 +69,7 @@ All memory types are [thread-scoped](./working-memory.mdx#thread-scoped-memory-d
69
69
 
70
70
  To persist and recall information between conversations, memory requires a storage adapter.
71
71
 
72
- Supported options include [LibSQL](/examples/memory/memory-with-libsql), [Postgres](/examples/memory/memory-with-pg), and [Upstash](/examples/memory/memory-with-upstash)
72
+ Supported options include [LibSQL](/docs/memory/storage/memory-with-libsql), [MongoDB](/docs/memory/storage/memory-with-mongodb), [Postgres](/docs/memory/storage/memory-with-pg), and [Upstash](/docs/memory/storage/memory-with-upstash)
73
73
 
74
74
  We use LibSQL out of the box because it is file-based or in-memory, so it is easy to install and works well with the playground.
75
75
 
@@ -92,9 +92,10 @@ const agent = new Agent({
92
92
 
93
93
  **Storage/vector code Examples**:
94
94
 
95
- - [LibSQL](/examples/memory/memory-with-libsql)
96
- - [Postgres](/examples/memory/memory-with-pg)
97
- - [Upstash](/examples/memory/memory-with-upstash)
95
+ - [LibSQL](/docs/memory/storage/memory-with-libsql)
96
+ - [MongoDB](/docs/memory/storage/memory-with-mongodb)
97
+ - [Postgres](/docs/memory/storage/memory-with-pg)
98
+ - [Upstash](/docs/memory/storage/memory-with-upstash)
98
99
 
99
100
  ### Embedder configuration
100
101
 
@@ -0,0 +1,141 @@
1
+ ---
2
+ title: "Example: Memory with LibSQL | Memory | Mastra Docs"
3
+ description: Example for how to use Mastra's memory system with LibSQL storage and vector database backend.
4
+ ---
5
+
6
+ # Memory with LibSQL
7
+
8
+ This example demonstrates how to use Mastra's memory system with LibSQL as the storage backend.
9
+
10
+ ## Prerequisites
11
+
12
+ This example uses the `openai` model. Make sure to add `OPENAI_API_KEY` to your `.env` file.
13
+
14
+ ```bash filename=".env" copy
15
+ OPENAI_API_KEY=<your-api-key>
16
+ ```
17
+
18
+ And install the following package:
19
+
20
+ ```bash copy
21
+ npm install @mastra/libsql
22
+ ```
23
+
24
+ ## Adding memory to an agent
25
+
26
+ To add LibSQL memory to an agent use the `Memory` class and create a new `storage` key using `LibSQLStore`. The `url` can either by a remote location, or a local file system resource.
27
+
28
+ ```typescript filename="src/mastra/agents/example-libsql-agent.ts" showLineNumbers copy
29
+ import { Memory } from "@mastra/memory";
30
+ import { Agent } from "@mastra/core/agent";
31
+ import { openai } from "@ai-sdk/openai";
32
+ import { LibSQLStore } from "@mastra/libsql";
33
+
34
+ export const libsqlAgent = new Agent({
35
+ name: "libsql-agent",
36
+ instructions: "You are an AI agent with the ability to automatically recall memories from previous interactions.",
37
+ model: openai("gpt-4o"),
38
+ memory: new Memory({
39
+ storage: new LibSQLStore({
40
+ url: "file:libsql-agent.db"
41
+ }),
42
+ options: {
43
+ threads: {
44
+ generateTitle: true
45
+ }
46
+ }
47
+ })
48
+ });
49
+ ```
50
+
51
+ ## Local embeddings with fastembed
52
+
53
+ Embeddings are numeric vectors used by memory’s `semanticRecall` to retrieve related messages by meaning (not keywords). This setup uses `@mastra/fastembed` to generate vector embeddings.
54
+
55
+ Install `fastembed` to get started:
56
+
57
+ ```bash copy
58
+ npm install @mastra/fastembed
59
+ ```
60
+
61
+ Add the following to your agent:
62
+
63
+ ```typescript filename="src/mastra/agents/example-libsql-agent.ts" showLineNumbers copy
64
+ import { Memory } from "@mastra/memory";
65
+ import { Agent } from "@mastra/core/agent";
66
+ import { openai } from "@ai-sdk/openai";
67
+ import { LibSQLStore, LibSQLVector } from "@mastra/libsql";
68
+ import { fastembed } from "@mastra/fastembed";
69
+
70
+ export const libsqlAgent = new Agent({
71
+ name: "libsql-agent",
72
+ instructions: "You are an AI agent with the ability to automatically recall memories from previous interactions.",
73
+ model: openai("gpt-4o"),
74
+ memory: new Memory({
75
+ storage: new LibSQLStore({
76
+ url: "file:libsql-agent.db"
77
+ }),
78
+ vector: new LibSQLVector({
79
+ connectionUrl: "file:libsql-agent.db"
80
+ }),
81
+ embedder: fastembed,
82
+ options: {
83
+ lastMessages: 10,
84
+ semanticRecall: {
85
+ topK: 3,
86
+ messageRange: 2
87
+ },
88
+ threads: {
89
+ generateTitle: true
90
+ }
91
+ }
92
+ })
93
+ });
94
+ ```
95
+
96
+ ## Usage example
97
+
98
+ Use `memoryOptions` to scope recall for this request. Set `lastMessages: 5` to limit recency-based recall, and use `semanticRecall` to fetch the `topK: 3` most relevant messages, including `messageRange: 2` neighboring messages for context around each match.
99
+
100
+ ```typescript filename="src/test-libsql-agent.ts" showLineNumbers copy
101
+ import "dotenv/config";
102
+
103
+ import { mastra } from "./mastra";
104
+
105
+ const threadId = "123";
106
+ const resourceId = "user-456";
107
+
108
+ const agent = mastra.getAgent("libsqlAgent");
109
+
110
+ const message = await agent.stream("My name is Mastra", {
111
+ memory: {
112
+ thread: threadId,
113
+ resource: resourceId
114
+ }
115
+ });
116
+
117
+ await message.textStream.pipeTo(new WritableStream());
118
+
119
+ const stream = await agent.stream("What's my name?", {
120
+ memory: {
121
+ thread: threadId,
122
+ resource: resourceId
123
+ },
124
+ memoryOptions: {
125
+ lastMessages: 5,
126
+ semanticRecall: {
127
+ topK: 3,
128
+ messageRange: 2
129
+ }
130
+ }
131
+ });
132
+
133
+ for await (const chunk of stream.textStream) {
134
+ process.stdout.write(chunk);
135
+ }
136
+ ```
137
+
138
+
139
+ ## Related
140
+
141
+ - [Calling Agents](../agents/calling-agents.mdx)