Skip to content

Agent Memory: How to Build Agents that Learn and Remember Recent

Published: July 7, 2025 | Original Post


How agent memory solves the stateless nature of traditional LLMs by enabling knowledge retention across conversations.

What is Agent Memory?

Agent memory refers to how systems retain and utilize information across interactions. Rather than mimicking human memory structures, designing an agent's memory is essentially context engineering -- deciding what information occupies the context window at any given moment.

Memory Components

The framework identifies four distinct memory types:

1. Message Buffer

Stores recent conversation messages in a continuous thread.

2. Core Memory

Editable, in-context memory blocks focused on specific topics (user preferences, persona, objectives).

3. Recall Memory

Complete interaction history that persists to disk and can be searched when needed.

4. Archival Memory

Processed knowledge in external databases (vector databases, graph databases).

Technical Approaches

Summarization and Eviction

The system intelligently manages limited context windows through:

  • Strategic removal of older messages (typically 70%)
  • Recursive summarization that compresses information while preserving key details

Memory Blocks Architecture

Memory blocks contain:

  • Labels identifying the block
  • Descriptions explaining contents
  • Values representing actual tokens
  • Character limits defining context allocation

MemGPT Framework

An operating-system-inspired approach that treats context windows as constrained memory resources, enabling agents to autonomously move data between active (in-context) and external storage.

Sleep-Time Compute

An asynchronous system where agents refine memory during idle periods, improving both response times and memory quality without blocking operations.

Key Takeaway

Focus on effective context engineering rather than replicating human memory mechanics. An agent's capabilities ultimately depend on which information occupies its context window at any moment.