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'sBaseStorefor cross-thread long-term memory. Semantic search viastore.search(namespace, query=...)routes tosdk.fetch(...), so your graph nodes get Synap-powered recall out of the box.- User or customer scope. Pass
user_idfor private per-user memory, or just acustomer_id(nouser_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=Trueand feed turns viastore.record_message(conversation_id, role, content)so just-stated context is in play on the next read. (This lives alongside theBaseStoreAPI — anticipation has no key/value analogue.)
- User or customer scope. Pass
-
SynapCheckpointSaver— implementsBaseCheckpointSaverwith best-effort fuzzy retrieval. Checkpoint writes succeed durably; reads usesdk.fetchwhich is semantic-search shaped rather than exact KV. Use for observability/audit and demo flows. For production checkpoint durability, pair withSqliteSaver/PostgresSaver. -
create_synap_node— re-exported fromsynap-langchainfor 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 asSynapIntegrationError. Silent drops would hide ingestion outages. - Reads (
get,search,get_tuple,list) degrade gracefully — they log atERRORand returnNone/[]rather than crashing the graph. - Deletes (
SynapStore.delete,SynapCheckpointSaver.delete_thread) warn once and no-op — Synap has no public delete API.
Note on metadata-stripping backends.
get/searchidentify items by custom metadata markers. On instances that atomize content during extraction (e.g. MACA), those markers are stripped, so:
searchfalls back to returning the scope-filtered results Synap ranked (semantic retrieval still works). Scope (user_id/customer_id) is enforced at the fetch layer, but sub-namespace isolation within a scope is not. A one-time warning is logged. SetSynapStore(..., semantic_fallback=False)for strict namespace semantics (search returns[]when markers are absent).get(exact key) returnsNone— there's no reliable way to resolve an exact key without the markers. Usesearchas the read path.Job/document-level attribution (mapping fragments back to a source id) is not done in the store; build it in app code.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maximem_synap_langgraph-0.3.2.tar.gz.
File metadata
- Download URL: maximem_synap_langgraph-0.3.2.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0158dea7b30fd1bda7c4d5bd48557f2faa0fa3f2407ad3a10b79e541049eff93
|
|
| MD5 |
1d897be491c3b13442486c28eaba8df6
|
|
| BLAKE2b-256 |
246d90b9518d92b10262bc5f28e42aa9ea679faf6270f75b1b365488c0de0350
|
File details
Details for the file maximem_synap_langgraph-0.3.2-py3-none-any.whl.
File metadata
- Download URL: maximem_synap_langgraph-0.3.2-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
567a6d41dcc6725ef7d05e033827d0c44a92b637c66cbac29ea6e3e360b6d0db
|
|
| MD5 |
19a51331a70ce50245a3fffcd4018568
|
|
| BLAKE2b-256 |
6126419deb4d1b4c9ca40c60212cacbd5e213493f45d6a7c2978d498c08aa620
|