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-redisshallowShallowRedisSaver
Class

ShallowRedisSaver

ShallowRedisSaver - A Redis checkpoint saver that only keeps the latest checkpoint per thread.

This is a memory-optimized variant that:

  • Only stores the most recent checkpoint for each thread
  • Stores channel values inline (no separate blob storage)
  • Automatically cleans up old checkpoints and writes when new ones are added
  • Reduces storage usage for applications that don't need checkpoint history
Copy
class ShallowRedisSaver

Bases

BaseCheckpointSaver

Constructors

constructor
constructorโ†’ ShallowRedisSaver

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

Generate the next version ID for a channel.

Default is to use integer versions, incrementing by 1. If you override, you can use str/int/float versions, as long as they are monotonically increasing.

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
fromUrlโ†’ Promise<ShallowRedisSaver>
View source on GitHub