Skip to main content

astra-ai-sdk

Serve Astra-compressed models on your own hardware — Astra never runs your model server-side — and keep the Astra dashboard monitoring them while they run.

pip install astra-ai-sdk              # everything you need — pull, run, telemetry (onnxruntime + numpy included)
pip install 'astra-ai-sdk[system]'    # optional: finer CPU/RSS host metrics (psutil)

Exports: AstraRunner, AstraRunnerError, pull_artifact, AstraTelemetryReporter, AstraApiError.

On-device serving (the whole product)

AstraRunner.from_deployment pulls the deployed, compressed artifact once (sha256-cached under ~/.cache/astra) and serves it with onnxruntime inside your own process — no server to stand up, no hosted inference:

from astra_sdk import AstraRunner

# base_url defaults to the hosted Astra origin (override with ASTRA_BASE_URL).
runner = AstraRunner.from_deployment("dep_ab12cd34ef", "astra_sk_live_...")
out = runner.run({"input": my_numpy_array})   # bare ndarray per input name
print(out["latencyMs"], out["outputs"], out["preMs"], out["postMs"])
runner.close()                                 # final telemetry flush

run() returns {latencyMs, outputs, preMs, postMs, raw}.

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 AstraRunner

runner = AstraRunner.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.

Closed-loop telemetry (offline-durable)

Every on-device inference is measured and shipped back to Astra through a durable closed loop that can never block or break your serving path:

  • buffers events in memory and spools them to disk when offline;
  • flushes the buffered batches automatically on reconnect;
  • deletes each batch only after the server acks it, with per-batch idempotency so a retry is never double-counted.
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: AstraRunner.from_deployment(..., report_telemetry=False) or ASTRA_SDK_TELEMETRY=0. Disable the on-disk spool with ASTRA_SDK_SPOOL=0 (telemetry then buffers in memory only).

CLI

astra pull                  # pull the compressed artifact
astra serve --port 8765     # on-device HTTP endpoint: POST /infer
astra bench -n 200          # on-device p50/p95, reported as telemetry

Options can come from ASTRA_BASE_URL, ASTRA_DEPLOYMENT_ID, ASTRA_API_KEY (or --deployment / --api-key / --base-url flags).

Metadata

Release files for astra-ai-sdk 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for astra-ai-sdk 0.5.0
File Size Uploaded Provenance
astra_ai_sdk-0.5.0.tar.gz 21.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for astra-ai-sdk 0.5.0
File Interpreter ABI Platform
astra_ai_sdk-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.4 kB

Release files / astra_ai_sdk-0.5.0.tar.gz

Download URL astra_ai_sdk-0.5.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9a79ee40b60c55f712d77d35d0aae026f268fc6c5a6eb52b674d8e55a680ac27
BLAKE2b-256 checksum
How to use checksums
de9a4ee3568bd309f429d7d5c52e57a7c4629df047becd70db5e0a3d4a28808b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / astra_ai_sdk-0.5.0-py3-none-any.whl

Download URL astra_ai_sdk-0.5.0-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87b2aa61afee8d1e36a6857077698eb49bc61638e5ae3e92a61fac8ed98abd3f
BLAKE2b-256 checksum
How to use checksums
3f4d380e9efdd823af6284d825318fef9e1ef53bfca58612fe68396286ae5314
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for astra-ai-sdk 0.5.0

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.

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