Metadata-Version: 2.1
Name: langgraph-store-typedb
Version: 0.1.0
Summary: LangGraph BaseStore implementation backed by TypeDB 3.x
Home-page: https://github.com/typedb/langgraph-store-typedb
Author: Ganeshwara Hananda
Author-email: ganesh@typedb.com
License: MIT
Keywords: typedb langgraph langchain store memory database
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Database :: Front-Ends
Requires-Python: >=3.11,<3.13
Description-Content-Type: text/markdown
Requires-Dist: langgraph (<2.0.0,>=1.1)
Requires-Dist: typedb-driver (<4.0.0,>=3.8)

# langgraph-store-typedb

A [LangGraph](https://langchain-ai.github.io/langgraph/) `BaseStore` implementation
backed by [TypeDB 3.x](https://typedb.com/).

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

## Install

```bash
pip install langgraph-store-typedb
```

Requires Python 3.11+ and a TypeDB 3.8+ server.

## Quickstart

```python
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

```python
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
