# 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).

AI developers · Part 09: Production · Card 6 of 13 · Last updated 2026-10-13

## 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.

## Related concepts

- [Checkpointing](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/checkpointing)
- [Stateless](https://studyvisually.com/learn/tech/ai-developers/llm-basics/stateless)
- [Guardrails](https://studyvisually.com/learn/tech/ai-developers/production/guardrails)
- [Validate tool arguments](https://studyvisually.com/learn/tech/ai-developers/production/validate-tool-arguments)

Web page: https://studyvisually.com/learn/tech/ai-developers/production/memory-types
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=memory-types
