Default created agent does not remember the conversation. For example if
I tell agent "My name is X" and then later ask my name, agent will not
remember it.
We can create a thread_id and pass that to agent which represents entire
conversation to rememember.
When we compile an agent with a checkpointer (like InMemorySaver), LangGraph wraps the execution flow in a state machine database loop.
[ Client Request ] ── (thread_id: "1", new_message)
│
▼
┌──────────────────────┐
│ Checkpointer │
└──────────┬───────────┘
│ Fetch latest state for thread_id "1"
▼
┌──────────────────────────┐
│ Current State (List) │
│ - Human: I am Amit... │
│ - AI: Nice to meet... │
│ + Human: What's my color│ <-- Appended
└────────────┬─────────────┘
│
▼
┌──────────────────────┐
│ LLM Invocation │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Checkpointer │
└──────────────────────┘
Save updated state back to "1"