AkiDB Python SDK
A typed, production-grade Python client for AkiDB — a Mac-native retrieval memory engine for private AI agents.
Install
pip install -e ".[dev]" # from sdks/python
Usage
from akidb import AkiDBClient
with AkiDBClient(
"localhost:50051",
timeout=5.0, # per-call deadline (seconds)
max_retries=3, # retries on transient errors, exponential backoff
tls=True, # TLS channel
auth_token="…", # sent as `authorization: Bearer …`
) as client:
client.insert("doc-1", embedding, text="the source text", metadata=b'{"lang":"en"}')
result = client.text_search(
"why does token refresh fail?",
top_k=5, hybrid=True, rerank=True, diversity=True, pack=True, token_budget=1024,
)
for hit in result:
print(hit.id, hit.score)
print(result.context_pack)
Async
from akidb.aio import AsyncAkiDBClient
async with AsyncAkiDBClient("localhost:50051") as client:
await client.insert("doc-1", embedding, text="hello")
result = await client.text_search("hello", hybrid=True, pack=True)
Agent memory
client.memory_write("m1", embedding, "remember this", kind="note", conversation_id="c1")
hits = client.memory_read(query_embedding, conversation_id="c1")
Features
- Per-call deadlines, retry with exponential backoff on transient codes
(
UNAVAILABLE,DEADLINE_EXCEEDED,RESOURCE_EXHAUSTED). - TLS + bearer-token auth; custom channel options and metadata.
- Typed errors (
NotFoundError,InvalidArgumentError,UnavailableError, …) mapped from gRPC status codes; seeakidb.errors. - Full RPC coverage: insert, insert_batch, update, get, delete, search, search_batch, text_search, health, cluster_state, plus memory_write/read.
- Sync (
AkiDBClient) and async (AsyncAkiDBClient) clients.
Tests
pytest tests/ -v
Unit tests mock the gRPC stub, so no running server is required. A live
integration test (tests/test_live.py) runs only when AKIDB_SERVER_ADDR is set
(with AKIDB_TEST_DIM matching the server's index dimension); it is exercised in
CI (.github/workflows/sdks.yml) against a real server.
Observability & resilience knobs
timeout, max_retries, retry_backoff (jittered), on_retry=(attempt, error),
tls/ca_cert, auth_token, metadata, and gRPC interceptors are all
constructor options on both AkiDBClient and AsyncAkiDBClient.
Regenerating gRPC stubs / proto drift
The committed akidb/akidb_pb2*.py are generated from the vendored
proto/akidb.proto (a copy of crates/grpc-server/proto/akidb.proto):
python -m grpc_tools.protoc -I proto \
--python_out=akidb --grpc_python_out=akidb proto/akidb.proto
# then make the grpc import relative: `from . import akidb_pb2 as akidb__pb2`
../check-proto-drift.sh (and test_proto_drift.py) fail if the vendored proto
drifts from the canonical engine proto.
Metadata
Release files for akidb 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| akidb-0.6.1.tar.gz | 24.7 kB | Without provenance | Details for akidb-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| akidb-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for akidb-0.6.1-py3-none-any.whl |
Total release size: 45.7 kB
Release files / akidb-0.6.1.tar.gz
| Download URL | akidb-0.6.1.tar.gz |
|---|---|
| Size | 24.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce5f3f7b858e2266362f1947ae87e9f9f5d3859e40b56f5d20e2408a8753e654
|
|
BLAKE2b-256 checksum How to use checksums |
f95d987ed077b5959b710cc363b0cdff95c146a6098cad9238919ae0b1595c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / akidb-0.6.1-py3-none-any.whl
| Download URL | akidb-0.6.1-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f12385c7915ed96ac2e062f03994d52b19a569455244fe0cc05d6f64641b0f95
|
|
BLAKE2b-256 checksum How to use checksums |
e004f8c30b36a4582e4771dc2b7e31ea38938d65b6f607352b6b4d721b249481
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for akidb 0.6.1
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.