Official Python SDK for KyroDB
Project description
KyroDB Python SDK (kyrodb)
Official Python SDK for KyroDB gRPC APIs.
This SDK provides:
- Sync + async clients with matching behavior.
- Typed public response models (no protobuf objects in public returns).
- Strict input validation for IDs, vectors, filters, and call options.
- Production-oriented reliability defaults (timeouts, retries, circuit breaker support).
- TLS + API-key authentication, including key rotation providers.
Install
pip install kyrodb
Optional extras:
pip install "kyrodb[dev]" # lint/type/test tooling
pip install "kyrodb[proto]" # protobuf regeneration tooling
pip install "kyrodb[docs]" # MkDocs toolchain
pip install "kyrodb[numpy]" # faster vector validation path
Quick Start (Sync)
from kyrodb import KyroDBClient
with KyroDBClient(target="127.0.0.1:50051", api_key="kyro_live_key") as client:
client.wait_for_ready(timeout_s=5.0)
client.insert(
doc_id=1,
embedding=[0.0] * 768,
metadata={"tenant": "acme", "source": "sdk-readme"},
namespace="default",
)
result = client.search(
query_embedding=[0.0] * 768,
k=10,
namespace="default",
)
print(result.total_found)
Quick Start (Async)
import asyncio
from kyrodb import AsyncKyroDBClient
async def main() -> None:
async with AsyncKyroDBClient(target="127.0.0.1:50051", api_key="kyro_live_key") as client:
await client.wait_for_ready(timeout_s=5.0)
await client.insert(
doc_id=1,
embedding=[0.0] * 768,
metadata={"tenant": "acme"},
namespace="default",
)
result = await client.search(
query_embedding=[0.0] * 768,
k=10,
namespace="default",
)
print(result.total_found)
asyncio.run(main())
Core Behavior
Public API contract
- Public SDK surface is what is exported from
src/kyrodb/__init__.py. kyrodb._generated.*is internal implementation detail and not part of compatibility guarantees.
Error model
All RPC failures map to typed exceptions under KyroDBError, including:
AuthenticationErrorPermissionDeniedErrorInvalidArgumentErrorNotFoundErrorQuotaExceededErrorDeadlineExceededErrorServiceUnavailableErrorCircuitOpenError
Timeouts, retries, and circuit breaker
- Default call timeout is
30.0s. timeout_s=Noneexplicitly requests unbounded timeout.- Read-like operations are retry-enabled by default; writes are not.
- Retries use bounded exponential backoff with jitter and elapsed-time budget.
- Optional circuit breaker can fail fast under sustained transient failures.
- Use
RetryPolicy.no_retry()for benchmark, load-test, or latency-profiling runs where hidden retries would distort measurements.
Transport defaults
By default:
- gRPC keepalive is enabled.
- Send/receive message limits are set to 64 MiB.
- One client/channel should be reused per process/worker.
Filters
Filter builders:
exact(key, value)in_values(key, values)range_match(key, gte=..., lte=..., gt=..., lt=...)all_of([...])any_of([...])negate(filter_value)
Example:
from kyrodb import KyroDBClient, all_of, exact, in_values
with KyroDBClient(target="127.0.0.1:50051", api_key="kyro_live_key") as client:
filt = all_of([exact("tenant", "acme"), in_values("tier", ["pro", "enterprise"])])
result = client.search(query_embedding=[0.0] * 768, k=10, filter=filt, namespace="default")
print(result.total_found)
Security and TLS
from kyrodb import KyroDBClient, TLSConfig
with open("ca.pem", "rb") as f:
ca_pem = f.read()
with open("client.crt", "rb") as f:
client_crt = f.read()
with open("client.key", "rb") as f:
client_key = f.read()
tls = TLSConfig(
root_certificates=ca_pem,
certificate_chain=client_crt,
private_key=client_key,
)
client = KyroDBClient(target="db.internal:50051", api_key="kyro_live_key", tls=tls)
Security notes:
- Non-loopback targets require TLS.
- API key is sent as gRPC metadata (
x-api-key). - mTLS requires both certificate chain and private key.
- API key rotation:
- sync:
set_api_key(...),set_api_key_provider(...) - async:
set_api_key(...),set_api_key_provider(...),set_api_key_provider_async(...)
- sync:
API Surface
Both KyroDBClient and AsyncKyroDBClient provide:
insert,bulk_insert,bulk_load_hnsw,delete,update_metadata,batch_delete_ids,batch_delete_filterquery,search,bulk_search,bulk_queryhealth,metricsflush_hot_tier,create_snapshot,get_configwait_for_ready,close
Development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,proto]"
python scripts/gen_proto.py --proto proto/kyrodb.proto --out src/kyrodb/_generated
Run local CI parity:
./scripts/run_ci_local.sh
Documentation
docs/README.md— docs indexdocs/api-reference.md— method-level referencedocs/operations.md— reliability and runtime behaviordocs/troubleshooting.md— operational failure modesdocs/performance-benchmarks.md— validation overhead benchmarks
Hosted docs are generated from mkdocs.yml via .github/workflows/docs.yml.
Project details
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 kyrodb-0.2.0.tar.gz.
File metadata
- Download URL: kyrodb-0.2.0.tar.gz
- Upload date:
- Size: 57.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58d22e918c5d21da82c5a50955decafc81a906df4517a5f5780b4578d36df9b7
|
|
| MD5 |
4af8f048642953d34b0be12d7f4369fd
|
|
| BLAKE2b-256 |
3dec0d994db70487438a6d80b4f61f18b5501042170e2a01ad2e9f5f2c21a639
|
Provenance
The following attestation bundles were made for kyrodb-0.2.0.tar.gz:
Publisher:
release.yml on KyroDB/kyrodb-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kyrodb-0.2.0.tar.gz -
Subject digest:
58d22e918c5d21da82c5a50955decafc81a906df4517a5f5780b4578d36df9b7 - Sigstore transparency entry: 1247508772
- Sigstore integration time:
-
Permalink:
KyroDB/kyrodb-python@f86f90b0b4d6dcb8ab3c3f7313a9f08821e4d4f9 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/KyroDB
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f86f90b0b4d6dcb8ab3c3f7313a9f08821e4d4f9 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file kyrodb-0.2.0-py3-none-any.whl.
File metadata
- Download URL: kyrodb-0.2.0-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa7ebe5006997ec2484935a527ba4bdb38219793f7b202bfda85f75534698e25
|
|
| MD5 |
22c553d16a058dcdb82710603a55d086
|
|
| BLAKE2b-256 |
3e102a2753b45f7652e86f74669bc6b548b479ecffc3a5b5e5ec0dc2c48a8024
|
Provenance
The following attestation bundles were made for kyrodb-0.2.0-py3-none-any.whl:
Publisher:
release.yml on KyroDB/kyrodb-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kyrodb-0.2.0-py3-none-any.whl -
Subject digest:
aa7ebe5006997ec2484935a527ba4bdb38219793f7b202bfda85f75534698e25 - Sigstore transparency entry: 1247508784
- Sigstore integration time:
-
Permalink:
KyroDB/kyrodb-python@f86f90b0b4d6dcb8ab3c3f7313a9f08821e4d4f9 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/KyroDB
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f86f90b0b4d6dcb8ab3c3f7313a9f08821e4d4f9 -
Trigger Event:
workflow_dispatch
-
Statement type: