Vercel AI SDK gets persistent memory: MongoDB's open-source integration stores chats, facts and events in Atlas
Synopsis
MongoDB released and open-sourced an integration that turns MongoDB Atlas into the persistent memory store for AI applications and agents built with the Vercel AI SDK. The SDK itself ships no database, so an application previously started every conversation with no knowledge of the last one, and developers had to design schemas, write cleanup jobs and set up vector search themselves. The integration sorts memories into session, semantic, procedural, episodic and scratchpad types with separate retention policies, and creates vector indexes automatically while detecting embedding dimensions at startup.
Interpretation
AI applications and agents built with the Vercel AI SDK can now store their memories in MongoDB Atlas and keep them across sessions, users and restarts. The Vercel AI SDK is a TypeScript toolkit for building AI applications that handles calling models, streaming responses, using tools and running multi-step agents, but it includes no database to persist memories between runs; without memory, an application does not know who the user is or what was asked yesterday. The integration is released as open source and generally available on npm under Apache 2.0, works with AI SDK v6 and v7, and requires a MongoDB Atlas cluster; once installed, the package automatically stores the application's memories as documents.
Memories are automatically sorted into five types, each kept for a different length of time and retrieved differently. The five types are session, semantic, procedural, episodic and scratchpad: episodic memories expire after one year of inactivity by default, scratchpad notes expire after an hour, and a scratchpad note can be promoted to episodic memory if it turns out to matter. The semantic, procedural and episodic tiers use MongoDB Vector Search, which finds stored memories by semantic meaning rather than exact keywords; semantic and procedural memories are versioned so history is preserved when a fact changes.
Retention policies and vector indexes are configured by the integration, so developers supply only a connection string and an embedding model. Retention modes are none, ttl, ttl+importance and dynamic, where the developer defines a custom forgetting period; the model can also delete a specific memory through memory_forget when a user says to forget it, with removal usually within about 60 seconds. The integration creates vector indexes automatically and detects embedding dimensions at startup, and it accepts any AI SDK embedding model including Voyage AI, OpenAI, Cohere or Google; in production, AI SDK hooks let application code load and save the transcript at every turn so each user, assistant and tool message is saved exactly once.
Perspective
The integration targets TypeScript applications built with the Vercel AI SDK, requires a MongoDB Atlas cluster and works with AI SDK v6 and v7; by default the model decides when to save and read conversation turns, so it can occasionally skip one.
By default the model decides when to save and read conversation turns and can occasionally skip one, so production use calls for AI SDK hooks; keeping memories too long can decrease retrieval performance and raise costs, while deleting them too early makes applications forget important context, and developers must set that balance themselves.
