Skip to content

Add Redis backend for persistent memory storage #5

@vgudur-dev

Description

@vgudur-dev

Description

Implement a Redis-backed MemoryStore that persists agent memory across restarts and enables distributed agent deployments.

Motivation

The current InMemoryStore is great for development and testing, but production deployments need persistent storage. Redis is the most common choice for fast key-value storage in production AI systems.

Proposed Implementation

Create src/agent_memory_guard/storage/redis_store.py with:

  1. RedisMemoryStore implementing the MemoryStore protocol
  2. Support for Redis connection pools and Sentinel
  3. Key namespacing for multi-tenant deployments
  4. TTL support for automatic memory expiration
  5. Atomic operations for concurrent agent access

Example API

from agent_memory_guard import MemoryGuard, Policy
from agent_memory_guard.storage.redis_store import RedisMemoryStore

store = RedisMemoryStore(url="redis://localhost:6379", namespace="agent-1")
guard = MemoryGuard(store=store, policy=Policy.strict())

Acceptance Criteria

  • Implements full MemoryStore protocol
  • Connection pooling and reconnection handling
  • Key namespacing for multi-agent isolation
  • Integration tests (can use fakeredis for CI)
  • Add redis optional dependency group to pyproject.toml
  • Performance benchmarks vs InMemoryStore

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions