Conversations, agent state, and user memory
Words made simple
A few useful meanings before you read the explanation.
- State
- The data describing where a workflow is now, what it already knows, and what still needs to happen.
- Schema
- A description of the fields and value types that data should contain. It helps check that an answer has the expected shape.
- Authorization
- Checking what that identity is allowed to read or do. Being logged in does not grant access to every record.
More words from this lesson
- Tenant
- A customer or organization whose data must stay separate from other customers in a shared application.
- Chunking
- Dividing a long document into smaller pieces so relevant parts can be found and sent to the model.
Overview
- MongoDB collections can store conversation messages, task/run state, approved preferences, and memory records.
- A LangGraph checkpointer requires its expected integration contract rather than an arbitrary collection called
memory. - Business claims remain authoritative domain records.
Why this matters
These data types need different updates, query patterns, and retention.
An everyday example
Keep conversations, task checklists, and customer profiles in different sections of the filing system.
A technical example
conversations, messages, runs, approvals, user_memories, documents, and chunks have distinct schemas.
How it works
- Derive tenant/user
- Query specific collection
- Validate ownership
- Update with concurrency rules
- Project minimal context.
Architecture and flow
Node services → scoped collections → context builder / workflow / audit.
The insurance assistant example
Memory stores a confirmed language preference; approval stores exact draft authorization; claim status comes from the claim backend.
When to use it
Existing MongoDB application data when schemas and operational requirements fit.
When to avoid it
Avoid one indefinitely growing array containing every message and graph event.
Interview answer
“I model messages, task state, approvals, and memory separately and keep all access tenant/user scoped.”
Benefits, trade-offs, and production considerations
- Use bounded documents, pagination, appropriate TTLs, and optimistic concurrency.
- TTL expiry is not immediate and is not the whole deletion policy.
- Retention for audit records may differ from chat history.
Can you explain it without the notes?
Conversations, agent state, and user memory
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
MongoDB collections can store conversation messages, task/run state, approved preferences, and memory records. A LangGraph checkpointer requires its expected integration contract rather than an arbitrary collection called memory. Business claims remain…
Turn this concept into a clear answer.
Practice this conceptKeep connecting the ideas.
Next lesson: Multi-tenancy and comparison with PostgreSQL + pgvectorAdapted from 13_AI.MD · “Conversations, agent state, and user memory”. Examples are study fragments; framework behavior can depend on your version.