LangGraph Quickstart
Install
pip install remembr langgraph langchain-openai
Initialize
from remembr import RemembrClient
from adapters.langgraph.remembr_langgraph_memory import RemembrLangGraphCheckpointer
client = RemembrClient(api_key="rk_demo", base_url="http://localhost:8000/api/v1")
checkpointer = RemembrLangGraphCheckpointer(client=client, session_id="thread-42")
Store
checkpoint = checkpointer.put(
config={"configurable": {"thread_id": "thread-42"}},
checkpoint={"id": "cp-1", "channel_values": {"messages": ["research completed"]}},
metadata={},
)
print(checkpoint)
Search
restored = checkpointer.get({"configurable": {"thread_id": "thread-42"}})
print(restored)
Delete
import asyncio
async def clear() -> None:
await client.forget_session("thread-42")
asyncio.run(clear())
Real sample
from langgraph.graph import END, START, StateGraph
from remembr import RemembrClient
from adapters.langgraph.remembr_langgraph_memory import RemembrLangGraphCheckpointer
def step(state: dict) -> dict:
state["messages"] = state.get("messages", []) + ["researched answer"]
return state
builder = StateGraph(dict)
builder.add_node("step", step)
builder.add_edge(START, "step")
builder.add_edge("step", END)
client = RemembrClient(api_key="rk_demo", base_url="http://localhost:8000/api/v1")
graph = builder.compile(
checkpointer=RemembrLangGraphCheckpointer(client=client, session_id="thread-42")
)
result = graph.invoke({"messages": []}, config={"configurable": {"thread_id": "thread-42"}})
print(result)