Redis Storage
For common Agent integration, extraction modes, and tool configuration, see Usage and Configuration.
Use case: Production, high concurrency, distributed deployment
Configuration options:
WithRedisClientURL(url): Redis connection URL (recommended)WithRedisInstance(name): Use pre-registered Redis instanceWithMemoryLimit(limit): Memory limit per userWithKeyPrefix(prefix): Set a prefix for all Redis keys. When set, every key is prefixed withprefix:. For example, ifprefixis"myapp", the keymem:{app:user}becomesmyapp:mem:{app:user}. Default is empty (no prefix). This is useful for sharing a single Redis instance across multiple environments or servicesWithCustomTool(toolName, creator): Register custom toolWithToolEnabled(toolName, enabled): Enable/disable toolWithExtraOptions(...options): Extra options passed to Redis client
Note: WithRedisClientURL takes priority over WithRedisInstance
Redis ACL requirement: The default per-user memory limit is 1000. When the
configured limit is positive, AddMemory uses a server-side Lua script to
atomically check the capacity and write the memory. This script calls
HEXISTS, HLEN, and HSET. UpdateMemory always uses a Lua script to
atomically validate and rotate memory IDs; its update path uses HGET, and its
script calls HEXISTS, HSET, and HDEL.
ACL users must be allowed to run EVALSHA and EVAL (EVAL is required when
a script is not yet cached), the commands used by both scripts, and access the
configured memory-key pattern. Do not remove EVAL after warm-up because the
Redis script cache can be cleared by a restart or SCRIPT FLUSH. Redis-compatible
backends must support server-side Lua for these scripted paths.
WithMemoryLimit(0) keeps AddMemory on the direct HSET path without a
scripting dependency. UpdateMemory still uses Lua.
Key prefix example: