Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To persist LangGraph state, compile your graph with a checkpointer and invoke it with a configurable.thread_id. Reuse that ID to continue the same thread. Choose the saver for your deployment: in-memory for tests, SQLite for lightweight use, or PostgreSQL for durable workloads. A separate LangGraph store is for application data that must be shared across threads.

Checkpointer or store: which persistence do you need?

LangGraph has two complementary persistence mechanisms. A checkpointer saves graph-state snapshots within a thread. It supports continuing conversations, resuming interrupted runs, recovering from failures, and inspecting or revisiting state. A store holds application-defined data outside any one graph thread, such as user preferences or facts that multiple threads need to access. An application can use both. See the LangGraph persistence guide.

  • Use a checkpointer when a graph needs to retain and resume its own state across runs.
  • Use a store when application data should be available across different threads. Your graph nodes or application code must explicitly read and write store items.

What a checkpoint contains

A checkpoint is more than a chat transcript. The LangGraph Python checkpoint reference describes it as a snapshot of channel values, channel versions, and per-node version tracking. Checkpoints are grouped into a sequence associated with a thread_id; a checkpoint_id can identify a particular snapshot within that sequence. The reference also documents pending writes: when one node succeeds but another fails, the successful node’s writes can be retained for resumption rather than rerunning all completed work. See the LangGraph Python checkpoint reference.

Configure checkpointing in a standalone graph

The essential configuration path is the same in principle across integrations: select a saver, complete any required setup, compile the graph with that saver, then supply a thread ID when invoking it. The examples below use Python.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Select and initialize a saver. For example, the in-memory saver is convenient for a quick demonstration. For PostgreSQL, connect using the selected integration and call its required setup method before compiling the graph.
  2. Compile the graph with the checkpointer. Pass the saver as checkpointer=... to compile().
  3. Invoke with a thread ID. Pass a configuration object containing {"configurable": {"thread_id": "..."}}. Reuse that thread ID to continue the same persisted thread; choose another ID to start a separate thread.
  4. Add a store separately if needed. Configure it for data that must span threads, then explicitly read or write its items in graph nodes or application code.

The official quickstart demonstrates the in-memory interface, but in-memory state is not durable across process restarts. JavaScript uses the corresponding checkpointer option when compiling a graph; consult the relevant integration documentation for its exact saver setup. The Python persistence guide and checkpoint reference cover the Python configuration path.

Choose a backend for your deployment

Backend Documented fit Key trade-off
InMemorySaver / MemorySaver Debugging, testing, and the simplest quickstart example Stores data in process memory; state is lost when the process restarts.
SqliteSaver Lightweight synchronous use, demonstrations, and small projects The synchronous saver reference says it does not scale to multiple threads. Async SQLite support is also available, but its package documentation does not recommend async SQLite for production.
PostgresSaver / AsyncPostgresSaver Durable production workloads and long-running workflows Requires PostgreSQL connectivity and setup. Choose sync or async integration to match the application.
Agent Server persistence Managed deployments where the server handles persistence infrastructure Backend options and deployment requirements depend on the Agent Server environment; this is not the configuration model for every standalone LangGraph app.

Compare options by durability across restarts, expected concurrency and scale, synchronous or asynchronous execution, who operates the backing service, and the deployment environment. The cited documentation describes intended use cases, not universal performance rankings or benchmark results. For implementation-specific limits, consult the checkpoint reference and the SQLite package documentation.

Plan retention and secure checkpoint storage

Set a retention policy

Checkpoints accumulate during long conversations. LangGraph’s persistence guide warns that growth can increase storage costs and latency, and recommends periodically pruning old checkpoints or defining a retention policy. The right retention period depends on your application’s recovery, audit, and storage needs; the documentation does not prescribe one universal duration.

Keep PostgreSQL thread IDs short

The persistence guide notes that PostgresSaver stores thread_id in a limited-length column and recommends keeping IDs under 255 characters. A UUID or hash is a practical choice if your natural identifier may exceed that limit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restrict SQLite deserialization

The SQLite package documentation describes restricting checkpoint deserialization to known-safe types in case the database is compromised. It specifies setting LANGGRAPH_STRICT_MSGPACK=true or passing an explicit allowed_msgpack_modules list. Check the documentation for the version of the package you have installed before applying the setting.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Account for subgraph boundaries and managed hosting

Subgraphs may have separate checkpoint namespaces

A subgraph can have its own checkpoint namespace, which affects what the parent graph can see and how state is shared. If information must cross graph boundaries, consider putting it in a shared store or configuring the subgraph to write to the parent checkpoint. The persistence guide covers these options and related troubleshooting.

Agent Server manages persistence differently

In Agent Server deployments, persistence infrastructure is handled by the server. LangSmith’s data-plane documentation says PostgreSQL is used for server resources and is the default checkpoint backend. MongoDB can serve as an alternative checkpoint backend in supported deployments, while PostgreSQL remains required for other server resources. These details apply to Agent Server deployments; a standalone LangGraph application is not universally required to use PostgreSQL or MongoDB.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.