Python SDK — neo4j-agent-memory

The Python SDK is the original implementation of the agent-memory contract. It can talk to Neo4j directly over Bolt or to the hosted NAMS service over HTTP.

Install

pip install neo4j-agent-memory
# or, with uv:
uv add neo4j-agent-memory

Optional extras (extractors, framework integrations, embeddings):

pip install "neo4j-agent-memory[all]"

Quick start

from neo4j_agent_memory import MemoryClient, MemorySettings

settings = MemorySettings(
    neo4j={"uri": "bolt://localhost:7687", "password": "password"}
)

async with MemoryClient(settings) as client:
    msg = await client.short_term.add_message("session-1", "user", "Hello")
    await client.long_term.add_entity("Alice", "PERSON")
    context = await client.get_context("hello")

For the hosted service, swap the neo4j={…​} config for nams={"api_key": "nams_…​"} — see NAMS Quickstart.

Where to go next

Source and releases

Looking for the TypeScript SDK?

See TypeScript SDK. The two SDKs share the same memory model and back onto the same NAMS service, so a Python and a TypeScript agent can read and write the same memory.