-
Notifications
You must be signed in to change notification settings - Fork 335
RC/AI: Redis Agent Memory #3300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
688b3f8
108582c
335576c
7ad9906
1552778
ed69422
6df35a3
6db28fa
b3789da
362164e
605ab98
e50727b
bc39496
f32e3ab
c94b578
7d00849
4a595fa
8a5ed39
7e3faa2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| --- | ||
| alwaysopen: false | ||
| categories: | ||
| - docs | ||
| - develop | ||
| - ai | ||
| description: Redis Iris is a suite of fully-managed services that give AI agents the context engine they need to reliably act on business data. | ||
| hideListLinks: true | ||
| linktitle: Context engine | ||
| title: Context engine | ||
| weight: 30 | ||
| --- | ||
|
|
||
| Context engine includes four services: | ||
|
|
||
| - **[LangCache]({{< relref "/develop/ai/context-engine/langcache" >}})**: A semantic caching service that stores and reuses LLM responses for similar queries, reducing API costs and improving response latency. | ||
| - **[Agent Memory]({{< relref "/develop/ai/context-engine/agent-memory" >}})**: A persistent memory service that maintains short-term session memory and long-term memory across agent interactions. | ||
| - **[Context Retriever]({{< relref "/develop/ai/context-engine/context-retriever" >}})**: Turns your business data into structured tools that AI agents can safely and reliably use, defined once and reused across all agents. | ||
| - **[Data integration]({{< relref "/develop/ai/context-engine/data-integration" >}})**: Syncs live data from your existing relational databases into Redis Cloud so agents always have access to fresh, accurate business data. | ||
|
|
||
| All four services are available on [Redis Cloud]({{< relref "/operate/rc/context-engine" >}}) using the REST API, with no database setup or management required. | ||
|
|
||
| ## LangCache | ||
|
|
||
| [LangCache]({{< relref "/develop/ai/context-engine/langcache" >}}) uses semantic similarity to match incoming prompts against previously cached LLM responses. When LangCache finds a semantically similar response in the cache, it returns that response immediately without making an LLM call. | ||
|
|
||
| **Key benefits:** | ||
|
|
||
| - **Lower LLM costs**: Reduces redundant API calls for semantically equivalent queries. | ||
| - **Faster responses**: Serves cached answers in milliseconds instead of waiting for an LLM. | ||
| - **Managed embeddings**: LangCache handles embedding generation automatically. | ||
| - **Cache control**: Configure similarity thresholds, TTLs, and eviction policies. | ||
|
|
||
| LangCache works well for AI assistants, chatbots, RAG applications, AI agents, and centralized AI gateway services. | ||
|
|
||
| [Get started with LangCache]({{< relref "/develop/ai/context-engine/langcache" >}}) | ||
|
|
||
| ## Agent Memory | ||
|
|
||
| [Redis Agent Memory]({{< relref "/develop/ai/context-engine/agent-memory" >}}) gives AI agents a structured, persistent memory layer using a two-tier model: | ||
|
|
||
| - **Session memory** (short-term or working memory): Holds the current conversation state and session metadata, with configurable TTL-based expiration. | ||
| - **Long-term memory**: Stores information extracted from past sessions, including user preferences and learned patterns, as text with vector embeddings for semantic retrieval. | ||
|
|
||
| Promotion from session memory to long-term memory is automatic and non-blocking. As a conversation progresses, the service asynchronously extracts and stores important information in the background, keeping agent interactions responsive. You can also create long-term memories directly using the API for bulk imports or external knowledge sources. | ||
|
|
||
| Agent Memory is available as a REST API and Python SDK. | ||
|
|
||
| [Get started with Redis Agent Memory]({{< relref "/develop/ai/context-engine/agent-memory" >}}) | ||
|
|
||
| ## Context Retriever | ||
|
|
||
| Agents don't fail because they lack data. They fail because they don't know how to use it. Context Retriever turns your raw business data into structured tools that agents can reliably act on, without requiring each project to rediscover how your data works. | ||
|
|
||
| You define your data model once, specifying the entities that matter (such as customers or orders) and the fields agents need. Context Retriever automatically generates the tools agents use to query and work with that data. Agents never access your database directly. They call the generated tools, and the system handles the rest. | ||
|
|
||
| **Key benefits:** | ||
|
|
||
| - **Define once, reuse everywhere**: Business context is captured once and shared across all agents. | ||
| - **Automatic tool generation**: Tools are generated from your data model, not hand-coded per agent. | ||
| - **Controlled access**: Each agent requires a key, and access tags automatically filter what data each agent can see. | ||
| - **Governed by design**: Agents can only use tools that have been explicitly defined, with no direct database access. | ||
|
|
||
| [Get started with Context Retriever]({{< relref "/develop/ai/context-engine/context-retriever" >}}) | ||
|
|
||
| ## Data integration | ||
|
|
||
| AI agents are only as reliable as the data they work with. [Redis Data Integration (RDI)]({{< relref "/operate/rc/databases/rdi" >}}) keeps your Redis Cloud database in sync with your existing relational databases, including Oracle, MySQL, PostgreSQL, and SQL Server, so agents always have access to current, accurate business data without querying slow primary databases directly. | ||
|
|
||
| RDI uses a data pipeline that performs an initial sync of your source data into Redis, then captures changes in real time. Updates from your primary database appear in Redis within seconds, eliminating stale data and cache misses. Your agents interact only with Redis, which provides fast and predictable query performance. | ||
|
|
||
| **Key benefits:** | ||
|
|
||
| - **Always-fresh data**: Changes in your source database propagate to Redis within seconds. | ||
| - **No direct database access**: Agents query Redis, not your production databases. | ||
| - **Minimal setup**: No infrastructure to manage. Redis Cloud handles the pipeline. | ||
| - **Broad source support**: Works with Oracle, MySQL, PostgreSQL, MariaDB, SQL Server, and AWS Aurora. | ||
|
|
||
| [Get started with Data integration]({{< relref "/develop/ai/context-engine/data-integration" >}}) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| Title: Redis Agent Memory | ||
| alwaysopen: false | ||
| categories: | ||
| - docs | ||
| - develop | ||
| - ai | ||
| description: Store agent memory for AI applications in Redis. | ||
| linkTitle: Agent Memory | ||
| hideListLinks: true | ||
| weight: 20 | ||
| bannerText: Redis Agent Memory is currently available in preview. Features and behavior are subject to change. | ||
| bannerChildren: true | ||
| --- | ||
|
|
||
| Redis Agent Memory is a memory service for AI Agents available as a REST API and client libraries. It provides the persistent, structured memory layer that intelligent agents need to store, retrieve, and manage contextual data across interactions. Rather than requiring developers to build custom memory infrastructure from scratch, Redis Agent Memory offers a turnkey solution with dedicated endpoints, secure API key management, configurable memory schemas, and automatic TTL-based lifecycle management. | ||
|
|
||
| [Get started](#get-started) with Redis Agent Memory on Redis Cloud, join the private preview, or set up your own Redis Agent Memory instance. | ||
|
|
||
| ## Redis Agent Memory overview | ||
|
|
||
| Redis Agent Memory uses a two-tier memory model: | ||
|
|
||
| - **Session memory** (also known as **Short-term memory** or **Working memory**) maintains the current conversation state, session history, and session-specific metadata. You can set a custom time-to-live (TTL) for session memory to control how long session data is retained. | ||
| - **Long-term memory** stores information extracted from past sessions, including user preferences, learned patterns, and other relevant data. | ||
|
|
||
| The promotion from short term memory to long-term memory is automatic. When you store a conversation event in session memory, the Agent Memory Server asynchronously extracts important information using the configured extraction strategy (discrete, summary, preferences, or custom). These extracted memories are then stored as long-term memory entries with vector embeddings and metadata. | ||
|
|
||
| This process is non-blocking: the extraction and promotion happen in the background using a task worker, so the main agent interaction remains responsive. Users do not need to explicitly trigger promotion; it happens as a natural byproduct of storing conversation events in working memory. | ||
| Users can also create long-term memories directly using the API. This is useful for bulk memory creation or for importing knowledge from external sources. | ||
|
|
||
| The short-term memory that is not promoted will eventually expire based on its TTL configuration. As a conversation progresses, Redis Agent Memory extracts and asynchronously stores important information into long-term memory. This process ensures responsive interactions while knowledge gradually accumulates. | ||
|
|
||
| ### Example: Memory storage during a conversation | ||
|
|
||
| Take this conversation between a User and an AI Travel Agent as an example: | ||
|
|
||
| ```text | ||
| 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. | ||
| ``` | ||
|
|
||
| For this conversation, you could store the following information with Redis Agent Memory: | ||
| - Session Memory: The current conversation state, including the user's query, the agent's response, and the user's follow-up question. The session memory also stores session-specific metadata. | ||
| - Long-term memory: Preference and location information from the conversation, stored as text and as vector embeddings for semantic retrieval. In this case, long-term memory might store "The user is a vegetarian" and "The user is planning a trip to Japan". | ||
|
|
||
| ## Get started with Redis Agent Memory {#get-started} | ||
|
|
||
| Get started with Redis Agent Memory on Redis Cloud, join the private preview for Redis Software, or set up your own open-source Redis Agent Memory instance. | ||
|
|
||
| {{< multitabs id="agent-memory-get-started" | ||
| tab1="Redis Cloud" | ||
| tab2="Redis Software (private preview)" | ||
| tab3="Open source" >}} | ||
|
|
||
| {{< embed-md "rc-agent-memory-get-started.md" >}} | ||
|
|
||
| -tab-sep- | ||
|
|
||
| Contact your Redis representative or [contact sales](https://redis.com/contact-sales/) to join the private preview on Redis Software. | ||
|
|
||
| -tab-sep- | ||
|
|
||
| The open-source version of Redis Agent Memory is [available on GitHub](https://github.com/redis/agent-memory-server). See [Redis Agent Memory server](https://redis.github.io/agent-memory-server/) for comprehensive docs, quick start guides, and API references. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This OSS version of Redis Agent Memory has several differences with the cloud one, and its API is different, so I would double-check again with @Jenverse if we want to promote it here. |
||
|
|
||
| {{< /multitabs >}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| --- | ||
| alwaysopen: false | ||
| categories: | ||
| - docs | ||
| - develop | ||
| - ai | ||
| description: Learn to use the Redis Agent Memory API for agent memory and semantic memory search. | ||
| hideListLinks: true | ||
| linktitle: API and SDK examples | ||
| title: Use the Redis Agent Memory API and SDK | ||
| weight: 10 | ||
| --- | ||
|
|
||
| Use the [Agent Memory API]({{< relref "/develop/ai/context-engine/agent-memory/api-reference" >}}) from your client app to store and retrieve agent memory information. | ||
|
|
||
| You can use any standard REST client or library to access the API. If your app is written in Python, you can also use the [Agent Memory Software Development Kit](https://pypi.org/project/redis-agent-memory/) (SDK) to access the API. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| ## Authentication | ||
|
|
||
| To access the Agent Memory API, you need: | ||
|
|
||
| - Agent Memory API endpoint | ||
| - an Agent Memory API user key | ||
| - a Store ID | ||
|
|
||
| When you call the API, you need to pass the Agent Memory API key in the `Authorization` header as a Bearer token and the store ID as the `storeId` path parameter. | ||
|
|
||
| For example: | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One question from devrel team was if you plan to include a drop-down menu to show programming-language examples, in addition to REST API calls? Just like we have with LangCache? In case of RAM, the Python SDK client?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's possible to have that, but I haven't had time and I figured I would prioritize getting something out rather than getting something perfect out. I can add that after release (or after I have something for context retriever). |
||
| ```sh | ||
| curl -s -X GET "https://$HOST/v1/stores/$STORE_ID/session-memory" \ | ||
| -H "accept: application/json" \ | ||
| -H "Authorization: Bearer $API_KEY" | ||
| ``` | ||
|
|
||
| This example expects several variables to be set in the shell: | ||
|
|
||
| - **$HOST** - the Agent Memory API endpoint | ||
| - **$STORE_ID** - the Store ID of your Agent Memory service | ||
| - **$API_KEY** - The Agent Memory API token | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Add session event | ||
|
|
||
| Use [`POST /v1/stores/{storeId}/session-memory/events`]({{< relref "/develop/ai/context-engine/agent-memory/api-reference#tag/session-memory/operation/AddSessionEvent" >}}) to add an event to a session in short-term memory. If a session doesn't exist yet, it will be created. | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something Ricardo noticed: It uses cache_id instead of store_id. And the REST API example does the same. curl -s -X GET "https://$HOST/v1/caches/$CACHE_ID/session-memory/" It may be worth double-checking with the API Spec from Agent Memory. |
||
| ```json | ||
| POST /v1/stores/{storeId}/session-memory/events | ||
| { | ||
| "sessionId": "abcd-efgh", | ||
| "actorId": "user-name", | ||
| "role": "USER", | ||
| "content": [ | ||
| { | ||
| "text": "I'm planning a trip to Japan next month." | ||
| } | ||
| ], | ||
| "createdAt": "2026-05-02T18:15:06Z", | ||
| "metadata": { | ||
| "browser": "Chrome", | ||
| "source": "web-chat" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Use this endpoint to store conversations between your users and your AI agent. You can use the `metadata` object to store additional metadata for your application. | ||
|
|
||
| The Agent Memory model will automatically promote relevant short-term memories to long-term memory. | ||
|
|
||
| ### Add Long-term memories | ||
|
|
||
| You may want to add one or more long-term memories to add specific preference information. | ||
|
|
||
| Use [`POST /v1/stores/{storeId}/long-term-memory/`]({{< relref "/develop/ai/context-engine/agent-memory/api-reference#tag/long-term-memory/operation/BulkCreateLongTermMemories" >}}) to add one or more long-term memories to long-term memory storage. | ||
|
|
||
| ```json | ||
| POST /v1/stores/{storeId}/long-term-memory | ||
| { | ||
| "memories": [ | ||
| { | ||
| "id": "cofIXpuMmg", | ||
| "text": "The user prefers vegetarian food.", | ||
| "memoryType": "episodic", | ||
| "sessionId": "abcd-efgh", | ||
| "ownerId": "user-name", | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ### Search Long-term memories | ||
|
|
||
| Use [`POST /v1/stores/{storeId}/long-term-memory/search`]({{< relref "/develop/ai/context-engine/agent-memory/api-reference#tag/long-term-memory/operation/SearchLongTermMemory" >}}) to search for long-term memories. | ||
|
|
||
| ```json | ||
| POST /v1/stores/{storeId}/long-term-memory/search | ||
| { | ||
| "text": "user preferences", | ||
| "similarityThreshold": 0.48725898820184166, | ||
| "filter": { | ||
| "sessionId": { | ||
| "eq": "abcd-efgh" | ||
| }, | ||
| "ownerId": { | ||
| "in": [ | ||
| "user1", | ||
| "user2" | ||
| ] | ||
| } | ||
| }, | ||
| "filterOp": "any" | ||
| } | ||
| ``` | ||
|
|
||
| In the `filter` object of the request body, you can filter the search by any of the following values: | ||
|
|
||
| | Filter | Data type | Definition | Supported operators | | ||
| |--------|----------|------------|---------------------| | ||
| | `sessionId` | string | The session ID the memory comes from. | `eq`, `ne`, `in`, `all` | | ||
| | `ownerId` | string | The owner ID of the memory. | `eq`, `ne`, `in`, `all` | | ||
| | `namespace` | string | The namespace of the memory. | `eq`, `ne`, `in`, `all` | | ||
| | `topics` | string | The topics of the memory. | `eq`, `ne`, `in`, `all` | | ||
| | `memoryType` | string | The type of memory (`semantic`, `episodic`, `message`). | `eq`, `ne`, `in`, `all` | | ||
| | `createdAt` | string (ISO 8601) | The timestamp when the memory was created. | `eq`, `gt`, `lt`, `gte`, `lte` | | ||
|
|
||
| For all values, you must set only one of these operators: | ||
|
|
||
| | Operator | Definition | | ||
| |----------|---------------------| | ||
| | `eq` | Returns memories with the value equal to the provided value. | | ||
| | `ne` | Returns memories where the value is not the provided value. | | ||
| | `in` | Returns memories where the value is one of a list of provided values. | | ||
| | `all` | Returns memories where the value matches all of the provided values. | | ||
| | `gt` | Returns memories where the value is greater than the provided value. | | ||
| | `lt` | Returns memories where the value is less than the provided value. | | ||
| | `gte` | Returns memories where the value is greater than or equal to the provided value. | | ||
| | `lte` | Returns memories where the value is less than or equal to the provided value. | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| Title: LangCache REST API | ||
| linkTitle: API reference | ||
| layout: apireference | ||
| type: page | ||
| params: | ||
| sourcefile: ./openapi-agent-memory.json | ||
| sortOperationsAlphabetically: false | ||
| --- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the configured extraction strategy (discrete, summary, preferences, or custom)-> Note here that currently we only support a single extraction strategy that we callinstructinternally, but I am thinking we don't even want to specify any strategy names in the docs. Best to confirm with @JenverseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.