Skip to main content
← All use cases

The scenario

There is a question you ask every week. What is this customer’s situation. Where is the migration up to. What do we know about this account. Asking it every week costs a call every week and gives you a slightly different answer each time. Writing the answer down costs nothing and is wrong within days.

Step 1 — Define the standing question

A memory model is a question plus its maintained answer. refresh_on_new_memories is what makes it standing rather than a snapshot: new memories in the space cause it to rewrite itself.
is_stale is the honest bit. It tells you the underlying memories have moved since this text was written, so you know whether you are reading a current answer or a recent one.

Step 3 — Force a rewrite when you need it fresh

Refresh is asynchronous and billed, so trigger it on the cadence you actually need rather than before every read.

Step 4 — See how the answer changed

The history is often more useful than the current text: it is a record of when your understanding of the account changed, which nobody was writing down.

Evals

  1. Create a model, record three relevant memories, refresh, read it.
  2. Record a memory that contradicts the briefing. Check is_stale flips.
  3. Refresh and confirm the new text reflects the contradiction rather than averaging it away.
  4. Read the history and check the previous version is preserved verbatim.

Guardrails

A briefing is a summary, and summaries lose the exception. Do not make an irreversible decision from the model text alone — retrieve the underlying memories when it matters. The model is for orientation, not evidence.
  • Creating and refreshing cost credits; reading is free. A model refreshed on every write to a busy space is an expensive way to be slightly more current.
  • A brand-new model briefly has no content. It is generated on the first refresh, and until then there is genuinely nothing to show — render that state rather than an empty string that reads like an answer.
  • Editing a model’s text does not refresh it, deliberately: a typo fix should not cost a full rewrite.

Built from

Every call above belongs to this runnable script’s territory — memory_basics.py — and the model surface is documented in full at Memory models.