Agentic AI Notebook
Agent Memory
Phase 5Module 4 of 15

Long-Term Memory

Users come back days later. If nothing persisted, you rebuilt a chatbot, not an assistant.

A personnel file — not today's notepad. You open it when they walk in.

Visual Workflows

Start here — scroll inside each diagram frame to explore, then use + / to zoom up to 200% if needed.

Overview

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Next session

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Load durable facts before the first model call.

Key Takeaways

  • 1.Long-term memory survives sessions — preferences, facts, past work. Write on purpose: extract, store, retrieve on the next visit.
  • 2.Stores are vector DBs, key-value, or graphs — pick for the query. Stale LTM is worse than none — version and expire facts.
  • 3.LTM is a store with write, retrieve, and forget. Extract structured facts.
  • 4.Retrieve a small set at session start. Expire what is no longer true.

Learn elsewhere

  • Semantic vs episodic — next modules
  • Memory Stores

Real Example

Scenario

User said they prefer Python six months ago. LTM returns that fact on login so the agent does not switch to Java.

What you would do

In Agent Memory, apply Long-Term Memory to this scenario: User said they prefer Python six months ago. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.

Commands

Commands to Remember

  • LTM survives sessions
  • Extract → store → retrieve
  • Index by user
  • Expire stale facts

Cheat Sheet

Quick recap

quick ref
  • Personnel file, not notepad
  • Write on purpose
  • Small retrieve at start
  • Forget is a feature

Common Mistakes

  • Saving raw transcripts as LTM
  • Never expiring old preferences
  • Retrieving 200 memories into the prompt