LangGraph
Use GridGain 8 as a LangGraph persistence backend: a checkpointer for thread state, a store for long-term memory across threads, and a node cache.
The langgraph-checkpoint-gridgain package lets LangGraph applications keep their state in GridGain. It provides the following components:
GridGainCheckpointSaver stores the state of a graph thread. It enables pausing and resuming graphs, human approval steps, and time travel.
GridGainMemoryStore stores JSON memory that is shared across graph threads. It supports namespaces, structured filters, and expiry enforced by the server.
GridGainNodeCache stores the outputs of graph nodes, so a repeated input can reuse the result.
These components use only the SQL and key-value APIs, so they do not require a license for vector search.
Prerequisites
Python 3.11 or later.
A running GridGain 8 cluster.
Installation
Install the package using pip:
pip install langgraph-checkpoint-gridgain==3.1.0The package depends on langchain-gridgain 3.1.0, langgraph-checkpoint 4.1.1 or later (below 5.0), langchain-core 1.4.7 or later (below 2.0), and pygridgain 1.7.0 or later (below 2.0). It installs the langchain-gridgain LangChain components as well. Install the langgraph package that runs your graphs separately.
Import the components from the langgraph namespace:
from langgraph.checkpoint.gridgain import GridGainCheckpointSaver
from langgraph.store.gridgain import GridGainMemoryStore
from langgraph.cache.gridgain import GridGainNodeCacheConnecting to GridGain
The components take a connected Python thin client. Your application creates and closes the clients:
Each component accepts a synchronous Client, an asynchronous AioClient, or both. With an AioClient, the asynchronous methods use non-blocking I/O. Without it, they run the synchronous methods in a worker thread.
GridGainCheckpointSaver
GridGainCheckpointSaver is a LangGraph checkpointer. It supports reading the latest and earlier checkpoints, listing checkpoints, writing checkpoints and intermediate writes, and deleting a thread with delete_thread.
The checkpointer stores data in three SQL caches: lg_checkpoints, lg_checkpoint_blobs, and lg_checkpoint_writes. It creates them automatically.
A graph that uses the checkpointer can pause, resume later with a new checkpointer instance, and continue from an earlier checkpoint.
The checkpointer has no expiry (TTL) option. It does not support extended operations such as copy_thread, prune, or delete_for_runs.
GridGainMemoryStore
GridGainMemoryStore is a LangGraph store for memory that outlives a single thread, such as user preferences or facts that an agent should recall across conversations. It stores JSON items in namespaces. By default, it uses the lg_store cache. To use another cache, set cache_name. When you create the store, it adds a (prefix, itemKey) index to the cache, if the index does not exist.
The store supports get, put, delete, search, list_namespaces, batch, and abatch.
Filters support exact matches and the $eq, $ne, $gt, $gte, $lt, and $lte operators. They apply to the JSON value of the item.
Item Expiry (TTL)
The cluster enforces item expiry. TTL values are in minutes. Set a TTL for an item with the ttl argument of put, or for the whole store with ttl_config. By default, reading an item resets its expiry. To read an item without resetting it, pass refresh_ttl=False.
GridGainNodeCache
GridGainNodeCache is a LangGraph node cache. It caches the results of graph nodes. It is not related to the LangChain GridGainCache, which caches model responses and uses a different interface.
To use the node cache, add a CachePolicy to each node whose output should be cached, and pass the cache to compile. Finish the edges of the graph before you compile it.
Given a connected client, a graph builder, and a node function expensive:
In this example, a repeated input reuses the cached output of the node for 300 seconds. The results are stored in GridGain, so a new graph or cache instance can read them after a restart.
TTL values are in seconds. Reading an entry does not extend its lifetime. If the TTL is
None, the entry does not expire.The default cache name is
lg_node_cache, and the cache is shared across the cluster. The node cache does not add an application identifier to the keys, so applications that must not share entries need differentcache_namevalues.cache_namemust be a plain identifier (letters, digits, and underscores, not starting with a digit) and cannot be an SQL reserved word. Node names must be plainstrvalues. For aStrEnummember, passstr(member); otherwise, the node cache raisesTypeError.node_cache.clear()removes all entries from the whole cache. To remove only some namespaces, pass them toclear().graph.clear_cache()removes the entries of the nodes of that graph.With an
AioClient, the asynchronous methods use non-blocking I/O.
Using the Components Together
Given a connected client and a configured graph builder:
The memory store TTL values above are in minutes. The node cache TTL is in seconds.
Upgrading From langchain-gridgain 2.x
In langchain-gridgain 2.x, the checkpointer and the memory store were part of the langchain-gridgain package. In version 3.0.0, they moved to langgraph-checkpoint-gridgain. Install the new package and update the imports:
The classes, their behavior, and the stored data are unchanged. GridGainNodeCache was never released in langchain-gridgain. It is available starting with langgraph-checkpoint-gridgain 3.0.0. The langchain_gridgain package does not import them anymore, and there is no langgraph_checkpoint_gridgain module.
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

