Skip to content

Memory architectures for long-running agents

Aditya

1 min read

Stacked memory blocks flowing into a central agent core

A practical map of working, episodic, and semantic memory—and when an agent should forget.

Long-running agents need continuity, but “remember everything” is not a design strategy. Unlimited memory increases cost, spreads outdated assumptions, and creates privacy risk. Useful memory is selective, typed, and easy to revise.

We divide agent memory into three layers based on how it is used.

Working memory

Working memory contains the active goal, current plan, recent observations, and constraints needed for the next action. It should be small enough to inspect and refresh frequently.

Instead of repeatedly compressing an entire conversation, maintain explicit fields. Structured state makes omissions visible and prevents a summary from quietly turning an old guess into a fact.

Episodic memory

Episodes record what happened during a completed workflow: the goal, significant actions, outcome, corrections, and lessons. Retrieval should consider similarity and recency, but also whether the earlier episode succeeded.

An agent should not imitate a failed episode simply because its wording is close to the current task.

Semantic memory

Semantic memory stores durable knowledge: user preferences, organization policies, entity relationships, and validated facts. These entries need provenance, timestamps, and ownership. A preference inferred from one interaction should not have the same authority as a policy approved by an administrator.

Forgetting is a feature

Add expiration, supersession, and deletion from the beginning. Memory that cannot be corrected will eventually make the agent confidently wrong.

Retrieval is a decision

Similarity search is only a candidate generator. Before injecting a memory, check its type, scope, freshness, authority, and relevance to the current goal. Log which memories influenced important actions so incidents can be reconstructed.

Evaluate memory over time

Single-turn benchmarks miss accumulation errors. Test multi-session scenarios where preferences change, policies conflict, and earlier outcomes become stale. Measure appropriate recall, appropriate forgetting, and the agent’s ability to resolve contradictions.

The best memory system does not make an agent seem omniscient. It gives the agent the smallest set of trustworthy context needed to act well—and a reliable way to let go of what is no longer true.

  • #agents
  • #memory
  • #architecture

Keep reading