Skip to content
Agentic AI

intermediate · Interactive lab

Memory and Context

A memory feature is a database with a friendly name. Four different decisions hide inside the word "remember", and two of them are refusals.

By the end: Tell durable memory from context, from a re-fetch, and from something that must not be stored at all.

Your challenge

Start here. This lab opens with everything remembered, which is the wrong starting point and what an agent with a memory feature does by default. Two of these must never be written to a store at all, one goes off within the conversation, and one should be fetched rather than kept — while two genuinely belong in memory and dropping them makes the agent look like it was not listening.

See it happen

What survives this turn

Memory: safe to keep
Slowed down so you can follow
THE SOURCE|+⟩and a coin in a boxBENCHDETECTORZ BASISanswers 0 and 1TALLYTHE QUBITTHE COIN
The agent holds things in this turn's context. Memory is what survives the turn, the source is what could be asked again, and the record is where information about a person is supposed to live.
  1. This turn → What survives
  2. What survives → The source
  3. What survives → The system of record
STEP 1 / 6

Four decisions, one word

Everything in This turn is about to end. What survives is a store — with backups, with readers, and with no expiry of its own — and deciding what goes into it is four decisions rather than one.

Configure

Your decision for each item

For each item, decide what should happen to it when this turn ends. Where it came from, how long it holds, how sensitive it is and how often it is needed all decide it.

What should happen to this when the turn ends?
Keep it in memory
· It holds, it is needed, and nothing else has it.
Fetch it when needed
· A system owns it and it moves.
This turn only
· Useful now, and gone when the turn ends.
Never write it down
· It must not be in a store at all.
  1. M-901 — The account ID the customer gave in conversation

    No system can be asked for what someone said out loud.

    What it is
    the customer's account ID · ordinary working information
    Where it came from
    the person said it · there is no way to fetch it again
    How long it holds
    indefinitely
    How often it is needed
    every turn
  2. M-902 — The status of ORD-501, fetched ten minutes ago

    The system that owns it is one call away.

    What it is
    the status of ORD-501 · ordinary working information
    Where it came from
    a system that owns it · it can be fetched again
    How long it holds
    about 10 minutes
    How often it is needed
    occasionally
  3. M-903 — The access token the last tool call used

    It is valid for an hour, and it is a credential.

    What it is
    the access token the tool call used · a credential
    Where it came from
    a system that owns it · it can be fetched again
    How long it holds
    about 1 hours
    How often it is needed
    every turn
  4. M-904 — The card number the customer read out

    It does not expire, and it is not the agent's to hold.

    What it is
    the card number the customer read out · personal data about someone
    Where it came from
    the person said it · there is no way to fetch it again
    How long it holds
    indefinitely
    How often it is needed
    occasionally
  5. M-905 — The tenant's time zone

    It never changes, and almost every answer needs it.

    What it is
    the tenant's time zone · ordinary working information
    Where it came from
    a system that owns it · it can be fetched again
    How long it holds
    indefinitely
    How often it is needed
    every turn
  6. M-906 — The agent's own working notes for this task

    Useful for the rest of this task, and meaningless after it.

    What it is
    the agent's own working notes for this task · ordinary working information
    Where it came from
    the agent produced it · there is no way to fetch it again
    How long it holds
    about 30 minutes
    How often it is needed
    every turn
  7. M-907 — That the customer prefers email over phone

    Genuinely useful next time, and genuinely about a person.

    What it is
    the customer prefers email over phone · personal data about someone
    Where it came from
    the person said it · there is no way to fetch it again
    How long it holds
    indefinitely
    How often it is needed
    occasionally

Where it came from, how long it holds, how sensitive it is, and how often it is needed. All four decide it.

Learn more

Why this pattern exists

Ask what an agent should remember and the answer sounds like a product feature. It is not: it is a retention decision, a staleness decision and a cost decision, all taken at once and usually by accident. Four things separate them. Where the item came from — a system that owns it can be asked again, and a person who said it cannot. How long it stays true — an account ID holds indefinitely, an order status holds for minutes. How sensitive it is — a memory store outlives the conversation, gets backed up, and is read by whoever can read the store. And how often it is needed, because fetching an unchanging fact on every single turn is a call and a wait that buys nothing. Seven items here, and the right answers include two different ways of saying no.

An agent is midway through a customer-service conversation, and each of these is something it could carry into the next turn. Every row shows what it is, where it came from, how long it holds and how often it is needed. Three turns later, the consequence of the decision is shown.

  • Tell durable memory from context, from a re-fetch, and from something that must not be stored at all.
  • Weigh how long an item stays true against the fact that memory has no expiry of its own.
  • Keep what cannot be fetched again, and stop fetching what never changes.

The rule this lesson applies: Memory is not a capability, it is a store — and everything that is true of a database is true of it. Anything sensitive written there is written there for good: backed up, replicated, and readable by whoever can read the store, long after the conversation that produced it. A credential should never be in it, and personal data belongs wherever that organisation's personal data already belongs, under the retention rules that already exist, rather than in an agent's notes. The second half is staleness. Memory has no expiry of its own, so anything with a shelf life becomes a quiet lie a few turns later: the order status that was true when it was written is used as though it were true now, and nothing in the conversation says otherwise. Those are the two refusals. The two positives matter as much for whether the agent is usable at all: something the person said and no system holds must be carried, or the agent asks for it twice and looks like it was not listening; and something that never changes and is needed on every turn should be held rather than fetched each time, which is latency and quota for an answer already known.