Skip to main content

Serve Astra-compressed models anywhere - hosted or local ONNX serving with built-in telemetry that feeds the Astra dashboard

Project description

astra-ai-sdk

Serve Astra-compressed models anywhere — and keep the Astra dashboard monitoring them while they run on your hardware.

pip install astra-ai-sdk                # hosted inference client
pip install 'astra-ai-sdk[serve]'       # + local ONNX serving (onnxruntime, numpy)
pip install 'astra-ai-sdk[serve,system]'  # + precise CPU/RSS metrics (psutil)

Hosted inference

Calls the Astra-hosted endpoint; telemetry is recorded server-side.

from astra_sdk import AstraClient

# base_url defaults to the hosted Astra origin (override with ASTRA_BASE_URL).
client = AstraClient("dep_ab12cd34ef", "astra_sk_live_...")
out = client.infer({"input": [[0.1, 0.2, 0.3]]})
print(out["latencyMs"], out["outputs"])

Local serving (the headline)

Pulls the deployed, compressed artifact once (sha256-cached under ~/.cache/astra) and serves it with onnxruntime in your process:

from astra_sdk import LocalRunner

# base_url defaults to the hosted Astra origin (override with ASTRA_BASE_URL).
runner = LocalRunner.from_deployment("dep_ab12cd34ef", "astra_sk_live_...")
out = runner.run({"input": my_numpy_array})   # local inference
print(out["latencyMs"], out["raw"][0].shape)
runner.close()

Run a file you already have

Downloaded the artifact (SDK Hub → Download Artifact) or have an .onnx on disk? Skip the deployment — serve the file directly:

from astra_sdk import LocalRunner

runner = LocalRunner.from_file("compressed.onnx")
out = runner.run({"input": my_numpy_array})
runner.close()

Telemetry is off for a bare file; pass deployment_id= + api_key= to still report local runs to that deployment.

What gets reported to the dashboard

A background thread batches telemetry to Astra (never blocks or breaks your serving path; bounded queue with drop-oldest under pressure):

Stream Cadence Fields
Request events per inference timestamp, latency breakdown (preprocess / inference / postprocess ms), success / error code, batch size, region tag, input shape signature
System snapshots ~30 s CPU %, RSS MB, throughput req/min, dropped-event count, SDK / Python / onnxruntime versions, OS, arch, execution provider, hostname
Window stats ~60 s or 200 requests per-input tensor mean/std/min/max/NaN%, output class distribution (top-10), 16-bin confidence histogram, mean entropy, mean top-1 confidence

Window stats power the dashboard's prediction drift (PSI vs the deployment's reference distribution) and input distribution shift alerts.

Opt out any time: LocalRunner.from_deployment(..., report_telemetry=False) or ASTRA_SDK_TELEMETRY=0.

CLI

astra pull  --deployment dep_x --api-key KEY
astra serve --deployment dep_x --api-key KEY --port 8765
astra bench --deployment dep_x --api-key KEY -n 200

Options can also come from ASTRA_BASE_URL, ASTRA_DEPLOYMENT_ID, ASTRA_API_KEY.

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

astra_ai_sdk-0.2.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

astra_ai_sdk-0.2.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file astra_ai_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: astra_ai_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for astra_ai_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7ebceb8629a867f6dbcee84ad6e80a00d943e525c0b4827c6fdf68e32865c594
MD5 baaa6254909f9cb65cf154ecac60de6e
BLAKE2b-256 0b113cb755e5e0df38ada3e2873522802f213696f782bfb60bfd38596b54fb41

See more details on using hashes here.

File details

Details for the file astra_ai_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: astra_ai_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for astra_ai_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71cf36961914f1cfcd61a5a6e6fbfba0066e6015691b3c4c2fb5a2c38a30de52
MD5 b216feb7629f9ca1048be9ae5b7b747a
BLAKE2b-256 1810136238e909fec205249d735fd70519ff14024937b6e1880bae58e7f9e289

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page