Redis Agent Memory

Store agent memory for AI applications in Redis.

What is Redis Agent Memory?

Redis Agent Memory is a memory service for AI applications. It stores ordered conversation events in session memory and durable information in long-term memory.

When enabled, automatic summarization compacts session memory by summarizing older events while retaining recent events in full. Redis Agent Memory extracts long-term memories automatically from session events.

Access Redis Agent Memory through the redis-iris Python SDK, the iris CLI, its REST API, or its MCP server. It works with any agent framework or LLM provider.

Overview

What's the same and what's different if you already know Redis

Learn more →
Read more
Quickstart

Make your first requests

Learn more →
Read more
Developer guide

Add memory to your application

Learn more →
Read more
Sessions

Store conversation events

Learn more →
Read more
Long-term memory

Recall information across conversations

Learn more →
Read more
Namespaces

Organize your memories

Learn more →
Read more
MCP

Connect an MCP client to a store

Learn more →
Read more

Why use Redis Agent Memory?

  • Context-aware conversations: Store ordered conversation events with their actor, role, timestamp, and metadata, then retrieve them by session ID. Configure session expiration to control how long the conversation is retained.
  • Automatic session summarization: Automatically summarize older conversation events while retaining recent messages in full.
  • Automatic long-term memory: Automatically extract durable information from session events in the background. You can also create long-term memories directly from external data.
  • Sensitive-data exclusions: Guide automatic extraction away from information that should not be kept in long-term memory.
  • Relevant retrieval: Search long-term memory semantically and narrow results with filters.
  • Multi-session recall: Retrieve relevant memories across conversations and filter results by owner, session, namespace, topic, or memory type.
  • Custom memory types: Define memory types for your business domain, with structured fields and instructions that control what Redis Agent Memory extracts.

Concepts

Redis Agent Memory provides two memory tiers. See the overview for how they relate to sessions, owners, and namespaces.

Session memory

Stores the ordered events and metadata for a conversation.

  • Configurable retention: Set a time-to-live (TTL) to control how long session events are retained.
  • Automatic summarization: Condense older events after a configured threshold while retaining recent events in full, reducing the conversation history sent to the model's context window.

Long-term memory

Stores durable information that can be retrieved across sessions using semantic search and filters.

  • Automatic extraction: Process session events asynchronously and store important information with vector embeddings and metadata.
  • Custom memory types: Define domain-specific memories with structured fields and extraction instructions.
  • Sensitive-data exclusions: Guide automatic extraction away from specified sensitive information.
  • Direct memory creation: Create memories through the API or import knowledge from external sources.
  • Configurable retention: Set a separate TTL for long-term memories.

Example: Travel planning agent

Consider a travel agent helping a user plan a trip:

User: I'm planning a trip to Japan next month and need help finding some restaurants for the trip.
Agent: Nice! What cities are you visiting?
User: I'm going to Tokyo and Kyoto. Also, I'm a vegetarian.
Agent: Good to know! I'll help you find some vegetarian-friendly restaurants in Tokyo and Kyoto.

Session memory

Stores an ordered sequence of events under a session ID, including each event's role, content, timestamps, and metadata. Before the next agent turn, the application can retrieve the session to reconstruct the conversation context.

Automatic session summarization

Summarizes older events after the configured threshold while retaining recent messages in full. The application can provide relevant conversation history to the agent without filling the model's context window with every original event.

Automatic long-term memory extraction

Extracts durable information in the background, such as "The user is vegetarian." Later sessions can retrieve it after the original session expires.

Custom memory types

Stores domain-specific information in a custom trip_preference type with fields such as destinations, travel_period, and dietary_requirements.

Quick example

  1. Set up an Agent Memory store:

  2. Install the Redis Iris Python package, which includes the iris CLI:

    pip install 'redis-iris>=1.0.0'
    
  3. With IRIS_AGENT_MEMORY_URL, IRIS_AGENT_MEMORY_STORE_ID, and IRIS_AGENT_MEMORY_API_KEY in your environment, record a conversation, then recall what Agent Memory extracted from it:

import time

from redis_iris.agent_memory import AgentMemory

OWNER_ID = "quickstart-user"
SESSION_ID = "travel-planning-session"

memory = AgentMemory.from_env()
health = memory.client.store_health()
print(health.status.value)
for name, feature in health.features.items():
    print(f"  {name}: {feature.status.value}")
set -euo pipefail
MEMORY_API="${IRIS_AGENT_MEMORY_URL%/}/iris/data/v1/agent-memory/stores/$IRIS_AGENT_MEMORY_STORE_ID"
OWNER_ID=quickstart-user
SESSION_ID=travel-planning-session
curl --fail-with-body --silent --show-error \
  "$MEMORY_API/health" \
  -H "Authorization: Bearer $IRIS_AGENT_MEMORY_API_KEY" | jq .
conversation = memory.conversation(owner=OWNER_ID, session_id=SESSION_ID)
saved = conversation.user(
    "I am visiting Tokyo and Kyoto next month. I am vegetarian and prefer spicy food."
)
print("Saved event", saved.event_id)
jq -n --arg owner "$OWNER_ID" --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg key "$(uuidgen)" '{
  actorId: $owner,
  role: "USER",
  content: [{text: "I am visiting Tokyo and Kyoto next month. I am vegetarian and prefer spicy food."}],
  createdAt: $now,
  idempotencyKey: $key
}' > event.json
curl --fail-with-body --silent --show-error \
  -X POST "$MEMORY_API/sessions/$SESSION_ID/events" \
  -H "Authorization: Bearer $IRIS_AGENT_MEMORY_API_KEY" \
  -H 'Content-Type: application/json' --data-binary @event.json | jq .
question = "What dietary requirements and food preferences does the user have?"
for _ in range(30):  # extraction runs in the background
    known = memory.recall(question, owner=OWNER_ID)
    if known:
        break
    time.sleep(10)
print(known.as_prompt())
jq -n --arg owner "$OWNER_ID" '{
  query: "What dietary requirements and food preferences does the user have?",
  filter: {ownerId: {eq: $owner}},
  limit: 5
}' > search.json
for _ in $(seq 30); do  # extraction runs in the background
  RESULTS=$(curl --fail-with-body --silent --show-error \
    -X POST "$MEMORY_API/memories/search" \
    -H "Authorization: Bearer $IRIS_AGENT_MEMORY_API_KEY" \
    -H 'Content-Type: application/json' --data-binary @search.json)
  [ "$(jq '.items | length' <<< "$RESULTS")" -gt 0 ] && break
  sleep 10
done
jq '.items[] | {memoryId, text, memoryType}' <<< "$RESULTS"
iris agent-memory memories search \
  "What dietary requirements and food preferences does the user have?" \
  --owner quickstart-user --prompt

Follow the quickstart to explore the same travel planning scenario in Python, the Iris CLI, or cURL.

Explore the documentation

  • Overview: Understand session memory, long-term memory, and namespaces.

  • Quickstart: Store a conversation and recall an extracted memory.

  • Developer guide: Put the pieces together in an application.

  • Sessions: Store conversation events and configure retention and summarization.

  • Long-term memory: Create and retrieve memories across conversations, including custom memory types.

  • MemoryETL: Extract memories from documents and inspect their source evidence.

  • Summary Views: Materialize text or structured summaries of long-term memories.

  • Ingestion webhooks: Review input and generated changes before they are saved.

  • Namespaces: Organize memories and manage namespace hierarchies.

  • MCP: Let an agent search and curate long-term memory through the store's MCP endpoint.

  • API reference: Look up request and response schemas.

For shared placement rules, see Namespace routing. To build a conversation list, see List and sort sessions.

RATE THIS PAGE
Back to top ↑