Skip to main content

Fast, embedded vector + graph memory for AI agents

Project description

CortexaDB Logo

CortexaDB: SQLite for AI Agents

License: MIT/Apache-2.0 Status: Beta Version PyPI Downloads

CortexaDB is a lightweight, high-performance embedded database built in Rust, specifically designed to serve as the long-term memory for AI agents. It provides a single-file, zero-dependency storage solution that combines the simplicity of SQLite with the semantic power of vector search, graph relationships, and temporal indexing.


The Problem: Why CortexaDB?

Current AI agent frameworks often struggle with "memory" once the context window fills up. Developers usually have to choose between complex, over-engineered vector databases (that require a running server) or simple JSON files (that are slow and lose searchability at scale).

CortexaDB exists to provide a middle ground: a hard-durable, embedded memory engine that runs inside your agent's process. It ensures your agent never forgets, starting instantly with zero overhead, and maintaining millisecond query latencies even as it learns thousands of new facts.


Quickstart

from cortexadb import CortexaDB
from cortexadb.providers.openai import OpenAIEmbedder

# 1. Open database with an embedder 
db = CortexaDB.open("agent.mem", embedder=OpenAIEmbedder())

# 2. Add facts 
mid1 = db.add("The user prefers dark mode.")
mid2 = db.add("User works at Stripe.")
db.connect(mid1, mid2, "relates_to")

# 3. Fluent Query Builder
hits = db.query("What are the user's preferences?") \
    .limit(5) \
    .use_graph() \
    .execute()

print(f"Top Hit: {hits[0].id}")

Installation

CortexaDB is available on PyPI for Python and can be added via Cargo for Rust.

Python

pip install cortexadb
pip install cortexadb[docs,pdf]  # Optional: For PDF/Docx support

Core Capabilities

  • 100x Faster Ingestion: New batch insertion system allows processing 5,000+ chunks/second.
  • Hybrid Retrieval: Search by semantic similarity (Vector), structural relationship (Graph), and time-based recency in a single query.
  • Ultra-Fast Indexing: Uses HNSW (USearch) for sub-millisecond approximate nearest neighbor search.
  • Fluent API: Chainable QueryBuilder for expressive searching and collection scoping.
  • Hard Durability: WAL-backed storage ensures zero data loss.
  • Privacy First: Completely local. Your agent's memory stays on your machine.

Technical Architecture & Benchmarks

Performance Benchmarks (v0.1.7)

Measured on M2 Mac with 1,000 chunks of text.

Operation v0.1.6 (Sync) v0.1.7 (Batch) Improvement
Ingestion 12.4s 0.12s 103x Faster
Memory Add 15ms 1ms 15x Faster
HNSW Search 0.3ms 0.28ms -

License & Status

CortexaDB is currently in Beta (v0.1.7). It is released under the MIT and Apache-2.0 licenses.
We are actively refining the API and welcome feedback!


CortexaDB — Because agents shouldn't have to choose between speed and a soul (memory).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cortexadb-0.1.8-cp313-cp313-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cortexadb-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

cortexadb-0.1.8-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cortexadb-0.1.8-cp311-cp311-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

cortexadb-0.1.8-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file cortexadb-0.1.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cortexadb-0.1.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65b4e9b20e799f96ed7e3b35fed973c8526efecc3139d33f40adcafe4e8627fb
MD5 bb05e9e8161719f7063e497802409f12
BLAKE2b-256 4e2e8839486715978181378592c337cfe1ba185a9d19192beb9f77bb14728450

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexadb-0.1.8-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on anaslimem/CortexaDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cortexadb-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for cortexadb-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 531d75d764594fed2fdf0de75f6b41d143c3ee27e101d8dc68a32dfaed5bce7e
MD5 e29c25f81d535859c39e958eb04b7d6f
BLAKE2b-256 028b0782fca901f0f1351bbbb51420356b9dac4faf5c6ba1d64705e0eaec7b81

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexadb-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: release.yml on anaslimem/CortexaDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cortexadb-0.1.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cortexadb-0.1.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db364b6acb8df323c5e2688e1fc2ba85385965add28cfff7e72c5166b8242906
MD5 b01513d15a9fcf8ec07755563b622ce1
BLAKE2b-256 d9285c1c45b91a436a5224c3529d5df9ad0251ab9b6ea0a0e0b0ee12d6f4577d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexadb-0.1.8-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on anaslimem/CortexaDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cortexadb-0.1.8-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for cortexadb-0.1.8-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bcf40433f0628db5c41d22163ec44571d845808fdd6f2490abce2d1057e0476b
MD5 50d077a9e5c197670c4393ee63919dea
BLAKE2b-256 7347d22249323272e76ea02e32fffc393de3163f8a90f5ea3b949b4bacb9061b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexadb-0.1.8-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: release.yml on anaslimem/CortexaDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cortexadb-0.1.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cortexadb-0.1.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9dec71e744d9553404bc95079975fabceddbcded3a176275fdeb9600d28b5209
MD5 fcbcc0ee7f269de65ad6f805c7bc9893
BLAKE2b-256 73f7b1365b44b3601b163a5192d1766002ea64c7cdc26966a8a57e1a73919390

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexadb-0.1.8-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on anaslimem/CortexaDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page