Skip to content

Commit ac8fa48

Browse files
authored
docs: document selectable memory backends and managed setup (#18)
- Reconcile env var names to canonical REDIS_AGENT_MEMORY_* (with AGENT_MEMORY_* fallbacks) in 01_integration.md - Add managed Redis Agent Memory setup how-to and wire into nav/index - Fix stale 'Agent Memory Server only' framing in concepts/memory.md - Advertise public backend constants in llms.txt and config snippets - README: add managed_memory_quickstart to examples matrix and fix the 'all examples run via adk web' claim
1 parent 320ca15 commit ac8fa48

7 files changed

Lines changed: 158 additions & 20 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,14 @@ server requires them.
119119

120120
## Examples
121121

122-
All examples run via `adk web` and ship with a README and `.env.example`. See the [Examples index](https://redis-developer.github.io/adk-redis/examples/) for descriptions.
122+
Each example ships with a README and `.env.example`. Memory and session
123+
examples that register services through `get_service_registry()` run via
124+
`python main.py`; tools-only and search examples run via `adk web`. See each
125+
example's README and the [Examples index](https://redis-developer.github.io/adk-redis/examples/) for the runner and backend each uses.
123126

124127
| Category | Examples |
125128
|---|---|
126-
| **Memory and sessions** | [`simple_redis_memory`](examples/simple_redis_memory/) · [`travel_agent_memory_hybrid`](examples/travel_agent_memory_hybrid/) · [`travel_agent_memory_tools`](examples/travel_agent_memory_tools/) · [`fitness_coach_mcp`](examples/fitness_coach_mcp/) |
129+
| **Memory and sessions** | [`managed_memory_quickstart`](examples/managed_memory_quickstart/) · [`simple_redis_memory`](examples/simple_redis_memory/) · [`travel_agent_memory_hybrid`](examples/travel_agent_memory_hybrid/) · [`travel_agent_memory_tools`](examples/travel_agent_memory_tools/) · [`fitness_coach_mcp`](examples/fitness_coach_mcp/) |
127130
| **Search** | [`redis_search_tools`](examples/redis_search_tools/) · [`redis_sql_search`](examples/redis_sql_search/) · [`redisvl_mcp_search`](examples/redisvl_mcp_search/) |
128131
| **Caching** | [`semantic_cache`](examples/semantic_cache/) · [`langcache_cache`](examples/langcache_cache/) |
129132

docs/concepts/memory.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The LLM decides when to search, create, update, or delete memories.
1111
|---------|---------|
1212
| **Protocol** | MCP (via SSE or Streamable HTTP) or REST-based ADK tools |
1313
| **Control** | LLM-driven: the agent chooses when to remember and recall |
14-
| **Session storage** | Agent Memory Server working memory |
15-
| **Long-term memory** | Agent Memory Server with vector + full-text indexes |
14+
| **Session storage** | Redis Agent Memory or Agent Memory Server working memory |
15+
| **Long-term memory** | Redis Agent Memory or Agent Memory Server with vector + full-text indexes |
1616
| **Language support** | MCP works with Python, TypeScript, and any MCP-compatible client |
1717

1818
## How It Works
@@ -25,7 +25,7 @@ flowchart TD
2525
MCP -->|MCP| MCPS[McpToolset<br/>search · create · prompt]
2626
MCP -->|REST| REST[Memory Tools<br/>SearchMemoryTool · CreateMemoryTool]
2727
28-
MCPS --> AMS[Agent Memory Server]
28+
MCPS --> AMS["Redis Agent Memory<br/>or Agent Memory Server"]
2929
REST --> AMS
3030
3131
AMS --> WM[Working Memory]
@@ -45,6 +45,12 @@ flowchart TD
4545

4646
Unlike the [services approach](sessions.md), where the framework handles memory automatically, here the LLM explicitly calls memory tools during reasoning. This gives you fine-grained control over what gets stored and retrieved.
4747

48+
!!! note "MCP requires the self-hosted server"
49+
The SDK tools (Option 2) target either Redis Agent Memory
50+
(`redis-agent-memory`) or the self-hosted Agent Memory Server
51+
(`opensource-agent-memory`). The MCP path (Option 1) is provided only by the
52+
self-hosted Agent Memory Server; the managed backend has no MCP endpoint.
53+
4854
## Option 1: MCP Tools
4955

5056
Connect to the Agent Memory Server's MCP endpoint using ADK's `McpToolset`. This is the recommended approach for multi-language support and when the same memory server is shared across agents.
@@ -101,8 +107,10 @@ from adk_redis import (
101107
MemoryToolConfig,
102108
)
103109

110+
from adk_redis import REDIS_AGENT_MEMORY_BACKEND
111+
104112
config = MemoryToolConfig(
105-
backend="redis-agent-memory",
113+
backend=REDIS_AGENT_MEMORY_BACKEND, # alias for "redis-agent-memory"
106114
api_base_url="http://localhost:8000",
107115
api_key="...",
108116
store_id="...",
@@ -156,6 +164,11 @@ agent = Agent(
156164
| `distance_threshold` | `None` | Compatibility alias for search threshold |
157165
| `deduplicate` | `True` | Deduplicate when creating memories |
158166

167+
For `backend`, you can pass the `"redis-agent-memory"` /
168+
`"opensource-agent-memory"` strings directly, or import the typo-safe
169+
`REDIS_AGENT_MEMORY_BACKEND` / `OPENSOURCE_AGENT_MEMORY_BACKEND` constants (or
170+
the `MemoryBackendName` type) from `adk_redis`.
171+
159172
Launch with the [ADK web UI](https://google.github.io/adk-docs/runtime/) for interactive testing:
160173

161174
```bash

docs/llms.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ For task-oriented recipes, browse the
2626
## How-to guides
2727

2828
- [Redis setup](user_guide/how_to_guides/redis_setup.md): start Redis 8.4 locally or in Redis Cloud.
29+
- [Managed memory setup](user_guide/how_to_guides/managed_memory_setup.md): connect to the managed Redis Agent Memory backend.
2930
- [Memory server setup](user_guide/how_to_guides/memory_server_setup.md): run Agent Memory Server.
3031
- [Session service](user_guide/how_to_guides/session_service.md): wire `RedisWorkingMemorySessionService`.
3132
- [Memory service](user_guide/how_to_guides/memory_service.md): wire `RedisLongTermMemoryService`.
@@ -59,6 +60,9 @@ When generating code that uses adk-redis:
5960
(`RedisLongTermMemoryServiceConfig`, etc.) so options are explicit.
6061
- Set `backend="redis-agent-memory"` for Redis Agent Memory, or
6162
`backend="opensource-agent-memory"` for the open source self-hosted server.
63+
For typo-safety, import the `REDIS_AGENT_MEMORY_BACKEND` and
64+
`OPENSOURCE_AGENT_MEMORY_BACKEND` constants (or the `MemoryBackendName` type)
65+
from `adk_redis` instead of writing the strings inline.
6266
- For the RedisVL MCP path, use ADK's native `McpToolset` with the
6367
appropriate `*ConnectionParams` class. Set
6468
`tool_filter=["search-records"]` to suppress writes, or pass

docs/user_guide/01_integration.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ Provide Redis Agent Memory connection settings:
1212

1313
```bash
1414
export REDIS_MEMORY_BACKEND="redis-agent-memory"
15-
export AGENT_MEMORY_SERVER_URL="https://..."
16-
export AGENT_MEMORY_STORE_ID="..."
17-
export AGENT_MEMORY_API_KEY="..."
15+
export REDIS_AGENT_MEMORY_API_BASE_URL="https://..."
16+
export REDIS_AGENT_MEMORY_STORE_ID="..."
17+
export REDIS_AGENT_MEMORY_API_KEY="..."
1818
```
1919

20-
For the open source self-hosted Agent Memory Server, use
21-
`REDIS_MEMORY_BACKEND="opensource-agent-memory"` and point
22-
`AGENT_MEMORY_SERVER_URL` at your server.
20+
These are the same variable names used by the
21+
[managed memory quickstart](how_to_guides/managed_memory_setup.md) and the
22+
integration tests. For the open source self-hosted Agent Memory Server, use
23+
`REDIS_MEMORY_BACKEND="opensource-agent-memory"`, point
24+
`REDIS_AGENT_MEMORY_API_BASE_URL` at your server, and omit the API key and
25+
store ID unless your deployment requires them.
2326

2427
## 2. Install dependencies
2528

@@ -38,28 +41,33 @@ from google.adk.runners import Runner
3841
from google.adk.tools import load_memory
3942
from google.adk.tools import preload_memory
4043
from adk_redis import (
44+
REDIS_AGENT_MEMORY_BACKEND,
4145
RedisWorkingMemorySessionService,
4246
RedisWorkingMemorySessionServiceConfig,
4347
RedisLongTermMemoryService,
4448
RedisLongTermMemoryServiceConfig,
4549
)
4650

51+
# REDIS_AGENT_MEMORY_BACKEND and OPENSOURCE_AGENT_MEMORY_BACKEND are typo-safe
52+
# aliases for the "redis-agent-memory" and "opensource-agent-memory" strings.
53+
backend = os.getenv("REDIS_MEMORY_BACKEND", REDIS_AGENT_MEMORY_BACKEND)
54+
4755
session_service = RedisWorkingMemorySessionService(
4856
config=RedisWorkingMemorySessionServiceConfig(
49-
backend=os.getenv("REDIS_MEMORY_BACKEND", "redis-agent-memory"),
50-
api_base_url=os.environ["AGENT_MEMORY_SERVER_URL"],
51-
api_key=os.environ.get("AGENT_MEMORY_API_KEY"),
52-
store_id=os.environ.get("AGENT_MEMORY_STORE_ID"),
57+
backend=backend,
58+
api_base_url=os.environ["REDIS_AGENT_MEMORY_API_BASE_URL"],
59+
api_key=os.environ.get("REDIS_AGENT_MEMORY_API_KEY"),
60+
store_id=os.environ.get("REDIS_AGENT_MEMORY_STORE_ID"),
5361
default_namespace="my_app",
5462
)
5563
)
5664

5765
memory_service = RedisLongTermMemoryService(
5866
config=RedisLongTermMemoryServiceConfig(
59-
backend=os.getenv("REDIS_MEMORY_BACKEND", "redis-agent-memory"),
60-
api_base_url=os.environ["AGENT_MEMORY_SERVER_URL"],
61-
api_key=os.environ.get("AGENT_MEMORY_API_KEY"),
62-
store_id=os.environ.get("AGENT_MEMORY_STORE_ID"),
67+
backend=backend,
68+
api_base_url=os.environ["REDIS_AGENT_MEMORY_API_BASE_URL"],
69+
api_key=os.environ.get("REDIS_AGENT_MEMORY_API_KEY"),
70+
store_id=os.environ.get("REDIS_AGENT_MEMORY_STORE_ID"),
6371
default_namespace="my_app",
6472
)
6573
)

docs/user_guide/how_to_guides/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Task-oriented recipes for adk-redis.
1414

1515
Stand up a local Redis 8 instance for ADK agents.
1616

17+
- :material-cloud:{ .lg .middle } **[Managed memory setup](managed_memory_setup.md)**
18+
19+
---
20+
21+
Connect to the managed Redis Agent Memory backend (the library default).
22+
1723
- :material-server-network:{ .lg .middle } **[Memory server setup](memory_server_setup.md)**
1824

1925
---
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Managed Redis Agent Memory Setup
2+
3+
This guide covers the **managed** `redis-agent-memory` backend, which is the
4+
library default. For the self-hosted alternative, see
5+
[Agent Memory Server setup](memory_server_setup.md).
6+
7+
The managed backend is a hosted Redis Agent Memory data plane: there is no
8+
local Agent Memory Server, worker, or Docker setup to run. You connect to it
9+
with an API base URL, an API key, and a store ID.
10+
11+
## Credentials
12+
13+
The managed backend requires three values from your Redis Agent Memory
14+
deployment:
15+
16+
| Value | Config field | Environment variable |
17+
|-------|--------------|----------------------|
18+
| API base URL | `api_base_url` | `REDIS_AGENT_MEMORY_API_BASE_URL` |
19+
| API key | `api_key` | `REDIS_AGENT_MEMORY_API_KEY` |
20+
| Store ID | `store_id` | `REDIS_AGENT_MEMORY_STORE_ID` |
21+
22+
These are the same variable names used by the
23+
[managed memory quickstart example](https://github.com/redis-developer/adk-redis/tree/main/examples/managed_memory_quickstart)
24+
and the integration tests.
25+
26+
```bash
27+
export REDIS_MEMORY_BACKEND="redis-agent-memory"
28+
export REDIS_AGENT_MEMORY_API_BASE_URL="https://..."
29+
export REDIS_AGENT_MEMORY_API_KEY="..."
30+
export REDIS_AGENT_MEMORY_STORE_ID="..."
31+
```
32+
33+
## Wiring the services
34+
35+
```python
36+
import os
37+
38+
from adk_redis import (
39+
REDIS_AGENT_MEMORY_BACKEND,
40+
RedisLongTermMemoryService,
41+
RedisLongTermMemoryServiceConfig,
42+
RedisWorkingMemorySessionService,
43+
RedisWorkingMemorySessionServiceConfig,
44+
)
45+
46+
session_service = RedisWorkingMemorySessionService(
47+
config=RedisWorkingMemorySessionServiceConfig(
48+
backend=REDIS_AGENT_MEMORY_BACKEND,
49+
api_base_url=os.environ["REDIS_AGENT_MEMORY_API_BASE_URL"],
50+
api_key=os.environ["REDIS_AGENT_MEMORY_API_KEY"],
51+
store_id=os.environ["REDIS_AGENT_MEMORY_STORE_ID"],
52+
default_namespace="my_app",
53+
)
54+
)
55+
56+
memory_service = RedisLongTermMemoryService(
57+
config=RedisLongTermMemoryServiceConfig(
58+
backend=REDIS_AGENT_MEMORY_BACKEND,
59+
api_base_url=os.environ["REDIS_AGENT_MEMORY_API_BASE_URL"],
60+
api_key=os.environ["REDIS_AGENT_MEMORY_API_KEY"],
61+
store_id=os.environ["REDIS_AGENT_MEMORY_STORE_ID"],
62+
default_namespace="my_app",
63+
)
64+
)
65+
```
66+
67+
`REDIS_AGENT_MEMORY_BACKEND` is a typo-safe alias for the
68+
`"redis-agent-memory"` string. Either form works.
69+
70+
## Identifier constraints
71+
72+
The managed API accepts only alphanumeric characters and hyphens
73+
(`[A-Za-z0-9-]`) in identifier fields such as namespace, session ID, and actor
74+
ID, and caps session IDs at 64 characters. `adk-redis` adapts ADK identifiers
75+
to fit:
76+
77+
- Namespaces and authors are sanitized: unsupported characters (including `_`
78+
and `:`) are replaced with hyphens. For example, `my_app` becomes `my-app`.
79+
- ADK session IDs that exceed the limit or contain unsupported characters are
80+
hashed to a stable hex value that fits the 64-character cap.
81+
82+
This adaptation is automatic. You do not need to pre-sanitize identifiers, but
83+
be aware that two raw namespaces that differ only by an unsupported character
84+
(for example `my_app` and `my-app`) collapse to the same managed namespace.
85+
86+
## Differences from the self-hosted backend
87+
88+
The managed backend intentionally omits features that depend on a self-hosted
89+
Agent Memory Server:
90+
91+
- No auto-summarization, extraction strategies, or recency-boosted search.
92+
- No MCP endpoint. MCP memory tools require the
93+
[Agent Memory Server](memory_server_setup.md).
94+
95+
For a runnable minimal agent on the managed backend, see the
96+
[managed memory quickstart example](https://github.com/redis-developer/adk-redis/tree/main/examples/managed_memory_quickstart).
97+
98+
## Next steps
99+
100+
- [Session service](session_service.md) and [Memory service](memory_service.md)
101+
for full configuration options.
102+
- [Agent Memory Server setup](memory_server_setup.md) for the self-hosted
103+
backend with summarization, extraction, and MCP.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ nav:
172172
- How-To Guides:
173173
- user_guide/how_to_guides/index.md
174174
- Redis setup: user_guide/how_to_guides/redis_setup.md
175+
- Managed memory setup: user_guide/how_to_guides/managed_memory_setup.md
175176
- Memory server setup: user_guide/how_to_guides/memory_server_setup.md
176177
- Session service: user_guide/how_to_guides/session_service.md
177178
- Memory service: user_guide/how_to_guides/memory_service.md

0 commit comments

Comments
 (0)