Zero LLM cost • CPU-only • Open Source

memgraph-agent

Graph-powered memory for AI agents.

NER entity extraction + co-occurrence graph + Personalized PageRank.
Multi-hop retrieval in 1.9ms. No API keys needed.

GitHub
$ pip install memgraph-agent ✓ copied
102
Entity Nodes
728
Graph Edges
1.9ms
PPR Retrieval
$0
LLM Cost

Three pillars of intelligent memory

Inspired by SPRIG, built for production.

NER Entity Graph

CPU-only entity extraction via spaCy + domain dictionaries. Supports English & Chinese. Custom dictionaries for finance, crypto, and AI terms. No LLM calls, no API keys.

spaCy (15MB) + regex → <1ms extraction

PPR Multi-hop Retrieval

Personalized PageRank walks the co-occurrence graph to find entities N hops away. Search "BTC" → find "Freqtrade" (2 hops). With explainable path traces.

α=0.85 damping • 1.9ms avg • 2-hop default

Hybrid Search

Fuses vector similarity (ChromaDB + sentence-transformers) with graph PPR scores. 28% higher multi-hop recall than vector-only. Tunable α blend factor.

score = α·vector + (1-α)·PPR

Architecture

📝
Text Input
MEMORY.md
Daily notes
Live ingest
🔬
NER Extract
spaCy + regex
EN/ZH support
Custom dicts
🕸️
Graph + Vector
NetworkX graph
ChromaDB vectors
Co-occurrence
🔍
Hybrid Search
PPR multi-hop
Vector similarity
Fused ranking

Quick Start

1. Install
pip install memgraph-agent
python -m spacy download en_core_web_sm
2. Build your knowledge graph
from memgraph_agent import MemoryGraph

mg = MemoryGraph()
result = mg.build()
# → 102 nodes, 728 edges, 8 communities
3. Search with multi-hop retrieval
# Hybrid search (vector + graph PPR)
results = mg.search("BTC trading strategy")

# Pure graph search (PPR only, ~1.9ms)
results = mg.ppr_search("BTC")

# Add new memories
mg.ingest("CrewAI v0.80 released with async support")
4. Visualize & explore
# Interactive HTML visualization (pyvis)
mg.visualize()

# Detect entity communities (Louvain)
communities = mg.communities()

# Export for external tools
mg.export()  # → GraphML format

How it compares

System Monthly Cost Latency Multi-hop CPU-only
GPT-4 extraction ~$450 2-5s Prompt-dependent
Mem0 ~$200-500 1-3s Limited
GraphRAG ~$100-300 Minutes
memgraph-agent $0 <2ms ✓ PPR