Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Agent Memory  ›  Lesson

What Is Agent Memory?

What is Agent Memory? 12 minBecause a model remembers nothing between calls, agent memory is a system around it that writes, stores and retrieves information, split into short-term memory for the current task and long-term memory across sessions.

What Is Agent Memory?

Asha opens Tripmate a month after her Jaipur trip and types, "Same as last time, but to Udaipur." For a good assistant that is a complete request: same dates pattern, same class, window seats, vegetarian meals. For a bare model it is meaningless — it has never "met" Asha. Agent memory is what closes that gap.

The rule

A model remembers nothing; memory is what your app writes, stores and puts back.

Every model call starts from zero. So "memory" in an agent is not inside the model. It is a system around it with three moves:

  • Write — decide what is worth keeping ("Asha prefers window seats").
  • Store — save it somewhere: the running message list, a database, a file, a search index.
  • Retrieve — at the right moment, find the relevant pieces and put them into the context.

Memory is usually split by how long it lasts:

  • Short-term memory — the current conversation and task: recent messages, tool results, the plan so far. It lives in the context window and ends with the session.
  • Long-term memory — facts and history kept across sessions: preferences, past trips, what worked before. It lives in storage and is brought back only when relevant.
session starts → retrieve relevant long-term notes → add to context
during the task → short-term history grows in the context
session ends   → write the notes worth keeping to long-term storage

The shortcut

For any piece of information ask: "Will I need this after this conversation ends?" No → short-term; let it live in the context and fade. Yes → long-term; write it down deliberately, and plan how it will be found later.

Sorting what Tripmate learned on the Jaipur tripStep 1 of 4
  1. "Show me trains after 6 pm"

    Only matters for this search. Short-term: keep it in the conversation.

The trap is keeping everything. A store full of stale search results makes retrieval noisier and slower, and it holds personal data you have no reason to keep. Memory is as much about choosing what to forget as what to save.

Drills

Answer fast — trust the rule.

quick drill

Where does an agent's long-term memory live?

quick drill

Which fact belongs in long-term memory?

quick drill

What are the three moves of any agent memory system?

quick drill

Why not save every message forever?

Remember

  • A model remembers nothing; memory is what the app writes, stores and retrieves into context.
  • Shortcut: "Will I need this after the conversation ends?" — no is short-term, yes is long-term.
  • Trap: keeping everything, which clutters retrieval and holds data you should not.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainDesign Tripmate's memory

Explain why Tripmate needs a memory system at all, and sort these into short-term or long-term memory: today's search results, Asha's home station, the step the plan is on, and the fact she disliked a hotel last year.