Skip to main content

ci PyPI version License

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

langgraph_surrealdb-0.4.0.tar.gz (138.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langgraph_surrealdb-0.4.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file langgraph_surrealdb-0.4.0.tar.gz.

File metadata

  • Download URL: langgraph_surrealdb-0.4.0.tar.gz
  • Upload date:
  • Size: 138.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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

Hashes for langgraph_surrealdb-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ba597cf288d13990923aba09a9d22750a48d02b7b3faa979e75c2447b7b9cbcb
MD5 e283b02bd5a96e31dc03f69cc3fc8628
BLAKE2b-256 569474f7bdd0b1ee2624ec6a548edd1ad2a7b679fc66479698a011e7d1ceb416

See more details on using hashes here.

File details

Details for the file langgraph_surrealdb-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: langgraph_surrealdb-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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

Hashes for langgraph_surrealdb-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4afbac7bbc85ec6d252b1e91232c181bf406356deb1006a1e4d0bcbe47403ddb
MD5 bd9470fa9c071cba3877734a21b76231
BLAKE2b-256 6cdfbe19fa462dd6b2d21da6481ffe5d2c3168b3879af314d400aaba4b212a63

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.0

2 files

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page