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.3.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.3.0
File Size Uploaded Provenance Actions
cortexdb_client-0.3.0.tar.gz 85.4 kB Without provenance Details for cortexdb_client-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 123.6 kB

Release files / cortexdb_client-0.3.0.tar.gz

Download URL cortexdb_client-0.3.0.tar.gz
Size 85.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8b1304d843bee697a73c2ce6c64bbf42c24548dc426b4ecebf27c33df22d65e1
BLAKE2b-256 checksum
How to use checksums
b407c9ca0f4c581aa4385edbe2ce6265b52d9a2fa9021d605112c20ae2645402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

Download URL cortexdb_client-0.3.0-py3-none-any.whl
Size 38.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd2a931c6c8065921955abcc4e11ee23b4f1570c98047a708c741517f94335b0
BLAKE2b-256 checksum
How to use checksums
a7fce7b3b6b6214f04aada92462e83ff0d79f1520022b31f4544a9ccc2bfd35c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for cortexdb-client 0.3.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