crewai - ✅(Solved) Fix [FEATURE] Add Valkey as a storage backend for the unified memory system [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#5578Fetched 2026-04-22 07:50:38
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1labeled ×1

Fix Action

Fixed

PR fix notes

PR #3: adds Valkey Storage Implementation

Description (problem / solution / changelog)

Adds Valkey as a storage backend for CrewAI's unified memory system, using the valkey-glide client. Valkey is a high-performance, Redis-compatible key-value store that provides a distributed, production-ready alternative to the existing LanceDB and Qdrant storage options.

What's included ValkeyStorage (valkey_storage.py) — full StorageBackend implementation:

CRUD operations (save, get, update, delete) with both sync and async APIs Server-side vector search via Valkey Search module (FT.SEARCH with KNN) Scope-based record organization with hierarchical scope queries Category indexing and filtering Metadata filtering with AND logic Pagination support (limit/offset) for list_records Scope introspection (get_scope_info, list_scopes, list_categories, count) Bulk delete with scope, category, metadata, and age-based filters Connection retry with exponential backoff for transient errors Lazy client initialization and async context manager support reset for clearing all or scoped records ValkeyCache (valkey_cache.py) — lightweight cache interface:

get/set/delete/exists with optional TTL JSON serialization for complex values Connection timeout handling Used by A2A agent card caching and file upload caching as an alternative to Redis Integration points:

unified_memory.py — wired as a storage backend option encoding_flow.py — encoding flow support for Valkey storage memory_tools.py — memory tool descriptions updated with clearer parameter docs upload_cache.py — added ValkeyCache as a cache backend option (alongside memory/Redis) agent_card.py / task.py — added VALKEY_URL environment variable support for aiocache configuration, with priority over REDIS_URL Optional dependency:

Added valkey = ["valkey-glide>=1.3.0"] to [project.optional-dependencies] in pyproject.toml Install with pip install crewai[valkey] Tests ~5,300 lines of tests across 5 test files covering:

Core CRUD and index operations (test_valkey_storage.py) Vector search with filters, scoring, pagination (test_valkey_storage_search.py) Scope operations, listing, categories, count, reset (test_valkey_storage_scope.py) Error handling, retry, serialization/deserialization (test_valkey_storage_errors.py) Cache operations with TTL (test_valkey_cache.py) All tests use mocked Valkey clients — no running Valkey instance required.

fixes https://github.com/crewAIInc/crewAI/issues/5578

Changed files

  • lib/crewai-files/src/crewai_files/cache/upload_cache.py (modified, +209/-29)
  • lib/crewai/pyproject.toml (modified, +3/-0)
  • lib/crewai/src/crewai/a2a/utils/agent_card.py (modified, +59/-2)
  • lib/crewai/src/crewai/a2a/utils/task.py (modified, +61/-19)
  • lib/crewai/src/crewai/memory/encoding_flow.py (modified, +26/-1)
  • lib/crewai/src/crewai/memory/storage/valkey_cache.py (added, +183/-0)
  • lib/crewai/src/crewai/memory/storage/valkey_storage.py (added, +1912/-0)
  • lib/crewai/src/crewai/memory/types.py (modified, +41/-2)
  • lib/crewai/src/crewai/memory/unified_memory.py (modified, +40/-3)
  • lib/crewai/src/crewai/tools/memory_tools.py (modified, +39/-9)
  • lib/crewai/src/crewai/translations/en.json (modified, +2/-2)
  • lib/crewai/tests/memory/storage/test_valkey_cache.py (added, +499/-0)
  • lib/crewai/tests/memory/storage/test_valkey_storage.py (added, +3170/-0)
  • lib/crewai/tests/memory/storage/test_valkey_storage_errors.py (added, +344/-0)
  • lib/crewai/tests/memory/storage/test_valkey_storage_scope.py (added, +1109/-0)
  • lib/crewai/tests/memory/storage/test_valkey_storage_search.py (added, +1175/-0)
  • uv.lock (modified, +68/-66)
RAW_BUFFERClick to expand / collapse

Feature Area

Core functionality

Is your feature request related to a an existing bug? Please link it here.

CrewAI's memory system currently supports LanceDB (embedded) and Qdrant for storage. For production deployments that need a distributed, low-latency key-value store with vector search capabilities, there's no built-in option. Users who want to run CrewAI in distributed or containerized environments need a storage backend that supports shared state across processes without relying on embedded databases or local file systems.

Additionally, the caching layer for A2A agent cards and file uploads currently only supports in-memory or Redis backends. There's no option for Valkey, which is the open-source, community-driven successor to Redis.

Describe the solution you'd like

Add Valkey as a first-class storage backend for CrewAI's unified memory system using the valkey-glide client. This should include:

  • A ValkeyStorage class implementing the StorageBackend protocol with full CRUD, vector search (via Valkey Search module), scope management, category indexing, and metadata filtering
  • A ValkeyCache class for simple key-value caching with TTL support, usable by A2A and file upload subsystems
  • VALKEY_URL environment variable support for configuring cache backends across the framework
  • An optional dependency group (pip install crewai[valkey]) so the core package stays lightweight

Describe alternatives you've considered

  • Redis: Valkey is wire-compatible with Redis but is fully open-source (BSD license) without the dual-licensing concerns introduced by Redis Ltd. in 2024. The valkey-glide client is maintained by the Valkey community and AWS.
  • Qdrant: Already supported, but requires a separate vector database service. Valkey can serve as both the key-value store and vector search engine in a single service.
  • LanceDB: The current default, but it's embedded and doesn't support distributed access across multiple processes or containers.

Additional context

Valkey is a Linux Foundation project forked from Redis 7.2. It supports the Redis Search module for server-side vector similarity search (KNN with cosine distance), making it suitable for both caching and memory storage in a single deployment.

Willingness to Contribute

Yes, I'd be happy to submit a pull request

extent analysis

TL;DR

Add Valkey as a storage backend for CrewAI's unified memory system by implementing the ValkeyStorage and ValkeyCache classes.

Guidance

  • Implement the ValkeyStorage class to support full CRUD, vector search, scope management, category indexing, and metadata filtering using the valkey-glide client.
  • Create a ValkeyCache class for simple key-value caching with TTL support, compatible with A2A and file upload subsystems.
  • Introduce the VALKEY_URL environment variable to configure cache backends across the framework.
  • Consider adding an optional dependency group (pip install crewai[valkey]) to keep the core package lightweight.

Example

# Example ValkeyStorage class implementation
class ValkeyStorage:
    def __init__(self, url):
        self.url = url
        self.client = valkey_glide.Client(url)

    def get(self, key):
        return self.client.get(key)

    def set(self, key, value):
        self.client.set(key, value)

Notes

The implementation should ensure compatibility with the existing StorageBackend protocol and handle any specific requirements for vector search and caching.

Recommendation

Apply workaround by implementing the proposed Valkey storage backend, as it provides a suitable solution for distributed, low-latency key-value storage with vector search capabilities.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

crewai - ✅(Solved) Fix [FEATURE] Add Valkey as a storage backend for the unified memory system [1 pull requests, 1 participants]