Skip to main content

Synap memory integration for LangGraph — BaseStore + BaseCheckpointSaver

Project description

synap-langgraph

Synap memory integration for LangGraph.

Install

pip install synap-langgraph

Requires langgraph>=1.0, maximem-synap>=0.2.0.

What's in the box

  • SynapStore — implements LangGraph's BaseStore for cross-thread long-term memory. Semantic search via store.search(namespace, query=...) routes to sdk.fetch(...), so your graph nodes get Synap-powered recall out of the box.

    • User or customer scope. Pass user_id for private per-user memory, or just a customer_id (no user_id) for a customer-wide shared pool visible to every user in the deployment.
    • All memory types. Reads surface facts and preferences (plus episodes / emotions / temporal events), so stated preferences aren't dropped.
    • Anticipation (optional). Construct with include_conversation_context=True and feed turns via store.record_message(conversation_id, role, content) so just-stated context is in play on the next read. (This lives alongside the BaseStore API — anticipation has no key/value analogue.)
  • SynapCheckpointSaver — implements BaseCheckpointSaver with best-effort fuzzy retrieval. Checkpoint writes succeed durably; reads use sdk.fetch which is semantic-search shaped rather than exact KV. Use for observability/audit and demo flows. For production checkpoint durability, pair with SqliteSaver / PostgresSaver.

  • create_synap_node — re-exported from synap-langchain for users who discovered our LangGraph support through the LangChain package. This is the canonical home.

Quickstart

from langgraph.graph import StateGraph, START, END
from maximem_synap import MaximemSynapSDK
from synap_langgraph import SynapStore, SynapCheckpointSaver

sdk = MaximemSynapSDK(api_key="sk-...")

store = SynapStore(sdk, user_id="alice", customer_id="acme")
saver = SynapCheckpointSaver(sdk, user_id="alice", customer_id="acme")

graph = StateGraph(MyState)
# ... add nodes / edges ...
app = graph.compile(checkpointer=saver, store=store)

# Store usage inside a node:
async def remember(state, runtime):
    await runtime.store.aput(
        ("alice", "preferences"),
        "language",
        {"value": "English"},
    )

Error policy

  • Writes (SynapStore.put, SynapCheckpointSaver.put, put_writes) surface SDK failures as SynapIntegrationError. Silent drops would hide ingestion outages.
  • Reads (get, search, get_tuple, list) degrade gracefully — they log at ERROR and return None/[] rather than crashing the graph.
  • Deletes (SynapStore.delete, SynapCheckpointSaver.delete_thread) warn once and no-op — Synap has no public delete API.

Note on exact key lookups. get/search match memories by custom metadata markers. On instances that strip custom metadata during extraction (e.g. MACA atomization), exact-key get is unreliable and a one-time warning is logged — semantic search remains the reliable path. Job/document-level attribution (mapping fragments back to a source id) is not done in the store; build it in app code from the ids returned at write time.

When to use which checkpointer

Goal Saver
Durable thread checkpoints, exact restore LangGraph's SqliteSaver or PostgresSaver
Thread state surfaced in Synap for observability/audit/cross-thread analysis SynapCheckpointSaver
Both Use Sqlite/Postgres as primary; layer SynapCheckpointSaver for the Synap view

Cross-thread long-term memory (BaseStore) maps cleanly to Synap — use SynapStore as your default.

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

maximem_synap_langgraph-0.3.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

maximem_synap_langgraph-0.3.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file maximem_synap_langgraph-0.3.1.tar.gz.

File metadata

  • Download URL: maximem_synap_langgraph-0.3.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for maximem_synap_langgraph-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d700f2e81083fa631504e0447e149e22b7c19dc2f8544e8888fdbc0105f2c6fd
MD5 0cf9ec4462add74ccba406dde6d177c0
BLAKE2b-256 76b77932632b611c20aa1915084455c74a2f3116c78d1e630a1b03b995cefa2d

See more details on using hashes here.

File details

Details for the file maximem_synap_langgraph-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for maximem_synap_langgraph-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82e27114da13fbd7eb5d6ff59467391be2f59dbe8531fd79e80ceb6425fe6014
MD5 1e79d754e218d9d907e2d19561eed3fe
BLAKE2b-256 13db16d2a363d4e3d0bbb96ac7692f791f450f9ddef04f46438b5dcce4af71b2

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