Skip to main content

Install

pip install synap-langgraph

What’s included

ClassPurpose
SynapCheckpointSaverThread-level checkpoint persistence with fuzzy retrieval
SynapStoreCross-thread long-term memory via BaseStore

SynapCheckpointSaver

Replaces LangGraph’s in-memory or SQLite checkpointer so conversation threads persist across restarts and can be retrieved by semantic similarity.
from langgraph.graph import StateGraph
from synap_langgraph import SynapCheckpointSaver

saver = SynapCheckpointSaver(sdk=sdk, user_id="alice")

graph = StateGraph(...)
# ... add nodes and edges ...
app = graph.compile(checkpointer=saver)

config = {"configurable": {"thread_id": "thread-001"}}
result = await app.ainvoke({"messages": [HumanMessage("Hello")]}, config=config)

SynapStore

Gives agents access to cross-thread long-term memory. Implements BaseStore so it works with any LangGraph construct that accepts a store.
from synap_langgraph import SynapStore, SynapCheckpointSaver

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

app = graph.compile(checkpointer=saver, store=store)
Within graph nodes, access the store through RunnableConfig:
async def my_node(state, config, *, store):
    # Retrieve cross-thread memories
    memories = await store.asearch(("user", "alice"), query="project preferences")

    # Write a new memory
    await store.aput(
        ("user", "alice"),
        key="pref-001",
        value={"content": "Prefers async communication", "type": "preference"},
    )
    return state

Using both together

from synap_langgraph import SynapStore, SynapCheckpointSaver

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

app = graph.compile(checkpointer=saver, store=store)

config = {"configurable": {"thread_id": "session-42"}}
async for event in app.astream({"messages": [HumanMessage("Hi")]}, config=config):
    print(event)

Next steps

LangChain

Memory and callbacks for LangChain chains.

LlamaIndex

BaseMemory and retriever for LlamaIndex pipelines.