@mastra/pg 1.20.0-alpha.4 → 1.20.1-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,105 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.20.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Improved workflow run list performance in `@mastra/pg` when filtering by workflow name. The default index avoids sorting the ordered result query for workflows with large run histories. Paginated requests still use a separate count query. ([#21308](https://github.com/mastra-ai/mastra/pull/21308))
8
+
9
+ - Updated dependencies [[`7e096f0`](https://github.com/mastra-ai/mastra/commit/7e096f02f0dddbf09b85d306458351245ed2f886), [`8f0a332`](https://github.com/mastra-ai/mastra/commit/8f0a3321bf180368d76fe7b36aa1a8f60f00b6de), [`b098de9`](https://github.com/mastra-ai/mastra/commit/b098de9d7cb9f672e0883a5c716465a3a689693d), [`ef6e295`](https://github.com/mastra-ai/mastra/commit/ef6e295b59bc25a5b61b633a89c97bcfce9fb465), [`208e1b3`](https://github.com/mastra-ai/mastra/commit/208e1b39f30f4b386e494394e9d71d96f0f90241), [`c938d34`](https://github.com/mastra-ai/mastra/commit/c938d34739936c8ecbabd67ad6a4a4396f41c4c6), [`1d9a0ea`](https://github.com/mastra-ai/mastra/commit/1d9a0ea4a9901baee6cd56737243bd6d1f631ac0), [`3667679`](https://github.com/mastra-ai/mastra/commit/3667679db057edfb086846d13369fdda4902ad65), [`49696e8`](https://github.com/mastra-ai/mastra/commit/49696e8e42f870674a0a58f5abcd22cc54dd2864), [`512100a`](https://github.com/mastra-ai/mastra/commit/512100a7d8b7e9c920f2590c6b3612f5de0d3cff), [`9ef432b`](https://github.com/mastra-ai/mastra/commit/9ef432b6faa534b57b0d182a610e13dd9a7123ff), [`b9cf308`](https://github.com/mastra-ai/mastra/commit/b9cf30846f97f99ac1906ee8a68f4f2d117b0378)]:
10
+ - @mastra/core@1.60.0-alpha.2
11
+
12
+ ## 1.20.0
13
+
14
+ ### Minor Changes
15
+
16
+ - Added experiment provenance and grouping support to the LibSQL, MongoDB, MySQL, PostgreSQL, and Spanner storage adapters. These fields remain available for later grouping and filtering. ([#20645](https://github.com/mastra-ai/mastra/pull/20645))
17
+
18
+ ```ts
19
+ import { PostgresStore } from '@mastra/pg';
20
+
21
+ const storage = new PostgresStore({
22
+ id: 'postgres-storage',
23
+ connectionString: process.env.DATABASE_URL!,
24
+ });
25
+
26
+ await dataset.startExperiment({
27
+ task,
28
+ scorers,
29
+ provenance: { source: 'github', sourceVersion: 'abc123' },
30
+ grouping: { experimentSetId: 'benchmark-1', variantId: 'candidate', trialIndex: 0 },
31
+ });
32
+ ```
33
+
34
+ - Memory list reads now surface database errors instead of silently returning empty results. ([#17910](https://github.com/mastra-ai/mastra/pull/17910))
35
+
36
+ Previously, the paginated memory reads (`listThreads`, `listMessages`, `listMessagesByResourceId`, and `listMessagesById`) caught backend failures, logged them, and returned an empty payload like `{ threads: [], total: 0, hasMore: false }`. A transient outage (locked table, dropped connection) was therefore indistinguishable from a genuinely empty result, so an agent reading conversation history during a brief failure would treat it as "no history" and could overwrite real state. These methods now re-throw the failure as a `MastraError`. Validation (USER) errors and genuinely empty results are unchanged.
37
+
38
+ **Behavior change**
39
+
40
+ Callers that previously received an empty result on a backend failure will now receive a thrown `MastraError`. If you call these read methods directly (rather than through an agent, which already surfaces errors), wrap them so a transient outage doesn't crash the caller:
41
+
42
+ ```ts
43
+ try {
44
+ const { threads } = await storage.listThreads({ resourceId });
45
+ // ...use threads
46
+ } catch (error) {
47
+ // a real backend failure. Decide whether to retry, surface, or degrade.
48
+ // An empty thread list no longer hides here; it only means "no threads".
49
+ }
50
+ ```
51
+
52
+ ### Patch Changes
53
+
54
+ - Fixed `include` in `listMessages` and `listMessagesByResourceId` so it can no longer return a message that belongs to a different resource. When you pass a `resourceId`, the target message and its surrounding context messages now stay inside that resource. Includes that cross threads inside the same resource keep working, so semantic recall with `scope: 'resource'` is unchanged. ([#20984](https://github.com/mastra-ai/mastra/pull/20984))
55
+
56
+ **Behaviour change in the in-memory store**
57
+
58
+ The in-memory store read the context window from the thread you queried. It now reads the window from the thread that owns the target message, which is what the SQL stores already did. This only changes the result when an `include` entry names a message from another thread.
59
+
60
+ The in-memory store also ignored `include` in `listMessagesByResourceId`. It now returns the included messages, like `@mastra/libsql` and `@mastra/pg` do.
61
+
62
+ Fixes #20604.
63
+
64
+ - Improved chat response time with PostgresStore. Message history now reads a page of messages and its total count in one query instead of two. When semantic recall is on, the recall read also starts at the same time as the page read. Each agent turn therefore makes fewer database round-trips, which is most noticeable on remote Postgres. ([#20979](https://github.com/mastra-ai/mastra/pull/20979))
65
+
66
+ - Fixed PgVector top-level metadata equality filters so configured B-tree metadata indexes can match filtered vector queries. ([#20789](https://github.com/mastra-ai/mastra/pull/20789))
67
+
68
+ - Fixed a crash where updating a thread without a title (for example during observational memory buffering) could write a null title and violate the database's not-null constraint when running a newer @mastra/memory against an older storage package. Memory now checks whether the connected storage adapter supports partial thread updates and backfills the existing title for older adapters, so mixed-version deployments keep working. See #21041 for the original title-clobbering fix this makes backward compatible. ([#21257](https://github.com/mastra-ai/mastra/pull/21257))
69
+
70
+ - Storage adapters now declare support for partial thread updates, letting newer @mastra/memory preserve existing thread titles instead of overwriting them, while remaining safe against older versions. ([#21257](https://github.com/mastra-ai/mastra/pull/21257))
71
+
72
+ - Add a persistent `threadState` domain to `PostgresStore` ([#20994](https://github.com/mastra-ai/mastra/pull/20994))
73
+
74
+ `PostgresStore` did not register a `threadState` domain, so durable task and goal
75
+ state fell back to in-memory storage and was lost on restart. Anything relying on
76
+ thread state (task tools, long-running agent goals) could not be backed by Postgres
77
+ alone, and required composing a second adapter through `MastraCompositeStore`.
78
+
79
+ `ThreadStatePG` now stores state as JSONB keyed by `(threadId, type)` with an atomic
80
+ upsert that preserves `createdAt`, participates in `exportSchemas()` and `init()`, and
81
+ supports retention pruning anchored on `updatedAtZ` so state for still-active threads
82
+ survives age-based pruning.
83
+
84
+ - Fixed generated thread titles being clobbered during a turn ([#21041](https://github.com/mastra-ai/mastra/pull/21041))
85
+
86
+ `updateThread` required both `title` and `metadata`, so callers that only needed to
87
+ change metadata (message persistence, working memory, observational memory, channel
88
+ subscriptions) had to read the thread and pass its title back. When title generation
89
+ finished between that read and the write, the freshly generated title was overwritten
90
+ with the stale one.
91
+
92
+ `title` and `metadata` are now independently optional: omitting one leaves that column
93
+ untouched. Callers that only change metadata no longer send a title, and message
94
+ persistence no longer rewrites a thread row it just read.
95
+
96
+ - Fixed transaction completion when applications start several database operations at the same time. Pending operations now finish before the transaction completes or is cancelled, preventing query conflicts after batch failures and operations that application code does not await. ([#20869](https://github.com/mastra-ai/mastra/pull/20869))
97
+
98
+ - Fixed PostgreSQL memory timestamps to stay aligned across server timezones. ([#20831](https://github.com/mastra-ai/mastra/pull/20831))
99
+
100
+ - Updated dependencies [[`e7109ee`](https://github.com/mastra-ai/mastra/commit/e7109ee6f731bacc79c885906f3c7dca8d8f013a), [`b8ce7ec`](https://github.com/mastra-ai/mastra/commit/b8ce7ec96e39343c6c2f36d12d68a9ad816c09f7), [`2e4624e`](https://github.com/mastra-ai/mastra/commit/2e4624edb6917e61249cb60ee377735e7af7e4a9), [`45a9147`](https://github.com/mastra-ai/mastra/commit/45a914741f578754d79d8b7de7b4e4f304d8e14a), [`a3a3624`](https://github.com/mastra-ai/mastra/commit/a3a3624f646b98e409424d8defccbd334da9e8b8), [`6246914`](https://github.com/mastra-ai/mastra/commit/62469146636911f3cbbe0880bd011c6a897a59a7), [`6445eba`](https://github.com/mastra-ai/mastra/commit/6445eba6020abac681aba1cc9289f446cb400cbe), [`86b7b77`](https://github.com/mastra-ai/mastra/commit/86b7b777980d30f66e1fd134a37d2af4c22e54cc), [`1c75e32`](https://github.com/mastra-ai/mastra/commit/1c75e32f7fc0b9fb6f548b4407feaec8a1440212), [`296dc9a`](https://github.com/mastra-ai/mastra/commit/296dc9af29f3616e786c7825ec32e0df92d754c5), [`f59032a`](https://github.com/mastra-ai/mastra/commit/f59032a73699443555a08a479e7ac578975784f2), [`cdd5c33`](https://github.com/mastra-ai/mastra/commit/cdd5c33ac6c7118a9f139e6dc0e14e6a8ae31658), [`3f73c07`](https://github.com/mastra-ai/mastra/commit/3f73c076727e8c36b4fff7a1b40290fb68957fa8), [`772c0c8`](https://github.com/mastra-ai/mastra/commit/772c0c897cec383258de2e6178147f8014767c7b), [`d7cf7fa`](https://github.com/mastra-ai/mastra/commit/d7cf7fafc1ae1b50bd8462dd0e6c671a8606db93), [`7c1ebb1`](https://github.com/mastra-ai/mastra/commit/7c1ebb15690c4b3f0eabb19077cf8af573311e57), [`0f9a448`](https://github.com/mastra-ai/mastra/commit/0f9a448502157e59f7b76f24360ad497168f5ef8), [`578bf2e`](https://github.com/mastra-ai/mastra/commit/578bf2e6a88e9d5b8bf502204e15a95dfbb679ae), [`c47165c`](https://github.com/mastra-ai/mastra/commit/c47165c983c87594c6952f1fd2fa51a90205034c), [`289f4ce`](https://github.com/mastra-ai/mastra/commit/289f4ce16e3293370440172132c52ee787cbc09f), [`df31eb0`](https://github.com/mastra-ai/mastra/commit/df31eb0c7087d782a0d9346e467f9a4af4b0eef6), [`9571e3a`](https://github.com/mastra-ai/mastra/commit/9571e3a06ed2c5220196460bf82a2129255c3a8b), [`4f16ff8`](https://github.com/mastra-ai/mastra/commit/4f16ff824bf2f9b0ddc93f210477c10c8a4fb1ab), [`b4c89b4`](https://github.com/mastra-ai/mastra/commit/b4c89b4371b0c86da57403ad1a3b3ef0681f3128), [`e6534fa`](https://github.com/mastra-ai/mastra/commit/e6534fab031216f6cb48c4c9907cbfdce9d60bc6), [`210cb7a`](https://github.com/mastra-ai/mastra/commit/210cb7a167998c7bbf72cb3b93e6eb0563330239), [`06b2d87`](https://github.com/mastra-ai/mastra/commit/06b2d87e63bcdd0ed59215c6789692b9b12de376), [`1c67d85`](https://github.com/mastra-ai/mastra/commit/1c67d85e9da8285662f4dbbf47e0378c3fee0747), [`ac01d63`](https://github.com/mastra-ai/mastra/commit/ac01d6355974aec73fdb8781449ed12bac582094), [`80a3324`](https://github.com/mastra-ai/mastra/commit/80a33245d3110204de6f56d61211523ffe338692), [`e44e8f3`](https://github.com/mastra-ai/mastra/commit/e44e8f370b66c339ddcaba946d33da6d3c3f06cd), [`d9d2881`](https://github.com/mastra-ai/mastra/commit/d9d2881ede6dd6c023d144215fc812062aed0890), [`a810a05`](https://github.com/mastra-ai/mastra/commit/a810a058f62ad407cfc1701e0be36ae91145d7cf), [`ba24be6`](https://github.com/mastra-ai/mastra/commit/ba24be662439c331ab23a600041f93803c89eca8), [`842b5fe`](https://github.com/mastra-ai/mastra/commit/842b5fe22b6a7fa811bd14e48eb9af523ac989f2), [`990611b`](https://github.com/mastra-ai/mastra/commit/990611ba76eb876d86c9c594371ae5f02f94b432), [`80bdf3a`](https://github.com/mastra-ai/mastra/commit/80bdf3ae16ade6ff63bde0cb16fa2df8ab7dd4dd), [`c967a5e`](https://github.com/mastra-ai/mastra/commit/c967a5eec150c5dc5418c4a4388982d1fb7ad27c), [`dc4a25d`](https://github.com/mastra-ai/mastra/commit/dc4a25d41af4e2fe97a816070eaec6aa963ab53b), [`9ba1247`](https://github.com/mastra-ai/mastra/commit/9ba12470c77f1c03642d720ce67e517e878f666e), [`fd96298`](https://github.com/mastra-ai/mastra/commit/fd96298a8367622f4ebfcaa97b5b6c1fbbd14564), [`66bbfb5`](https://github.com/mastra-ai/mastra/commit/66bbfb5f05b473d39f88c0e4a481ccac41634f3a), [`dc4a25d`](https://github.com/mastra-ai/mastra/commit/dc4a25d41af4e2fe97a816070eaec6aa963ab53b), [`f8da216`](https://github.com/mastra-ai/mastra/commit/f8da21633e7eb0e31c9ce0fc30567870d19416d3), [`4a09a9c`](https://github.com/mastra-ai/mastra/commit/4a09a9c0474ef643558fcb5f0edc542b82f1cab0), [`5f798b3`](https://github.com/mastra-ai/mastra/commit/5f798b3362e9bdf4d690f85245606e146eef60b9), [`6a84954`](https://github.com/mastra-ai/mastra/commit/6a84954a2667f85b6d59da652dab1bbff007ccb0), [`1e83a47`](https://github.com/mastra-ai/mastra/commit/1e83a4734ab61ba5926af6793e3569a78b72ed37), [`52d8ef0`](https://github.com/mastra-ai/mastra/commit/52d8ef03801f1deb7ee48532fc4190dd4a33916c), [`cdd5c33`](https://github.com/mastra-ai/mastra/commit/cdd5c33ac6c7118a9f139e6dc0e14e6a8ae31658), [`7fdcaa6`](https://github.com/mastra-ai/mastra/commit/7fdcaa66105d64290f9b14432a12ec99f39c4d3a), [`d6c56f9`](https://github.com/mastra-ai/mastra/commit/d6c56f951db3213330b98b0abafa9778c8770e58), [`e08e789`](https://github.com/mastra-ai/mastra/commit/e08e789c1bf4cd2fe46363f7a4728536ceccc9bd), [`bf936e2`](https://github.com/mastra-ai/mastra/commit/bf936e2c89b2ff0dad5695b873ddc009ba96d41e), [`7fb580a`](https://github.com/mastra-ai/mastra/commit/7fb580ac73fbcacf2ff00872a3395f73ae1b9fa5), [`ed5d606`](https://github.com/mastra-ai/mastra/commit/ed5d606739c5e3fbdfa9f272df7809aa5ab43b1d), [`f53d5bd`](https://github.com/mastra-ai/mastra/commit/f53d5bd4885b29e4ac29a428a6044088ea8d6aa3), [`32980a3`](https://github.com/mastra-ai/mastra/commit/32980a3e2413d0274ac244d32c37d910edc13f00), [`01a2943`](https://github.com/mastra-ai/mastra/commit/01a2943a7d886edefdff072bfa51f055bab54437), [`82e3365`](https://github.com/mastra-ai/mastra/commit/82e3365ef7c9bf7bee2e7a7029035ea262d68895), [`6104347`](https://github.com/mastra-ai/mastra/commit/61043473ba6bfd0a25156824e853e13165562e6c), [`35cc901`](https://github.com/mastra-ai/mastra/commit/35cc90102cf834a84827acaf9eee0b6d6d1e2a3b), [`a8b4cf0`](https://github.com/mastra-ai/mastra/commit/a8b4cf02823cffebc4751a53337dfacf097c1ae1), [`9571e3a`](https://github.com/mastra-ai/mastra/commit/9571e3a06ed2c5220196460bf82a2129255c3a8b), [`333785c`](https://github.com/mastra-ai/mastra/commit/333785c93cbb01e42c60167e995457c28897ddbf), [`bda2235`](https://github.com/mastra-ai/mastra/commit/bda22353ee28f2df0eaea555f7cae1549f979c0b), [`efd5c81`](https://github.com/mastra-ai/mastra/commit/efd5c81cc25fde3c2ddd86fc1178deb4ec176e19), [`1b482c2`](https://github.com/mastra-ai/mastra/commit/1b482c2d89244dd758c41e5f927a2b44041388d2), [`45bfb88`](https://github.com/mastra-ai/mastra/commit/45bfb88fd52f1dd3be20e2a38905777c96499c90), [`ff28284`](https://github.com/mastra-ai/mastra/commit/ff2828416f14daff9d956e6a352fdaa23c950979), [`4bcdfaf`](https://github.com/mastra-ai/mastra/commit/4bcdfaf0eac3199d7cb171b0a19a92c9c341eea4), [`e3b9307`](https://github.com/mastra-ai/mastra/commit/e3b9307098daefbfae2a52ae2ef51bc9fc701190), [`d6834c5`](https://github.com/mastra-ai/mastra/commit/d6834c5a7866b16734d23900163c2414ed70d791), [`f33264f`](https://github.com/mastra-ai/mastra/commit/f33264f517ae603279afd5c4251e2b40f6dd3618), [`689f2c4`](https://github.com/mastra-ai/mastra/commit/689f2c4b6c0835fe455702b01d21daa8abcd9331), [`fcd0667`](https://github.com/mastra-ai/mastra/commit/fcd0667a4e378be35c9a1b1eb19cce78fbfd7282), [`cfd0d9e`](https://github.com/mastra-ai/mastra/commit/cfd0d9ec77ec3c69dd96f79cdb579e03d79f22ce), [`acc3513`](https://github.com/mastra-ai/mastra/commit/acc3513b19f79bf0a7ec2998694580edca54086c), [`1670533`](https://github.com/mastra-ai/mastra/commit/1670533986f6bacf567746245348125e3a106448), [`a7eb4a1`](https://github.com/mastra-ai/mastra/commit/a7eb4a11450f6170274ed5141bffe821d4fdd5a6), [`0976933`](https://github.com/mastra-ai/mastra/commit/0976933142333ec78451feef265b68bcb45aa5e7), [`242b945`](https://github.com/mastra-ai/mastra/commit/242b94558777bfbdeb42cbfea84afff0b6ad0633), [`c52d346`](https://github.com/mastra-ai/mastra/commit/c52d3462ec831a5d95926ecd3d3373f5928ad2e5), [`af4636a`](https://github.com/mastra-ai/mastra/commit/af4636a74463275d71c1d13a38f7d2b738f128bf), [`01a2943`](https://github.com/mastra-ai/mastra/commit/01a2943a7d886edefdff072bfa51f055bab54437), [`2eabc09`](https://github.com/mastra-ai/mastra/commit/2eabc097d86d52fbd0123da36a7c874154cc384f), [`0023e79`](https://github.com/mastra-ai/mastra/commit/0023e7919431078280abd11c89d1edeae35fcc69), [`c2ad51e`](https://github.com/mastra-ai/mastra/commit/c2ad51e2467f901eecba8c9f4a45e22a50bd7c18), [`25ca73d`](https://github.com/mastra-ai/mastra/commit/25ca73d25dee7ce9f0ca72939e3a505c4db7257e), [`2f9ef3f`](https://github.com/mastra-ai/mastra/commit/2f9ef3f4ca06fc2dcdd5088c26b7f4da6a016791), [`e7eefcb`](https://github.com/mastra-ai/mastra/commit/e7eefcb162cda7c493e8c3bf43050ead0efbcb2c), [`fea5cae`](https://github.com/mastra-ai/mastra/commit/fea5caedc7e2cfea51784a15e015952692027abf), [`4d7aca2`](https://github.com/mastra-ai/mastra/commit/4d7aca2fe75f225c83d1502d63079568e6ec163f), [`e1cead1`](https://github.com/mastra-ai/mastra/commit/e1cead17b5f3653cf00d2f90cc19b113119c02ba), [`01a2943`](https://github.com/mastra-ai/mastra/commit/01a2943a7d886edefdff072bfa51f055bab54437), [`d9d93b2`](https://github.com/mastra-ai/mastra/commit/d9d93b25e4a65ad5fa153fa35be7ed149c8d587f), [`c4ec889`](https://github.com/mastra-ai/mastra/commit/c4ec889561c0264c43f66d04d587bee4ce35e792), [`4b59f78`](https://github.com/mastra-ai/mastra/commit/4b59f786cbc9a7d1ef07a07517dbd4b96865e99d), [`eeae63e`](https://github.com/mastra-ai/mastra/commit/eeae63e7fbe8e1f237adc69bca6e2ac13c5ca907), [`3dc97ea`](https://github.com/mastra-ai/mastra/commit/3dc97ea415fad353b48a13095fad1835933cc12a), [`94e7ae9`](https://github.com/mastra-ai/mastra/commit/94e7ae970b37c888cd1244ef013292639a2fe6d1), [`e6a2860`](https://github.com/mastra-ai/mastra/commit/e6a2860649cc51f87d32d78b766ae2126446ba07), [`7010c5d`](https://github.com/mastra-ai/mastra/commit/7010c5d15728bf9c5dfe4fb6b1bf80ce23bf143a), [`bab06b1`](https://github.com/mastra-ai/mastra/commit/bab06b18923873a584bdfc71a6b4ec7fb4727fb7), [`3d01cd3`](https://github.com/mastra-ai/mastra/commit/3d01cd387321b6f9c5cac31d487c84bf51b19c78), [`7bf3086`](https://github.com/mastra-ai/mastra/commit/7bf308663f0115ca74ad20554ade740f06640859), [`4c186a0`](https://github.com/mastra-ai/mastra/commit/4c186a017275f45e6ed4c09de0f89550e2d09e8c), [`b0fa077`](https://github.com/mastra-ai/mastra/commit/b0fa077bcbc9b08551846fe372a0d3d15b71ed72), [`0282e16`](https://github.com/mastra-ai/mastra/commit/0282e16115538c8e9b248b90f0748eb01cb5dc98), [`a8dd139`](https://github.com/mastra-ai/mastra/commit/a8dd1391a9fe9a6632c25809ef236980afa9a020), [`6a667b4`](https://github.com/mastra-ai/mastra/commit/6a667b4b7cd6a93fe41fcdd357b08c5a8c09b9ab), [`9be8878`](https://github.com/mastra-ai/mastra/commit/9be8878dcf0388e84fc4873e0eec27bd49b881a4), [`e5786be`](https://github.com/mastra-ai/mastra/commit/e5786be02bb903073082bd9d6da880ebaacc343f), [`2440e09`](https://github.com/mastra-ai/mastra/commit/2440e096ea6c2def1ccc1eb2d0f3f5b88c4af940), [`2093fbd`](https://github.com/mastra-ai/mastra/commit/2093fbd53bb744bae19ec89f6d73db9a66fbe8a7), [`a59049b`](https://github.com/mastra-ai/mastra/commit/a59049b1652a13efff66ac826326b5ed9a550342), [`7bd85ea`](https://github.com/mastra-ai/mastra/commit/7bd85ea7588b71c25ce9f4019c88f8539be5dcbc), [`83fa004`](https://github.com/mastra-ai/mastra/commit/83fa0044bfda8b703a83883dbd8bef204844d13f), [`a463cdf`](https://github.com/mastra-ai/mastra/commit/a463cdf1c95c3059e70f0bff27959e8558bb899d), [`e7a5da4`](https://github.com/mastra-ai/mastra/commit/e7a5da4ef8e4dd452d2f232961b4e682a85ffe43), [`7b4393d`](https://github.com/mastra-ai/mastra/commit/7b4393d557411fdcf07b0e30e5acaf7cc85154ae), [`0ea6b80`](https://github.com/mastra-ai/mastra/commit/0ea6b8001408ce02b56e8be0536b0fd8cbaf8ad2)]:
101
+ - @mastra/core@1.58.0
102
+
3
103
  ## 1.20.0-alpha.4
4
104
 
5
105
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.20.0-alpha.4"
6
+ version: "1.20.1-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -19,7 +19,7 @@ Read the individual reference documents for detailed explanations and code examp
19
19
  - [Workers](references/docs-deployment-workers.md) - Separate background processing from the API layer by running workflow execution, cron schedules, and background tasks in dedicated worker processes.
20
20
  - [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.
21
21
  - [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
22
- - [Storage overview](references/docs-storage-overview.md) - Configure storage for Mastra to persist runtime state across agents, workflows, observability, evals, schedules, and memory.
22
+ - [Storage](references/docs-storage-overview.md) - Configure storage for Mastra to persist runtime state across agents, workflows, observability, evals, schedules, and memory.
23
23
 
24
24
  ### Integrations
25
25
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.20.0-alpha.4",
2
+ "version": "1.20.1-alpha.0",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -106,19 +106,266 @@ Run the same build artifact in multiple containers, each with a different [`MAST
106
106
 
107
107
  Split deployments require a distributed PubSub backend ([`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) or [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub)), a shared [storage backend](https://mastra.ai/reference/workers/overview), and network connectivity between the orchestration worker and the API.
108
108
 
109
- The [worker deployment guide](https://mastra.ai/guides/deployment/mastra-workers) walks through this setup with Docker Compose and Kubernetes examples.
109
+ ### Select workers
110
+
111
+ Set [`MASTRA_WORKERS`](https://mastra.ai/reference/workers/overview) to control which workers run in each process:
112
+
113
+ | Value | Behavior |
114
+ | ------------------------------- | ------------------------------------------------------------------------------ |
115
+ | `false` | Disable all workers. Use this for the API process in a fully split deployment. |
116
+ | `orchestration` | Start the orchestration worker. |
117
+ | `scheduler` | Start the scheduler worker. |
118
+ | `backgroundTasks` | Start the background task worker. |
119
+ | `orchestration,backgroundTasks` | Start multiple workers from a comma-separated allowlist. |
120
+
121
+ You can also pass a worker name to the CLI. The command sets `MASTRA_WORKERS` in the spawned process:
122
+
123
+ ```bash
124
+ mastra worker start orchestration
125
+ ```
110
126
 
111
127
  ## Network architecture
112
128
 
113
- Workers are internal infrastructure. They're not exposed to end users and don't need their own subdomain, public URL, or inbound HTTP route.
129
+ Workers are internal infrastructure. They're not exposed to end users and don't need their own subdomain or public URL, including an inbound HTTP route.
114
130
 
115
131
  In a split deployment:
116
132
 
117
- - **The API server is the only public-facing process**: It serves all client HTTP requests, including REST endpoints, agent interactions, workflow triggers, and any custom routes.
133
+ - **The API server is the only public-facing process**: It serves all client HTTP requests. These requests include REST endpoints and agent interactions, plus workflow triggers and custom routes.
118
134
  - **Workers connect outbound only**: They pull events from the distributed PubSub backend and read/write to the shared storage database. They don't accept inbound traffic from clients.
119
135
  - **The orchestration worker calls the API internally**: It sends step execution requests to the API over the container network using `MASTRA_STEP_EXECUTION_URL`. This is internal service-to-service communication, not a public endpoint.
120
136
 
121
- All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. If a worker-related feature needs an HTTP route (for example, token minting for a voice integration), that route runs on the API server, not on the worker process.
137
+ All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. HTTP routes for worker-related features run on the API server rather than the worker process. One example is token minting for a voice integration.
138
+
139
+ ## Deploy split workers
140
+
141
+ Build the API and worker artifacts:
142
+
143
+ ```bash
144
+ mastra build
145
+ mastra worker build --output-dir .mastra/worker
146
+ ```
147
+
148
+ `mastra build` creates the API artifact in `.mastra/output/`. [`mastra worker build`](https://mastra.ai/reference/cli/mastra) creates a worker artifact in `.mastra/worker/`. The following Dockerfile accepts either directory:
149
+
150
+ ```dockerfile
151
+ FROM node:22-alpine
152
+
153
+ ARG MASTRA_OUTPUT=.mastra/output
154
+
155
+ WORKDIR /app
156
+
157
+ COPY ${MASTRA_OUTPUT}/package.json ${MASTRA_OUTPUT}/.npmrc* ./
158
+ RUN npm install --omit=dev
159
+
160
+ COPY ${MASTRA_OUTPUT}/ .
161
+
162
+ EXPOSE 4111
163
+ CMD ["node", "index.mjs"]
164
+ ```
165
+
166
+ See [Deploy a Mastra server](https://mastra.ai/docs/deployment/mastra-server) for more information about the build output.
167
+
168
+ ### Docker Compose
169
+
170
+ The following configuration runs PostgreSQL, Redis, the API, and one process for each worker type. Every process uses shared infrastructure, and the worker processes use the worker artifact.
171
+
172
+ ```yaml
173
+ x-worker: &worker
174
+ build:
175
+ context: .
176
+ args:
177
+ MASTRA_OUTPUT: .mastra/worker
178
+
179
+ x-mastra-environment: &shared-environment
180
+ DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
181
+ REDIS_URL: redis://redis:6379
182
+
183
+ services:
184
+ postgres:
185
+ image: postgres:16-alpine
186
+ environment:
187
+ POSTGRES_USER: mastra
188
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
189
+ POSTGRES_DB: mastra
190
+ volumes:
191
+ - pgdata:/var/lib/postgresql/data
192
+ healthcheck:
193
+ test: ['CMD-SHELL', 'pg_isready -U mastra']
194
+ interval: 5s
195
+ timeout: 3s
196
+ retries: 5
197
+
198
+ redis:
199
+ image: redis:7-alpine
200
+ healthcheck:
201
+ test: ['CMD', 'redis-cli', 'ping']
202
+ interval: 5s
203
+ timeout: 3s
204
+ retries: 5
205
+
206
+ api:
207
+ build:
208
+ context: .
209
+ args:
210
+ MASTRA_OUTPUT: .mastra/output
211
+ ports:
212
+ - '4111:4111'
213
+ environment:
214
+ <<: *shared-environment
215
+ WORKER_TOKEN: ${WORKER_TOKEN}
216
+ MASTRA_WORKERS: 'false'
217
+ depends_on:
218
+ postgres:
219
+ condition: service_healthy
220
+ redis:
221
+ condition: service_healthy
222
+ healthcheck:
223
+ test: ['CMD', 'wget', '-qO-', 'http://localhost:4111/api/agents']
224
+ interval: 5s
225
+ timeout: 3s
226
+ retries: 5
227
+
228
+ orchestration-worker:
229
+ <<: *worker
230
+ environment:
231
+ <<: *shared-environment
232
+ MASTRA_WORKERS: orchestration
233
+ MASTRA_STEP_EXECUTION_URL: http://api:4111/api
234
+ MASTRA_WORKER_AUTH_TOKEN: ${WORKER_TOKEN}
235
+ depends_on:
236
+ api:
237
+ condition: service_healthy
238
+
239
+ scheduler-worker:
240
+ <<: *worker
241
+ environment:
242
+ <<: *shared-environment
243
+ MASTRA_WORKERS: scheduler
244
+ depends_on:
245
+ api:
246
+ condition: service_healthy
247
+
248
+ background-task-worker:
249
+ <<: *worker
250
+ environment:
251
+ <<: *shared-environment
252
+ MASTRA_WORKERS: backgroundTasks
253
+ depends_on:
254
+ api:
255
+ condition: service_healthy
256
+
257
+ volumes:
258
+ pgdata:
259
+ ```
260
+
261
+ Set the secrets next to `docker-compose.yml`, along with any model provider credentials your application needs:
262
+
263
+ ```bash
264
+ POSTGRES_PASSWORD=your-secure-password
265
+ WORKER_TOKEN=your-shared-secret-token
266
+ ```
267
+
268
+ Configure the API auth provider to accept `WORKER_TOKEN` before exposing the deployment. The orchestration worker sends the same value through `MASTRA_WORKER_AUTH_TOKEN`. The scheduler and background task workers don't call the step execution endpoint in this pull-based topology, so they don't need that variable.
269
+
270
+ Start the stack and verify that the containers and API are available:
271
+
272
+ ```bash
273
+ docker compose up -d
274
+ docker compose ps
275
+ curl http://localhost:4111/api/agents
276
+ ```
277
+
278
+ ### Kubernetes
279
+
280
+ Create separate Deployments for the API, orchestration worker, scheduler worker, and background task worker. Use the same image and Secret for each Deployment. Set only the role-specific environment variables directly on each container.
281
+
282
+ The orchestration worker Deployment has the following shape:
283
+
284
+ ```yaml
285
+ apiVersion: apps/v1
286
+ kind: Deployment
287
+ metadata:
288
+ name: orchestration-worker
289
+ spec:
290
+ replicas: 1
291
+ selector:
292
+ matchLabels:
293
+ app: orchestration-worker
294
+ template:
295
+ metadata:
296
+ labels:
297
+ app: orchestration-worker
298
+ spec:
299
+ containers:
300
+ - name: worker
301
+ image: your-registry/mastra-workers:latest
302
+ env:
303
+ - name: MASTRA_WORKERS
304
+ value: orchestration
305
+ - name: MASTRA_STEP_EXECUTION_URL
306
+ value: http://api:4111/api
307
+ envFrom:
308
+ - secretRef:
309
+ name: mastra-secrets
310
+ resources:
311
+ requests:
312
+ cpu: 250m
313
+ memory: 256Mi
314
+ ```
315
+
316
+ Use `MASTRA_WORKERS: scheduler` and `MASTRA_WORKERS: backgroundTasks` for the other worker Deployments. Set `MASTRA_WORKERS: 'false'` on the API Deployment and expose the API with a Service. Give every process access to the same database and PubSub backend. Configure the API auth provider with a worker token, then expose that token to the orchestration worker as `MASTRA_WORKER_AUTH_TOKEN`. See [Deploy Mastra to Kubernetes](https://mastra.ai/integrations/deploy/kubernetes) for the base Kubernetes resources.
317
+
318
+ Apply the manifests, then verify the pods and API:
319
+
320
+ ```bash
321
+ kubectl apply -f k8s/
322
+ kubectl get pods
323
+ kubectl port-forward svc/api 4111:4111
324
+ ```
325
+
326
+ In a separate terminal, request an API route:
327
+
328
+ ```bash
329
+ curl http://localhost:4111/api/agents
330
+ ```
331
+
332
+ ### Step execution URL
333
+
334
+ In a fully split deployment, the orchestration worker delegates workflow step execution to the API over HTTP. Set `MASTRA_STEP_EXECUTION_URL` to the API's internal URL, including the `/api` prefix:
335
+
336
+ ```bash
337
+ MASTRA_STEP_EXECUTION_URL=http://api:4111/api
338
+ ```
339
+
340
+ Without this variable, the orchestration worker attempts to execute steps in its own process, which doesn't have access to the full Mastra runtime in a split deployment.
341
+
342
+ The endpoint uses the server's normal auth pipeline. If the API has an auth provider, set `MASTRA_WORKER_AUTH_TOKEN` to a bearer token that provider accepts. Mastra forwards the value as an `Authorization: Bearer` credential. The configured auth provider validates the token. See [Worker authentication](https://mastra.ai/docs/server/auth/workers) for server configuration and other credential formats.
343
+
344
+ ### Scale workers
345
+
346
+ The orchestration and background task workers can scale horizontally. PubSub consumer groups distribute events across their instances:
347
+
348
+ ```bash
349
+ docker compose up -d --scale orchestration-worker=3
350
+ docker compose up -d --scale background-task-worker=2
351
+ ```
352
+
353
+ For Kubernetes, change the Deployment replica count manually or use a HorizontalPodAutoscaler:
354
+
355
+ ```bash
356
+ kubectl scale deployment/orchestration-worker --replicas=3
357
+ kubectl scale deployment/background-task-worker --replicas=2
358
+ ```
359
+
360
+ Run exactly one scheduler worker. Multiple schedulers polling the same storage can publish duplicate events for a schedule.
361
+
362
+ ### Crash recovery
363
+
364
+ A distributed PubSub backend persists unacknowledged events, which lets orchestration and background task workers resume after a restart. When the API is unavailable, a failed step-execution request causes the event to be delivered again. Because an event can be processed more than once, handlers should be idempotent when possible.
365
+
366
+ The scheduler calculates the next fire time from the current time after it restarts. It doesn't replay schedules that elapsed while it was unavailable.
367
+
368
+ If the API crashes while a step is executing, that work can be lost and the workflow run can remain in a `running` state. See [known limitations](#known-limitations) and [durable agent crash recovery](https://mastra.ai/docs/long-running-agents/durable-agents).
122
369
 
123
370
  ## Known limitations
124
371
 
@@ -129,7 +376,6 @@ All three worker types (orchestration, scheduler, background task) sit behind th
129
376
 
130
377
  ## Related
131
378
 
132
- - [Worker deployment guide](https://mastra.ai/guides/deployment/mastra-workers): Docker Compose and Kubernetes examples
133
379
  - [Worker authentication](https://mastra.ai/docs/server/auth/workers): Secure worker-to-API communication
134
380
  - [Workers reference](https://mastra.ai/reference/workers/overview): Details about worker environment variables and types, with a list of supported storage backends
135
381
  - [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
@@ -270,7 +270,7 @@ Supported embedding models:
270
270
 
271
271
  - **OpenAI**: `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`
272
272
  - **Google**: `gemini-embedding-001`
273
- - **OpenRouter**: Access embedding models from various providers
273
+ - **OpenRouter**: Access embedding models from multiple providers
274
274
 
275
275
  ```ts
276
276
  import { Agent } from '@mastra/core/agent'
@@ -1,6 +1,6 @@
1
1
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
2
 
3
- # Working Memory
3
+ # Working memory
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
 
@@ -213,7 +213,7 @@ const paragraphMemory = new Memory({
213
213
 
214
214
  ## Structured working memory
215
215
 
216
- 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
+ Working memory can also be defined using a structured schema instead of a Markdown template. 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.
217
217
 
218
218
  **Requirement:** You must specify either `template` or `schema`, but not both.
219
219
 
@@ -1,6 +1,6 @@
1
1
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
2
 
3
- # Storage overview
3
+ # Storage
4
4
 
5
5
  Storage is the persistence layer for the Mastra runtime. It keeps memory, workflow state, observability data, eval results, schedules, and long-running agent state available after a process restarts.
6
6
 
@@ -188,25 +188,26 @@ You can also route `observability` to a dedicated analytics backend. See the [ob
188
188
 
189
189
  ## Supported providers
190
190
 
191
- Each provider page includes installation instructions, configuration parameters, and usage examples:
191
+ Each provider page includes installation instructions, configuration parameters, and usage examples. libSQL is the fastest path for local development because it doesn't require running a separate database server.
192
192
 
193
+ - [Aurora DSQL](https://mastra.ai/integrations/databases/aurora-dsql)
194
+ - [ClickHouse](https://mastra.ai/integrations/databases/clickhouse)
193
195
  - [Cloudflare D1](https://mastra.ai/integrations/databases/cloudflare-d1)
194
- - [Cloudflare KV & Durable Objects](https://mastra.ai/integrations/databases/cloudflare-kv)
196
+ - [Cloudflare KV](https://mastra.ai/integrations/databases/cloudflare-kv)
195
197
  - [Convex](https://mastra.ai/integrations/databases/convex)
198
+ - [DuckDB](https://mastra.ai/integrations/databases/duckdb)
196
199
  - [DynamoDB](https://mastra.ai/integrations/databases/dynamodb)
197
200
  - [Google Cloud Spanner](https://mastra.ai/integrations/databases/spanner)
198
201
  - [LanceDB](https://mastra.ai/integrations/databases/lancedb)
199
202
  - [libSQL](https://mastra.ai/integrations/databases/libsql)
200
- - [Microsoft SQL Server](https://mastra.ai/integrations/databases/mssql)
201
203
  - [MongoDB](https://mastra.ai/integrations/databases/mongodb)
204
+ - [MSSQL](https://mastra.ai/integrations/databases/mssql)
202
205
  - [Neon Postgres](https://mastra.ai/integrations/databases/neon)
203
206
  - [OracleDB](https://mastra.ai/integrations/databases/oracledb)
204
207
  - [PostgreSQL](https://mastra.ai/integrations/databases/postgresql)
205
208
  - [Redis](https://mastra.ai/integrations/databases/redis)
206
209
  - [Upstash](https://mastra.ai/integrations/databases/upstash)
207
210
 
208
- > **Tip:** libSQL is the fastest path for local development because it doesn't require running a separate database server.
209
-
210
211
  ## Next steps
211
212
 
212
213
  - [Composite storage](https://mastra.ai/reference/storage/composite)
@@ -407,8 +407,9 @@ PostgreSQL storage creates composite indexes during initialization for common qu
407
407
  - `mastra_ai_spans_name_startedat_idx`: (name, startedAt DESC)
408
408
  - `mastra_ai_spans_scope_startedat_idx`: (scope, startedAt DESC)
409
409
  - `mastra_scores_trace_id_span_id_created_at_idx`: (traceId, spanId, createdAt DESC)
410
+ - `mastra_workflow_snapshot_name_createdat_idx`: (workflow\_name, createdAt DESC)
410
411
 
411
- These indexes improve performance for filtered queries with sorting, including `dateRange` filters on message queries.
412
+ These indexes improve performance for filtered queries with sorting, including `dateRange` filters on message queries and Studio's workflow runs-list.
412
413
 
413
414
  ### Configuring Indexes
414
415
 
@@ -521,11 +522,11 @@ const stats = await storage.db.one(`
521
522
 
522
523
  PostgreSQL offers different index types optimized for specific scenarios:
523
524
 
524
- | Index Type | Best For | Storage | Speed |
525
- | ------------------- | --------------------------------------- | ---------- | -------------------------- |
526
- | **btree** (default) | Range queries, sorting, general purpose | Moderate | Fast |
527
- | **hash** | Equality comparisons only | Small | Very fast for `=` |
528
- | **gin** | JSONB, arrays, full-text search | Large | Fast for contains |
529
- | **gist** | Geometric data, full-text search | Moderate | Fast for nearest-neighbor |
530
- | **spgist** | Non-balanced data, text patterns | Small | Fast for specific patterns |
531
- | **brin** | Large tables with natural ordering | Very small | Fast for ranges |
525
+ | Index Type | Best For | Storage size | Speed |
526
+ | ------------------- | --------------------------------------- | ------------ | -------------------------- |
527
+ | **btree** (default) | Range queries, sorting, general purpose | Moderate | Fast |
528
+ | **hash** | Equality comparisons only | Small | Very fast for `=` |
529
+ | **gin** | JSONB, arrays, full-text search | Large | Fast for contains |
530
+ | **gist** | Geometric data, full-text search | Moderate | Fast for nearest-neighbor |
531
+ | **spgist** | Non-balanced data, text patterns | Small | Fast for specific patterns |
532
+ | **brin** | Large tables with natural ordering | Very small | Fast for ranges |
@@ -127,7 +127,7 @@ const { embeddings } = await embedMany({
127
127
  })
128
128
  ```
129
129
 
130
- > **Vector Database Compatibility:** When storing embeddings, the vector database index must be configured to match the output size of your embedding model. If the dimensions don't match, you may get errors or data corruption.
130
+ > **Vector Database Compatibility:** When storing embeddings, configure the vector database index to match the output size of your embedding model to avoid errors or data corruption from mismatched dimensions.
131
131
 
132
132
  ## Example: Complete pipeline
133
133
 
@@ -201,7 +201,7 @@ const results = await store.query({
201
201
  ### Amazon S3 Vectors
202
202
 
203
203
  - Equality values must be primitives (string/number/boolean). `null`/`undefined`, arrays, objects, and Date aren't allowed for equality. Range operators accept numbers or Date (Dates are normalized to epoch ms).
204
- - `$in`/`$nin` require **non-empty arrays of primitives**; Date elements are allowed and normalized to epoch ms. **Array equality** isn't supported.
204
+ - `$in`/`$nin` require **non-empty arrays of primitives**. Date elements are allowed and normalized to epoch ms. **Array equality** isn't supported.
205
205
  - Implicit AND is canonicalized (`{a:1,b:2}` → `{$and:[{a:1},{b:2}]`). Logical operators must contain field conditions and use non-empty arrays. They may appear only at the root or within other logical operators (not inside field values).
206
206
  - Keys listed in `nonFilterableMetadataKeys` at index creation are stored but not filterable. This setting is immutable.
207
207
  - $exists requires a boolean value.
@@ -234,7 +234,7 @@ const storage = new MongoDBStore({
234
234
 
235
235
  `prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist and are reused by future writes, so the file stops growing: for most users this alone solves the unbounded-growth problem.
236
236
 
237
- Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically; a manual `VACUUM FULL` is only needed if you must return disk to the OS.
237
+ Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically. A manual `VACUUM FULL` is only needed if you must return disk to the OS.
238
238
 
239
239
  For MongoDB, deleted documents are reused by future insertions. To reclaim disk space, run [`db.runCommand({ compact: "collection_name" })`](https://www.mongodb.com/docs/manual/reference/command/compact/) during a maintenance window.
240
240
 
@@ -353,7 +353,7 @@ const response = await agent.generate('Find information about deployment', {
353
353
  })
354
354
  ```
355
355
 
356
- This approach allows you to:
356
+ Runtime configuration supports these use cases:
357
357
 
358
358
  - Switch between environments (dev/staging/prod)
359
359
  - Adjust performance parameters based on load
@@ -350,7 +350,7 @@ The `PgVector` class exposes its underlying PostgreSQL connection pool as a publ
350
350
  pgVector.pool // instance of pg.Pool
351
351
  ```
352
352
 
353
- This enables advanced usage such as running direct SQL queries, managing transactions, or monitoring pool state. When using the pool directly:
353
+ Direct pool access supports advanced operations such as direct SQL queries, transactions, or pool-state monitoring. When using the pool directly:
354
354
 
355
355
  - You are responsible for releasing clients (`client.release()`) after use.
356
356
  - The pool remains accessible after calling `disconnect()`, but new queries will fail.