Context and memory · about 15 minutes of study

Memory

Agent memory is application-managed information retained across steps or sessions. It can include temporary state, past events, facts or procedures, with explicit storage and retention rules.

Before you start: Review Lost in the middle first. Python-like examples use variables, lists and functions.

Guided concept walkthrough

Follow the mechanism

Working state

Hold the current task and recent observations.

1 / 4

A conceptual animation, not a live model trace. Play advances every five seconds and stops at the final stage.

Start with an everyday explanation

A scratchpad holds current work; a notebook can hold selected lessons for later. Someone must decide what gets written, who may read it and when to erase it.

See a concrete example

A user preference can persist with consent and expiry. A one-time claim token should not become permanent memory or be shared with another tenant.

A claim to question

Long-term does not mean permanent; short-term state is not automatically wiped at task end.

Try before revealing the answer

Design a memory record with user scope, source, created_at and expires_at. Decide how to correct an outdated address.

Show the worked answer

Authorize access by user, record the source and expiry, replace or invalidate stale facts and remove dependent cached copies. Keep sensitive credentials out of durable conversational memory.

Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.

Your explanation and revision notes

Loading local notes…

Read the primary reference

Lost in the Middle

The explanation and exercises are original teaching material. The linked source provides background; examples and assumed numbers here are not claims about a particular company.