@mongodb-developer/vercel-ai-memory
MongoDB Atlas-backed persistent memory for the Vercel AI SDK with five structured memory tiers and vector search.
At a Glance
The @mongodb-developer/vercel-ai-memory package is licensed under Apache 2.0. Requires a user-provided MongoDB Atlas cluster, which is an external cost.
Engagement
Available On
Alternatives
Listed Nov 2026
About @mongodb-developer/vercel-ai-memory
@mongodb-developer/vercel-ai-memory is an npm package from MongoDB that adds persistent memory to agents built with the Vercel AI SDK. It also offers a memory provider for Vercel Eve, which the README marks as not yet production-ready. Memories are stored in MongoDB Atlas with automatic vector search indexes and per-type retention policies.
What It Is
The package is a TypeScript library that exposes a single memory tool to an AI SDK agent, scoped to a user and session. It provides five memory tiers: Session, Semantic, Procedural, Episodic, and Scratchpad. Developers can supply any AI SDK embedding model, or opt into Atlas Automated Embedding (Voyage AI) so that Atlas generates vectors server-side. It supports AI SDK v6 and v7, and the AI SDK, MongoDB driver and zod are installed as peer dependencies.
How the memory tiers work
Session memory holds conversation turns and can run in two modes: tool-driven, where the LLM decides when to read and write, or hook-driven, where runtime hooks (loadSession and onFinish) capture each turn exactly once. The README recommends the hook-driven mode for production. Semantic and procedural memories are temporally versioned, episodic memory records events, and scratchpad notes can be promoted to episodic memory. An agent-driven memory_forget command marks a memory for deletion through a TTL index.
Retention and multi-tenancy
Each memory type accepts a retention policy: none, TTL, TTL with importance, or dynamic forgetting-curve expiry. Topology options allow custom database, collection and index names, extra filter fields such as tenant_id, and disabling or hiding memory types. Retrieval filters cover minimum importance, recency window and candidate multiplier.
Vercel Eve provider
Through the /eve subpath, mongodbMemory() plugs into Eve's memory slots. It performs automatic recall before each turn, automatic or agent-driven capture, and remember/forget tools, partitioned by Eve's trusted scope key. This subpath is excluded from the package's semantic-versioning guarantees.
Setup path
Install with npm or pnpm, pass a MongoDB Atlas connection string as uri, and provide either an embedder or autoEmbed, but not both. Automated Embedding requires Atlas with Voyage AI enabled for the organization. The README advises storing the connection string as a secret in production. Switching embedding modes on an existing database temporarily breaks search for previously saved memories.
Community Discussions
Be the first to start a conversation about @mongodb-developer/vercel-ai-memory
Share your experience with @mongodb-developer/vercel-ai-memory, ask questions, or help others learn from your insights.
Pricing
Open Source (Apache 2.0)
The @mongodb-developer/vercel-ai-memory package is licensed under Apache 2.0. Requires a user-provided MongoDB Atlas cluster, which is an external cost.
- 5 memory types: Session, Semantic, Procedural, Episodic, Scratchpad
- Atlas Vector Search
- Atlas Automated Embedding (Voyage AI)
- Per-type retention policies
- Multi-tenant ready
Capabilities
Key Features
- Five memory types: session, semantic, procedural, episodic, scratchpad
- Atlas Vector Search semantic retrieval
- Atlas Automated Embedding via Voyage AI
- Auto-detected embedding dimensions
- Per-type retention policies: none, ttl, ttl+importance, dynamic
- Agent-driven memory_forget deletion
- Multi-tenant configuration with custom collections, indexes and filter fields
- Temporal versioning of semantic and procedural memories
- Hook-driven deterministic session capture
- Vercel Eve memory provider (not yet production-ready)
- Lazy MongoDB connection
- Works with any AI SDK embedding provider
