How is long-term memory typically implemented in an agent?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Long-term memory persists across tasks in a vector store, key-value store, or database. The agent retrieves relevant entries each task and injects them into the prompt; the model weights stay frozen.
Imagine a friend you only see once a month. They cannot literally remember everything you ever told them, so they keep a small notebook with the important facts: 'allergic to peanuts, has a daughter named Mia, prefers tea to coffee.' Before they meet you again, they flip to your page. Long-term memory works that way for an agent. It cannot keep every conversation alive in its head. So important facts go into a notebook (a database). Before each new task, the agent looks up the relevant page and reads it. The model's brain has not changed at all. The notebook has just grown by a few lines.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define long-term memory as cross-task persistence external to the model. Name the contents and the contrast with short-term memory and weights. Describe the storage shapes (vector store, key-value, relational) and when each fits. Walk through the three operations (write, read, maintain). Close on multi-tenant scoping and aging as load-bearing production concerns.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing long-term memory updates the model. The model weights are frozen at inference. Long-term memory is an external store the runtime queries; nothing about the model itself ever changes.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.