Neo4j Agent Memory
AI model by Neo4j
Graph-based memory for AI agents to store context, entities, and reasoning.
Neo4j Agent Memory is a graph-based memory layer for AI agents that stores conversations, entities, and reasoning traces in an interconnected Neo4j graph. It is designed for developers building sophisticated AI assistants that require long-term context and auditable reasoning.
Model specs
The full spec card (context, pricing per token, modalities and more) on AntSpace. Sign up free to see the full spec card.
- Languages
- Python, TypeScript
Category: AI Infrastructure
- Sizes and variants
- GLiNER2.5 (for extraction)
- Access
- Python SDK, TypeScript SDK, REST API, Hosted NAMS Workspace
- Languages
- Python, TypeScript
- Extraction Model
- GLiNER2.5
- Client SDKs
- Python, TypeScript
- Connection Protocol
- Bolt
- Graph-based memory layer for AI agents
- Supports short-term, long-term, and reasoning memory
- Ontology-driven entity extraction using GLiNER2.5
- Integrations for LangChain, LlamaIndex, and PydanticAI
- Available via Python and TypeScript SDKs
Overview
Neo4j Agent Memory is a Neo4j Labs project that provides a specialized graph-based memory layer for AI agents and generative AI applications. It enables developers to store and retrieve three distinct types of memory—short-term conversation history, long-term entity knowledge, and reasoning traces—within a single interconnected Neo4j graph. By linking messages to the entities they mention and reasoning steps to their sources, it allows agents to maintain deep context and learn from interactions over time. The library supports ontology-driven entity extraction using GLiNER2.5 and provides built-in entity resolution to keep the knowledge graph clean. It is delivered through Python and TypeScript SDKs and can be deployed using either a self-managed Neo4j database or a hosted NAMS workspace. Neo4j Agent Memory integrates with popular frameworks such as LangChain, LlamaIndex, and PydanticAI to simplify the addition of persistent memory to agentic workflows.
Memory Management
- Short-term Memory: The library stores conversation messages and metadata in a Neo4j graph to provide context for subsequent agent interactions.
- Long-term Memory: It manages entities, graph relationships, user preferences, and facts to maintain long-term context across sessions.
- Reasoning Traces: The system records application-supplied traces, steps, and tool calls to allow for the inspection and auditing of agent actions.
- Interconnected Graph Memory: It links messages to mentioned entities and reasoning traces to the messages that initiated them within a single interconnected graph.
Knowledge Extraction and Resolution
- Ontology-Driven Extraction: The library uses an ontology document to drive GLiNER2.5 for the extraction of entities and relationships from text.
- Entity Resolution Management: It resolves new mentions against existing entities during ingestion to maintain a clean and accurate knowledge graph.
- Custom Extraction Schemas: Users can apply custom entity extraction schemas to tailor the knowledge graph to specific domain requirements.
- Batch Processing: The system supports batch and chunk extraction to handle large volumes of unstructured data efficiently.
Developer Tools and Integrations
- Python SDK Support: Neo4j Agent Memory provides a dedicated SDK for Python developers to integrate graph memory into their AI applications.
- TypeScript SDK Support: A TypeScript SDK is available for building memory-enabled agents in JavaScript and Node.js environments.
- Framework Integrations: The library integrates with major frameworks including LangChain, LlamaIndex, PydanticAI, CrewAI, and the OpenAI Agents SDK.
- Cloud and Web Integrations: It supports integration with the Vercel AI SDK, Microsoft Agent Framework, and Google ADK.
Operational Features
- Bolt Connection Support: The library connects directly to a Neo4j database through the Bolt protocol for self-managed deployments.
- Hosted NAMS Workspace: Developers can use a hosted NAMS workspace for a managed backend experience without managing their own database.
- User-Scoped Memory: It allows for the association of memory with specific users and supports scoped reads for data privacy.
- Buffered Writes: The system includes buffered writes to handle high-frequency memory updates without blocking application execution.
Use cases
- Developers build persistent chatbots that remember user preferences and past interactions across multiple sessions.
- AI agents extract entities and relationships from conversations to build a dynamic knowledge graph of a specific domain.
- System auditors inspect reasoning traces and tool calls to understand how an agent arrived at a specific answer.
- Application teams share a common memory pool across multiple agents to ensure consistent knowledge and context.
Specifications
- Sizes and variants
- GLiNER2.5 (for extraction)
- Access
- Python SDK, TypeScript SDK, REST API, Hosted NAMS Workspace
- Languages
- Python, TypeScript
- Extraction Model
- GLiNER2.5
- Client SDKs
- Python, TypeScript
- Connection Protocol
- Bolt
- Storage Backends
- Neo4j DBMS, NAMS Hosted Workspace
- Memory Types
- Short-term, Long-term, Reasoning
- Integration Frameworks
- LangChain, LlamaIndex, PydanticAI, CrewAI, OpenAI Agents SDK
- Cloud Platforms
- AWS, Google Cloud (Vertex AI), Microsoft Azure
How it works
- Install the SDK: Developers install the neo4j-agent-memory Python package or the @neo4j-labs/agent-memory TypeScript package.
- Configure Storage Backend: The application connects to either a self-hosted Neo4j database using the Bolt protocol or a hosted NAMS workspace.
- Define Ontology: An ontology document is provided to define the types of entities and relationships the agent should extract and remember.
- Integrate Memory Operations: The agent uses the SDK to store messages, extract entities into the long-term graph, and record reasoning traces for later recall.
FAQ
What types of memory does Neo4j Agent Memory support?
Neo4j Agent Memory supports three distinct memory types: short-term memory for conversation history, long-term memory for entities and facts, and reasoning traces for auditing agent steps.
Can I use Neo4j Agent Memory with existing agent frameworks?
Yes, it integrates with major frameworks such as LangChain, LlamaIndex, PydanticAI, CrewAI, and the OpenAI Agents SDK.
How does it extract entities for long-term memory?
The library uses an ontology-driven extraction process powered by GLiNER2.5 to identify and link entities and relationships from unstructured text.
What are the storage options for the memory graph?
You can choose between connecting to a self-managed Neo4j database via the Bolt protocol or using a hosted NAMS (Neo4j Agent Memory Service) workspace.
Added by AntSpace from public sources (neo4j.com).