Redis Examples
June 30, 2026 ยท View on GitHub
Complexity: ๐จ Intermediate
These examples use the Redis memory backend from the Redis-maintained nemo-agent-toolkit-redis plugin.
Table of Contents
Key Features
- Redis Memory Backend Integration: Demonstrates how to integrate Redis as a memory backend for NeMo Agent Toolkit workflows, enabling persistent memory storage and retrieval across agent interactions.
- Chat Memory Management: Shows implementation of simple chat functionality with the ability to create, store, and recall memories using Redis as the underlying storage system.
- Embeddings-Based Memory Search: Uses embeddings models to create vector representations of queries and stored memories, implementing HNSW indexing with L2 distance metrics for efficient similarity search.
Prerequisites
Ensure that Docker is installed and the Docker service is running before proceeding.
- Install Docker: Follow the official installation guide for your platform: Docker Installation Guide
- Start Docker Service:
- Linux: Run
sudo systemctl start docker(ensure your user has permission to run Docker). - Mac & Windows: Docker Desktop should be running in the background.
- Linux: Run
- Verify Docker Installation: Run the following command to verify that Docker is installed and running correctly:
docker info
Installation and Setup
If you have not already done so, follow the instructions in the Install Guide to create the development environment and install NeMo Agent Toolkit.
To run this example, install the required dependencies by running the following command:
uv pip install -e .
This installs the external Redis plugin directly. The provider maintains and releases the plugin independently from NVIDIA NeMo Agent Toolkit.
Start Services
Run redis on localhost:6379 and Redis Insight on localhost:5540 with:
docker compose -f examples/deploy/docker-compose.redis.yml up
The examples are configured to use the Phoenix observability tool. Start phoenix on localhost:6006 with:
docker compose -f examples/deploy/docker-compose.phoenix.yml up
Run the Workflow
This example shows how to have a simple chat that uses a Redis memory backend for creating and retrieving memories.
An embeddings model is used to create embeddings for queries and for stored memories. Uses HNSW and L2 distance metric.
Set Up API Keys
If you have not already done so, follow the Obtaining API Keys instructions to obtain an NVIDIA API key. You need to set your NVIDIA API key as an environment variable to access NVIDIA AI services:
export NVIDIA_API_KEY=<YOUR_API_KEY>
Create Memory
Here we will add a memory for the workflow to use in following invocations. The memory tool will automatically determine the intent as to whether or not an input should be stored as a "fact" or if the input should be used to query the memory.
nat run --config_file=examples/memory/redis/configs/config.yml --input "my favorite flavor is strawberry"
Expected Workflow Output
<snipped for brevity>
Workflow Result:
['The user's favorite flavor has been stored as strawberry.']
Recall Memory
Once we have established something in the memory, we can use the workflow to give us a response based on its input.
nat run --config_file=examples/memory/redis/configs/config.yml --input "what flavor of ice-cream should I get?"
Expected Workflow Output
<snipped for brevity>
Workflow Result:
['You should get strawberry ice cream, as it is your favorite flavor.']