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_prompt hydration 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_KEY for NAT's OpenAI LLM and Redis Agent Memory extraction
  • REDIS_AGENT_MEMORY_URL
  • REDIS_AGENT_MEMORY_NAMESPACE
  • HOST_REDIS_PORT and HOST_REDIS_AGENT_MEMORY_PORT if the default local ports are already occupied
  • REDIS_STACK_IMAGE and AGENT_MEMORY_SERVER_IMAGE if 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-user
  • conversation_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=asyncio for a single-process local setup.