/neo4j-skills:neo4j-agent-memory-skillfrom neo4j-skills
Authoritative reference for the neo4j-agent-memory Python package — a graph-native memory system for AI agents with short-term, long-term, and reasoning layers on Neo4j, plus the hosted NAMS service.
Ships in neo4j-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Authoritative reference for the neo4j-agent-memory Python package — a Neo4j Labs project that gives AI agents three distinct memory layers (short-term, long-term, reasoning) in a single knowledge graph.
⚠️ Verify authoritative state before writing. Version numbers, extras, tool counts, and API surface change between releases. The values in this skill reflect a specific point in time. Before publishing anything version-sensitive, confirm against PyPI (
https://pypi.org/project/neo4j-agent-memory/) and the GitHub README (https://github.com/neo4j-labs/agent-memory). PyPI is the authoritative source for version numbers — never infer.
neo4j-agent-memory Python package or the hosted NAMS service at memory.neo4jlabs.comneo4j-driver-python-skillneo4j-cypher-skillneo4j-graphrag-skillrelate-agent-memory skill; see neo4j-getting-started-skill → references/choose-engine.md. Shared, multi-agent, or hosted memory stays here.| Field | Value |
|---|---|
| Package | neo4j-agent-memory |
| PyPI | https://pypi.org/project/neo4j-agent-memory/ |
| GitHub | https://github.com/neo4j-labs/agent-memory |
| Canonical docs | https://neo4j.com/labs/agent-memory/ |
| Hosted service | https://memory.neo4jlabs.com (NAMS — early-access; docs at https://memory.neo4jlabs.com/docs and Labs how-to Use NAMS) |
| Hosted MCP endpoint | https://memory.neo4jlabs.com/mcp (Streamable HTTP, bearer auth) |
| License | Apache-2.0 |
| Python | 3.11+ (3.10 dropped in 0.8.0) |
| Neo4j | Bolt backend: AuraDB or self-managed 5.26+ (per package README). NAMS manages its own database |
| Status | Experimental (Neo4j Labs, community-supported) |
| Current version | Not pinned here — releases ship every few weeks. Check PyPI before citing |
A graph-native memory system for AI agents that stores conversations, builds knowledge graphs, and records agent reasoning — all as connected nodes in a single Neo4j database.
neo4j-agent-memory ships in two consumption models. They are the same underlying project — the differences are how you run it, how you authenticate, and what's managed for you.
| Option | What It Is | When to Choose |
|---|---|---|
| Self-hosted library | pip install neo4j-agent-memory + your own Neo4j (local / Docker / Aura). Full Python API, local MCP server, and framework integrations run in your process. | Dev, on-prem data, custom extraction pipelines, full control, bringing your own embeddings / LLMs. |
| Hosted (NAMS) | Managed service at https://memory.neo4jlabs.com. Per-workspace isolated Neo4j Aura database, REST API, remote MCP endpoint, web console. | Zero-infra trials, sharing memory across agents / machines, demos, teams that don't want to run Neo4j. |
⚠️ NAMS is early-access. The package README leads with it and the Labs docs cover it (Use NAMS, Bolt vs NAMS). Do not assert SLAs, pricing, or GA status in published content. See the Hosted Service (NAMS) section below for details.
The defining architectural feature. Every piece of content describing the project should lead with this trinity.
| Memory Type | Stores | Color Convention |
|---|---|---|
| Short-Term | Conversation messages, session history, sequential message chains, metadata-filtered search, LLM-powered summaries | Green (#B2F2BB / #2F9E44) |
| Long-Term | Entities (people, places, orgs), preferences, facts, and the relationships between them — built automatically from conversations via the POLE+O model | Orange/Yellow (#FFEC99 / #F08C00) |
| Reasoning | Decision traces, tool call provenance, thought-action-outcome chains — so the agent can learn from its own past reasoning patterns | Purple (#D0BFFF / #9C36B5) |
Reasoning memory is the primary competitive differentiator. Most competing systems cover short-term and long-term but treat reasoning as an afterthought or omit it entirely. Lead with this when positioning.
Long-term memory uses the POLE+O entity framework — the canonical entity classification for this project:
When diagramming the data model, use ellipses for entity nodes and labeled arrows (UPPER_SNAKE_CASE) for relationships, consistent with Neo4j Browser conventions.
Core install plus extras. The extras pattern is pip install neo4j-agent-memory[<extra>].
pip install neo4j-agent-memory # Core
pip install neo4j-agent-memory[openai] # + OpenAI embeddings (default embedder — needed unless another is configured)
pip install neo4j-agent-memory[nams] # + hosted NAMS backend (pulls httpx)
pip install neo4j-agent-memory[mcp] # + MCP server
pip install neo4j-agent-memory[langchain] # + LangChain
pip install neo4j-agent-memory[all] # Everything
Full extras list (subject to change — verify PyPI): all, anthropic, aws, bedrock, cli, crewai, extraction, full, fuzzy, gliner, gliner2, google, google-adk, instructor, langchain, langchain-agents, litellm, llamaindex, mcp, microsoft-agent, nams, observability, openai, openai-agents, opentelemetry, opik, pydantic-ai, sentence-transformers, spacy, strands, vertex-ai.
Canonical import pattern and basic usage. This is the shape to reproduce in tutorials and examples.
Default embedder is OpenAI (text-embedding-3-small). Install neo4j-agent-memory[openai] and set OPENAI_API_KEY, or the first add_message fails (EmbeddingError / missing credentials). Local alternative: [sentence-transformers] extra + embedding="sentence-transformers/all-MiniLM-L6-v2". Version 0.6.0 also failed on Bolt with ModuleNotFoundError: No module named 'httpx' — fixed in 0.7.0; on 0.6.0 add the [nams] extra.
import asyncio
from neo4j_agent_memory import MemoryClient, MemorySettings
async def main():
settings = MemorySettings(
neo4j={"uri": "bolt://localhost:7687", "password": "your-password"},
embedding="openai/text-embedding-3-small", # needs [openai] + OPENAI_API_KEY
)
async with MemoryClient(settings) as memory:
# Short-term: store a conversation message
await memory.short_term.add_message(
session_id="user-123",
role="user",
content="Hi, I'm John and I love Italian food!"
)
# Long-term: build the knowledge graph
await memory.long_term.add_entity("John", "PERSON")
await memory.long_term.add_preference(
category="food",
preference="Loves Italian cuisine"
)
# Get combined context for an LLM prompt
context = await memory.get_context(
"What restaurant should I recommend?",
session_id="user-123"
)
print(context)
asyncio.run(main())
Note the async context manager pattern (async with MemoryClient(settings) as memory:) — this is the canonical form.
Exposes memory as tools for MCP-compatible AI assistants (Claude Desktop, Claude Code, Cursor, VS Code Copilot).
The authoritative one-liner (no install needed):
uvx --from "neo4j-agent-memory[mcp,openai]" neo4j-agent-memory mcp serve --password <neo4j-password>
[openai] (plus OPENAI_API_KEY) is needed for the default embedder; or pass --embedding sentence-transformers/all-MiniLM-L6-v2 with the [sentence-transformers] extra.
Install-local alternative:
neo4j-agent-memory mcp serve --password <pw>
# stdio (default — Claude Desktop, Claude Code)
neo4j-agent-memory mcp serve --password <pw>
# Streamable HTTP (network; endpoint /mcp/). `--transport sse` deprecated — serves Streamable HTTP with warning
neo4j-agent-memory mcp serve --transport http --port 8080 --password <pw>
# Core profile — fewer tools, less context overhead
neo4j-agent-memory mcp serve --profile core --password <pw>
# Session continuity across conversations
neo4j-agent-memory mcp serve \
--session-strategy per_day \
--user-id alice \
--password <pw>
| Profile | Tools | Contents |
|---|---|---|
| core | 6 | memory_search, memory_get_context, memory_store_message, memory_add_entity, memory_add_preference, memory_add_fact |
| extended (default) | 16 | Core + conversation history, entity details, graph export, relationship creation, reasoning traces, observations, read-only Cypher |
As of v0.1.1, memory_add_fact accepts a metadata parameter, bringing it to parity with memory_add_entity.
claude mcp add neo4j-agent-memory -- \
uvx --from "neo4j-agent-memory[mcp,openai]" neo4j-agent-memory mcp serve --password <neo4j-password>
{
"mcpServers": {
"neo4j-agent-memory": {
"command": "uvx",
"args": ["--from", "neo4j-agent-memory[mcp,openai]", "neo4j-agent-memory", "mcp", "serve", "--password", "your-password"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}
For the hosted MCP endpoint at
memory.neo4jlabs.com/mcp, see the Hosted Service (NAMS) section below — it uses Streamable HTTP transport and bearer-token auth, not a localuvxinvocation.
NAMS — Neo4j Agent Memory Service — is the managed deployment of neo4j-agent-memory at https://memory.neo4jlabs.com. It bundles the REST API, the MCP server, a web console, and per-workspace Neo4j Aura databases.
⚠️ Verify against the live service before citing. Endpoint shapes, tool counts, auth flows, and limits can change without a release note. Before publishing anything NAMS-specific, re-check the NAMS docs, the OpenAPI spec at
/openapi.json, and the Labs pages Use NAMS and Bolt vs NAMS.
https://memory.neo4jlabs.comhttps://memory.neo4jlabs.com/v1/ — OpenAPI spec at /openapi.json; covers conversations, entities, observations, reasoning traces, and read-only Cypherhttps://memory.neo4jlabs.com/mcp — Streamable HTTP transport, exposes the hosted tool set, bearer-token authnams_, created and rotated from the web console — used as a bearer token for REST and MCPX-Workspace-Id header / workspace_id), else workspace_id required. Workspace-bound keys need no headerDon't mix these with the self-hosted library's --password Neo4j credential — they serve different sides of the stack.
Same package talks to NAMS — no REST code needed:
pip install "neo4j-agent-memory[nams]"
export MEMORY_API_KEY=nams_...
export MEMORY_ENDPOINT=https://memory.neo4jlabs.com/v1
MemoryClient() selects NAMS when MEMORY_API_KEY is set, else Bolt. Explicit: NamsSettings / connect().neo4j-agent-memory mcp serve --backend nams.NotSupportedError on NAMS — check Bolt vs NAMS. Neo4j version requirement applies to Bolt only.Each workspace is backed by an isolated Neo4j Aura database, provisioned on demand. Bring-your-own-Neo4j is supported as an alternative, configured per workspace.
Usage counters are tracked per API key / workspace. Exact limits are not publicly documented — check the console or re-verify against the service before committing customers to numbers.
claude mcp add --transport http neo4j-agent-memory-hosted \
https://memory.neo4jlabs.com/mcp \
--header "Authorization: Bearer <nams_api_key>"
.mcp.json (Hosted MCP){
"mcpServers": {
"neo4j-agent-memory-hosted": {
"url": "https://memory.neo4jlabs.com/mcp",
"type": "http",
"headers": {
"Authorization": "Bearer nams_..."
}
}
}
}
claude_desktop_config.json takes local (stdio) servers only. Use Settings → Connectors → Add custom connector, or the mcp-remote stdio bridge:
{
"mcpServers": {
"neo4j-agent-memory-hosted": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://memory.neo4jlabs.com/mcp", "--header", "Authorization:${AUTH_HEADER}"],
"env": { "AUTH_HEADER": "Bearer nams_..." }
}
}
}
All integrations live under neo4j_agent_memory.integrations.<framework>. Install the matching extra.
| Framework | Install Extra | Import |
|---|---|---|
| LangChain | [langchain] | from neo4j_agent_memory.integrations.langchain import Neo4jAgentMemory |
| Pydantic AI | [pydantic-ai] | from neo4j_agent_memory.integrations.pydantic_ai import MemoryDependency |
| Google ADK | [google-adk] | from neo4j_agent_memory.integrations.google_adk import Neo4jMemoryService |
| AWS Strands | [strands] | from neo4j_agent_memory.integrations.strands import context_graph_tools |
| CrewAI | [crewai] | from neo4j_agent_memory.integrations.crewai import Neo4jCrewMemory |
| LlamaIndex | [llamaindex] | from neo4j_agent_memory.integrations.llamaindex import Neo4jLlamaIndexMemory |
| OpenAI Agents | [openai-agents] | from neo4j_agent_memory.integrations.openai_agents import ... |
| Microsoft Agent Framework | [microsoft-agent] | from neo4j_agent_memory.integrations.microsoft_agent import Neo4jMicrosoftMemory |
Multi-stage extraction (cost/quality tradeoff from fastest → most accurate):
GLiREL for relationshipsEnrichment is a separate background stage: Wikipedia and Diffbot can hydrate extracted entities with additional context.
Deduplication (v0.1.1+) auto-merges duplicate facts and preferences using subject/predicate matching plus embedding similarity (threshold ~0.95), and updates confidence rather than creating new nodes. Tuned via DeduplicationConfig.
Configuration objects to know: ExtractionConfig, DeduplicationConfig, MemoryIntegration, SessionStrategy.
These phrasings are load-bearing. Use them verbatim when possible.
neo4j-agent-memory is positioned as the complete implementation of the context graph category — it covers all three memory layers, not just two.neo4j-labs-brand skill for the full voice guide).When editing or reviewing content about this project, check for:
neo4j.com/labs/agent-memory, not a Vercel preview URL.mcp-neo4j-cypher, mcp-neo4j-memory — the old knowledge graph memory server, etc.). neo4j-agent-memory's MCP server is distinct and ships as part of the package under the [mcp] extra.uvx invocation and a Neo4j --password; NAMS uses a Streamable HTTP MCP URL and a nams_-prefixed bearer token. Don't mix them.Mentions of these are frequent; recognize them and use the correct names.
| Project | What It Is |
|---|---|
| create-context-graph | CLI scaffolder (uvx create-context-graph) that generates full-stack context graph apps pre-wired with neo4j-agent-memory. Canonical docs: create-context-graph.dev. |
| Lenny's Podcast Memory Explorer | Flagship demo — 299 podcast episodes, knowledge graph, geospatial maps, Wikipedia enrichment. PydanticAI-based. Source: https://github.com/neo4j-labs/agent-memory/tree/main/examples/lennys-memory |
| neo4j-agent-integrations | Broader umbrella of framework integrations, many of which are packaged back into neo4j-agent-memory under [<framework>] extras. |
| agent-memory-tck | Technology Compliance Kit — behavioral specifications for multi-language/multi-framework interoperability (polyglot). |
| Microsoft Learn integration | Official Microsoft Agent Framework docs reference neo4j-agent-memory as the Neo4j Memory Provider. |
Point users to the upstream examples rather than inventing examples. All items below live under the examples/ directory at https://github.com/neo4j-labs/agent-memory/tree/main/examples :
When building diagrams for this project, combine this skill with:
excalidraw skill — JSON format and the project's diagram management scriptneo4j-styleguide skill — Cypher code style and Neo4j brand colorsneo4j-labs-brand skill — Labs purple (#6366F1), status badges, disclaimer languageMemory-type colors (use consistently across all diagrams):
Short-Term: #B2F2BB fill / #2F9E44 stroke (green)
Long-Term: #FFEC99 fill / #F08C00 stroke (orange/yellow)
Reasoning: #D0BFFF fill / #9C36B5 stroke (purple)
Neo4j/Store: #A5D8FF fill / #1971C2 stroke (blue)
Labs accent: #6366F1 (purple, for Labs branding elements)
The canonical docs at neo4j.com/labs/agent-memory follow the Diataxis framework (see the diataxis skill in this project for details):
When adding new content, place it in the right quadrant.
Before publishing any content about this project, verify:
neo4j.com/labs/agent-memoryneo4j_agent_memory.integrations.<framework> (underscore, snake_case)/openapi.json)neo4j-agent-memory[<extra>])MemoryClient as async context manager--passwordWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
neo4j-agent-memory, agent-memory, graph-memory, pole-o-model, nams
npx claudepluginhub neo4j/agent-skills --plugin neo4j-skills30 skills in this plugin
/neo4j-aura-agent-skillManages Neo4j Aura Agents via the v2beta1 REST API — create, list, get, update, delete, and invoke Aura agents backed by an AuraDB instance. Use when configuring Aura Agent tools (CypherTemplate, SimilaritySearch, Text2Cypher), setting system prompts, deploying agents to REST or MCP endpoints, invoking agents with natural language queries, or generating evaluation datasets (max 50 questions) for the Aura Agent evaluation feature. Covers OAuth2 auth, organization/project scoping, tool parameter schemas, and InvokeAgentResponse format. Does NOT cover AuraDB instance provisioning — use neo4j-aura-provisioning-skill. Does NOT cover vector index creation — use neo4j-vector-index-skill./neo4j-aura-graph-analytics-skillServerless Aura Graph Analytics (AGA) GDS Sessions — covers GdsSessions, AuraGraphDataScience, AuraAPICredentials, DbmsConnectionInfo, SessionMemory, get_or_create, remote graph projection with gds.graph.project.cypher and gds.graph.project.remote, gds.graph.project.native, gds.graph.construct, graphdatascience client 2.0 session endpoints, async compute and gds.jobs, AuraDB Cypher API memory/sessionId projection, algorithms, write-back, and session lifecycle. Use for AuraDB-connected, self-managed Neo4j, or standalone DataFrame/Spark session workloads. Does NOT cover the embedded GDS plugin on Aura Pro or self-managed Neo4j — use neo4j-gds-skill. Does NOT handle Cypher authoring — use neo4j-cypher-skill. Does NOT cover Snowflake Graph Analytics — use neo4j-snowflake-graph-analytics-skill.Other plugins' skills for the same job