LangGraph/Persistence
Intermediate8 min

Thread IDs & Multi-Session

Thread IDs isolate conversations. One graph, many users, each with their own state history.

Quick Reference

  • Thread ID: a string passed in config={'configurable': {'thread_id': 'abc'}} on every invoke
  • Each thread has its own independent state history — no cross-contamination
  • Same compiled graph serves all threads — no need to re-compile per user
  • Thread namespacing: combine user_id + session_id for multi-tenant isolation
  • List threads via checkpointer.list() to inspect or clean up old sessions

What Are Threads?

Thread = isolated conversation

A thread is an isolated conversation identified by a string ID. Each thread has its own state history, its own checkpoint chain, and its own position in the graph. Two threads running on the same compiled graph share nothing.

Passing a thread_id on every call

When a checkpointer is enabled, thread_id is mandatory. Every invoke() and stream() call must include it in the config. Omitting it raises an error. The thread_id is a plain string -- you control the format and semantics.