Skip to main content

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"))

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: checkpoints and checkpoint_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, and prune are not implemented (the official SQLite saver doesn't implement them either) and raise NotImplementedError.

License

MIT © PerSQL

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langgraph_checkpoint_persql-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

langgraph_checkpoint_persql-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file langgraph_checkpoint_persql-0.1.0.tar.gz.

File metadata

File hashes

Hashes for langgraph_checkpoint_persql-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da9bf1e3d8699505de6d392db724b91a7e842630d9b50df0124a10a9e1a01f7b
MD5 8f3c533e41c4ae6f0acb0b6a9c90dad6
BLAKE2b-256 93366207c4acc0324137ef298a657c9d2cb855d6719b6ae50305f761d33d545c

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_checkpoint_persql-0.1.0.tar.gz:

Publisher: python-release-langgraph.yml on persql/persql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langgraph_checkpoint_persql-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langgraph_checkpoint_persql-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a8413a99338f29aac6eb0c002abaa712989d2ba6b446c84f822f61d9eb0de5f
MD5 ef6aab46627ba19924b07e37aec52a97
BLAKE2b-256 2be75a3e5ef1d49783decb0ea9fed76eb6a02d4951b87871ba11ee12ffd0e8ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_checkpoint_persql-0.1.0-py3-none-any.whl:

Publisher: python-release-langgraph.yml on persql/persql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page