Three stores, three shapes
LearningMode.ALWAYS runs an extractor on every turn. LearningMode.AGENTIC gives the agent tools to write when it judges something worth keeping.
Entity memory in detail
The Contacts agent gets four entity-memory tools when configured as above:
Example chat that builds up the graph:
User profile
User profile is one record peruser_id, updated in place. Whatever the agent learns about you (your role, your preferences, your working style) goes here.
db, get terser automatically.
Session context
Session context is plan-shaped. “What’s this conversation actually about? What does the user want by the end?” The agent uses it to keep multi-turn plans coherent.Vanilla agentic memory vs LearningMachine
For most agents,enable_agentic_memory=True is enough: a single bucket of facts that the agent writes to via tools.
LearningMachine is right when the shape of memory matters:
- A relationship graph (Contacts) needs entities and edges, not flat strings.
- A self-improving SQL agent (Dash) needs to separate “validated queries” from “error patterns I’ve fixed”.
enable_agentic_memory=True and move to LearningMachine once flat memory feels too lossy.
See it in action
agents/contacts/agent.py, Learning Machine docs