MongoDB plugs a memory store into Vercel AI SDK: agents keep user context across sessions, with vector search in the same database
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 starts 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 tiers and stores them as Atlas documents, with the semantic, procedural and episodic tiers retrieved by meaning through MongoDB Vector Search rather than keywords, and indexes and embedding dimensions handled at startup.
Interpretation
AI applications and agents built with the Vercel AI SDK can now keep their memories in MongoDB Atlas, retaining conversations, user facts and past events across sessions, users and restarts. The Vercel AI SDK does not include a database that persists memories between runs; without memory an application knows nothing of the previous conversation, who the user is or what was asked yesterday. The integration is released as open source and generally available on npm under the Apache 2.0 license, works with AI SDK v6 and v7, and requires a MongoDB Atlas cluster.
Memories are kept in five categories by purpose: session memory follows the current conversation, semantic memory holds facts about people, entities and preferences, procedural memory holds workflows and instructions, episodic memory holds key events and outcomes, and scratchpad memory holds temporary notes on work in progress. The integration assigns each category its own retention policy automatically: scratchpad memories expire after an hour, episodic memories expire after one year of inactivity by default, and semantic and procedural memories are versioned so history survives a changed fact. The semantic, procedural and episodic tiers use MongoDB Vector Search to find memories by meaning, and the integration creates vector indexes and detects embedding dimensions at startup, accepting any AI SDK embedding model such as Voyage AI, OpenAI, Cohere or Google.
Perspective
The integration targets developers building with Vercel AI SDK v6 or v7 who have a MongoDB Atlas cluster; enabling it means installing the package and its peer dependencies, creating a memory instance with a connection string and an embedding model, and passing the memory tools to the application scoped to a user and session.
By default the model decides when to save and read conversation turns, so it can occasionally skip one; for production, AI SDK hooks let the application's own code load and save the transcript at every turn so each user, assistant and tool message is saved exactly once.
