Skip to content

Plain Redis Fallback for langgraph-redis (Planned PR) #98

@fullzer4

Description

@fullzer4

TL;DR: Add a lightweight fallback saver that works on Redis without RediSearch / RedisJSON (e.g., AWS ElastiCache standard, Upstash, GCP Memorystore, older OSS). Uses only core commands; no infra changes for users.

Problem

AsyncShallowRedisSaver depends on RediSearch/RedisJSON via redisvl. On providers/environments without those modules (ElastiCache standard, Upstash w/out FT, Memorystore, older OSS <7.1), initialization fails during module capability checks.

Proposal

Introduce PlainAsyncShallowRedisSaver, a fallback using only core Redis primitives:

  • Checkpoints/offsets: HGET/HSET, ZADD, GET/SET
  • Per-thread lock: SET key value NX PX <ttl> + release via EVAL (compare-and-del)

These commands are long-standing (e.g., EVAL since 2.6; SET NX/PX in the SET spec) and require no external modules.

Detection & Usage

Extend from_conn_string(...):

  1. Try the current module-based saver.
  2. If Search/JSON are absent:
    • If ?fallback=plain or allow_plain=True → use Plain variant.
    • Otherwise: auto-fallback with a warning (configurable).

Provider Compatibility (Quick)

Environment Modules Available Current Result With Fallback
AWS ElastiCache (standard) None Fails Works
Upstash (JSON only, no FT) Partial (no RediSearch) Fails Works
Azure Cache (Enterprise tier) Full (Search + JSON) Works Unchanged
GCP Memorystore (standard) None Fails Works
Recent OSS w/ modules installed Full Works Unchanged
Older OSS / no modules (<7.1) None Fails Works

Ask

Would maintainers be interested in this contribution? If so, I’d be happy to open the PR with the fallback implementation, minimal tests, and brief docs (factory flag + small compatibility table). If you prefer an explicit-flag-only approach (no auto-fallback) or different naming than PlainAsyncShallowRedisSaver, please advise and I’ll align the PR accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions