Skip to main content

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.

Metadata

Release files for cortexdb-client 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cortexdb-client 0.2.0
File Size Uploaded Provenance
cortexdb_client-0.2.0.tar.gz 82.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cortexdb-client 0.2.0
File Interpreter ABI Platform
cortexdb_client-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 112.6 kB

Release files / cortexdb_client-0.2.0.tar.gz

Download URL cortexdb_client-0.2.0.tar.gz
Size 82.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8f26f3a1cf785089a738566a1c572ca8963f654646ddd2b35e81053a5efd9139
BLAKE2b-256 checksum
How to use checksums
9a712d3b207bcb7e7bc50535b13323654ec43d50ff65fd0686795c2447227e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / cortexdb_client-0.2.0-py3-none-any.whl

Download URL cortexdb_client-0.2.0-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0e6be7cefcd3660d043c04806b663add4b5cd21d46676d6f7bdc38bb5c7d75e
BLAKE2b-256 checksum
How to use checksums
8266b5a93e29daebecd27b4723c4d6ec682cc313922861102e82fb963a85f831
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for cortexdb-client 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page