Typed gRPC client for CortexDB (AI memory + knowledge graph sidecar)
Project description
cortexdb-client (Python)
Typed gRPC client for CortexDB — a
pure-Go, single-file AI memory and knowledge graph database, served as a
sidecar (cortexdb-grpc). Give your Python agent (e.g. Hermes) durable
memory and a queryable knowledge graph.
Install
pip install cortexdb-client # or: uv add cortexdb-client
Start the sidecar (one binary, one SQLite file):
go install github.com/liliang-cn/cortexdb/v2/cmd/cortexdb-grpc@latest
CORTEXDB_PATH=agent.db CORTEXDB_GRPC_TOKEN=s3cret cortexdb-grpc
# listening on 127.0.0.1:47821
Quick start
from cortexdb_client import CortexClient, proto
with CortexClient.connect("127.0.0.1:47821", token="s3cret") as client:
client.knowledge.SaveKnowledge(proto.SaveKnowledgeRequest(
knowledge_id="note-1",
content="The user is building an autonomous research agent in Python.",
))
hits = client.knowledge.SearchKnowledge(proto.SearchKnowledgeRequest(
query="what is the user building?", top_k=3,
))
for h in hits.results:
print(h.knowledge_id, h.score, h.snippet)
Sub-clients mirror the Rust crate: client.knowledge, client.memory,
client.graph (SPARQL/RDF/SHACL/inference/ontology), client.graphrag,
client.tools (generic tool dispatch, same surface as MCP), client.admin.
Why a knowledge graph, not just vectors
Beyond semantic recall, the graph service lets an agent store and traverse
entities and relations — multi-hop questions like "who, among the people
Alice knows, works on X" — with SPARQL, RDFS-lite inference, and SHACL-lite
validation. That is the capability most agent-memory layers lack.
Embeddings
Lexical mode needs no keys. Point the sidecar at any OpenAI-compatible embeddings endpoint (e.g. Ollama) to enable vector retrieval:
OPENAI_BASE_URL=http://localhost:11434/v1 \
CORTEXDB_EMBED_MODEL=embeddinggemma CORTEXDB_EMBED_DIM=768 \
cortexdb-grpc
Regenerating the protobuf code
Generated code is committed under cortexdb_client/_pb. To regenerate after a
proto change: uv run --extra dev ./gen.sh.
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 Distribution
Built Distribution
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 cortexdb_client-0.1.0.tar.gz.
File metadata
- Download URL: cortexdb_client-0.1.0.tar.gz
- Upload date:
- Size: 81.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
455ed06b9292b2231631d1b2d775c3e84b01cabd28760162dc50a26d60885242
|
|
| MD5 |
637af8e2df917c4370ecfa05859c80da
|
|
| BLAKE2b-256 |
8fb88048e60a4d4a7c4e0db1faba9f14fe0d9ba1133449f20774815024ac7e1e
|
File details
Details for the file cortexdb_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cortexdb_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b0e9d14a632f7fef1bbc1e8d0d9fbca1c5023c7875e7b06f1a09f91b0fe45b2
|
|
| MD5 |
2f01f205d6051abd9964394add6d0afd
|
|
| BLAKE2b-256 |
462629fc34d97dddc8cfede403679608236ad05bf7382b76d23593c344e9c834
|