cd /news/ai-agents/give-your-vercel-ai-sdk-agents-memor… · home › topics › ai-agents › article
[ARTICLE · art-166632] src=redis.io ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Give your Vercel AI SDK agents memory with Redis Agent Memory

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.

by read4 min views1 publishedNov 9, 2026
Give your Vercel AI SDK agents memory with Redis Agent Memory
Image: Redis (auto-discovered)

Blog

We've released @redis/vercel-ai-sdkRedis Agent Memory to agents built with Vercel's AI SDK. Most 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.

What Redis Agent Memory does #

Redis Agent Memory, part of Redis 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.

You 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 and talk to it over HTTP. This package is the AI SDK layer on top.

The integration: two ways in #

Both 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.

| | Automatic-memory model | Memory tools |

|---|---|---|
| How you use it | memory.model({ scope }) as your request's model | memory.tools({ scope }) as tools | 

| Recall and history | Restored and injected before inference | The model chooses when to search or save | | Recording | Automatic, user messages and assistant steps | Model-selected, or optional lifecycle hooks | | Best for | Continuity with no extra prompting | Explicit, selective, model-directed memory |

Option 1: Memory without changing your agent #

The simplest path is automatic-memory. You configure the connection once, then wrap your model per request:

Before 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.

Option 2: Let the model manage its own memory #

If 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. Rule 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.

Built with production in mind #

Memory sits on the hot path of every request, so we kept it bounded and predictable:

  • Scoped by user and session. Memories are always tied to auserId , and session restore and recording need asessionId . Resolve both from an authenticated state.
  • 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.
  • Failures don't break replies. Memory errors surface through an optionalonDiagnostic callback and never replace a successful model response. Diagnostics never include prompt, memory, or credential text.
  • Recalled context is marked as untrusted and possibly stale , so the model treats it as a hint, not ground truth.
  • 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.

Get started #

The package is server-side and ESM-only, and requires Node.js 22+, AI SDK 7.x, and Zod 4.x.

Provision a store in Redis Cloud, then set AGENT_MEMORY_URL, AGENT_MEMORY_API_KEY and AGENT_MEMORY_STORE_ID in your server environment.

For a step-by-step walkthrough on how to use the library, check out the Build a Meal-Planning Agent with Redis Memory guide. The GitHub repo 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.

Get started with Redis today #

Speak to a Redis expert and learn more about enterprise-grade Redis today.

── more in #ai-agents 4 stories · sorted by recency
── more on @redis 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/give-your-vercel-ai-…] indexed:0 read:4min 2026-11-09 · —