Inside Neo4j's Agent Memory
Summary
The "neo4j-labs/agent-memory" architecture provides a robust solution for durable AI agent memory, addressing limitations of file systems and vector indexes. It centers on a single Neo4j graph, integrating three memory tiers: short-term conversations, long-term typed entities, and reasoning traces, connected by ":MENTIONS", ":TOUCHED", and ":INITIATED_BY" relationships. The system employs an 8-module architecture, including a 3-stage extraction pipeline using spaCy, GLiNER, and LLMs, and a composite resolver with a "SAME_AS" pattern for deduplication. Its POLE+O ontology (Person, Object, Location, Event, Organization) structures long-term memory, complemented by ":Fact" and ":Preference" nodes. This design enables unified context retrieval, allowing agents to build compounding intelligence and provide personalized experiences.
Key takeaway
For AI Engineers building intelligent agents, adopting a knowledge graph for agent memory is crucial to overcome context fragmentation and achieve compounding intelligence. Your agents can utilize structured memory, like the "neo4j-labs/agent-memory" patterns, to maintain entity identity, personalize interactions, and improve reasoning. Consider implementing a tiered memory system and a robust deduplication strategy to ensure your agents learn and remember effectively across sessions.
Key insights
Graph-based agent memory unifies short-term, long-term, and reasoning contexts for durable, personalized AI interactions.
Principles
- Durable AI memory requires structured graph relationships for identity.
- Memory systems benefit from tiered organization on a single graph.
- Entity extraction should use a cost-optimized, multi-stage ladder.
Method
The "neo4j-labs/agent-memory" system employs a 3-stage extraction pipeline (spaCy, GLiNER, LLM) and a composite resolver. Deduplication uses vector/fuzzy similarity with a "SAME_AS" pattern: auto-merge >0.95, new node <0.85, human review 0.85-0.95.
In practice
- Implement POLE+O ontology for structured entity typing.
- Use ":SAME_AS" edges for human-in-the-loop deduplication.
- Store reasoning traces to enable agent learning from past actions.
Topics
- Agent Memory
- Knowledge Graphs
- Neo4j
- Named Entity Recognition
- Deduplication
- LLM Agents
Code references
Best for: AI Engineer, Machine Learning Engineer, MLOps Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by Decoding AI Magazine.