Agents, Tool Use & MCP·Question 32 of 90Intermediate

Your agent needs to remember things across sessions. Would you use a vector store or rolling summarisation? Defend the choice.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

For most production agents, neither as the primary mechanism. I start with structured state plus files, and add retrieval only where the data genuinely does not fit a schema.

Full worked answer

For most production agents, neither as the primary mechanism. I start with structured state plus files, and add retrieval only where the data genuinely does not fit a schema.

The honest comparison:

Summarisation compresses everything and loses detail unpredictably. It is lossy in one direction: once a fact is dropped it is gone forever, and rolling summaries compound their own errors because summary N+1 summarises summary N. Good for conversational continuity ("what have we been discussing"), bad for facts you must recall exactly, like an order ID mentioned forty turns ago.

Vector memory keeps everything and retrieves top-k. It fails differently: retrieval misses. If the user says "the flight thing" and the memory says "booking reference for LHR to JFK", embedding similarity may not bridge that. Worse, it retrieves plausible rather than relevant memories, so a question about this week's NYC trip pulls last year's NYC trip and the agent confidently acts on stale facts. Summarisation cannot surface a fact it dropped; vector memory surfaces the wrong fact, which is more dangerous because it looks like success.

What I would build:

  • Structured facts in a database. Preferences, entity IDs, settled decisions. Exact lookup, no embedding, no retrieval miss. This covers more than people expect.
  • Files as memory. The agent writes notes and reads them back by path. Survives compaction, is inspectable and diffable, and the agent controls what it keeps.
  • Vector recall only for unstructured history, where the query really is fuzzy.
  • Summarisation for the conversational tail, keeping recent turns verbatim.

Describing this as tiered (always-in-context core, searchable recall, archival store) is fine vocabulary, but the real interview signal is knowing that memory writes are the hard part. Deciding what is worth remembering, and invalidating facts that are no longer true, is harder than retrieval, and no vector store does it for you. A memory layer that only ever appends becomes a pile of contradictions within weeks.

What a good answer covers

  • For most production agents, neither as the primary mechanism
  • I start with structured state plus files, and add retrieval only where the data genuinely does not fit a…
  • Summarisation compresses everything and loses detail unpredictably
  • It is lossy in one direction
  • Good for conversational continuity ("what have we been discussing"), bad for facts you must recall…

Key terms: structured state plus files · Summarisation · Vector memory · Structured facts in a database · Files as memory · Summarisation for the conversational tail

Interviewer follow-ups to expect

  1. How do you handle a memory that becomes false, like a user changing their address?

  2. How would you evaluate whether your memory layer is helping at all?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep