| Mechanism | Purpose | In-memory / local | DB-persisted | Notes |
|---|---|---|---|---|
MemorySaver |
Persist graph state per step (thread continuity) | ✅ Yes | ❌ No | Notebook/dev only; lost on process restart |
PostgresSaver |
Durable execution state | ❌ No | ✅ Postgres | Required for resumable workflows, HITL, failures |
| (others) | (Future / custom savers) | — | — | Checkpointer interface is pluggable |
What it stores
- Full graph state
- Current node
- Messages / flags / intermediate state
Key idea
Checkpointers persist execution, not knowledge.
| Mechanism | Purpose | In-memory / local | DB-persisted | Notes |
|---|---|---|---|---|
InMemoryStore |
Cross-thread memory items | ✅ Yes | ❌ No | Process-local KV store |
PostgresStore |
Durable memory items | ❌ No | ✅ Postgres | Production default |
| (custom store) | S3, Redis, etc. | Depends | Depends | Implement BaseStore |
What it stores
- Arbitrary key/value objects
- Namespaced by tuples (e.g.
(user_id, "profile")) - Optional embedding indexes
Key idea
Stores persist agent memory, not execution flow.
| Mechanism | Purpose | In-memory / local | DB-persisted | Notes |
|---|---|---|---|---|
InMemoryStore + embeddings |
Semantic recall | ✅ Yes | ❌ No | Embeddings live in RAM |
PostgresStore + embeddings |
Durable semantic memory | ❌ No | ✅ Postgres | Requires vector support |
| External vector DB (pattern) | Large-scale semantic memory | ❌ No | ✅ External | LangGraph does not mandate one |
What it stores
- Text or structured blobs
- Vector embeddings
- Retrieved via
store.search()
Key idea
Semantic memory is a capability of the store, not a separate primitive.
| Mechanism | Purpose | In-memory / local | DB-persisted | Notes |
|---|---|---|---|---|
| Store-backed episodes | Recall past interactions | ✅ Yes (InMemoryStore) | ✅ Yes (PostgresStore) | Pattern implemented on top of Store |
| Few-shot injection | Condition LLM behavior | N/A | N/A | Prompt-time use only |
What it stores
- Past interactions
- Outcomes / feedback
- Free-form or structured episode records
Key idea
Episodic memory is modeled data + retrieval, not a LangGraph primitive.
| Mechanism | Purpose | In-memory / local | DB-persisted | Notes |
|---|---|---|---|---|
| Store-backed instructions | Agent behavior policy | ✅ Yes | ✅ Yes | Often versioned text blobs |
| Reflection node | Self-modification | N/A | N/A | Writes updated policy to Store |
What it stores
- Instructions
- Policies
- Strategy hints
Key idea
Procedural memory is policy state, externalized via Store.
| Memory category | Lives inside graph? | Lives outside graph? |
|---|---|---|
| Graph definition | ❌ | ❌ (pure code) |
| Execution state | ❌ | ✅ (checkpointer) |
| Agent memory | ❌ | ✅ (store) |
| Domain knowledge | ❌ | ❌ (should live elsewhere, e.g. Graphiti) |
LangGraph graphs are stateless. All memory is external.
| Use case | Required components |
|---|---|
| Chat continuity | PostgresSaver |
| User profiles / preferences | PostgresStore |
| Semantic RAG | PostgresStore or external vector DB |
| Learning from experience | PostgresStore |
| World model / facts | Graphiti (separate system) |