Skip to content

AsyncRedisSaver.setup() calls async methods without awaiting #74

@harshit-jn-9

Description

@harshit-jn-9

Example code:

from langgraph.checkpoint.redis import AsyncRedisSaver
import asyncio

async def main():
    saver = AsyncRedisSaver(redis_url="redis://localhost:6379")
    await saver.setup()  # <- causes RuntimeWarning

asyncio.run(main())

Error Message and Stack Trace (if applicable)

RuntimeWarning: coroutine 'AsyncSearchIndex.create' was never awaited
  self.checkpoints_index.create(overwrite=False)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
...

Description
AsyncRedisSaver.setup() internally calls AsyncSearchIndex.create() (which is async) without using await, leading to RuntimeWarning: coroutine was never awaited and runtime issues.

Expected Behaviour:
The setup() method should either:

  • Be defined as async def setup(...), so the caller knows to await it, or
  • Internally await the coroutines like .create(...), or
  • Clearly document that the user is responsible for calling await saver.checkpoints_index.create(...) directly (which isn't ideal).

Suggested Fix:
Update AsyncRedisSaver.setup() to:

async def setup(self): 
await self.checkpoints_index.create(overwrite=False) 
await self.checkpoint_blobs_index.create(overwrite=False) 
await self.checkpoint_writes_index.create(overwrite=False) 

Temporary Workaround:
Use RedisSaver instead of AsyncRedisSaver until the issue is fixed.

System Info:

  • langgraph-checkpoint-redis: 0.0.8
  • redis: 6.2.0
  • Python: 3.12
  • OS: macOS Sequoia 15.5

Metadata

Metadata

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