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.

Download files

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

Source Distribution

cortexdb_client-0.1.1.tar.gz (81.9 kB view details)

Uploaded Source

Built Distribution

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

cortexdb_client-0.1.1-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file cortexdb_client-0.1.1.tar.gz.

File metadata

  • Download URL: cortexdb_client-0.1.1.tar.gz
  • Upload date:
  • Size: 81.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for cortexdb_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 497265ae0ee802e84ab9b188fea7e0465aadee9ffa011834400a4e190aa5326b
MD5 4656777f4aa7ec917292603b4f647024
BLAKE2b-256 8e463181107c159e3490e5bfdd03ef3aa00ab006a595883451e6421f8443b73b

See more details on using hashes here.

File details

Details for the file cortexdb_client-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cortexdb_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b2bdc1d57c11ad369843538abe7750d632126b6a17498ee5e0fb3d91667c644
MD5 1b837e5b63bc0d8b5bad29e5b0dbe7b6
BLAKE2b-256 524d4f1c33fd9d28e409d054369f3a5d5a672973a2e1f14d607105a5e4fe2fb0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

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