Fast, embedded vector + graph memory for AI agents
Project description
CortexaDB: SQLite for AI Agents
CortexaDB is a simple, fast, and hard-durable embedded database designed specifically for AI agent memory. It provides a single-file-like experience (no server required) but with native support for vectors, graphs, and temporal search.
Think of it as SQLite, but with semantic and relational intelligence for your agents.
Quickstart
Python (Recommended)
CortexaDB is designed to be extremely easy to use from Python via high-performance Rust bindings.
from cortexadb import CortexaDB
# Open database (auto-creates if missing)
# You can provide a manual dimension or an Embedder instance
db = CortexaDB.open("agent.mem", dimension=1536)
# Store a memory
mid = db.remember("The user prefers dark mode for the dashboard.", metadata={"type": "preference"})
# Ask a question (Semantic Search)
hits = db.ask("Does the user have UI preferences?")
for hit in hits:
print(f"ID: {hit.id}, Score: {hit.score}")
# Connect memories (Graph Relationships)
db.connect(mid1, mid2, "relates_to")
Installation
Python
CortexaDB is available on PyPI and can be installed via pip:
# Recommended: Install from PyPI
pip install cortexadb
# From GitHub (Install latest release)
pip install "cortexadb @ git+https://github.com/anaslimem/CortexaDB.git#subdirectory=crates/cortexadb-py"
Rust
Add CortexaDB to your Cargo.toml:
[dependencies]
cortexadb-core = { git = "https://github.com/anaslimem/CortexaDB.git" }
Key Features
- Hybrid Retrieval: Combine vector similarity (semantic), graph relations (structural), and recency (temporal) in a single query.
- Hard Durability: Write-Ahead Log (WAL) and Segmented logs ensure your agent never forgets, even after a crash.
- Multi-Agent Namespaces: Isolate memories between different agents or workspaces within a single database file.
- Deterministic Replay: Record operations to a log file and replay them exactly to debug agent behavior or migrate data.
- Automatic Capacity Management: Set
max_entriesormax_bytesand let CortexaDB handle LRU/Importance-based eviction automatically. - Crash-Safe Compaction: Background maintenance that keeps your storage lean without risking data loss.
API Guide
Core Operations
| Method | Description |
|---|---|
CortexaDB.open(path, ...) |
Opens or creates a database at the specified path. |
.remember(text, ...) |
Stores a new memory. Auto-embeds if an embedder is configured. |
.ask(query, ...) |
Performs a hybrid search across vectors, graphs, and time. |
.connect(id1, id2, rel) |
Creates a directed edge between two memory entries. |
.namespace(name) |
Returns a scoped view of the database for a specific agent/context. |
.delete_memory(id) |
Permanently removes a memory and updates all indexes. |
.compact() |
Reclaims space by removing deleted entries from disk. |
.checkpoint() |
Truncates the WAL and snapshots the current state for fast startup. |
Configuration Options
When calling CortexaDB.open(), you can tune the behavior:
sync:"strict"(safest),"async"(fastest), or"batch"(balanced).max_entries: Limits the total number of memories (triggers auto-eviction).record: Path to a log file for capturing the entire session for replay.
Technical Essentials: How it's built
Click to see the Rust Architecture
Why Rust?
CortexaDB is written in Rust to provide memory safety without a garbage collector, ensuring predictable performance (sub-100ms startup) and low resource overhead—critical for "embedded" use cases where the DB runs inside your agent's process.
The Storage Engine
CortexaDB follows a Log-Structured design:
- WAL (Write-Ahead Log): Every command is first appended to a durable log with CRC32 checksums.
- Segment Storage: Large memory payloads are stored in append-only segments.
- Deterministic State Machine: On startup, the database replays the log into an in-memory state machine. This ensures 100% consistency between the disk and your queries.
Hybrid Query Engine
Unlike standard vector DBs, CortexaDB doesn't just look at distance. Our query planner can:
- Vector: Find semantic matches using Cosine Similarity.
- Graph: Discover related concepts by traversing edges created with
.connect(). - Temporal: Boost or filter results based on when they were "remembered".
Versioned Serialization
We use a custom versioned serialization layer (with a "magic-byte" header). This allows us to update the CortexaDB engine without breaking your existing database files—it knows how to read "legacy" data while writing new records in the latest format.
License & Status
CortexaDB is currently in Beta (v0.1). 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cortexadb-0.1.1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95e798107f766ff00b6051bd064fa6fb66032843f00edbe86f28a393c3471337
|
|
| MD5 |
e0b8cdbbbb30bf3c16372ccaed65b42f
|
|
| BLAKE2b-256 |
0064214bbf1f66fb895c988ea56567c3aa9640cafbf9422ecc9b7bd63c82c0bb
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp314-cp314-win_amd64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp314-cp314-win_amd64.whl -
Subject digest:
95e798107f766ff00b6051bd064fa6fb66032843f00edbe86f28a393c3471337 - Sigstore transparency entry: 992457965
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7d1be9ee83914a6c717f9b4461c4c7b94d20e87211a95315d0a173448708999
|
|
| MD5 |
563834fe8ea75b46c484a17946e9b303
|
|
| BLAKE2b-256 |
ceac108ff7929584bad89c4a626a8de09d7ef0395eb1d70a1c4445169518345d
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp313-cp313-win_amd64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp313-cp313-win_amd64.whl -
Subject digest:
e7d1be9ee83914a6c717f9b4461c4c7b94d20e87211a95315d0a173448708999 - Sigstore transparency entry: 992457964
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
241c208578207720dcc1a472dd7b88366260f4e72f85461807ec145680c8597e
|
|
| MD5 |
dbedb4ddc614cb73277da2fe42ae9f01
|
|
| BLAKE2b-256 |
260bd655446ac18d084df6fdc6957c32fad7f9671af3fe1c4e9936a92656af8d
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
241c208578207720dcc1a472dd7b88366260f4e72f85461807ec145680c8597e - Sigstore transparency entry: 992457947
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d02ec199e2fb4939e631bd273defdf6e563aac4c70a3fb3bd3bd98e9c05997b3
|
|
| MD5 |
40941debef2dde9f4909e246b495d911
|
|
| BLAKE2b-256 |
225c40cc5bc2f5e1eaa0e970da5251c82eda0afeba1082472e1908112244fbc1
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp312-cp312-win_amd64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp312-cp312-win_amd64.whl -
Subject digest:
d02ec199e2fb4939e631bd273defdf6e563aac4c70a3fb3bd3bd98e9c05997b3 - Sigstore transparency entry: 992457942
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f62d1975838edd4cf29a0f4a0194bba9a67d0ba9288b04d6256da337e564478c
|
|
| MD5 |
40ba229385717f01c5c2d7b13ce0439f
|
|
| BLAKE2b-256 |
8744ac14c667eace12566c06cf9a1505bab2fc3488b203dcc43f395d19dacac8
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl -
Subject digest:
f62d1975838edd4cf29a0f4a0194bba9a67d0ba9288b04d6256da337e564478c - Sigstore transparency entry: 992457958
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
521c3b72dddba67e8db49d0b0fec7083ca8047375d100ab5c178c1c49656d6fd
|
|
| MD5 |
ab0ec51a3ea42e741d12f8fba935c40d
|
|
| BLAKE2b-256 |
a7f65fc80780b86a9deeb6d364613f73f7ab04d7d1ebcb4ab912f149629ffa27
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
521c3b72dddba67e8db49d0b0fec7083ca8047375d100ab5c178c1c49656d6fd - Sigstore transparency entry: 992457968
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dd16944361e7fdec489e301e0719886e5ba41ef67186535b91ed1b88aa41436
|
|
| MD5 |
6c8c3854ce3862be0f8ff9e1c9b4300b
|
|
| BLAKE2b-256 |
664e1d164bfa80cecfe6ba9df4265de33e07535b25c81a2476779b061f498868
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp311-cp311-win_amd64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp311-cp311-win_amd64.whl -
Subject digest:
1dd16944361e7fdec489e301e0719886e5ba41ef67186535b91ed1b88aa41436 - Sigstore transparency entry: 992457955
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cec67442c339c9a9b3f4804ec088010cf6761ba92dd5356da45b9434f99dc65
|
|
| MD5 |
3cbc03b463027ca2c25c23106ff175fc
|
|
| BLAKE2b-256 |
e84ce14090649e9183993ded4edc360639d16d2236f740e8f528f643bc7aa3d8
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl -
Subject digest:
7cec67442c339c9a9b3f4804ec088010cf6761ba92dd5356da45b9434f99dc65 - Sigstore transparency entry: 992457962
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2837990c8b20593868892e5a893e5997749ca85544ba3633816a4b0c160eebb5
|
|
| MD5 |
db43dfb1963866dcba92622fe7987d2f
|
|
| BLAKE2b-256 |
0232d73d860ecb0d319f83b68f41cf07299040161ca022361fa38e9c5fcb98ba
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
2837990c8b20593868892e5a893e5997749ca85544ba3633816a4b0c160eebb5 - Sigstore transparency entry: 992457953
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cortexadb-0.1.1-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: cortexadb-0.1.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ea81923966c1e708968d24644e41cd8535d090bd55ecb30f8401dd10c2ffade
|
|
| MD5 |
f53cdf4908e253d0ba670d316deb21be
|
|
| BLAKE2b-256 |
786ee46f4d1c05e3058c02600783e3dfc9b3760097c2e3c65f8be637647b9495
|
Provenance
The following attestation bundles were made for cortexadb-0.1.1-cp310-cp310-win_amd64.whl:
Publisher:
release.yml on anaslimem/CortexaDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexadb-0.1.1-cp310-cp310-win_amd64.whl -
Subject digest:
2ea81923966c1e708968d24644e41cd8535d090bd55ecb30f8401dd10c2ffade - Sigstore transparency entry: 992457950
- Sigstore integration time:
-
Permalink:
anaslimem/CortexaDB@059b347a008be48c4567c5bf3200426b12235568 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/anaslimem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b347a008be48c4567c5bf3200426b12235568 -
Trigger Event:
push
-
Statement type: