LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph.checkpoint.sqlite

    langgraph.checkpoint.sqlite

    Description

    LangGraph SQLite Checkpoint

    Implementation of LangGraph CheckpointSaver that uses SQLite DB (both sync and async, via aiosqlite)

    Usage

    from langgraph.checkpoint.sqlite import SqliteSaver
    
    write_config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}}
    read_config = {"configurable": {"thread_id": "1"}}
    
    with SqliteSaver.from_conn_string("") as checkpointer:
        checkpoint = {
            "v": 4,
            "ts": "2024-07-31T2019.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))

    Async

    from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
    
    async with AsyncSqliteSaver.from_conn_string("") as checkpointer:
        checkpoint = {
            "v": 4,
            "ts": "2024-07-31T2019.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
        await checkpointer.aput(write_config, checkpoint, {}, {})
    
        # load checkpoint
        await checkpointer.aget(read_config)
    
        # list checkpoints
        [c async for c in checkpointer.alist(read_config)]

    Classes

    Class

    SqliteSaver

    A checkpoint saver that stores checkpoints in a SQLite database.

    Class

    AsyncSqliteSaver

    An asynchronous checkpoint saver that stores checkpoints in a SQLite database.

    Functions

    Function

    search_where

    Return WHERE clause predicates for (a)search() given metadata filter

    Modules

    Module

    sqlite

    Module

    aio

    Module

    utils