|
| 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. |
0 commit comments