Architecturecontext memoryagent state

What Is Agent Memory?

Agent memory is how an AI agent retains context across steps, sessions, or longer — from short-term conversation history to persistent knowledge stores.

2 min readUpdated agent-memory.md

Agent memory is how an AI agent retains and retrieves context beyond a single prompt. It spans from immediate conversation history to persistent knowledge that survives across sessions.

Types of agent memory

TypeScopeExample
Working memoryCurrent loop / conversationMessages and tool results in the active thread
Session memorySingle user sessionPreferences stated earlier in the conversation
Long-term memoryAcross sessionsUser profile, past interactions, learned facts
External memoryRetrieved on demandDocuments, databases, vector stores (often via RAG)

Why memory matters

Without memory, every interaction starts from zero. An agent that forgets a tenant's prior maintenance history will treat a recurring leak as a new issue. Memory lets agents build context, avoid repeating questions, and make better decisions over time.

Memory design tradeoffs

  • More context = better decisions but higher cost and risk of hitting context window limits
  • Persistent memory requires storage, privacy controls, and retrieval strategy
  • What to remember is an architecture decision — storing everything creates noise; storing too little loses critical context

See RAG for how retrieval augments agent memory with external knowledge.