LangChainLangChain 1.4 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
46 small wins to finish your pathNext lesson →

The desk's saved threads

A thread is one customer's saved conversation, held by the checkpointer, and it holds exactly what the model saw, masked card number and all.

Last updated: 27 Sep, 2026 · LangChain 1.4

The morning in lesson 35 ran across threads named ravi-1 and mei-1. This lesson opens one of them and reads what the checkpointer kept.

Reading a thread with get_state

python
state = agent.get_state({"configurable": {"thread_id": "ravi-1"}})
state.values["messages"]   # every message saved for that thread

Two messages on one thread

Send two messages on the same thread. Both are Ravi's, on ravi-1.

python
from chat import say
from desk import agent

say("ravi", "My card 4111 1111 1111 1111 was charged. Where is A17?", "ravi-1")
say("ravi", "How long does a refund take?", "ravi-1")   # same thread

Reading the thread back

Read the thread back with get_state. It returns everything the checkpointer saved for that thread id.

python
state = agent.get_state({"configurable": {"thread_id": "ravi-1"}})
print(len(state.values["messages"]), "messages saved")
print(state.values["messages"][0].text)   # the first message, as stored

Running two messages, then reading the thread

Two messages, then a look at what the thread holds.

Example
from chat import say
from desk import agent

say("ravi", "My card 4111 1111 1111 1111 was charged. Where is A17?", "ravi-1")
say("ravi", "How long does a refund take?", "ravi-1")
state = agent.get_state({"configurable": {"thread_id": "ravi-1"}})
print(len(state.values["messages"]), "messages saved")
print(state.values["messages"][0].text)

What the thread kept

  • Two questions left eight messages: each one added a question, a tool call, a tool result and an answer.
  • The first message is the card question, and the number in it is masked, because masking happened before the checkpointer ran.
  • Mei's thread holds none of this: a thread id is what separates two customers.

Passing a thread id vs reusing another's

Pass the right thread idReuse another's thread id
What the model seesOnly that thread's messagesAnother customer's messages
The card numberMasked before savingMasked before saving
The resultCustomers stay separateOne customer sees another's orders

When threads stay separate

  • Keeping each customer's conversation separate on a shared desk.
  • Auditing what the model saw, after the fact.
Watch out. The thread id is what separates two customers. Forget to pass one, or reuse another customer's, and the desk answers one person with another's orders.
Try it yourself
  • Print state.values["messages"][-1].text and compare it with what say printed.
  • Ask Ravi a third question and count the messages again.
  • Read the same thread id as Mei and see whose messages come back.

Every expert started right here.