Skip to main content

LangGraph BaseStore adapter for Lithtrix agent memory

Project description

lithtrix-langgraph

LangGraph BaseStore adapter that persists long-term agent memory via the Lithtrix HTTP API.

Install

cd lithtrix-langgraph
pip install -e '.[dev]'

Environment

Variable Required Default
LITHTRIX_API_KEY Yes
LITHTRIX_API_URL No https://api.lithtrix.ai

Constructor kwargs api_key / api_url override env vars (useful in tests).

Usage

from lithtrix_langgraph import LithtrixStore

store = LithtrixStore()
item = store.get(("my-agent",), "notes")
store.put(("my-agent",), "notes", {"text": "hello"})

Compile a LangGraph graph with store=LithtrixStore(...) to give nodes access to the same store API.

Key mapping

Lithtrix keys are flat strings (1–128 chars, charset [a-zA-Z0-9-_.:]).

LangGraph call Lithtrix key
get((), "deerflow:rung1:mcp-interop-2025:findings") deerflow:rung1:mcp-interop-2025:findings
get(("deerflow", "rung1", "mcp-interop-2025"), "findings") same

Empty namespace passes the key through unchanged so DeerFlow Rung 1 flat keys remain readable.

Values

  • Put: LangGraph values are dictPUT /v1/memory/{key} with body {"value": <dict>}. Serialized size is checked locally at 512 KiB before HTTP (mirrors API MEMORY_VALUE_TOO_LARGE / HTTP 413).
  • Get: JSON objects are returned as-is. String/number/array payloads (DeerFlow Rung 1) are wrapped as {"content": <raw>}.
  • Timestamps: Uses Lithtrix created_at / updated_at when present; otherwise datetime.now(UTC) on read.
  • TTL: supports_ttl = False; PutOp.ttl is ignored.

SearchOp supported subset

Feature Support
namespace_prefix Yes → Lithtrix list prefix
query (semantic) Yes → GET /v1/memory/search
limit / offset Yes (best-effort pagination)
filter with query Partial — exact top-level match applied client-side after semantic search
filter without query Partial — list keys under prefix, fetch values, exact match only
$eq / $ne / $gt / … No — raises NotImplementedError
Cross-namespace search No

HTTP errors

401/403/413/422 responses propagate as LithtrixAPIError with error_code when the API returns structured JSON (e.g. MEMORY_VALUE_TOO_LARGE).

Tests

cd lithtrix-langgraph && python -m pytest -q

All tests mock HTTP; no live API calls in the default suite.

Phoenix harness (cross-framework proof)

Optional live run — requires LITHTRIX_API_KEY (uses real API credits):

export LITHTRIX_API_KEY=ltx_...
python scripts/langgraph_phoenix_harness.py --help
python scripts/langgraph_phoenix_harness.py --out /tmp/phoenix_metrics.json

Proves DeerFlow-path flat key write → LangGraph LithtrixStore.get((), MEMORY_KEY) read on the same agent. Default CI tests mock the harness logic (tests/test_phoenix_harness_logic.py).

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

lithtrix_langgraph-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

lithtrix_langgraph-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lithtrix_langgraph-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for lithtrix_langgraph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3519e19a2cbd26e1c46e386803c0f0a57545ec26ca91a40583a9a1a70800aab
MD5 3dfd87149ecafdcfe2a9b27fc96aa06a
BLAKE2b-256 73f7de459fc649d4bd354ccae62fd685f90b4446976052d547ec3d8e72dcd67c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lithtrix_langgraph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90d9c6d237d67adfab99084eed4311fcb38c4b02984b1f76666720bd7d640ff1
MD5 810732e69f7be0aab59247f4f46108c4
BLAKE2b-256 f6a9a0bf8c32486e7672954df8e5f81bff48f345ecadbfb68fe55e8c6d6b07e0

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