Typed persistence utilities for LangGraph-based OOAI applications.
Project description
ooai-persistence
ooai-persistence provides typed persistence helpers for LangGraph-based OOAI applications.
Responsibilities
- checkpointer configuration and backend resolution
- store configuration and backend resolution
- graph cache configuration
- strict serializer allowlist support
- sync and async persistence contexts
- local infrastructure defaults for Postgres, optional Redis, and optional MongoDB
Quick start
pdm install -G :all
pdm run pytest
pdm run ooai-persistence smoke --backend memory
For a no-infrastructure memory bundle:
from ooai_persistence import AppSettings, open_sync_persistence
settings = AppSettings.memory()
with open_sync_persistence(settings) as persistence:
persistence.store.put(("users", "will"), "profile", {"name": "Will"})
profile = persistence.store.get(("users", "will"), "profile")
For async usage:
from ooai_persistence import AppSettings, open_persistence
settings = AppSettings.local_sqlite(".ooai/persistence/dev.sqlite3")
async with open_persistence(settings) as persistence:
...
CLI
The package ships a small diagnostics and smoke-test CLI:
ooai-persistence doctor --backend postgres --json
ooai-persistence smoke --backend memory
ooai-persistence smoke --backend sqlite --sqlite-path .ooai/persistence/smoke.sqlite3
ooai-persistence smoke --backend postgres --async
ooai-persistence env --output .env
ooai-persistence ensure-postgres
The async Postgres smoke command exercises both the LangGraph checkpointer and store through the public context API.
Local Postgres
make bootstrap
make infra-up
make infra-test-postgres
make infra-down
make bootstrap creates .env from .env.example when needed and installs all
PDM extras. See infra/README.md for Compose details.
make infra-test-postgres runs the real async Postgres E2E path and the CLI
smoke path against Docker Compose Postgres.
If Docker is not installed but .env points at a reachable Postgres server,
make infra-up falls back to ooai-persistence ensure-postgres and creates the
configured database if needed.
Default backend behavior
By default, checkpointer and store use backend="auto".
auto resolves in this order:
- async Postgres when configured
- async SQLite when configured
- async MongoDB when configured
- async Redis when configured
- in-memory fallback
Serializer allowlist registry
The package includes a reusable strict-msgpack registry:
from ooai_persistence.serde.registry import MsgpackAllowlistRegistry
registry = MsgpackAllowlistRegistry()
registry.register_symbol("my_app.models", "WorkflowState")
registry.register_type(MyPersistedModel)
registry.register_import_string("my_app.models:AnotherPersistedModel")
That registry can be passed into the persistence context:
from ooai_persistence import AppSettings, open_persistence
settings = AppSettings()
async with open_persistence(settings, registry=registry) as bundle:
...
Documentation and release checks
pdm run sphinx-build -W -b html docs docs/_build/html
pdm build
CI runs formatting, linting, typing, tests with coverage, and the Sphinx build.
Docs also publish from main to GitHub Pages.
Releasing
Releases are tag-driven:
pdm lock --check
make check
git tag v0.2.0
git push origin v0.2.0
The release workflow verifies that the tag matches pyproject.toml, runs the
async Postgres E2E checks, builds the wheel/sdist, publishes through PyPI
Trusted Publishing, and creates a GitHub Release with artifacts attached.
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
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 ooai_persistence-0.2.1.tar.gz.
File metadata
- Download URL: ooai_persistence-0.2.1.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92938922b0ef3f0b4b6a1b2e2acb929d19ccf425fc8343202b347d34218210be
|
|
| MD5 |
a267201a75683ac644e60c874d54949c
|
|
| BLAKE2b-256 |
48d29598d239bfbd1da8e927a20d68b311efe47c4f96ce690de464264b417992
|
Provenance
The following attestation bundles were made for ooai_persistence-0.2.1.tar.gz:
Publisher:
release.yml on pr1m8/ooai-persistence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ooai_persistence-0.2.1.tar.gz -
Subject digest:
92938922b0ef3f0b4b6a1b2e2acb929d19ccf425fc8343202b347d34218210be - Sigstore transparency entry: 1438572360
- Sigstore integration time:
-
Permalink:
pr1m8/ooai-persistence@25fd4ac1a76386a5d680bfb18cfde49277d8d8be -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pr1m8
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@25fd4ac1a76386a5d680bfb18cfde49277d8d8be -
Trigger Event:
push
-
Statement type:
File details
Details for the file ooai_persistence-0.2.1-py3-none-any.whl.
File metadata
- Download URL: ooai_persistence-0.2.1-py3-none-any.whl
- Upload date:
- Size: 19.2 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 |
5a3fc888a9d837a2d38902e27515af57a57224867ba84eed064c4c6f3fff1526
|
|
| MD5 |
2c1d50d6da384fa9a35086b84d5b16e5
|
|
| BLAKE2b-256 |
7438f731d837c9a9c3ec361d55f1a9a235e04cf146f8c2276286992e83e64a9b
|
Provenance
The following attestation bundles were made for ooai_persistence-0.2.1-py3-none-any.whl:
Publisher:
release.yml on pr1m8/ooai-persistence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ooai_persistence-0.2.1-py3-none-any.whl -
Subject digest:
5a3fc888a9d837a2d38902e27515af57a57224867ba84eed064c4c6f3fff1526 - Sigstore transparency entry: 1438572366
- Sigstore integration time:
-
Permalink:
pr1m8/ooai-persistence@25fd4ac1a76386a5d680bfb18cfde49277d8d8be -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pr1m8
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@25fd4ac1a76386a5d680bfb18cfde49277d8d8be -
Trigger Event:
push
-
Statement type: