Redis Agent Memory Native Wrapper Example
July 6, 2026 ยท View on GitHub
This example uses the native Redis Agent Memory workflow:
_type: redis_agent_memory_auto_memory. It wraps a chat function and lets Redis
Agent Memory manage:
- session-scoped working memory
memory_prompthydration before each turn- turn appends back into working memory
- background promotion into long-term memory
Install
The inner agent in this example is NAT's chat_completion function, so the
base plugin install is enough:
pip install "nemo-agent-toolkit-redis"
For local development from this repository:
uv sync --group dev --extra test
Configure
cp examples/agent_auto_memory/.env.example examples/agent_auto_memory/.env
The example expects:
OPENAI_API_KEYfor NAT's OpenAI LLM and Redis Agent Memory extractionREDIS_AGENT_MEMORY_URLREDIS_AGENT_MEMORY_NAMESPACEHOST_REDIS_PORTandHOST_REDIS_AGENT_MEMORY_PORTif the default local ports are already occupiedREDIS_STACK_IMAGEandAGENT_MEMORY_SERVER_IMAGEif you need to override the tested image tags
Start Services
Compose starts Redis Stack and Redis Agent Memory containers for local development. Both
ports bind to 127.0.0.1, and Agent Memory auth is disabled.
docker compose \
--env-file examples/agent_auto_memory/.env \
-f examples/agent_auto_memory/compose.yml \
up -d
Validate And Run
uv run nat validate --config_file examples/agent_auto_memory/configs/config.yml
uv run python examples/agent_auto_memory/run_agent.py
The runner loads examples/agent_auto_memory/.env automatically.
By default it uses:
user_id=demo-userconversation_id=demo-session
That stable conversation_id is what the wrapper maps to Redis Agent Memory
session_id.
Example custom run:
uv run python examples/agent_auto_memory/run_agent.py \
--user-id alice \
--conversation-id alice-session \
--input "Remember that I prefer concise answers." \
--input "How should you answer me?"
Stop Services
docker compose \
--env-file examples/agent_auto_memory/.env \
-f examples/agent_auto_memory/compose.yml \
down -v
Notes
- The memory backend config still uses
_type: redis_agent_memory_backend; that is the long-term memory surface shared by both examples. - The workflow wrapper is the differentiated path when you want automatic prompt hydration and working-memory continuity on every turn.
- The Compose file runs Redis Stack plus
agent-memory api --task-backend=asynciofor a single-process local setup.