Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers LangGraph checkpointing: MemorySaver/PostgresSaver setup, thread_id use, JSON-safe state, schema migration, time-travel debugging.
78% 91%+13 ptsof test cases passed
Passed 21 of 23 test cases with the skill, and 18 of 23 without it.
We are defining our agent state schema using TypedDict. Our state includes message history, turn counts, last user action timestamps, and transaction price data. How should non-primitive types be handled to avoid serialization errors during human-in-the-loop interrupts?
Message history is typed using Annotated with AnyMessage list and add_messages reducer
3 of 3 safety checks passed
thread_id Discipline — Fail Loud On Missing, Scope Per TenantP16 is the single most common LangGraph production incident: multi-turn agent "forgets everything" because the caller never passed
thread_id. No error raised, no log line. Every invocation gets a freshMemorySaver/PostgresSaverentry under a blank key.
LangGraph's checkpointer reads config["configurable"]["thread_id"] at invoke time. If the key is missing, the checkpointer either (a) uses None as the thread key (which is valid from the DB's perspective — it just maps to a specific row that all "no thread" calls share across tenants, which is worse than no memory), or (b) creates a fresh transient state. Neither path raises. The conversation history from turn 1 vanishes by turn 2 and the only signal is user-visible: "the bot keeps introducing itself."
Wrap your entry point. Refuse to call graph.invoke / graph.ainvoke without a thread_id.
from typing import Any
def require_thread_id(config: dict[str, Any]) -> dict[str, Any]:
"""Raise if thread_id is missing. Return config unchanged otherwise.
Call this at every application boundary before invoking the graph.
Fails loudly so P16 surfaces in tests, not in production conversation logs.
"""
configurable = (config or {}).get("configurable", {})
thread_id = configurable.get("thread_id")
if not thread_id:
raise ValueError(
"thread_id missing from config['configurable']. "
"Every graph invocation must carry a thread_id for checkpointing. "
"See langchain-langgraph-checkpointing skill."
)
if not isinstance(thread_id, str):
raise TypeError(
f"thread_id must be str (typically a UUID string), got {type(thread_id).__name__}"
)
return config
Attach it at every call site:
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.