put(
self,
config: RunnableConfig,
checkpoint: Checkpoint,
metadata: CheckpointMetadata,
new_versions: | Name | Type | Description |
|---|---|---|
config* | RunnableConfig | |
checkpoint* | Checkpoint | |
metadata* | CheckpointMetadata | |
new_versions* | ChannelVersions |
Save a checkpoint to the database.
This method saves a checkpoint to the SQLite database. The checkpoint is associated with the provided config and its parent config (if any).
Examples:
from langgraph.checkpoint.sqlite import SqliteSaver with SqliteSaver.from_conn_string(":memory:") 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'}}
The config to associate with the checkpoint.
The checkpoint to save.
Additional metadata to save with the checkpoint.
New channel versions as of this write.