Skip to content

fix: add async setup() method to AsyncRedisSaver (#74) #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions langgraph/checkpoint/redis/aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,21 @@ async def asetup(self) -> None:
# Detect cluster mode if not explicitly set
await self._detect_cluster_mode()

async def setup(self) -> None: # type: ignore[override]
"""Set up the checkpoint saver asynchronously.

This method creates the necessary indices in Redis and detects cluster mode.
It MUST be called before using the checkpointer.

This async method follows the canonical pattern used by PostgreSQL and SQLite
checkpointers in the LangGraph ecosystem. The type ignore is necessary because
the base class defines a sync setup() method, but async checkpointers require
an async setup() method to properly handle coroutines.

Usage: await checkpointer.setup()
"""
await self.asetup()

async def _detect_cluster_mode(self) -> None:
"""Detect if the Redis client is a cluster client by inspecting its class."""
if self.cluster_mode is not None:
Expand Down