Make LangGraph state graphs durable and aware of long-term context. Synap stores thread checkpoints so conversations survive restarts, and exposes a cross-threadDocumentation Index
Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
Use this file to discover all available pages before exploring further.
BaseStore that any graph node can read and write.
Overview
This guide shows how to plug Synap into a LangGraph application to build graphs that:- Persist their thread state across processes and restarts
- Resume any conversation by its
thread_idwithout losing context - Share long-term memory (user preferences, facts, episodes) across all threads belonging to the same user
| Component | LangGraph interface | Purpose |
|---|---|---|
SynapCheckpointSaver | BaseCheckpointSaver | Thread-level checkpoint persistence per thread_id |
SynapStore | BaseStore | Cross-thread long-term memory accessible from any node |
Setup
Install the package alongside LangGraph:.env
Basic integration
The smallest useful integration replaces LangGraph’s in-memory checkpointer withSynapCheckpointSaver. Compile your graph with the saver, then invoke it as usual — every node transition is persisted, and the next invocation with the same thread_id resumes from the last checkpoint:
ainvoke again with the same thread_id, and the graph picks up where it left off. Checkpoint retrieval failures degrade gracefully — the graph starts from an empty state and the error is logged.
This covers per-thread durability. To give your graph access to memories outside a single thread, layer in SynapStore below.
Core concepts
Thread checkpoints
SynapCheckpointSaver implements LangGraph’s BaseCheckpointSaver interface. Every state transition the graph commits is sent to Synap and tagged with the active thread_id:
thread_id you pass through config.configurable.thread_id maps one-to-one to a Synap conversation. Replaying a thread is just another ainvoke with the same thread_id — Synap returns the stored checkpoint and LangGraph rehydrates state from it.
In addition to exact-thread replay, the saver supports fuzzy retrieval: when no checkpoint exists for a thread_id, Synap can return the closest semantically-similar thread for the user. This is useful for “continue where I left off”-style flows that do not pin a thread ID up front.
Cross-thread memory
SynapStore implements BaseStore and gives every node in the graph access to long-term memory that spans all of the user’s threads:
store keyword argument that LangGraph injects:
("user", "alice") above) scopes reads and writes to a particular memory partition. Use ("user", user_id) for per-user memory and ("customer", customer_id) for tenant-wide memory. Read Memory Scopes for the full hierarchy.
Complete example: agent that remembers across threads
The following graph wires both components together. Each thread is durable on its own, and the assistant can recall facts from earlier conversations the same user had under a differentthread_id:
SynapCheckpointSaverlets the graph resume mid-conversation bythread_id— even after a restart.SynapStoreis read inrecalland written inremember, so each thread enriches a shared user-level memory pool.- Memory and thread state are independent — you can drop the store and keep just the checkpointer (or vice versa) and the graph still works.
Advanced patterns
Multi-tenant scoping
Both components accept the same scoping triple —user_id, optional customer_id, optional conversation_id — and namespace store entries with tuples like ("user", user_id) or ("customer", customer_id). customer_id is required on B2B Synap instances and ignored on single-tenant ones. See Memory Scopes.
Streaming with persistence
The checkpointer is fully compatible withastream, so token-by-token streaming and durable state are not mutually exclusive:
SynapCheckpointSaver.
Failure semantics
SynapCheckpointSaver and SynapStore follow the Synap integration contract:
- Read failures degrade gracefully —
aget,asearch, and checkpoint loads return empty results and log an error, so the graph keeps running. - Write failures surface explicitly —
aputand checkpoint commits raiseSynapIntegrationErrorso callers know if persistence failed.
Next steps
LangChain
Memory, retriever, and tools for LangChain chains and agents.
Memory Scopes
How
user_id, customer_id, and namespaces interact across stores.Context Fetch
The retrieval API that powers
SynapStore.asearch.Ingestion
Direct ingestion API for pipelines that need finer control than the store.