Skip to main content

TinkerFin LangGraph Store

Persistent LangGraph memory with asynchronous reads, atomic batches, structured search, and namespace listing. SQLite, PostgreSQL, and MySQL use the same query and batch API.

Installation

pip install "tinkerfin-langgraph-store[sqlalchemy]" aiosqlite

Choose asyncpg for PostgreSQL or asyncmy for MySQL. Supply a SQLAlchemy AsyncEngine configured with that driver.

Quick start

import asyncio

from sqlalchemy.ext.asyncio import create_async_engine
from tinkerfin_langgraph_store import SqlAlchemyStore


async def main() -> None:
    engine = create_async_engine("sqlite+aiosqlite:///memory.db")
    try:
        async with SqlAlchemyStore(engine) as store:
            await store.aput(("users", "alice"), "preferences", {"language": "en"})
            item = await store.aget(("users", "alice"), "preferences")
            print(item.value if item else None)
            matches = await store.asearch(("users",), filter={"language": "en"})
            print([item.namespace for item in matches])
    finally:
        await engine.dispose()


asyncio.run(main())

Pass the Store to TinkerFin(store=store).with_namespace(...).build(model=...) to isolate memory by Runtime namespace. The caller owns the Engine. Closing the Store waits for accepted operations and does not close the Engine. Setup is automatic; await store.setup() can validate storage at application startup.

Stored data and queries

  • aget, aput, adelete, and abatch use complete namespace/key identities. A batch reads one snapshot before writing; the final write to each key wins. Updates preserve created_at.
  • acompare_and_set(namespace, key, expected=observed, value=replacement) commits only when the complete JSON value still matches. expected=None requires absence; value=None deletes. A conflict returns False without changing data. Conditions are checked in the write transaction across Store instances.
  • asearch_exact(namespace, limit=100, offset=0) pages one collection and excludes descendant namespaces before pagination. It returns independent DocumentSnapshot values from tinkerfin_contracts.storage, ordered by update time descending and then key ascending.
  • asearch matches a literal namespace prefix. Results sort by updated_at descending, then namespace and key ascending. limit and offset apply after filtering.
  • Filters use literal top-level field names. $eq and $ne compare typed JSON values; use $eq for an object value. Missing fields match neither operator. Null differs from missing, booleans differ from numbers, and object key order does not affect equality. Integral floats equal their corresponding integers.
  • $gt, $gte, $lt, and $lte compare numbers at binary64 precision. Operands must be finite numbers within that range. Multiple fields and operators combine with AND.
  • alist_namespaces matches complete paths before max_depth, deduplication, sorting, and pagination. Its * matches one label; search treats * literally. Only namespaces containing documents appear.

Namespaces follow LangGraph's label rules. Namespace, key, and document sizes are subject to the database's payload and resource limits. Document values must be finite JSON objects. TTL, semantic search, vector indexing, and synchronous database calls are unsupported.

Use a pool with exclusive checkouts. File SQLite Engines use one by default; in-memory SQLite needs AsyncAdaptedQueuePool(pool_size=1, max_overflow=0). Existing tables and indexes must match the complete current structure.

Documentation and license

TinkerFin documentation · MIT License · NOTICE

Metadata

Release files for tinkerfin-langgraph-store 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tinkerfin-langgraph-store 0.1.1
File Size Uploaded
tinkerfin_langgraph_store-0.1.1.tar.gz 28.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tinkerfin-langgraph-store 0.1.1
File Interpreter ABI Platform
tinkerfin_langgraph_store-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.0 kB

Release files / tinkerfin_langgraph_store-0.1.1.tar.gz

Download URL tinkerfin_langgraph_store-0.1.1.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c45c70782d4597b1e37f093f3ff6311d21c1dfb41a885603c40a67cd6d5fa9d8
BLAKE2b-256 checksum
How to use checksums
2227d350b87a2b152625172f961a2fe110b22e046a8ebfd0f9353948816ca765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tinkerfin_langgraph_store-0.1.1-py3-none-any.whl

Download URL tinkerfin_langgraph_store-0.1.1-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fcccf31d5b6d37677ef4442fe69ae121415bd50f1647059a58990e9edfc4e46
BLAKE2b-256 checksum
How to use checksums
4f7de516276ddd90cfef4f11930de337c1312953b01212b27eb3aa051d62f42f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release 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