Architecture · Tools pattern
Memory as a Tool: Tool-Based Memory for Agents
Memory-as-a-tool exposes store, search and update operations as callable agent tools — letting the LLM decide what to remember and retrieve instead of automatic extraction pipelines.
Memory tools
Definition
What is the memory-as-a-tool pattern?
Memory-as-a-tool exposes memory_store, memory_search, memory_update and memory_forget as function-calling tools the agent invokes.
The LLM decides when to read and write — agent-controlled memory. Contrast with automatic pipelines (Mem0 auto-extract after each turn). Letta implements built-in memory tools for core/archival paging; LangGraph registers custom tool handlers against vector stores.
Benefits
Why expose memory as tools
Agent discretion, interpretable actions and alignment with tool-using agent architectures — at the cost of model discipline.
- Discretion — agent skips storing ephemeral greetings
- Interpretability — memory ops visible in tool-call logs
- Procedural link — stored trajectories become skill memory
- Trade-off — unreliable if the model forgets to call tools
Research
AgeMem and research grounding
Recent research explores reinforcement learning to train agents when to invoke memory tools effectively (AgeMem, arXiv:2601.01885).
RL-trained memory tool use improves long-horizon recall in research settings — production teams often start with Letta’s built-in tools or LangGraph handlers before RL fine-tuning.
Implementation
Implementing memory tools
Define JSON schemas → implement handlers hitting your vector/graph store → register as agent tools → inject results into next turn.
tools = [
{"name": "memory_search", "parameters": {"query": "string", "user_id": "string"}},
{"name": "memory_store", "parameters": {"content": "string", "user_id": "string"}}
]
# Handler calls Engram/Mem0/DIY store on invocation
Comparison
Memory-as-tool vs automatic pipelines
| Approach | Who decides | Examples | Best for |
|---|---|---|---|
| Tool-based | Agent (LLM) | Letta, custom LangGraph tools | Agent-controlled paging, research agents |
| Automatic | Pipeline | Engram, Mem0 | Fast personalization POC |
| Hybrid | Both | Auto-extract + explicit forget tool | Production assistants |
FAQ
Frequently asked questions
What is a memory tools example?
memory_search(query, user_id), memory_store(content, user_id), memory_update(id, content), memory_forget(id) — registered as function-calling tools the LLM invokes.
Memory tools vs Mem0 automatic extraction?
Tools: agent decides when to read/write. Automatic pipelines (Engram, Mem0): extract after each turn. Automatic is faster to ship; tools give more control.
Does Letta use memory tools?
Yes — Letta exposes core/archival memory operations as agent tools (MemGPT paging pattern). See Letta alternatives.
LangGraph memory tools?
Register custom tools with handlers calling Engram, Mem0 or your vector store. LangMem also provides store.search/store.put patterns.
RL for memory tool training?
Research (e.g. AgeMem, arXiv:2601.01885) trains agents when to invoke memory tools. See memory and RL.
How does memory-as-tool link to procedural memory?
Stored tool trajectories and successful plans become procedural memories — how the agent accomplished tasks. See procedural memory.
Production risks of memory tools?
Model may forget to call tools, store PII without filters, or retrieve wrong scope. Mitigate with metadata filters, PII redaction and monitoring.
Hybrid automatic + tool pattern?
Auto-extract salient facts each turn plus explicit memory_forget tool for user corrections — common in production assistants.