WhoBuilt

Architecting Agent Memory: Principles, Patterns, and Best Practices

Jun 27, 2025· 18 min· 141K views·Watch on YouTube

Speaker

Richmond Alake of MongoDB explains how agent memory can make AI applications more reliable, capable, and personal at an AI Engineer talk.

Memory makes agents stateful

Alake traces AI from LLM chatbots to RAG and then agents with reasoning and tool use. He describes agent capability as a spectrum, from an LLM in a loop to autonomous systems, and argues that memory helps agents retain information between executions.

Manage what enters the context window

Agent memory lets systems accumulate information and use it in later steps. Alake frames memory management as generating, storing, retrieving, integrating, updating, and forgetting information. A large context window still needs relevant memories selected and structured for each response.

Use retrieval as an agent capability

Alake describes RAG as retrieving relevant information and says agents can use retrieval as a tool they choose when needed. He argues that vector search alone is insufficient and presents MongoDB as supporting multiple retrieval methods.

Choose memory patterns for the task

Alake outlines persona, toolbox, conversation, workflow, episodic, long-term, and entity memory. For example, toolbox memory stores tool schemas for retrieval, while workflow memory can retain failed steps to inform later attempts. His experimental Memories library demonstrates these patterns and includes signals such as recall and recency.

Build memory systems around your needs

Alake says there is no single solution for agent memory and points to MemGPT, Mem0, and Zep as tools focused on memory management. He presents MongoDB as a provider for custom memory systems and describes Voyage AI embeddings and rerankers as ways to support retrieval and reduce hallucinations.

Takeaways

  • Treat memory as a way to carry useful state between agent executions.
  • Retrieve and structure relevant context instead of filling the context window with all available data.
  • Give agents retrieval tools they can call when they need information.
  • Store failed workflow steps so future runs can avoid repeating them.
  • Choose memory patterns and retrieval methods to fit the application; there is no single memory design for every agent.

Mentioned in this talk

Search inside this talk

What was claimed 6

Related talks