An embedded database designed for AI Agent long-term memory, supporting hybrid retrieval across vector, graph, and temporal dimensions.
Positioned as "SQLite for AI Agents," CortexaDB addresses the persistent memory problem for AI Agents after context window overflow. The core engine is written in Rust (cortexadb-core) and exposes high-performance Python bindings (cortexadb-py) via maturin, managed as a Cargo workspace.
Retrieval Engine#
- Vector Search: Native semantic similarity retrieval using HNSW algorithm (backed by USearch library) for sub-millisecond approximate nearest neighbor search.
- Graph Relationships: Supports creating and querying relationship edges between memory entries (e.g.,
relates_to), mixable with vector search in the same query. - Temporal Indexing: Built-in time-dimension indexing supporting time-decay/recency-based retrieval.
- Hybrid Retrieval: A single query can leverage all three signals—semantic similarity, structural relationships, and temporal decay.
Storage & Performance#
- WAL (Write-Ahead Log) backed storage ensures zero data loss.
- Batch writes claimed at 5,000+ chunks/second (README claim, no independent benchmark data found).
Usability#
- Zero-dependency / Single-file: No server process needed, SQLite-like embedded experience.
- Fluent Query Builder: Chain-style Python API (
.query().limit().use_graph().execute()). - Embedder Abstraction: Inject external embedding models via provider interface (only
OpenAIEmbeddershown in docs; other model support unconfirmed). - Document Parsing (optional): Install
cortexadb[docs,pdf]for PDF/DOCX parsing and import.
Privacy & Deployment#
- Fully local execution; data never leaves the user's machine.
- Cross-platform: Windows, Linux, macOS.
- Current stable version v1.0.1, dual-licensed under MIT + Apache-2.0.
Quick Start#
from cortexadb import CortexaDB
from cortexadb.providers.openai import OpenAIEmbedder
db = CortexaDB.open("agent.mem", embedder=OpenAIEmbedder())
mid1 = db.add("The user prefers dark mode.")
mid2 = db.add("User works at Stripe.")
db.connect(mid1, mid2, "relates_to")
hits = db.query("What are the user's preferences?").limit(5).use_graph().execute()
Unconfirmed Items#
- Batch write performance lacks independent benchmark verification.
- Documentation site
cortexa-db.vercel.apphas SSL certificate issues; full docs cannot be verified. - PyPI page protected by JS challenge; package details unverifiable.
use_graph()graph traversal algorithm (BFS/DFS/PageRank etc.) and depth limits undocumented.- Whether
cortexadb-coreis published to crates.io is unclear.