Short-term, long-term and working memory
Short-term: the messages array, trimmed or summarized. Long-term: facts saved to a DB across sessions. Working state: where the agent is in a multi-step task (a checkpointer).
Last updated
Analogy
Request scope, the users table, and the session store.
In an agent
"How do you handle memory?" is a top interview question. Name all three.
Practice
Flashcards
- Interview: three kinds of agent memory?Short-term message history, long-term facts in a database, and working state in a checkpointer.
Interview questions
- How do you handle memory?
- Short-term memory is the message history, trimmed or summarized near the context limit.
- Long-term facts go to a database and are retrieved when relevant.
- For multi-step tasks, LangGraph checkpoints in Postgres hold the working state.
Questions people ask
What are the types of memory in an AI agent?
Three. Short-term memory is the messages array of the current conversation, trimmed or summarised as it grows. Long-term memory is facts saved in a database across sessions, such as user preferences. Working memory is where the agent is in a multi-step task, usually kept by a checkpointer.
How do I answer how do you handle memory in an interview?
Name all three kinds and how you store each. The messages array for short-term memory, trimmed or summarised to fit the context window. A database for long-term facts, loaded when relevant. A checkpointer for working state, so long tasks can pause and resume. Mention that the model itself stores nothing.