Install any skill in seconds. Free to start, no credit card required.
Get Started Free →jeremylongshore/langchain-langgraph-checkpointing
Persist LangGraph agent state correctly with MemorySaver and PostgresSaver — thread_id discipline, JSON-serializable state rules, time-travel, schema migration.
Passed 21 of 23 test cases with the skill, and 18 of 23 without it.
and 3 more in the full report
3 fixed18 passed either way2 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 3 test cases the skill fixed. Same model, same prompt, with and without the skill.
I'm building a LangGraph multi-turn agent in Python, but my workflow loses context between API calls and fails during interrupts when holding non-primitive data like datetime objects. Could you write a Python snippet that defines a strict JSON-safe state dictionary, includes a helper function to convert custom data types before saving, and creates a middleware function that raises an explicit error if the required conversation routing configuration is missing from a graph invocation?
| Checked | Without skill | With skill |
|---|---|---|
| The middleware validates thread_id from config before graph invocation at the application boundary rather than inside a graph node | Missed | Passed |
| The AgentState dictionary types the messages key using Annotated with add_messages and AnyMessage | Missed | Passed |
| The validation function raises ValueError when thread_id is missing from config | Missed | Passed |
The instructions your model reads when the skill loads.
A chat agent that "keeps introducing itself" is almost always P16. The caller
invokes graph.invoke(state) without passing config={"configurable": {"thread_id": ...}} — LangGraph's checkpointer silently spawns a fresh state per
call. No error, no warning, no log line. The user sees it; the code does not.
That is one of five separate checkpointing pitfalls this skill covers:
thread_id silently resets memoryinterrupt_before raises TypeError when state holds non-JSON values
(datetime, Decimal, custom classes) — and it raises at the interrupt
boundary, not when the bad value was first assigned, so the traceback points
at the wrong linePostgresSaver does not auto-migrate checkpoint schema; upgrading
langgraph silently reads old checkpoints as empty stateConversationBufferMemory and the rest of legacy chat memory were
removed in LangChain 1.0; checkpointers are the replacementstate["files"] grows unboundedly
and eventually makes checkpoint writes a latency hotspotThis skill walks through picking a checkpointer by environment, enforcing
thread_id at the application boundary, constraining state to JSON-safe
primitives, Postgres setup + migration, and time-travel for incident debugging.
Pinned to langgraph >= 1.0, < 2.0, langgraph-checkpoint-postgres >= 1.0, < 2.0. Pain-catalog anchors: P16, P17, P18, P20, P22, P40, P51.
pip install langgraph langchain-core (both >= 1.0, < 2.0)pip install langgraph-checkpoint-postgres and a Postgres 13+
instanceasyncpgthread_id strategy — typically a UUID4 string per conversation; see
thread-id-discipline.mdtest cases passed, vs 18 / 23 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.