Skip to main content

🛡️ DriftGuard AI

Self-Healing MLOps & Autonomous Retraining Platform

PyPI version License: MIT


DriftGuard is a production-grade observability platform that detects data drift, concept drift, and model degradation in real-time, automatically triggering CI/CD retraining loops (like Apache Airflow) to heal your AI pipelines with zero human intervention.

🌟 Features

  • Real-Time Telemetry: Asynchronous, non-blocking telemetry logging that adds zero latency to your inference APIs.
  • Enterprise Dashboard: A stunning, Vercel-inspired observability dashboard to monitor your entire fleet of models in real-time.
  • Self-Healing Webhooks: Automatically fire POST payloads to your orchestrator (Airflow, Kubeflow, SageMaker) when SLA thresholds are breached.
  • Multi-Tenant Security: Securely isolate telemetry data by project using hashed API keys.

🚀 Quickstart: Bring Your Own Server

You can run the entire DriftGuard platform on your own infrastructure for free using Docker.

1. Start the Platform

Clone this repository and spin up the backend and frontend simultaneously using our highly optimized, pre-built Docker Hub images:

git clone https://github.com/Yugenjr/DriftGuard-AI-Sdk.git
cd DriftGuard-AI-Sdk/infra
docker-compose -f docker-compose.prod.yml up -d

Your dashboard is now live at http://localhost:3000! Go create your first API key.

2. Install the SDK

Install the lightweight Python SDK into your inference environment:

pip install driftguard-ai-sdk

3. Wrap your Model

Import the SDK and initialize it in your FastAPI/Flask app:

from fastapi import FastAPI
from driftguard import DriftGuard

# 1. Initialize DriftGuard
dg = DriftGuard(
    model_id="fraud-detector-v1",
    api_key="dg-your-secret-key",
    drift_threshold=0.15,
    expected_features=["amount", "location_score", "velocity"]
)

app = FastAPI()

@app.post("/predict")
def predict(features: list[float]):
    prediction = model.predict([features])
    
    # 2. Log telemetry asynchronously (Non-blocking)
    dg.log_prediction(
        features=features,
        prediction=prediction
    )
    
    return {"fraud_probability": prediction}

🏗 Architecture

                     +---------------------------------------+
                     |          Client Application           |
                     +-------------------+-------------------+
                                         |
                                (Predict Telemetry)
                                         v
                     +-------------------+-------------------+
                     |          DriftGuard SDK               |
                     |  - Wrapper pattern intercept          |
                     |  - River ADWIN concept drift checks   |
                     +-------------------+-------------------+
                                         |
                                 (HTTP Telemetry)
                                         v
                     +-------------------+-------------------+
                     |       DriftGuard FastAPI Core API     | <---+ NextJS Dashboard (:3000)
                     |       - /register, /predict, /drift   | <---+ Grafana (:3001)
                     |       - Prom metrics /metrics (:8000) |
                     +-------------------+-------------------+
                                         |
                        (SLA Drift Breach Trigger)
                                         v
                     +-------------------+-------------------+
                     |      Prefect Orchestration Server     |
                     |      - drift_detection_flow (:4200)   |
                     +-------------------+-------------------+
                                         |
                                 (Runs steps)
                                         v
                     +-------------------+-------------------+
                     |      ZenML Step Training Pipelines    |
                     |  - Step 1: Great Expectations Validate|
                     |  - Step 2: Feast Feature Store Check  |
                     |  - Step 3: Train & Track (MLflow/W&B) |
                     |  - Step 4: Validate (>1% boost check) |
                     |  - Step 5: Canary Progressive Deploy  |
                     |  - Step 6: Immutable JSON Ledger & PDF|
                     +-------------------+-------------------+
                                         |
                            (Progressive Split Promotes)
                                         v
                     +-------------------+-------------------+
                     |       BentoML & Ray Serve Fleet       |
                     |       - canary_router: 10%->100%      |
                     |       - SLA Monitoring & Rollbacks    |
                     +---------------------------------------+

DriftGuard is composed of three main components:

  1. The Python SDK (driftguard/): A lightweight client that intercepts inferences and streams telemetry.
  2. The FastAPI Engine (main.py): A high-concurrency event processor backed by PostgreSQL for state management.
  3. The Obsidian Dashboard (dashboard/): A Next.js (React) front-end providing a breathtaking developer experience.

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details on how to set up your local development environment.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for driftguard-ai-sdk 1.0.4

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

Source distribution (sdist)

Source distribution for driftguard-ai-sdk 1.0.4
File Size Uploaded Provenance Actions
driftguard_ai_sdk-1.0.4.tar.gz 38.5 kB Without provenance Details for driftguard_ai_sdk-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for driftguard-ai-sdk 1.0.4
File Interpreter ABI Platform Actions
driftguard_ai_sdk-1.0.4-py3-none-any.whl Python 3 none any Details for driftguard_ai_sdk-1.0.4-py3-none-any.whl

Total release size: 61.6 kB

Release files / driftguard_ai_sdk-1.0.4.tar.gz

Download URL driftguard_ai_sdk-1.0.4.tar.gz
Size 38.5 kB
Tags Source
SHA-256 checksum
How to use checksums
21d12688295d41e59c7d440b1e279b2fb3b1d0708e1b3f78ffdb9c48e080941a
BLAKE2b-256 checksum
How to use checksums
843655648770f093b94e7620ae8ae01257b71bfcf27b4bc60302680a93c65f97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / driftguard_ai_sdk-1.0.4-py3-none-any.whl

Download URL driftguard_ai_sdk-1.0.4-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d70b081728ae3716dce8a3df3d1e9a81c3e3bbe4e931bb3b31d308aa6f07b09d
BLAKE2b-256 checksum
How to use checksums
5590bce0018aa0e3e320bf605d7eb8dea38a3a3bbc2ac381e0106e44f189e62c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for driftguard-ai-sdk 1.0.4

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