Module 7 · Agent Memory & State · Lesson 15 of 34
Short-term and long-term memory
Full history, sliding windows, summaries and memory stores: what each remembers and what it costs.
In this lesson · about 20 minutes
- Tell short-term (context) memory from long-term (stored) memory
- Compare four memory strategies on recall and cost
- Decide what is worth saving as a long-term memory
The model remembers nothing between calls (Module 2). Everything an agent "knows" about the past is something your system chose to send. There are two layers:
- Short-term memory: what is in the context window right now: recent messages, the current task, tool results.
- Long-term memory: facts saved outside the model (in a database) and brought back when relevant: the user's preferences, past decisions, lessons learned.
Four common strategies:
- Full history: send everything. Perfect recall until it no longer fits, and cost grows every turn.
- Sliding window: send only the last N turns. Cheap and simple, but older facts vanish.
- Running summary: compress older turns into a summary. Keeps the gist; small details can be lost.
- Memory store: extract important facts as they appear, save them, and retrieve the relevant ones each turn. Best recall at low cost, but more moving parts, and a wrong memory can stick around.
Try it · simulator
Agent memory strategies
A customer chats about a birthday cake over 12 turns. Pick a memory strategy and see what the agent still knows at the end, and what each turn costs.
- #1Hi! I'm ordering a cake for my daughter's birthday party.fact
- #2Important: she is allergic to nuts.fact
- #3What flavours do you have?
- #4Her name is Lily, please write it on top.fact
- #5Chocolate sounds good. Do you do sprinkles?
- #6I'd like to keep it under $40.fact
- #7How long do cakes stay fresh?
- #8Can it be pink and purple?
- #9The party is on Saturday afternoon.fact
- #10Do you deliver to Riverside?
- #11Great. Will candles be included?
- #12OK, please confirm the full order.
Pink border: sent word for word. Green: carried as a summary or saved memory. Grey: forgotten.
Questions answered right
1 / 4
Context at turn 12
530tokens
At turn 200 it would be
530tokens
Moving parts
Few
Check your understanding0 of 3 correct
Quiz score: 0 of 3
Written by Noviq Academy in its own words. The simulators are small teaching models that keep the real idea and leave out the scale; their numbers (prices, speeds, scores) are illustrative. Model names, prices and features change quickly, so check your provider's current documentation before you build. Read-aloud uses your device's built-in voices.