Maximem Synap's Agent Memory Now Available for Vercel AI SDK
The Vercel AI SDK has become the standard for JavaScript and TypeScript developers building AI applications. Unified interface across models. Streaming built in. If you are building an agent in the Vercel ecosystem, the AI SDK is where you start.
Today, Maximem Synap extends the Vercel AI SDK with persistent per-user memory. Native memory stores conversation state within a single process. Synap makes that state survive restarts, resolve entities across sessions, and retrieve relevant context without manual wiring.
Where Vercel AI SDK Excels
Vercel gave JavaScript developers a unified way to build with AI. One interface for every model provider. Streaming responses that work without fighting the framework. Tool calling with proper async patterns. If your agent needs to call external tools, stream responses, or switch models without code changes, the Vercel AI SDK handles the integration well.
The problem emerges when your user returns after a day or a week. The AI SDK's memory options handle the current session. They do not persist across process restarts. A unified API does not help if the agent forgets what the user told it yesterday.
How Vercel AI SDK Memory Works Today
The Vercel AI SDK ships with basic memory patterns for conversation tracking. All store data within a single process lifetime. For a deeper look at how each works, see the Vercel AI SDK documentation.
In-Memory Store stores every message in a list attached to the agent run. This scratchpad grows with each turn. After twenty exchanges, your context window fills with accumulated noise. The agent struggles to find your actual instructions. When the process restarts, the list clears. Every session begins at zero. Windowed Store keeps only the most recent K messages and discards older content. The window slides forward. Conversations from yesterday are already gone. This approach does not solve memory. It accelerates forgetting by design.
Both options solve in-session state management. Cross-session persistence, entity resolution, semantic retrieval, and automatic compaction fall outside their scope. These are memory-layer problems, not SDK-level concerns.
What Synap Adds
Synap is agentic context management. It does not replace the Vercel AI SDK's memory. It extends the SDK with a persistence layer that survives restarts.
We ship three components that plug into the SDK's native interfaces:
SynapMiddleware implements the SDK's middleware interface. Attach it to any agent. The middleware captures every turn in the background and ingests it into Synap asynchronously. Your agent logic remains unchanged. Execution latency stays the same. The agent keeps working and starts remembering.
SynapHistory implements the memory store interface. Use it as your memory backend. Memory is scoped per user and per conversation. State survives restarts. Prior messages replay on the next session without manual setup.
SynapRetriever implements the retriever interface. Fetch user-scoped memories as standard memory objects. Two modes are available. Fast mode uses vector-only search and returns results in 50 to 100ms. Accurate mode adds graph traversal and reranking for 200 to 500ms latency.
The integration is a native JavaScript package. Drop it in, replace the memory backend, and your agent picks up persistent memory without a rewrite.
We built this because JavaScript agents kept stalling in production. The problem was not bad integration. It was missing context that lived in a different session last Tuesday. Production testing hit 90.2% on LongMemEval. Fast mode retrieves in under 100ms.
For why context management is infrastructure and not a feature, read What Is Agentic Context Management? (/blog/what-is-agentic-context-management). For build-versus-buy numbers, see The Real Cost of DIY Agent Memory.
Technical Deep Dive
LongMemEval Benchmark
LongMemEval tests whether agents recall facts across long, multi-turn conversations spanning multiple sessions. The benchmark simulates production conditions where users return days apart and expect the agent to remember prior context. Synap scores 90.2% on this benchmark. Baseline vector-only approaches typically score 60-70%. The gap comes from entity resolution and temporal awareness that pure vector search lacks.
Entity Resolution Mechanism
Synap tracks identity across 15 reference patterns: names, emails, phone numbers, account IDs, session IDs, API keys, and more. When an agent encounters "John" in one session and "[email protected]" in another, the resolution engine runs deterministic matching on structured fields, then probabilistic matching on unstructured references. Conflicts are resolved using temporal recency and source confidence scores. The result is a single canonical entity that accumulates context across all identifiers.
Accuracy-Preserving Compaction
Compaction identifies which facts are critical versus redundant. Critical facts include user preferences, constraints, commitments, and entity relationships. Redundant facts include repeated greetings, acknowledged statements, and intermediate reasoning steps. The compaction engine uses a classifier trained on conversation data to distinguish these categories. Most teams see 60 to 70% fewer tokens shipped to the LLM per turn after compaction kicks in. The accuracy preservation comes from never dropping classified-critical facts, even under aggressive token budgets.
Graph Traversal in Accurate Mode
Fast mode retrieves by vector similarity alone. Accurate mode adds a graph layer that traverses relationships between entities. If you ask about "the project John mentioned," the graph finds John, traverses to projects linked to John, and returns the relevant context. This adds latency but catches connections that vector similarity misses. Reranking then scores results by recency, confidence, and query relevance.
Multi-Tenant Scoping
Memory is scoped by three keys: user_id identifies the person, conversation_id isolates individual sessions, and customer_id enables multi-tenant deployments. A SaaS deploying agents for multiple customers uses customer_id to ensure tenant A never sees tenant B's memory. This scoping is enforced at the storage layer, not just in application logic.
What Synap Adds to Vercel AI SDK
Persistence
Vercel AI SDK Native. In-process only. State clears on restart.
With Synap. Per-user memory survives across sessions and restarts.
Entity Resolution
Vercel AI SDK Native. Raw identifiers. No linking across sessions.
With Synap. "John" and "[email protected]" resolve to one canonical entity across every session.
Compaction
Vercel AI SDK Native. Manual summarization or no compaction. Lossy.
With Synap. Automatic and configurable. Accuracy-preserving compaction that does not drop critical facts.
Retrieval Latency
Vercel AI SDK Native. Depends on setup.
With Synap. 50 to 100ms fast mode. 200 to 500ms accurate mode.
Long-Term Recall
Vercel AI SDK Native. Not benchmarked for cross-session recall.
With Synap. 90.2% on LongMemEval.
Failure Handling
Vercel AI SDK Native. Retrieval failures crash the run or return noise.
With Synap. Empty result and a logged error. Your agent keeps running.
User Scoping
Vercel AI SDK Native. Run-scoped only.
With Synap. Built-in user_id, conversation_id, customer_id scoping out of the box.
What Production Teams Gain
Cross-session continuity. Your user chats on Monday, returns on Wednesday. SynapHistory replays prior context. SynapRetriever surfaces relevant facts from last week. The agent treats every session as one continuous conversation. Native memory treats every session as a fresh start.
Accuracy that ships. 90.2% on LongMemEval measures whether agents recall facts across long, multi-turn conversations spanning multiple sessions.
Token efficiency. Synap's compaction trims conversation history without dropping critical context. Most teams see 60 to 70% fewer tokens shipped to the LLM per turn. At scale, that is the difference between profit and burn.
Latency that does not block. Fast retrieval: 50 to 100ms. Accurate mode with graph traversal and reranking: 200 to 500ms. Both degrade without crashing. A failure returns empty results and a log line, not a broken agent.
Entity resolution. "John from Acme," "[email protected]," and "user_4829" resolve to one person across every session. Synap handles this at the memory layer so your agent does not have to.
Production resilience. The middleware captures turns in the background without adding latency. The retriever returns empty results on failure instead of crashing. The history replays prior messages per session. All three components implement standard Vercel AI SDK interfaces. No wrappers. No adapters.
How to Get Started
Setup
Install the package:
npm install @maximem/synap-vercel-adk ai @ai-sdk/openai
Configure your API key. Generate one from the Synap Dashboard.
.env
SYNAP_API_KEY=synap_your_key_here
OPENAI_API_KEY=your-openai-api-key
Initialize the provider once at application startup:
import { createSynap } from "@maximem/synap-vercel-adk";
const synap = await createSynap({ apiKey: process.env.SYNAP_API_KEY!, });
createSynapinitializes the underlying Synap SDK internally — you don’t need to manage the SDK lifecycle separately. SeeSDK Initializationfor the full lifecycle if you’d rather construct the SDK directly.
Basic integration The smallest useful integration wraps a model withsynap.wrapand uses it like any other Vercel AI SDK model:
import { generateText } from "ai"; import { anthropic } from "@ai-sdk/anthropic";const model = synap.wrap(anthropic("claude-sonnet-4-6"), { userId: "alice", customerId: "acme", // optional — required for B2B instances });
const { text } = await generateText({ model, messages: [{ role: "user", content: "What do you remember about my account?" }], });
On every call, the middleware fetches Synap context, injects it as a system message, proxies the request to the wrapped model, and ingests the resulting turn back into Synap.Context-fetch failures degrade gracefully(empty context, error logged);turn-ingestion failures surface explicitlyso silent data loss is impossible.
Memory Is Infrastructure
Vercel gave JavaScript developers a unified interface for building with AI. Real value. The memory patterns it ships handle in-session state well. Making that state persist across sessions, resolve entities, and retrieve intelligently is a different problem.
The teams that ship production agents discover this around month three. They either build memory infrastructure themselves, or they plug in a system built for the problem.
This is why memory is infrastructure, not a feature.
Start building Vercel AI SDK agents that remember across sessions → (https://synap.maximem.ai)
Synap pricing is usage-based. You pay for memory operations: storage, retrieval, compaction. No per-seat or per-framework surcharge. Starter plan: $49/month. Every new account gets $25 in free credits to test before committing. See full pricing at https://synap.maximem.ai/pricing.
Related Posts
- I Spoke to 500+ Voice Ai Builders in India Over 3 Months. Here is What I Found
- Maximem Synap's Agent Memory Now Available for Pydantic AI



