LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    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
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph.checkpoint.postgresshallowShallowPostgresSaverput
    Method●Since v2.0

    put

    Copy
    put(
      self,
      config: RunnableConfig,
      checkpoint: Checkpoint,
      metadata: CheckpointMetadata,
      new_versions: 
    View source on GitHub
    ChannelVersions
    )
    ->
    RunnableConfig

    Parameters

    NameTypeDescription
    config*RunnableConfig

    The config to associate with the checkpoint.

    checkpoint*Checkpoint

    The checkpoint to save.

    metadata*CheckpointMetadata

    Additional metadata to save with the checkpoint.

    new_versions*ChannelVersions

    Save a checkpoint to the database.

    This method saves a checkpoint to the Postgres database. The checkpoint is associated with the provided config. For ShallowPostgresSaver, this method saves ONLY the most recent checkpoint and overwrites a previous checkpoint, if it exists.

    Examples:

    from langgraph.checkpoint.postgres import ShallowPostgresSaver DB_URI = "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" with ShallowPostgresSaver.from_conn_string(DB_URI) as memory: config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}} checkpoint = {"ts": "2024-05-04T06:32:42.235444+00:00", "id": "1ef4f797-8335-6428-8001-8a1503f9b875", "channel_values": {"key": "value"}} saved_config = memory.put(config, checkpoint, {"source": "input", "step": 1, "writes": {"key": "value"}}, {}) print(saved_config) {'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef4f797-8335-6428-8001-8a1503f9b875'}}

    New channel versions as of this write.