LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
  • Stream
LangGraph SDK
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
โŒ˜I

Chat LangChain

What can I help with?

Enter to sendยทShift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemoteStream
LangGraph SDK
ClientAuthReactLoggingReact UiServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/langgraph-checkpoint-redisindexRedisSaver
Class

RedisSaver

Copy
class RedisSaver

Bases

BaseCheckpointSaver

Used in Docs

  • Deploy with Next.js

Constructors

constructor
constructorโ†’ RedisSaver

Properties

property
serde: SerializerProtocol

Methods

method
deleteThreadโ†’ Promise<void>

Delete all checkpoints and writes associated with a specific thread ID.

method
endโ†’ Promise<void>
method
getโ†’ Promise<Checkpoint<string, string> | undefined>
method
getDeltaChannelHistoryโ†’ Promise<Record<string, DeltaChannelHistory>>

Walk the parent chain returning per-channel writes + seed, used to reconstruct DeltaChannel state from checkpoint_writes.

For each requested channel, walks ancestors of the checkpoint identified by config (following parentConfig) and accumulates the pending writes for that channel. The walk terminates per-channel at the nearest ancestor whose channel_values[ch] is populated; that value is returned as seed. If the walk reaches the root without finding a stored value, seed is omitted from that channel's entry โ€” the consumer treats the absence as "start empty".

Walks the parent chain (not list({ before })): for forked threads, only on-path ancestors contribute.

Within a single checkpoint, writes are ordered by writesSortKey โ€” (task_path, task_id, idx) โ€” the order live execution applies a superstep's task writes in. This default walk cannot sort by path itself (CheckpointPendingWrite carries no path), so it relies on getTuple returning pendingWrites already in writesSortKey order, which the contract above requires of every saver. Writes stored without a task_path (graph input, Command updates, rows predating the column) sort first, by task_id.

The default implementation walks getTuple + parentConfig once for all channels โ€” each ancestor visited once, not once per channel. Savers with direct storage access (e.g. MemorySaver) override for performance; the return contract is fixed here.

method
getNextVersionโ†’ number

A multiple of a billion above current, plus a random number below a billion. Blobs are keyed by channel and version, so two branches from one checkpoint that minted the same version would share a blob: the second branch's value replaces the first's, and the first branch reads it back from then on. The version is an integer because RedisJSON returns some floats with different last digits, and the checkpoint then points at a blob key that doesn't exist. A string version throws in the base class rather than turn into NaN.

method
getTupleโ†’ Promise<CheckpointTuple | undefined>
method
listโ†’ AsyncGenerator<CheckpointTuple>
method
putโ†’ Promise<RunnableConfig<Record<string, any>>>
method
putWritesโ†’ Promise<void>

Store intermediate writes linked to a checkpoint.

taskPath is the serialized path of the task creating the writes (see writesSortKey). Implementations should persist it when they can, and must return pendingWrites from getTuple/list in writesSortKey order โ€” live execution applies a superstep's writes in that order, so replaying in any other order can rebuild a different value for an order-sensitive reducer. Writes stored without a path (rows predating it, savers that don't persist one) sort first by taskId, which is also the order live execution applies input in.

method
toJSONโ†’ string

Prevent JSON.stringify from traversing backend clients (e.g. pg Pool timers) when a checkpointer is present in runnable configurable.

method
fromClusterโ†’ Promise<RedisSaver>
method
fromUrlโ†’ Promise<RedisSaver>
View source on GitHub