AI Engineering · LLM applications that ship
How should an agent store and use memory?
Short answer
Separate working memory from long-term storage. Keep the current task in context, persist durable facts and decisions explicitly, and retrieve them only when relevant.
Memory is a product decision, not a vector database default. The agent needs the current plan and recent observations in context, plus a store for facts that should survive the session: user preferences, prior decisions, open tasks. Dumping every past interaction into the prompt is expensive and often harmful.
- Working memory: current goal, plan, recent tool results.
- Episodic memory: past conversations and outcomes, retrieved by relevance.
- Semantic memory: stable facts and preferences, written deliberately with provenance.
- Expire or correct memory when the user changes their mind.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1How do you decide what deserves to be written to long-term memory?
- 2What would you do with conflicting memories?
- 3How does memory affect evaluation?
Say it in the interview
I split memory into working and long-term. The current task, plan and recent observations stay in context. Durable facts, preferences and decisions get written deliberately to a store with provenance, and are retrieved only when relevant. I do not replay entire histories. Memory also has to be correctable and deletable, because a stale preference treated as fact is worse than having no memory at all.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live AI Engineering mock interview and get scored feedback on depth, clarity and confidence.