Files
langgraph/libs/checkpoint
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
52483175d9 chore(deps-dev): bump the major group in /libs/checkpoint with 2 updates (#7967)
Bumps the major group in /libs/checkpoint with 2 updates:
[redis](https://github.com/redis/redis-py) and
[mypy](https://github.com/python/mypy).

Updates `redis` from 7.4.0 to 8.0.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/redis/redis-py/releases">redis's
releases</a>.</em></p>
<blockquote>
<h2>8.0.0</h2>
<h1>Changes</h1>
<h2>🚀 Highlights</h2>
<h3>Async Cluster PubSub</h3>
<p>This release introduces full <strong>asyncio Cluster PubSub
support</strong>, bringing shard-channel capabilities
(<code>SSUBSCRIBE</code>, <code>SUNSUBSCRIBE</code>,
<code>SPUBLISH</code>) to the async <code>RedisCluster</code> client.
The new <code>ClusterPubSub</code> class in
<code>redis.asyncio.cluster</code> automatically routes shard-channel
subscriptions to the correct cluster node based on key-slot hashing,
manages per-node PubSub connections, and supports round-robin message
retrieval across nodes. Users can create a cluster pubsub instance via
<code>RedisCluster.pubsub()</code> and use <code>ssubscribe()</code>,
<code>sunsubscribe()</code>, and <code>get_sharded_message()</code> just
as they would with the sync cluster client.</p>
<h3>Keyspace and subkey notifications</h3>
<p>Redis Keyspace Notifications are now supported for standalone and
cluster deployments in both sync and async modes. New classes —
<code>KeyspaceNotifications</code>,
<code>ClusterKeyspaceNotifications</code>,
<code>AsyncKeyspaceNotifications</code>, and
<code>AsyncClusterKeyspaceNotifications</code> — provide a high-level
API for keyspace/keyevent subscriptions and subkey notification
families: <code>subkeyspace</code>, <code>subkeyevent</code>,
<code>subkeyspaceitem</code>, and <code>subkeyspaceevent</code>.
Convenience methods like <code>subscribe_keyspace()</code>,
<code>subscribe_keyevent()</code>, <code>subscribe_subkeyspace()</code>,
<code>subscribe_subkeyevent()</code>,
<code>subscribe_subkeyspaceitem()</code>, and
<code>subscribe_subkeyspaceevent()</code> simplify common patterns, with
channel classes for both key and subkey channels.</p>
<p>In cluster mode, subscriptions are managed across primary nodes
because each node emits notifications only for keys it owns, with
built-in topology-change handling. Sync <code>run_in_thread()</code> and
async <code>listen()</code> workflows are supported.</p>
<h3>Redis Array commands(<a
href="https://redis.io/docs/latest/develop/data-types/arrays/">https://redis.io/docs/latest/develop/data-types/arrays/</a>)</h3>
<p>redis-py now supports <a
href="https://redis.io/docs/latest/develop/data-types/arrays/">Redis
Arrays</a>, a preview Redis data type for sparse, index-addressable
sequences of strings. New <code>AR*</code> command helpers cover indexed
reads/writes, range scans, deletion, cursor-based insertion, ring-buffer
writes, metadata, text search, and aggregation, including
<code>ARGET</code>, <code>ARSET</code>, <code>ARMGET</code>,
<code>ARMSET</code>, <code>ARSCAN</code>, <code>ARGREP</code>,
<code>ARRING</code>, and <code>AROP</code>.</p>
<h3>Type Hints Improvements (breaking changes)</h3>
<p>The <code>@overload</code> pattern has been applied systematically
across <strong>core commands</strong> (<code>core.py</code>),
<strong>VectorSet commands</strong>, and <strong>module
commands</strong> (Search, JSON, TimeSeries, Bloom filters) to provide
distinct return types for sync and async clients. Previously, methods
returned a combined <code>ResponseT</code> (i.e.,
<code>Union[Awaitable[Any], Any]</code>), which caused static analysis
tools like mypy and Pyright to flag false positives. Now, sync clients
see concrete return types (e.g., <code>int</code>, <code>bool</code>,
<code>list[str]</code>) while async clients see
<code>Awaitable[...]</code> wrappers. This is a <strong>breaking change
for type-checking only</strong>—runtime behavior is unchanged, but code
relying on the old union return types in type annotations may need
updates. Two new protocol types, <code>SyncClientProtocol</code> and
<code>AsyncClientProtocol</code>, are used in overload signatures to
enable this distinction.</p>
<h3>RESP3 by default with opt-in unified responses</h3>
<p>redis-py 8.0.0 now uses RESP3 on the wire by default while preserving
legacy RESP2-compatible Python response shapes for existing applications
(<a
href="https://redirect.github.com/redis/redis-py/issues/4052">#4052</a>).
Protocol-independent unified response shapes are available by setting
<code>legacy_responses=False</code>, so affected commands return the
same Python structure with RESP2 or RESP3.</p>
<p>Use <code>protocol=2</code> to force RESP2 on the wire,
<code>protocol=3</code> to opt into native RESP3 response shapes, or
<code>legacy_responses=False</code> to migrate to unified responses. See
<a
href="https://github.com/redis/redis-py/blob/HEAD/docs/unified_responses.rst"><code>https://github.com/redis/redis-py/blob/HEAD/docs/unified_responses.rst</code></a>
and <a
href="https://github.com/redis/redis-py/blob/HEAD/specs/unified_responses_migration_guide.md"><code>https://github.com/redis/redis-py/blob/HEAD/specs/unified_responses_migration_guide.md</code></a>
for the affected commands and migration details.</p>
<h3>Connection and retry defaults</h3>
<p>Default connection settings were updated: <code>socket_timeout</code>
and <code>socket_connect_timeout</code> now default to 5 seconds, TCP
keepalive is enabled by default, socket reads use a 32 KB buffer,
connection pools default to <code>max_connections=100</code>, and retry
defaults now use 10 attempts with exponential jitter backoff.</p>
<p>Note: <code>socket_timeout</code> can affect blocking commands such
as <code>BLPOP</code>/<code>BRPOP</code>; if a command blocks longer
than the client socket timeout, it may raise <code>TimeoutError</code>
before the command timeout elapses (<a
href="https://redirect.github.com/redis/redis-py/issues/2807">#2807</a>).</p>
<h2>🧪 Experimental Features</h2>
<ul>
<li>Added support for new array commands (<a
href="https://redirect.github.com/redis/redis-py/issues/4055">#4055</a>)</li>
</ul>
<h2>🚀 New Features</h2>
<ul>
<li>Support Cluster PubSub in asyncio (<a
href="https://redirect.github.com/redis/redis-py/issues/3736">#3736</a>)</li>
<li>Add Redis Keyspace Notifications Support for Redis Cluster (<a
href="https://redirect.github.com/redis/redis-py/issues/3962">#3962</a>)</li>
<li>Add random load balancing strategy which allows for use of the
primary (<a
href="https://redirect.github.com/redis/redis-py/issues/4027">#4027</a>)</li>
<li>Add FPHA (floating-point homogeneous array) arg support to JSON.SET
(<a
href="https://redirect.github.com/redis/redis-py/issues/4011">#4011</a>)</li>
<li>Added custom Claude command + XNACK command support (<a
href="https://redirect.github.com/redis/redis-py/issues/4030">#4030</a>)</li>
<li>Adding Time Series Multiple Aggregators support (<a
href="https://redirect.github.com/redis/redis-py/issues/4035">#4035</a>)</li>
<li>Adding support for new COUNT aggregator for some sorted set commands
- ZINTER, ZINTERSTORE, ZUNION, ZUNIONSTORE (<a
href="https://redirect.github.com/redis/redis-py/issues/4034">#4034</a>)</li>
<li>Adding support for new INCREX command (<a
href="https://redirect.github.com/redis/redis-py/issues/4067">#4067</a>
<a
href="https://redirect.github.com/redis/redis-py/issues/4077">#4077</a>)</li>
<li>Add support for PubSub subscriptions with binary channel names and
handlers (<a
href="https://redirect.github.com/redis/redis-py/issues/4068">#4068</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/redis/redis-py/commit/733f80ec633d6a772a6e1ccb1c0cca6fc1afb4b6"><code>733f80e</code></a>
Updates in default connection and retry settings (<a
href="https://redirect.github.com/redis/redis-py/issues/4082">#4082</a>)</li>
<li><a
href="https://github.com/redis/redis-py/commit/a68a16c296591e902d0c749d31781550048f280f"><code>a68a16c</code></a>
Updating Redis supported versions in README.md and lib version to
8.0.0</li>
<li><a
href="https://github.com/redis/redis-py/commit/43a41d3d2956aa69eb0041655067ffaaaf23c6c3"><code>43a41d3</code></a>
Updating INCREX command arg - SATURATE now controls overflow behaviour
(<a
href="https://redirect.github.com/redis/redis-py/issues/4077">#4077</a>)</li>
<li><a
href="https://github.com/redis/redis-py/commit/1496deba3801605cb123cb1b67adda50e85cd1e5"><code>1496deb</code></a>
Preserve explicit None for client metadata config (<a
href="https://redirect.github.com/redis/redis-py/issues/4081">#4081</a>)</li>
<li><a
href="https://github.com/redis/redis-py/commit/57dc08c550f82086afeaa68a7cd7e5df356f7217"><code>57dc08c</code></a>
Avoid zero-timeout async reads in hiredis connections readiness checks
and re...</li>
<li><a
href="https://github.com/redis/redis-py/commit/cd54ddd25aa307dc7f05bc0e4387cfc294c0a4c8"><code>cd54ddd</code></a>
fix(typing): correct type annotation for XReadResponse (<a
href="https://redirect.github.com/redis/redis-py/issues/4046">#4046</a>)</li>
<li><a
href="https://github.com/redis/redis-py/commit/ab2d41fcf0f9477ac788822d7c430004076a27f2"><code>ab2d41f</code></a>
Add support for PubSub subscriptions with binary channel names and
handlers (...</li>
<li><a
href="https://github.com/redis/redis-py/commit/ef24dc99b6f2aa9507f19aa4ce4be37745ed6c77"><code>ef24dc9</code></a>
Randomize cluster startup node order during topology refresh (<a
href="https://redirect.github.com/redis/redis-py/issues/4060">#4060</a>)</li>
<li><a
href="https://github.com/redis/redis-py/commit/b604015aeb5abce4b576f9dc54ffe30a3f1ba8c6"><code>b604015</code></a>
Add CLAUDE.md and /sync-claude-md skill for managing (<a
href="https://redirect.github.com/redis/redis-py/issues/4066">#4066</a>)</li>
<li><a
href="https://github.com/redis/redis-py/commit/2b8b4fcc9986fbc1f188cc6a355d12eec814ee90"><code>2b8b4fc</code></a>
Fix flaky tests (<a
href="https://redirect.github.com/redis/redis-py/issues/4071">#4071</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/redis/redis-py/compare/v7.4.0...v8.0.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `mypy` from 1.20.2 to 2.1.0
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/python/mypy/blob/master/CHANGELOG.md">mypy's
changelog</a>.</em></p>
<blockquote>
<h1>Mypy Release Notes</h1>
<h2>Next Release</h2>
<h2>Mypy 2.1</h2>
<p>We’ve just uploaded mypy 2.1.0 to the Python Package Index (<a
href="https://pypi.org/project/mypy/">PyPI</a>).
Mypy is a static type checker for Python. This release includes new
features, performance
improvements and bug fixes. You can install it as follows:</p>
<pre><code>python3 -m pip install -U mypy
</code></pre>
<p>You can read the full documentation for this release on <a
href="http://mypy.readthedocs.io">Read the Docs</a>.</p>
<h3>librt.vecs: Fast Growable Array Type for Mypyc</h3>
<p>The new <code>librt.vecs</code> module provides an efficient growable
array type <code>vec</code> that is
optimized for mypyc use. It provides fast, packed arrays with integer
and floating point
value types, which can be <strong>several times faster</strong> than
<code>list</code>, and tens of times faster
than <code>array.array</code> in code compiled using mypyc. It also
supports nested <code>vec</code> objects and
non-value-type items, such as <code>vec[vec[str]]</code>.</p>
<p>Refer to the <a
href="https://mypyc.readthedocs.io/en/latest/librt_vecs.html">documentation</a>
for
the details.</p>
<p>Contributed by Jukka Lehtosalo.</p>
<h3>librt.random: Fast Pseudo-Random Number Generation</h3>
<p>The new <code>librt.random</code> module provides fast pseudo-random
number generation that is
optimized for code compiled using mypyc. It can be 3x to 10x faster than
the stdlib
<code>random</code> module in compiled code.</p>
<p>Refer to the <a
href="https://mypyc.readthedocs.io/en/latest/librt_random.html">documentation</a>
for
the details.</p>
<p>Contributed by Jukka Lehtosalo (PR <a
href="https://redirect.github.com/python/mypy/pull/21433">21433</a>).</p>
<h3>Mypyc Improvements</h3>
<ul>
<li>Enable incremental self-compilation (Vaggelis Danias, PR <a
href="https://redirect.github.com/python/mypy/pull/21369">21369</a>)</li>
<li>Make compilation order with multiple files consistent (Piotr
Sawicki, PR <a
href="https://redirect.github.com/python/mypy/pull/21419">21419</a>)</li>
<li>Fix crash on accessing <code>StopAsyncIteration</code> (Piotr
Sawicki, PR <a
href="https://redirect.github.com/python/mypy/pull/21406">21406</a>)</li>
<li>Fix incremental compilation with <code>separate</code> flag
(Vaggelis Danias, PR <a
href="https://redirect.github.com/python/mypy/pull/21299">21299</a>)</li>
</ul>
<h3>Fixes to Crashes</h3>
<ul>
<li>Fix crash on partial type with <code>--allow-redefinition</code> and
<code>global</code> declaration (Jukka Lehtosalo, PR <a
href="https://redirect.github.com/python/mypy/pull/21428">21428</a>)</li>
<li>Fix broken awaitable generator patching (Ivan Levkivskyi, PR <a
href="https://redirect.github.com/python/mypy/pull/21435">21435</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/python/mypy/commit/c1c336d7e34eb313080c79b156518c58d27c7234"><code>c1c336d</code></a>
Remove +dev from version</li>
<li><a
href="https://github.com/python/mypy/commit/74df14b7cbf08140236aa45bbb7f42219b0b1df7"><code>74df14b</code></a>
Add changelog for mypy 2.1 (<a
href="https://redirect.github.com/python/mypy/issues/21464">#21464</a>)</li>
<li><a
href="https://github.com/python/mypy/commit/022d9bc96f86c40f338a5cf150f1806cc8f300ff"><code>022d9bc</code></a>
Revert &quot;TypeForm: Enable by default (<a
href="https://redirect.github.com/python/mypy/issues/21262">#21262</a>)&quot;</li>
<li><a
href="https://github.com/python/mypy/commit/8826288214f1cb31496e610667481221e025359c"><code>8826288</code></a>
[mypyc] Document librt.random (<a
href="https://redirect.github.com/python/mypy/issues/21463">#21463</a>)</li>
<li><a
href="https://github.com/python/mypy/commit/3f4067b699dbe52d08e42ef3b3ebfdebdc06bd96"><code>3f4067b</code></a>
Bump librt version to 0.11.0 (<a
href="https://redirect.github.com/python/mypy/issues/21458">#21458</a>)</li>
<li><a
href="https://github.com/python/mypy/commit/2b1eb58a250c5f1eb4ef5fb1f312ff528c5a1d4e"><code>2b1eb58</code></a>
[mypyc] Enable incremental self-compilation (<a
href="https://redirect.github.com/python/mypy/issues/21369">#21369</a>)</li>
<li><a
href="https://github.com/python/mypy/commit/8152f4af3f6c03beaf2660026240f0fdce7feecc"><code>8152f4a</code></a>
Respect file config comments for stale modules (<a
href="https://redirect.github.com/python/mypy/issues/21444">#21444</a>)</li>
<li><a
href="https://github.com/python/mypy/commit/116d60bdd3fdfe8d97c6afe99370910db56f1b92"><code>116d60b</code></a>
Fix nondeterminism from nonassociativity of overload joins (<a
href="https://redirect.github.com/python/mypy/issues/21455">#21455</a>)</li>
<li><a
href="https://github.com/python/mypy/commit/6c4af8e42110cea3f84bc02add2ca7b89c268210"><code>6c4af8e</code></a>
Fix function call message change for small number of args (<a
href="https://redirect.github.com/python/mypy/issues/21432">#21432</a>)</li>
<li><a
href="https://github.com/python/mypy/commit/4b8fdcaf24032592510e8f15421fb32d82a71800"><code>4b8fdca</code></a>
[mypyc] Add librt.random module (<a
href="https://redirect.github.com/python/mypy/issues/21433">#21433</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/python/mypy/compare/v1.20.2...v2.1.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-02 23:02:23 -07:00
..
2026-02-26 12:01:58 -08:00

LangGraph Checkpoint

This library defines the base interface for LangGraph checkpointers. Checkpointers provide a persistence layer for LangGraph. They allow you to interact with and manage the graph's state. When you use a graph with a checkpointer, the checkpointer saves a checkpoint of the graph state at every superstep, enabling several powerful capabilities like human-in-the-loop, "memory" between interactions and more.

Key concepts

Checkpoint

Checkpoint is a snapshot of the graph state at a given point in time. Checkpoint tuple refers to an object containing checkpoint and the associated config, metadata and pending writes.

Thread

Threads enable the checkpointing of multiple different runs, making them essential for multi-tenant chat applications and other scenarios where maintaining separate states is necessary. A thread is a unique ID assigned to a series of checkpoints saved by a checkpointer. When using a checkpointer, you must specify a thread_id and optionally checkpoint_id when running the graph.

  • thread_id is simply the ID of a thread. This is always required.
  • checkpoint_id can optionally be passed. This identifier refers to a specific checkpoint within a thread. This can be used to kick off a run of a graph from some point halfway through a thread.

You must pass these when invoking the graph as part of the configurable part of the config, e.g.

{"configurable": {"thread_id": "1"}}  # valid config
{"configurable": {"thread_id": "1", "checkpoint_id": "0c62ca34-ac19-445d-bbb0-5b4984975b2a"}}  # also valid config

Serde

langgraph_checkpoint also defines protocol for serialization/deserialization (serde) and provides an default implementation (langgraph.checkpoint.serde.jsonplus.JsonPlusSerializer) that handles a wide variety of types, including LangChain and LangGraph primitives, datetimes, enums and more.

Important

Checkpoint deserialization security: By default the serializer allows any Python type found in checkpoint data. New applications should set the environment variable LANGGRAPH_STRICT_MSGPACK=true or pass an explicit allowed_msgpack_modules list to JsonPlusSerializer to restrict deserialization to known-safe types.

Pending writes

When a graph node fails mid-execution at a given superstep, LangGraph stores pending checkpoint writes from any other nodes that completed successfully at that superstep, so that whenever we resume graph execution from that superstep we don't re-run the successful nodes.

Interface

Each checkpointer should conform to langgraph.checkpoint.base.BaseCheckpointSaver interface and must implement the following methods:

  • .put - Store a checkpoint with its configuration and metadata.
  • .put_writes - Store intermediate writes linked to a checkpoint (i.e. pending writes).
  • .get_tuple - Fetch a checkpoint tuple using for a given configuration (thread_id and checkpoint_id).
  • .list - List checkpoints that match a given configuration and filter criteria.
  • .delete_thread() - Delete all checkpoints and writes associated with a thread.
  • .get_next_version() - Generate the next version ID for a channel.

If the checkpointer will be used with asynchronous graph execution (i.e. executing the graph via .ainvoke, .astream, .abatch), checkpointer must implement asynchronous versions of the above methods (.aput, .aput_writes, .aget_tuple, .alist). Similarly, the checkpointer must implement .adelete_thread() if asynchronous thread cleanup is desired. The base class provides a default implementation of .get_next_version() that generates an integer sequence starting from 1, but this method should be overridden for custom versioning schemes.

Usage

from langgraph.checkpoint.memory import InMemorySaver

write_config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}}
read_config = {"configurable": {"thread_id": "1"}}

checkpointer = InMemorySaver()
checkpoint = {
    "v": 4,
    "ts": "2024-07-31T20:14:19.804150+00:00",
    "id": "1ef4f797-8335-6428-8001-8a1503f9b875",
    "channel_values": {
      "my_key": "meow",
      "node": "node"
    },
    "channel_versions": {
      "__start__": 2,
      "my_key": 3,
      "start:node": 3,
      "node": 3
    },
    "versions_seen": {
      "__input__": {},
      "__start__": {
        "__start__": 1
      },
      "node": {
        "start:node": 2
      }
    },
}

# store checkpoint
checkpointer.put(write_config, checkpoint, {}, {})

# load checkpoint
checkpointer.get(read_config)

# list checkpoints
list(checkpointer.list(read_config))