LangGraph checkpointer backed by PerSQL — durable agent state in an isolated SQLite database per agent.
Project description
langgraph-checkpoint-persql
LangGraph checkpointer backed by PerSQL — durable agent state in an isolated SQLite database per agent, provisioned instantly.
pip install langgraph-checkpoint-persql
Usage
import os
from persql import PerSQL
from langgraph.checkpoint.persql import PerSQLSaver
client = PerSQL(token=os.environ["PERSQL_TOKEN"])
checkpointer = PerSQLSaver(client.database("acme/agent-state"))
graph = builder.compile(checkpointer=checkpointer)
config = {"configurable": {"thread_id": "session-42"}}
graph.invoke({"messages": [("user", "hi")]}, config)
graph.invoke({"messages": [("user", "remember me?")]}, config) # state persists
Async:
from persql import AsyncPerSQL
from langgraph.checkpoint.persql.aio import AsyncPerSQLSaver
async with AsyncPerSQL(token=os.environ["PERSQL_TOKEN"]) as client:
checkpointer = AsyncPerSQLSaver(client.database("acme/agent-state"))
graph = builder.compile(checkpointer=checkpointer)
await graph.ainvoke(inputs, {"configurable": {"thread_id": "session-42"}})
Or let the saver own the client:
with PerSQLSaver.from_token(os.environ["PERSQL_TOKEN"], "acme/agent-state") as cp:
graph = builder.compile(checkpointer=cp)
Tests run against the SDK's local mode — in-process SQLite, no network, no token:
checkpointer = PerSQLSaver(PerSQL(local=":memory:").database("test/db"))
Cross-thread memory (BaseStore)
The package also ships PerSQLStore / AsyncPerSQLStore, a LangGraph
BaseStore for long-term memory shared across threads:
from langgraph.store.persql import PerSQLStore
store = PerSQLStore(client.database("acme/agent-state"))
graph = builder.compile(checkpointer=checkpointer, store=store)
store.put(("users", "u1"), "prefs", {"theme": "dark"})
store.search(("users",), filter={"theme": "dark"})
One store_items table; a whole batch() of operations rides one HTTP
round-trip. Items are plain JSON, so the same database can serve the JS
@persql/langgraph store too. Not supported (raise
NotImplementedError): natural-language query= search — PerSQL is a
structured SQL substrate; pair it with a vector layer for semantic
recall — and item TTLs. Filtered searches fetch the whole namespace
prefix before paginating, so keep filtered prefixes to bounded
collections.
Per-agent isolation
The saver keys state by thread_id inside one database, like every
LangGraph checkpointer. PerSQL's shape lets you go one step further and
give each agent (or each run) its own database: provision with
client.databases.create(...) or lease a schema-only branch with a
scoped token via db.branches. See the
PerSQL docs for the per-agent patterns.
Storage and limits
- Two tables, created lazily on first use:
checkpointsandcheckpoint_writes, the same layout as the official SQLite saver (serialized values are base64 text rather than blobs). - Every saver call is one HTTP round-trip to the database. LangGraph checkpoints once per super-step, so a remote checkpointer adds wire latency per step — the same trade-off as the official Postgres saver.
- Checkpoint rows land on PerSQL's usage meters like any other write. A typical graph step writes one checkpoint row plus a few pending writes; see persql.com/pricing for rates.
delete_for_runs,copy_thread, andpruneare not implemented (the official SQLite saver doesn't implement them either) and raiseNotImplementedError.
License
MIT © PerSQL
Project details
Release history Release notifications | RSS feed
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_checkpoint_persql-0.2.0.tar.gz.
File metadata
- Download URL: langgraph_checkpoint_persql-0.2.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97cf06490a68f1191bd1883a0fbdb882e78d14a0e8e95c17aad8cb2c00f323b0
|
|
| MD5 |
e188d228e29206dec94f524e83951c26
|
|
| BLAKE2b-256 |
1caf7312966e0862e2bb069be80d895b5f70c690071f71489f1302802d69b435
|
Provenance
The following attestation bundles were made for langgraph_checkpoint_persql-0.2.0.tar.gz:
Publisher:
python-release-langgraph.yml on persql/persql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_checkpoint_persql-0.2.0.tar.gz -
Subject digest:
97cf06490a68f1191bd1883a0fbdb882e78d14a0e8e95c17aad8cb2c00f323b0 - Sigstore transparency entry: 1803608543
- Sigstore integration time:
-
Permalink:
persql/persql@ca711f54a324278daa68ed4a24d915563a306121 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/persql
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release-langgraph.yml@ca711f54a324278daa68ed4a24d915563a306121 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langgraph_checkpoint_persql-0.2.0-py3-none-any.whl.
File metadata
- Download URL: langgraph_checkpoint_persql-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ce482ad2795e417ad57aacb6a09478359e49db996529149e58a38e6fc139260
|
|
| MD5 |
f87f004204a6811c3333b1c4978bcecc
|
|
| BLAKE2b-256 |
3bdebb5e0a8609b54b162a53b876c69805a797a1b8f0d4304148a4b1860b49f6
|
Provenance
The following attestation bundles were made for langgraph_checkpoint_persql-0.2.0-py3-none-any.whl:
Publisher:
python-release-langgraph.yml on persql/persql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_checkpoint_persql-0.2.0-py3-none-any.whl -
Subject digest:
4ce482ad2795e417ad57aacb6a09478359e49db996529149e58a38e6fc139260 - Sigstore transparency entry: 1803608607
- Sigstore integration time:
-
Permalink:
persql/persql@ca711f54a324278daa68ed4a24d915563a306121 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/persql
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release-langgraph.yml@ca711f54a324278daa68ed4a24d915563a306121 -
Trigger Event:
push
-
Statement type: