{"slug": "give-your-vercel-ai-sdk-agents-memory-with-redis-agent-memory", "title": "Give your Vercel AI SDK agents memory with Redis Agent Memory", "summary": "Redis released @redis/vercel-ai-sdk, a package that connects Redis Agent Memory to agents built with Vercel's AI SDK, giving them short-term session memory and long-term personal memory through a single server-side factory, createRedisAgentMemory(...). The integration offers an automatic-memory model that restores and injects context before inference and records messages afterward, or memory.tools() that lets the model decide when to search, save, update or forget; by default the wrapper recalls up to 5 memories, caps long-term context at 8,000 characters and restored session context at 24,000, and uses one-second read and write deadlines. Redis Agent Memory, part of Redis Iris, is provisioned in Redis Cloud and accessed over HTTP, and the package marks recalled context as untrusted and possibly stale so the model treats it as a hint rather than ground truth.", "body_md": "Blog\n\n# Give your Vercel AI SDK agents memory with Redis Agent Memory\n\nWe've released [@redis/vercel-ai-sdk](https://www.npmjs.com/package/@redis/vercel-ai-sdk)[Redis Agent Memory](https://redis.io/agent-memory/) to agents built with Vercel's AI SDK.\n\nMost agents start every conversation cold. Users repeat their preferences, and yesterday's context is gone. You can bolt on a vector store and a pile of glue code, or you can hand the problem to a managed memory layer. With this package, a few lines of TypeScript give your agent short-term session memory and long-term personal memories.\n\n## What Redis Agent Memory does\n\nRedis Agent Memory, part of [Redis Iris](https://redis.io/iris/), is a managed memory layer for agents. It combines two things: short-term memory for the current session and long-term memory that follows the user across sessions, channels, and agents.\n\nYou don't hand-curate any of it. Redis Agent Memory works in the background: it summarizes long sessions so context stays compact, extracts durable memories from the events you record, and promotes them to long-term storage. Later, any conversation can pull them back with semantic search, so an agent can remember that a user prefers aisle seats without being told again. You provision a store in [Redis Cloud](https://cloud.redis.io/#/agent-memory) and talk to it over HTTP. This package is the AI SDK layer on top.\n\n## The integration: two ways in\n\nBoth approaches come from one server-side factory, `createRedisAgentMemory(...)`, which holds your connection and an optional default model. From there you choose how much control the model gets.\n\n|  | Automatic-memory model | Memory tools | \n|---|---|---|\n| How you use it | memory.model({ scope }) as your request's model | memory.tools({ scope }) as tools | \n| Recall and history | Restored and injected before inference | The model chooses when to search or save | \n| Recording | Automatic, user messages and assistant steps | Model-selected, or optional lifecycle hooks | \n| Best for | Continuity with no extra prompting | Explicit, selective, model-directed memory | \n\n## Option 1: Memory without changing your agent\n\nThe simplest path is automatic-memory. You configure the connection once, then wrap your model per request:\n\nBefore each model call, the wrapper restores the session, recalls the user's long-term memories, and injects them as a bounded context block. Afterward it records the user's message and each successful assistant step.\n\n## Option 2: Let the model manage its own memory\n\nIf you want explicit control, `memory.tools()` returns an ordinary AI SDK tool map you pass alongside your model. The model decides when to search, save, update, or forget memories, and you can expose only the tools you want. Session recording can be agent-managed or handled by optional lifecycle hooks.\n\nRule of thumb: pick the automatic-memory option for continuity with no extra prompting, and tools when you want model-directed memory management. The two can coexist, but don't enable automatic recording and session-write tools for the same interaction, or events may be duplicated.\n\n## Built with production in mind\n\nMemory sits on the hot path of every request, so we kept it bounded and predictable:\n\n- **Scoped by user and session.** Memories are always tied to a`userId` , and session restore and recording need a`sessionId` . Resolve both from an authenticated state.\n- **Bounded context.** By default the wrapper recalls up to 5 memories, caps long-term context at 8,000 characters and restored session context at 24,000, and uses one-second read and write deadlines.\n- **Failures don't break replies.** Memory errors surface through an optional`onDiagnostic` callback and never replace a successful model response. Diagnostics never include prompt, memory, or credential text.\n- **Recalled context is marked as untrusted and possibly stale** , so the model treats it as a hint, not ground truth.\n- **Best-effort recording.** Redis Agent Memory has no append idempotency key, so a timed-out write may still have landed. Use collision-resistant session IDs and serialize requests per session.\n\n## Get started\n\nThe package is server-side and ESM-only, and requires Node.js 22+, AI SDK 7.x, and Zod 4.x.\n\nProvision a store in [Redis Cloud](https://cloud.redis.io/#/agent-memory), then set `AGENT_MEMORY_URL`, `AGENT_MEMORY_API_KEY` and `AGENT_MEMORY_STORE_ID` in your server environment.\n\nFor a step-by-step walkthrough on how to use the library, check out the [Build a Meal-Planning Agent with Redis Memory](https://ai-sdk.dev/cookbook/guides/redis-agent-memory) guide.\n\nThe [GitHub repo](https://github.com/redis/vercel-ai-sdk) includes two runnable demos, one for the automatic-memory model and one for tools. It's MIT-licensed, and we'd love your feedback and contributions. Tell us what you build.\n\n## Get started with Redis today\n\nSpeak to a Redis expert and learn more about enterprise-grade Redis today.", "url": "https://wpnews.pro/news/give-your-vercel-ai-sdk-agents-memory-with-redis-agent-memory", "canonical_source": "https://redis.io/blog/give-your-vercel-ai-sdk-agents-memory-with-redis-agent-memory/", "published_at": "2026-11-09 00:00:00+00:00", "updated_at": "2026-11-10 00:52:09.753051+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-infrastructure"], "entities": ["Redis", "Redis Agent Memory", "Redis Iris", "Vercel", "Vercel AI SDK", "@redis/vercel-ai-sdk", "Redis Cloud"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/give-your-vercel-ai-sdk-agents-memory-with-redis-agent-memory", "markdown": "https://wpnews.pro/news/give-your-vercel-ai-sdk-agents-memory-with-redis-agent-memory.md", "text": "https://wpnews.pro/news/give-your-vercel-ai-sdk-agents-memory-with-redis-agent-memory.txt", "jsonld": "https://wpnews.pro/news/give-your-vercel-ai-sdk-agents-memory-with-redis-agent-memory.jsonld"}}