← Learn

agent memory

An external, writable data layer for AI agents, allowing them to maintain state across interactions and sessions, crucial for complex task execution.

Learn

When to use it

Use agent memory when a simple stateless model call can't handle tasks requiring continuity over multiple interactions. Agent memory provides a persistent state layer, enabling AI agents to perform complex tasks like maintaining context in a multi-turn conversation or tracking progress in a long-running workflow.

Quick example

In Claude Code, an AI-driven customer support agent needs to remember user preferences and past interactions to provide personalized service. You configure agent memory within Claude Code to store and retrieve this information across sessions. Here, Claude Code includes agent memory, allowing the AI to maintain state and enhance the user experience.

prompt → agent harness → agent memory → tools/files → stop

Ecosystem

Agent memory integrates within the broader AI agent architecture, interacting with harnesses and models to maintain continuity and context.

        ┌─ tools ──┐
prompt →│ agent harness │→ stop
        └─ agent memory ──┘

Misconceptions

MisconceptionRebuttal
It changes model weightsAgent memory only stores interaction data externally
Any database is agent memoryAgent memory must support writable state across sessions

Trade-offs

  • State continuity — increases complexity in data management
  • Personalization — requires careful handling of sensitive data
  • Task execution — adds overhead to maintain and query memory

Seen in