Ada SDK for Python
AdaClient represents one authenticated namespace. Its cached principal facades share one gRPC channel and one lazy, persistent namespace stream for events, signals, and jobs.
Installation
python -m pip install ada-grpc-sdk
Python 3.10 or newer is required. Construct the namespace client only in trusted backend code; api_key or api_key_provider authenticates the whole namespace.
Backend client
import os
from ada_sdk import AdaClient, StreamConfig, SubscriptionOptions
with AdaClient(
"memory.example.com:443",
api_key=os.environ["ADA_API_KEY"],
streams=StreamConfig(
events=SubscriptionOptions(
after_event_id=saved_event_cursor,
replay_limit=100,
),
signals=SubscriptionOptions(after_event_id=saved_signal_cursor),
jobs=SubscriptionOptions(after_event_id=saved_job_cursor),
),
) as ada:
alice = ada.principal("alice")
bob = ada.principal("bob")
stop_alice = alice.events.on(
"memory.ingest.finished",
lambda event: print(event.document_id),
)
stop_bob = bob.signals.on(
"routine.broken",
lambda signal: print(signal),
)
stop_job = alice.jobs.on(
"job.finished",
lambda event: print(event),
)
stop_alice()
stop_alice()
stop_bob()
stop_job()
Every event-name overload selects an exact generated protobuf payload type and returns an idempotent synchronous unsubscribe callable. Strict mypy fixtures reject unknown event names, mismatched payloads, open(), root data-plane calls, and principal creation on a browser client.
All ingest, recall, document, job, data, and summary operations live on the principal facade:
result = alice.ingest(ingest_pb2.IngestRequest(document=document))
status = alice.documents.get_status(
ingest_pb2.GetDocumentStatusRequest(document_id=document_id),
)
The facade overwrites every request principal. Public-event and signal catalogs remain on the root through get_public_event_catalog() and get_signal_catalog().
Replay cursors, reconnect policy, lifecycle handlers, and shutdown live on the root:
stop_cursor = ada.lifecycle.on(
"stream.cursor",
lambda info: save_cursor(
info.stream,
info.event_id,
info.principal_id,
),
)
stop_terminal = ada.lifecycle.on(
"stream.terminal",
lambda info: report_failure(info.stream, info.error),
)
close() and the context manager perform idempotent graceful shutdown and prevent later registrations.
AdaBrowserClient(endpoint, session_token=...) is a separate principal-bound client. It accepts no namespace API key and has no principal() method. Use it only with a short-lived browser session minted by a trusted backend.
Never embed a namespace API key in browser or otherwise untrusted client code. The TypeScript package is the supported browser/gRPC-Web implementation.
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 ada_grpc_sdk-0.0.1.tar.gz.
File metadata
- Download URL: ada_grpc_sdk-0.0.1.tar.gz
- Upload date:
- Size: 81.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a8d0218d37581035ae1de1d37b1834e4d64b0bcb692bc80aa6ac7772bde44c4
|
|
| MD5 |
96c0e6fc9373d4889a6c1a198e66f200
|
|
| BLAKE2b-256 |
5fc4452809387a96c467bad84805c64a8d8048da4c2b4a682f0a12bbcc1b5554
|
File details
Details for the file ada_grpc_sdk-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ada_grpc_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 91.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8297e75759a31154b5ae9b414f35bb644d90b3a2b7e03cf39e93abf7dbb7700d
|
|
| MD5 |
68081f0df0eed54f8fd93b4fe505037c
|
|
| BLAKE2b-256 |
303df5d9aa5632f7f6be53c6d1704dcba8108e97becc1f544e996f42136045b1
|