Metadata-Version: 2.4
Name: stayready
Version: 0.1.0
Summary: Push drift events and audit entries from your MLOps pipeline to Compass StayReady.
Project-URL: Homepage, https://stayready.dendrons.ai
Project-URL: Repository, https://github.com/dendrons-ai/compass
Author-email: "Dendrons.ai" <np@dendrons.ai>
License: MIT
Keywords: ai,compass,drift,governance,mlops,monitoring,stayready
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# StayReady Python SDK

Push drift events and audit entries from your MLOps pipeline to [Compass StayReady](https://stayready.dendrons.ai) — continuous AI governance monitoring for regulated sectors.

## Install

```bash
pip install stayready
```

## Quick start

```python
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
sr.drift(
    type="data_drift",              # data_drift | concept_drift | performance_degradation | regulatory_change
    severity="High",                # Critical | High | Medium | Low
    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")
```

Critical and High severity events trigger an email alert (and webhook, if configured) and can flag your linked GovernReady audit for re-assessment.

## Integration examples

**Evidently AI**

```python
psi = report.as_dict()["metrics"][0]["result"]["dataset_drift_share"]
if psi > 0.2:
    sr.drift(type="data_drift", severity="High", metric="PSI", value=psi,
             threshold=0.2, description="Evidently detected dataset drift.")
```

**Airflow (post-training validation)**

```python
def report_validation(**ctx):
    gini = ctx["ti"].xcom_pull(key="gini")
    if gini < 0.55:
        sr.drift(type="performance_degradation", severity="Critical", metric="Gini",
                 value=gini, threshold=0.55, description="Gini below policy floor after retrain.")
```

## Requirements

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

## Support

np@dendrons.ai · [stayready.dendrons.ai](https://stayready.dendrons.ai)
