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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

driftguard_ai_sdk-1.0.4.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

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

driftguard_ai_sdk-1.0.4-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file driftguard_ai_sdk-1.0.4.tar.gz.

File metadata

  • Download URL: driftguard_ai_sdk-1.0.4.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for driftguard_ai_sdk-1.0.4.tar.gz
Algorithm Hash digest
SHA256 21d12688295d41e59c7d440b1e279b2fb3b1d0708e1b3f78ffdb9c48e080941a
MD5 150937a9e82d420f5acf87ea286264ac
BLAKE2b-256 843655648770f093b94e7620ae8ae01257b71bfcf27b4bc60302680a93c65f97

See more details on using hashes here.

File details

Details for the file driftguard_ai_sdk-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for driftguard_ai_sdk-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d70b081728ae3716dce8a3df3d1e9a81c3e3bbe4e931bb3b31d308aa6f07b09d
MD5 26d5b22c94f179da38ec75927eab440e
BLAKE2b-256 5590bce0018aa0e3e320bf605d7eb8dea38a3a3bbc2ac381e0106e44f189e62c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

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