AI & DevelopmentDatabasesDeveloper Tools

Neo4j Relate: Embed a Graph Database in Your AI Agent

Neo4j shipped Relate on November 11 — an embedded, agent-native graph database written in Rust that lives inside your process, requires no server, and costs nothing to run. Install it with pip install relate-db, query it in Cypher, and your agent gets persistent graph memory with sub-millisecond reads. It’s Apache 2.0, and there’s a hackathon running through December 11 if you want an excuse to build with it.

The interesting part isn’t “Neo4j made something smaller.” It’s that the missing piece for serious agent memory — a database that understands relationships, not just rows — now fits in a pip install.

Agents Have a Memory Problem

Most agents reach for SQLite. It’s the right call for flat state: session IDs, user preferences, tool logs. But SQLite doesn’t know that Alice works for Acme, Acme is in the same industry as a prospect you’re targeting, and that prospect’s CTO recently published something the agent summarized last week. Those are edges, not columns.

When you model connected data in a relational database, you either write recursive CTEs that hurt to look at, or you give up and pass a giant flat list to the model and hope it reasons through the connections. Neither is production-grade agent memory.

Relate gives you a native graph. Nodes are entities. Edges are relationships. A Cypher match traverses both. The database is designed for the high-frequency read/write cycles agents actually generate — in-memory at sub-millisecond latency, or persisted to disk with a write-ahead log.

The Install Is Not a Project

This is worth saying clearly because every other graph database has historically been a weekend to get running. Relate is not that.

pip install relate-db

Then:

import relate

db = relate.connect(":memory:")

db.execute("CREATE (a:Person {name: 'Alice'})")
db.execute("CREATE (b:Person {name: 'Bob'})")
db.execute(
    "MATCH (a:Person {name:'Alice'}), (b:Person {name:'Bob'}) "
    "CREATE (a)-[:KNOWS]->(b)"
)

result = db.execute(
    "MATCH (a:Person)-[:KNOWS]->(b) RETURN a.name, b.name"
)

Swap ":memory:" for a path like "./agent-memory" and the graph persists to disk. Same API. No configuration file, no connection string, no port to open.

The GitHub repo has clients for Python, Node.js (native and WASM), Rust, Java, Go, and Swift. The CLI installs via curl -sSfL https://relatedb.ai/install.sh | bash if you prefer the interactive shell first.

The MCP Angle

Relate ships with a built-in MCP server. Run relate skill install from the CLI and the database skill is wired into Claude Code, Cursor, or any MCP-compatible host. No manual configuration.

What that gets you: the agent can build and traverse a graph mid-session without any database code on your side. Tool calls create nodes. Relationships accumulate. The agent queries the graph for context before each completion. It’s the architecture a lot of people have been assembling by hand — with separate vector stores, separate key-value layers, separate graph instances — now collapsed into one embedded library with one management surface.

If you want to expose the database over the network, relate serve starts Bolt (7687), HTTP (7474), and MCP (7475) in one process. One generated token handles auth. That’s the full server story.

Relate Is Not a SQLite Replacement

To be direct: if your agent tracks flat state — task history, session config, counters — SQLite is still the right tool. Relate doesn’t beat SQLite on high-frequency small writes to flat rows.

DuckDB is still better for analytical queries over large datasets. If your agent needs to aggregate millions of log entries or query parquet files, use DuckDB.

Relate is for the case where you’re modeling connected data and you need to traverse relationships. Customer → interaction history → product mentioned → competitor. User → task → subtask → blocking issue. That topology is native to a graph database. Forcing it into a relational schema makes both the write path and the read path more painful than they need to be.

If you’ve looked at Kuzu (also embedded Cypher, also open source), the main difference is workload: Kuzu is columnar and optimized for analytical scans. Relate is OLTP-optimized — lower latency per operation, built for the transaction-heavy pattern agents generate.

When to Use It

Use Relate when:

  • Agents accumulate knowledge across sessions and that knowledge has relationships
  • You’re doing GraphRAG — retrieval from a knowledge graph, not just vector similarity
  • Your data model has entities that connect to other entities and you’ll traverse those connections
  • You need sub-millisecond in-memory reads for a hot graph

The launch hackathon runs through December 11, with a Mac Studio as the top prize. The official tutorial covers all three run modes in depth. The repo is at github.com/relatedb/relate under Apache 2.0.

The embedded database layer for connected agent data has been missing for a while. This fills it.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *