Skip to content

Practice: Giving agents memory

Seven short questions. Answer each before opening the collapsible.

1. Why is an agent amnesiac by default?

Show answer

Because the loop (Lesson 1) works within a single run, and when the run ends the working state is discarded. There is no place information persists across runs unless you build one. Memory is designed in, not automatic.

2. What is short-term context, and how long does it last?

Show answer

The information present during one run: the conversation so far, the results of tools called this run, and the agent’s scratchpad of intermediate steps. It lasts exactly one run and is then gone, like notes on a single phone call.

3. What is persistent memory, and what does it make possible?

Show answer

Information that outlives the run that created it: preferences, learned facts, summaries of past conversations. It is what lets an assistant feel like it knows you, “book my usual sync” works because the usual was stored on an earlier run and read back on this one.

4. Why is “remember everything” a trap? Give the three reasons.

Show answer

Context cost (anything used must load into the finite context window; noise crowds it and adds cost/latency), staleness (stored facts go out of date), and privacy (persistent memory is stored personal data; more than you need is a liability). The skill is selectivity, not volume.

5. What kinds of things are usually worth keeping?

Show answer

Preferences (stable choices), identity and stable facts (account ID, team, home city), summaries of past runs (a recap, not the full transcript), and corrections (so the same mistake does not repeat). If a candidate fact fits none of these, it is usually noise.

6. Why is “remembering” also “updating”?

Show answer

Because facts change. When a user revises a preference, the right move is to update the stored fact, not append a contradicting one. An agent that only accumulates ends up holding both “prefers afternoons” and “prefers mornings” with no way to tell which is true. Memory is a living record, not a pile that only grows.

7. How do short-term context and persistent memory work together in one run?

Show answer

A run starts by loading the relevant persistent memory into the short-term context (preferences, last time’s summary), works within that context, and at the end writes anything newly worth keeping back to persistent memory. The agent feels continuous because each run reloads what mattered from the last.

Try it yourself: short-term or persistent?

Section titled “Try it yourself: short-term or persistent?”

For each item, decide whether it belongs in short-term context (lasts one run) or persistent memory (survives across runs).

A. The question the user just typed this turn.
B. "The user prefers email over phone."
C. The result of the calendar tool the agent called two steps ago, this run.
D. A one-paragraph summary of last week's conversation.
E. The agent's scratchpad reasoning while working the current task.
Show answer
  • A: short-term (this run’s conversation).
  • B: persistent (a durable preference, useful on future runs).
  • C: short-term (a tool result from this run; gone when the run ends).
  • D: persistent (a summary written to survive across runs).
  • E: short-term (working notes for this run only).

The test: will it matter after this run ends? If yes, persistent; if it only matters while this run is happening, short-term.

A support conversation just ended. For each line, decide KEEP or DISCARD, and if KEEP, name the kind (preference / identity / summary / correction).

1. "Always send my reports as PDF, not Word."
2. "My team is the Northwind project."
3. "Sorry, I sneezed, where were we?"
4. "Actually it's account 7782, not 7783 like I said earlier."
5. "It's pretty cold in the office today."
Show answer
  1. KEEP (preference) - a stable choice that pays off every future run.
  2. KEEP (identity / stable fact) - durable, reusable.
  3. DISCARD - pure noise, no future use.
  4. KEEP (correction) - update the stored account ID so the mistake does not repeat; note this also overwrites the earlier wrong value, not appends to it.
  5. DISCARD - transient, will not matter next time.

The decision rule throughout: not “can I store this” but “will this be worth having next time.”

Ten cards. Click any card to reveal the answer. Use the Print flashcards button for one card per page.

Q. Why is an agent amnesiac by default?
A.

The loop works within a single run; when the run ends, the working state is discarded. Nothing persists across runs unless you build it. Memory is designed in, not automatic.

Q. What is short-term context?
A.

The information present during one run: the conversation so far, this run’s tool results, and the scratchpad. It lasts exactly one run, then is gone.

Q. What is persistent memory?
A.

Information that survives across runs: preferences, learned facts, summaries of past conversations. It is what makes an assistant feel like it knows you.

Q. Why is 'remember everything' a trap?
A.

Three costs: context cost (the finite window fills with noise), staleness (stored facts go out of date), and privacy (persistent memory is stored personal data; more than you need is a liability).

Q. What four kinds of things are usually worth keeping?
A.

Preferences, identity/stable facts, summaries of past runs, and corrections. If a candidate fits none of these, it is usually noise.

Q. What is the retention decision rule?
A.

Not ‘can I store this’ but ‘will this be worth having next time.’ Keep durable, reusable, user-specific facts; discard transient noise.

Q. Why is remembering also updating?
A.

Facts change. Revise a stored fact when it changes rather than appending a contradicting one, or the agent holds both and cannot tell which is true. Memory is a living record, not an ever-growing pile.

Q. How do short-term context and persistent memory hand off?
A.

A run loads relevant persistent memory into short-term context at the start, works within it, and writes anything newly worth keeping back to persistent memory at the end.

Q. What is the difference between the context window and the agent's memory?
A.

The context window is short-term only and vanishes when the run ends. Treating it as the agent’s memory means everything is forgotten between runs. Persistent memory is the separate, lasting store.

Q. A summary of last week's chat: short-term or persistent?
A.

Persistent. It is written to survive across runs so the agent can pick up the thread. The summary is the memory; the full transcript is not kept.