Skip to main content

LangGraph BaseStore implementation backed by TypeDB 3.x

Project description

langgraph-store-typedb

A LangGraph BaseStore implementation backed by TypeDB 3.x.

Stores LangGraph memory items as opaque JSON blobs keyed by (namespace, key).

Install

pip install langgraph-store-typedb

Requires Python 3.11+ and a TypeDB 3.8+ server.

Quickstart

from typedb.driver import TypeDB, Credentials, DriverOptions, DriverTlsConfig
from langgraph_store_typedb import TypeDBStore

driver = TypeDB.driver(
    "localhost:1729",
    Credentials("admin", "password"),
    DriverOptions(DriverTlsConfig.disabled()),
)
store = TypeDBStore(driver, database="langgraph_memory")
store.ensure_database()
store.ensure_schema()

store.put(("users", "alice"), "pref-1", {"theme": "dark"})
item = store.get(("users", "alice"), "pref-1")
print(item.value)  # {'theme': 'dark'}

The store does not own the driver lifecycle — call driver.close() yourself when done.

Schema

Memory items are stored as a single entity type memory with attributes namespace_path (@key), ns_depth, mem_key, value_json, created_at, updated_at. See src/langgraph_store_typedb/resources/schema.tql.

namespace_path joins the namespace tuple with : and separates the key with / — e.g. ("users", "alice") + key pref-1 is stored as users:alice/pref-1. Namespace components and keys must not contain : or /.

Async

from langgraph_store_typedb import AsyncTypeDBStore, TypeDBStore

sync = TypeDBStore(driver, database="langgraph_memory")
sync.ensure_database()
sync.ensure_schema()
astore = AsyncTypeDBStore(sync)

await astore.aput(("users", "alice"), "pref-1", {"theme": "dark"})

AsyncTypeDBStore is a thin wrapper that offloads each operation to a thread via asyncio.to_thread. The underlying TypeDB Python driver is synchronous-only.

Limitations (v0.1)

Feature Status
search(query=...) (semantic) Not supported — raises NotImplementedError
index= on put Only None/False accepted; non-False raises NotImplementedError
ttl on put Silently ignored
filter= operators ($gt, $contains, …) Top-level exact match only
Wildcard * in list_namespaces paths Raises NotImplementedError
Atomic batch across ops Each op runs in its own transaction

License

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

langgraph_store_typedb-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for langgraph_store_typedb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48a46228ee294d52b69b356d27e907c176a836966b7a59fbc0da2b9950ad2c86
MD5 bead7533fd88cb1225a87cc9bf73f726
BLAKE2b-256 2fc3455ac5bef8df56582dd6c94123ac074b431301a60ace1b90cc8e691f1808

See more details on using hashes here.

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