Context Evolution
Search documents
Approaches for Managing Agent Memory
LangChain· 2025-12-18 17:53
Memory Updating Mechanisms for Agents - Explicit memory updating involves directly instructing the agent to remember specific information, similar to how cloud code functions [2][5][6][29] - Implicit memory updating occurs through the agent learning from natural interactions with users, revealing preferences without explicit instructions [7][19][29] Deep Agent CLI and Memory Management - Deep agents have a configuration home directory with an `agent MD` file that stores global memory, similar to Claude's `cloud MD` [3][4][6] - The `agent MD` files are automatically loaded into the system prompt of deep agents, ensuring consistent memory access [6] - Deep agent CLI allows adding information to global memory using natural language commands, updating the `agent MD` file [5] Implicit Memory Updating and Reflection - Agents can reflect on past interactions (sessions or trajectories) to generate higher-level insights and update their memory [8][9][10][28] - Reflection involves summarizing session logs (diaries) and using these summaries to refine and update the agent's memory [11][12] - Accessing session logs is crucial for implicit memory updating; Langsmith can be used to store and manage deep agent traces [13][14][15] Practical Implementation and Workflow - A utility can be used to programmatically access threads and traces from Langsmith projects [21] - The deep agent can be instructed to read interaction threads, identify user preferences, and update global memory accordingly [24][25] - Reflecting on historical threads allows the agent to distill implicit preferences and add them to its global memory, improving future interactions [26][27][28]