Skip to main content

Push drift events and audit entries from your MLOps pipeline to Compass StayReady.

Project description

StayReady Python SDK

Push drift events and audit entries from your MLOps pipeline to Compass StayReady — continuous AI governance monitoring for regulated sectors.

Install

pip install stayready

Quick start

import os
from stayready import StayReady

sr = StayReady(
    api_key=os.environ["STAYREADY_API_KEY"],
    model_id="your-model-uuid",  # from your StayReady dashboard
)

# Report drift when your monitoring detects it — StayReady computes severity
# itself from value/threshold/direction and this metric's own history; you
# don't set it.
sr.drift(
    type="data_drift",              # data_drift | concept_drift | performance_degradation | regulatory_change
    metric="PSI",
    value=0.28,
    threshold=0.20,
    description="Population Stability Index exceeded threshold on income feature.",
    affected_domains=["Data Quality", "Model Monitoring"],
    action_required="Retrain on recent data and re-validate before next production cycle.",
)

# Log lifecycle events to the immutable audit trail
sr.audit("model_retrained", "Retrained on Q2 data, Gini improved to 0.61", actor="ml-pipeline")

Severity is computed server-side by comparing value against threshold and this model+metric's own trailing baseline — not something you set. Critical and High results trigger an email alert (and webhook, if configured), deduped so repeated near-identical events don't re-notify, and can flag your linked GovernReady audit for re-assessment.

Most metrics are "higher is worse" (PSI, KS, error rate) — the default. If a drop is what's bad for your metric (Gini, accuracy, F1), pass direction="lower_is_worse" on the first call you ever make for that model+metric; it registers the metric's polarity and is ignored on later calls, so you can't accidentally flip it mid-stream.

Integration examples

Evidently AI

psi = report.as_dict()["metrics"][0]["result"]["dataset_drift_share"]
sr.drift(type="data_drift", metric="PSI", value=psi,
         threshold=0.2, description="Evidently reported this drift share.")

Airflow (post-training validation)

def report_validation(**ctx):
    gini = ctx["ti"].xcom_pull(key="gini")
    sr.drift(type="performance_degradation", metric="Gini", value=gini,
             threshold=0.55, direction="lower_is_worse",
             description="Gini after retrain.")

Requirements

Python 3.9+. Zero dependencies (standard library only).

Support

np@dendrons.ai · stayready.dendrons.ai

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

stayready-0.2.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

stayready-0.2.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stayready-0.2.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.14

File hashes

Hashes for stayready-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d1396adcccfdf896cd7076a86216053f50eadfc59fdd6e5d25facce482b52525
MD5 da009f78256b875ae75cfb1158b34346
BLAKE2b-256 03fc1e8768eabc09d448b83ca28a6e2c4ab884dfd81b0e026aff493f978122bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stayready-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.14

File hashes

Hashes for stayready-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aeab0c2a6b9b20db61505e239ef182e7353cc6f7f86264239ea25e7188e33564
MD5 ef1dec64771c72a9917ffc217c3bcd89
BLAKE2b-256 8377052f57f66194b321870ae34d647c282b1b1e4c3988978eb380533c6e050e

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