Brief IA
›

AI Agents: Three Safeguards and Memories for LangGraph

Research·Tom Levy·

AI Agents: Three Safeguards and Memories for LangGraph

AI Agents: Three Safeguards and Memories for LangGraph
Key Takeaways
1Three types of memory structure the long-term memory of AI agents: semantic, episodic, and procedural
2Their implementation under LangGraph relies on separate namespaces and tailored logics
3Safeguards are recommended to limit risks associated with global procedural modifications
4Exercises allow for testing the separation and retrieval of memories
Why it matters : A differentiated management of memories enhances the reliability and control of AI agents' behavior.

Separating facts, experiences, and rules of conduct changes the way agents build memory. A three-part framework—semantic, episodic, procedural—comes with an implementation under LangGraph, warnings about global modifications, and exercises to validate the system's behavior.

Protections Against Procedural Instruction Drift

Globally modifying an agent's procedural instructions is discouraged without specific protections. The design must distinguish between situations where information needs to be updated, added only, or exposed to a risk related to reflection. During each call, the model assembles elements from each type of memory into the system message. Exercises are proposed to verify that the episodic memory correctly filters successful experiences to avoid unwanted recalls.

Three Memories for Different Uses

An agent's long-term memory is divided into three categories: semantic memory, which retains current facts with update rules; episodic memory, which records experiences in an additive manner, marked by a success signal and retrieved by similarity; and procedural memory, which groups instructions and system prompts revised through reflection. Each requires an appropriate storage mode, trigger, and retrieval method. Considering memory as a uniform set exposes it to the obsolescence of facts, the loss of useful examples, and uncontrolled behavioral modifications.

Le brief IA que lisent les pros

Le brief IA que les pros lisent chaque soir

Les 7 actus IA du jour, décryptées en 5 min. Gratuit.

Inclus dès l'inscription : notre sélection des meilleurs guides & comparatifs IA.

Choisissez votre rythme

Gratuit · Pas de spam · Désabonnement en 1 clic

Implementation Under LangGraph and Validation Exercises

The three types of memory can be combined into a single storage under LangGraph, using distinct namespaces and differentiated writing and reading logics. For example, a week after launching an agent, a user's storage may contain a vegetarian diet, an update indicating fish consumption, and a restaurant reservation, all stored in key-value pairs and retrieved in the same manner. Exercises encourage restructuring existing storage according to these namespaces, testing reflection and withdrawal behavior, and validating the proper separation of memories.

Brief IA — L'actualité IA en français

L'essentiel de l'actualité de l'intelligence artificielle, décrypté et expliqué chaque jour.