langgraph-checkpoint


Namelanggraph-checkpoint JSON
Version 2.1.2 PyPI version JSON
download
home_pageNone
SummaryLibrary with base interfaces for LangGraph checkpoint savers.
upload_time2025-10-07 17:45:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

```python
{"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.

### 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.

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`).

## Usage

```python
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))
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "langgraph-checkpoint",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/29/83/6404f6ed23a91d7bc63d7df902d144548434237d017820ceaa8d014035f2/langgraph_checkpoint-2.1.2.tar.gz",
    "platform": null,
    "description": "# LangGraph Checkpoint\n\nThis 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.\n\n## Key concepts\n\n### Checkpoint\n\nCheckpoint 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.\n\n### Thread\n\nThreads 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.\n\n- `thread_id` is simply the ID of a thread. This is always required.\n- `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.\n\nYou must pass these when invoking the graph as part of the configurable part of the config, e.g.\n\n```python\n{\"configurable\": {\"thread_id\": \"1\"}}  # valid config\n{\"configurable\": {\"thread_id\": \"1\", \"checkpoint_id\": \"0c62ca34-ac19-445d-bbb0-5b4984975b2a\"}}  # also valid config\n```\n\n### Serde\n\n`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.\n\n### Pending writes\n\nWhen 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.\n\n## Interface\n\nEach checkpointer should conform to `langgraph.checkpoint.base.BaseCheckpointSaver` interface and must implement the following methods:\n\n- `.put` - Store a checkpoint with its configuration and metadata.\n- `.put_writes` - Store intermediate writes linked to a checkpoint (i.e. pending writes).\n- `.get_tuple` - Fetch a checkpoint tuple using for a given configuration (`thread_id` and `checkpoint_id`).\n- `.list` - List checkpoints that match a given configuration and filter criteria.\n\nIf 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`).\n\n## Usage\n\n```python\nfrom langgraph.checkpoint.memory import InMemorySaver\n\nwrite_config = {\"configurable\": {\"thread_id\": \"1\", \"checkpoint_ns\": \"\"}}\nread_config = {\"configurable\": {\"thread_id\": \"1\"}}\n\ncheckpointer = InMemorySaver()\ncheckpoint = {\n    \"v\": 4,\n    \"ts\": \"2024-07-31T20:14:19.804150+00:00\",\n    \"id\": \"1ef4f797-8335-6428-8001-8a1503f9b875\",\n    \"channel_values\": {\n      \"my_key\": \"meow\",\n      \"node\": \"node\"\n    },\n    \"channel_versions\": {\n      \"__start__\": 2,\n      \"my_key\": 3,\n      \"start:node\": 3,\n      \"node\": 3\n    },\n    \"versions_seen\": {\n      \"__input__\": {},\n      \"__start__\": {\n        \"__start__\": 1\n      },\n      \"node\": {\n        \"start:node\": 2\n      }\n    },\n}\n\n# store checkpoint\ncheckpointer.put(write_config, checkpoint, {}, {})\n\n# load checkpoint\ncheckpointer.get(read_config)\n\n# list checkpoints\nlist(checkpointer.list(read_config))\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Library with base interfaces for LangGraph checkpoint savers.",
    "version": "2.1.2",
    "project_urls": {
        "Repository": "https://www.github.com/langchain-ai/langgraph"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c4f206bf5addf8ee664291e1b9ffa1f28fc9d97e59806dc7de5aea9844cbf335",
                "md5": "160bfb2214c0fe4f1ab7cd04da867701",
                "sha256": "911ebffb069fd01775d4b5184c04aaafc2962fcdf50cf49d524cd4367c4d0c60"
            },
            "downloads": -1,
            "filename": "langgraph_checkpoint-2.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "160bfb2214c0fe4f1ab7cd04da867701",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 45763,
            "upload_time": "2025-10-07T17:45:16",
            "upload_time_iso_8601": "2025-10-07T17:45:16.190007Z",
            "url": "https://files.pythonhosted.org/packages/c4/f2/06bf5addf8ee664291e1b9ffa1f28fc9d97e59806dc7de5aea9844cbf335/langgraph_checkpoint-2.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "29836404f6ed23a91d7bc63d7df902d144548434237d017820ceaa8d014035f2",
                "md5": "f136fb70fbd1fb5d7472ae3aba62c4ff",
                "sha256": "112e9d067a6eff8937caf198421b1ffba8d9207193f14ac6f89930c1260c06f9"
            },
            "downloads": -1,
            "filename": "langgraph_checkpoint-2.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f136fb70fbd1fb5d7472ae3aba62c4ff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 142420,
            "upload_time": "2025-10-07T17:45:17",
            "upload_time_iso_8601": "2025-10-07T17:45:17.129696Z",
            "url": "https://files.pythonhosted.org/packages/29/83/6404f6ed23a91d7bc63d7df902d144548434237d017820ceaa8d014035f2/langgraph_checkpoint-2.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-07 17:45:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "langchain-ai",
    "github_project": "langgraph",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "langgraph-checkpoint"
}
        
Elapsed time: 2.16882s