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
state = agent.get_state({"configurable": {"thread_id": "ravi-1"}})
state.values["messages"] # every message saved for that threadTwo messages on one thread
Send two messages on the same thread. Both are Ravi's, on ravi-1.
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 threadReading the thread back
Read the thread back with get_state. It returns everything the checkpointer saved for that thread id.
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 storedRunning two messages, then reading the thread
Two messages, then a look at what the thread holds.
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 id | Reuse another's thread id | |
|---|---|---|
| What the model sees | Only that thread's messages | Another customer's messages |
| The card number | Masked before saving | Masked before saving |
| The result | Customers stay separate | One 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.
Related
- Previous: A morning at the desk
- Next: Testing the desk agent
- Reference: Short-term memory
Try it yourself
- Print
state.values["messages"][-1].textand compare it with whatsayprinted. - 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.