Skip to content

Commit dfc79b5

Browse files
Merge pull request #3300 from redis/DOC-6447
RC/AI: Redis Agent Memory
2 parents a21965d + 7e3faa2 commit dfc79b5

60 files changed

Lines changed: 3985 additions & 38 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
alwaysopen: false
3+
categories:
4+
- docs
5+
- develop
6+
- ai
7+
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.
8+
hideListLinks: true
9+
linktitle: Context engine
10+
title: Context engine
11+
weight: 30
12+
---
13+
14+
Context engine includes four services:
15+
16+
- **[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.
17+
- **[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.
18+
- **[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.
19+
- **[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.
20+
21+
All four services are available on [Redis Cloud]({{< relref "/operate/rc/context-engine" >}}) using the REST API, with no database setup or management required.
22+
23+
## LangCache
24+
25+
[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.
26+
27+
**Key benefits:**
28+
29+
- **Lower LLM costs**: Reduces redundant API calls for semantically equivalent queries.
30+
- **Faster responses**: Serves cached answers in milliseconds instead of waiting for an LLM.
31+
- **Managed embeddings**: LangCache handles embedding generation automatically.
32+
- **Cache control**: Configure similarity thresholds, TTLs, and eviction policies.
33+
34+
LangCache works well for AI assistants, chatbots, RAG applications, AI agents, and centralized AI gateway services.
35+
36+
[Get started with LangCache]({{< relref "/develop/ai/context-engine/langcache" >}})
37+
38+
## Agent Memory
39+
40+
[Redis Agent Memory]({{< relref "/develop/ai/context-engine/agent-memory" >}}) gives AI agents a structured, persistent memory layer using a two-tier model:
41+
42+
- **Session memory** (short-term or working memory): Holds the current conversation state and session metadata, with configurable TTL-based expiration.
43+
- **Long-term memory**: Stores information extracted from past sessions, including user preferences and learned patterns, as text with vector embeddings for semantic retrieval.
44+
45+
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.
46+
47+
Agent Memory is available as a REST API and Python SDK.
48+
49+
[Get started with Redis Agent Memory]({{< relref "/develop/ai/context-engine/agent-memory" >}})
50+
51+
## Context Retriever
52+
53+
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.
54+
55+
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.
56+
57+
**Key benefits:**
58+
59+
- **Define once, reuse everywhere**: Business context is captured once and shared across all agents.
60+
- **Automatic tool generation**: Tools are generated from your data model, not hand-coded per agent.
61+
- **Controlled access**: Each agent requires a key, and access tags automatically filter what data each agent can see.
62+
- **Governed by design**: Agents can only use tools that have been explicitly defined, with no direct database access.
63+
64+
[Get started with Context Retriever]({{< relref "/develop/ai/context-engine/context-retriever" >}})
65+
66+
## Data integration
67+
68+
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.
69+
70+
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.
71+
72+
**Key benefits:**
73+
74+
- **Always-fresh data**: Changes in your source database propagate to Redis within seconds.
75+
- **No direct database access**: Agents query Redis, not your production databases.
76+
- **Minimal setup**: No infrastructure to manage. Redis Cloud handles the pipeline.
77+
- **Broad source support**: Works with Oracle, MySQL, PostgreSQL, MariaDB, SQL Server, and AWS Aurora.
78+
79+
[Get started with Data integration]({{< relref "/develop/ai/context-engine/data-integration" >}})
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
Title: Redis Agent Memory
3+
alwaysopen: false
4+
categories:
5+
- docs
6+
- develop
7+
- ai
8+
description: Store agent memory for AI applications in Redis.
9+
linkTitle: Agent Memory
10+
hideListLinks: true
11+
weight: 20
12+
bannerText: Redis Agent Memory is currently available in preview. Features and behavior are subject to change.
13+
bannerChildren: true
14+
---
15+
16+
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.
17+
18+
[Get started](#get-started) with Redis Agent Memory on Redis Cloud, join the private preview, or set up your own Redis Agent Memory instance.
19+
20+
## Redis Agent Memory overview
21+
22+
Redis Agent Memory uses a two-tier memory model:
23+
24+
- **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.
25+
- **Long-term memory** stores information extracted from past sessions, including user preferences, learned patterns, and other relevant data.
26+
27+
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.
28+
29+
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.
30+
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.
31+
32+
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.
33+
34+
### Example: Memory storage during a conversation
35+
36+
Take this conversation between a User and an AI Travel Agent as an example:
37+
38+
```text
39+
User: I'm planning a trip to Japan next month and need help finding some restaurants for the trip.
40+
Agent: Nice! What cities are you visiting?
41+
User: I'm going to Tokyo and Kyoto. Also, I'm a vegetarian.
42+
Agent: Good to know! I'll help you find some vegetarian-friendly restaurants in Tokyo and Kyoto.
43+
```
44+
45+
For this conversation, you could store the following information with Redis Agent Memory:
46+
- 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.
47+
- 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".
48+
49+
## Get started with Redis Agent Memory {#get-started}
50+
51+
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.
52+
53+
{{< multitabs id="agent-memory-get-started"
54+
tab1="Redis Cloud"
55+
tab2="Redis Software (private preview)"
56+
tab3="Open source" >}}
57+
58+
{{< embed-md "rc-agent-memory-get-started.md" >}}
59+
60+
-tab-sep-
61+
62+
Contact your Redis representative or [contact sales](https://redis.com/contact-sales/) to join the private preview on Redis Software.
63+
64+
-tab-sep-
65+
66+
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.
67+
68+
{{< /multitabs >}}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
alwaysopen: false
3+
categories:
4+
- docs
5+
- develop
6+
- ai
7+
description: Learn to use the Redis Agent Memory API for agent memory and semantic memory search.
8+
hideListLinks: true
9+
linktitle: API and SDK examples
10+
title: Use the Redis Agent Memory API and SDK
11+
weight: 10
12+
---
13+
14+
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.
15+
16+
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.
17+
18+
## Authentication
19+
20+
To access the Agent Memory API, you need:
21+
22+
- Agent Memory API endpoint
23+
- an Agent Memory API user key
24+
- a Store ID
25+
26+
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.
27+
28+
For example:
29+
30+
```sh
31+
curl -s -X GET "https://$HOST/v1/stores/$STORE_ID/session-memory" \
32+
-H "accept: application/json" \
33+
-H "Authorization: Bearer $API_KEY"
34+
```
35+
36+
This example expects several variables to be set in the shell:
37+
38+
- **$HOST** - the Agent Memory API endpoint
39+
- **$STORE_ID** - the Store ID of your Agent Memory service
40+
- **$API_KEY** - The Agent Memory API token
41+
42+
## Examples
43+
44+
### Add session event
45+
46+
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.
47+
48+
```json
49+
POST /v1/stores/{storeId}/session-memory/events
50+
{
51+
"sessionId": "abcd-efgh",
52+
"actorId": "user-name",
53+
"role": "USER",
54+
"content": [
55+
{
56+
"text": "I'm planning a trip to Japan next month."
57+
}
58+
],
59+
"createdAt": "2026-05-02T18:15:06Z",
60+
"metadata": {
61+
"browser": "Chrome",
62+
"source": "web-chat"
63+
}
64+
}
65+
```
66+
67+
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.
68+
69+
The Agent Memory model will automatically promote relevant short-term memories to long-term memory.
70+
71+
### Add Long-term memories
72+
73+
You may want to add one or more long-term memories to add specific preference information.
74+
75+
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.
76+
77+
```json
78+
POST /v1/stores/{storeId}/long-term-memory
79+
{
80+
"memories": [
81+
{
82+
"id": "cofIXpuMmg",
83+
"text": "The user prefers vegetarian food.",
84+
"memoryType": "episodic",
85+
"sessionId": "abcd-efgh",
86+
"ownerId": "user-name",
87+
}
88+
]
89+
}
90+
```
91+
92+
### Search Long-term memories
93+
94+
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.
95+
96+
```json
97+
POST /v1/stores/{storeId}/long-term-memory/search
98+
{
99+
"text": "user preferences",
100+
"similarityThreshold": 0.48725898820184166,
101+
"filter": {
102+
"sessionId": {
103+
"eq": "abcd-efgh"
104+
},
105+
"ownerId": {
106+
"in": [
107+
"user1",
108+
"user2"
109+
]
110+
}
111+
},
112+
"filterOp": "any"
113+
}
114+
```
115+
116+
In the `filter` object of the request body, you can filter the search by any of the following values:
117+
118+
| Filter | Data type | Definition | Supported operators |
119+
|--------|----------|------------|---------------------|
120+
| `sessionId` | string | The session ID the memory comes from. | `eq`, `ne`, `in`, `all` |
121+
| `ownerId` | string | The owner ID of the memory. | `eq`, `ne`, `in`, `all` |
122+
| `namespace` | string | The namespace of the memory. | `eq`, `ne`, `in`, `all` |
123+
| `topics` | string | The topics of the memory. | `eq`, `ne`, `in`, `all` |
124+
| `memoryType` | string | The type of memory (`semantic`, `episodic`, `message`). | `eq`, `ne`, `in`, `all` |
125+
| `createdAt` | string (ISO 8601) | The timestamp when the memory was created. | `eq`, `gt`, `lt`, `gte`, `lte` |
126+
127+
For all values, you must set only one of these operators:
128+
129+
| Operator | Definition |
130+
|----------|---------------------|
131+
| `eq` | Returns memories with the value equal to the provided value. |
132+
| `ne` | Returns memories where the value is not the provided value. |
133+
| `in` | Returns memories where the value is one of a list of provided values. |
134+
| `all` | Returns memories where the value matches all of the provided values. |
135+
| `gt` | Returns memories where the value is greater than the provided value. |
136+
| `lt` | Returns memories where the value is less than the provided value. |
137+
| `gte` | Returns memories where the value is greater than or equal to the provided value. |
138+
| `lte` | Returns memories where the value is less than or equal to the provided value. |
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
Title: LangCache REST API
3+
linkTitle: API reference
4+
layout: apireference
5+
type: page
6+
params:
7+
sourcefile: ./openapi-agent-memory.json
8+
sortOperationsAlphabetically: false
9+
---

0 commit comments

Comments
 (0)