LangGraph Checkpoint for SurrealDB
SurrealDB-backed checkpointers for LangGraph.
Install
pip install langgraph-surrealdb
Configure SurrealDB
Set these environment variables (prefix: LANGGRAPH_SURREALDB_):
# required for all modes
export LANGGRAPH_SURREALDB_URL="ws://localhost:8000/rpc"
export LANGGRAPH_SURREALDB_NS="langgraph"
export LANGGRAPH_SURREALDB_DB="checkpoint"
export LANGGRAPH_SURREALDB_TABLE_PREFIX="prefix" # optionally add a prefix to checkpoint tables
# root mode
export LANGGRAPH_SURREALDB_AUTH_MODE="root"
export LANGGRAPH_SURREALDB_USER="root"
export LANGGRAPH_SURREALDB_PASSWORD="pass"
# record mode
# export LANGGRAPH_SURREALDB_AUTH_MODE="record"
# export LANGGRAPH_SURREALDB_USER="user"
# export LANGGRAPH_SURREALDB_PASSWORD="pass"
# export LANGGRAPH_SURREALDB_ACCESS="method"
# token mode
# export LANGGRAPH_SURREALDB_AUTH_MODE="token"
# export LANGGRAPH_SURREALDB_TOKEN="xyz"
Or create the saver directly from settings:
from langgraph_surrealdb import (
AsyncSurrealSaver,
RootAuth,
SurrealSaver,
SurrealSaverSettings,
SurrealSaverDatabaseSettings,
)
settings = SurrealSaverSettings(
writes_table="writes", # optional, defaults to 'writes'
checkpoints_table="checkpoints", # optional, defaults to 'checkpoints'
db=SurrealSaverDatabaseSettings(
url="ws://localhost:8000/rpc",
namespace="langgraph",
database="checkpoint",
# supports RootAuth, TokenAuth and RecordAuth
auth=RootAuth(
username="root",
password="root"
)
)
)
with SurrealSaver.from_settings(settings) as checkpointer:
...
async with AsyncSurrealSaver.from_settings(settings) as checkpointer:
...
Initialize schema
[!IMPORTANT] When using SurrealDB checkpointers for the first time, call a setup method to create required tables and indexes before using saver operations.
# one-time setup
with SurrealSaver.from_env() as checkpointer:
checkpointer.setup()
# async equivalent
async with AsyncSurrealSaver.from_env() as checkpointer:
await checkpointer.setup()
Use with LangGraph (sync)
from langgraph.graph import StateGraph
from langgraph_surrealdb import SurrealSaver
# build your graph
builder = StateGraph(dict)
# ... add nodes and edges ...
with SurrealSaver.from_env() as checkpointer:
checkpointer.setup()
graph = builder.compile(checkpointer=checkpointer)
result = graph.invoke(
{"input": "hello"},
config={"configurable": {"thread_id": "thread-1"}},
)
Use with LangGraph (async)
from langgraph.graph import StateGraph
from langgraph_surrealdb import AsyncSurrealSaver
builder = StateGraph(dict)
# ... add nodes and edges ...
async with AsyncSurrealSaver.from_env() as checkpointer:
await checkpointer.setup()
graph = builder.compile(checkpointer=checkpointer)
result = await graph.ainvoke(
{"input": "hello"},
config={"configurable": {"thread_id": "thread-1"}},
)
Then reuse the same thread_id to resume conversation state across calls.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langgraph_surrealdb-0.3.0.tar.gz.
File metadata
- Download URL: langgraph_surrealdb-0.3.0.tar.gz
- Upload date:
- Size: 134.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cd0037aa5ed3f3381ff79f38a05b8c75e625b59d4acfa25e2854b2b935c6b49
|
|
| MD5 |
5ffbc16f91c02c9e5adaadfac4ccafea
|
|
| BLAKE2b-256 |
a72f63e309b4016e01e359ca6c4e2aab4c26565662b05eecb4fd8875bcd801f4
|
File details
Details for the file langgraph_surrealdb-0.3.0-py3-none-any.whl.
File metadata
- Download URL: langgraph_surrealdb-0.3.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acdc5f3d86cfb94477c2632bca66d3b4e8f61c345ee17afbe87c0dab37be56c3
|
|
| MD5 |
de3d0e2c5cd83e4b25698460b986bf88
|
|
| BLAKE2b-256 |
28674b2f4299a7dce89d51715ec1ea2d615cb801e72cd3bf5dd9c0fd58c8eadf
|