Multi-agent AI system that detects, diagnoses, and remediates anomalies in oil & gas well operations.
Oil and gas operations generate thousands of sensor alerts daily. In 2026, the industry faces three compounding challenges:
| Challenge | Impact | DriftGuard Solution |
|---|---|---|
| False Alarm Fatigue | 85% of alerts are noise β operators ignore critical warnings | Sentinel Agent triages with confidence scoring, suppresses noise |
| Methane Compliance | EPA/OGMP 2.0 demands continuous monitoring with audit trails | Compliance Agent tracks emissions + generates regulatory reports |
| Pilot-to-Production Gap | 95% of AI pilots deliver no P&L impact (MIT, 2025) | Agentic system that acts autonomously, not just predicts |
"The question is no longer whether you can detect anomalies β it's what happens in the 30 seconds after detection."
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ORCHESTRATOR β
β Hierarchical Agent Coordination Layer β
ββββββββ¬βββββββββββββββ¬βββββββββββββββ¬βββββββββββββββ¬ββββββββββββββ
β β β β
ββββββββΌβββββββ ββββββΌββββββββ ββββββΌββββββββ βββββΌβββββββββββ
β π SENTINEL β β π©Ί DIAGNOSTβ β π PRESC- β β π COMPLIANCEβ
β β β -ICIAN β β RIPTOR β β β
β Isolation β β Z-score β β Action β β Methane β
β Forest + β β analysis + β β catalog + β β emissions + β
β Severity β β Domain β β Risk-based β β Regulatory β
β Triage β β knowledge β β escalation β β thresholds β
βββββββββββββββ ββββββββββββββ ββββββββββββββ ββββββββββββββββ
β β β β
ββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌββββββββββββββ
β SHARED INFRASTRUCTURE β
β Pydantic Schemas β’ Structured Logging β’ Configuration β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β FastAPI Gateway β
β REST API (port 8000) β’ Swagger Docs β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Streamlit Dashboard β
β File Upload β’ Pipeline Viz β’ Process Logs (port 8501) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
DriftGuard pipeline: upload data β auto-detect β diagnose β prescribe β comply
git clone https://github.com/YOUR_USERNAME/driftguard.git
cd driftguard
cp .env.example .env
docker compose upOpen http://localhost:8501 β upload a CSV and click Run Pipeline.
git clone https://github.com/YOUR_USERNAME/driftguard.git
cd driftguard
python -m venv .venv && source .venv/bin/activate
pip install -e .
pip install streamlit plotly
# Run dashboard
streamlit run dashboard/app.py
# Or run API only
python -m driftguard.main
# Run tests
pytest tests/ -v
|
|
- Interactive time-series charts for all 8 sensors
- Statistical summary table (mean, std, min, max)
- Raw data preview
- π Dark / Light Mode toggle in sidebar
- π‘ Activity Monitor β real-time log of pipeline actions in the sidebar
- π DMN Solutions branding β clickable logo links to dmnsolutions.com.au
β οΈ Error reporting β full tracebacks shown on failure with downloadable logs
Role: First line of defense β detects anomalies and triages by severity.
- Model: Isolation Forest (200 estimators, 5% contamination)
- Triage levels: NOISE β WATCH β ACT β CRITICAL
- Key metric: Reduces false positives by ~80% through confidence-gated escalation
Role: Root cause analysis on escalated anomalies.
- Method: Z-score analysis against baseline + domain knowledge correlation
- Knowledge base: 8 event type signatures from 3W dataset (BSW increase, DHSV closure, slugging, etc.)
- Output: Probable cause, confidence score, contributing sensors, urgency level
Role: Translates diagnoses into actionable remediation steps.
- Action catalog: 6+ predefined actions (choke adjustment, gas-lift tuning, inspection scheduling, emergency shutdown)
- Risk assessment: LOW / MEDIUM / HIGH with human approval gates
- Escalation: Automatic for critical events or high-risk actions
Role: Regulatory emissions monitoring and audit reporting.
- Metrics: Methane emissions (daily/hourly kg), intensity percentage
- Frameworks: EPA NSPS OOOOa/b/c, OGMP 2.0, EU Methane Regulation
- Output: Compliance alerts, violation detection, audit-ready reports
Built for the Petrobras 3W Dataset β a curated collection of real and simulated offshore oil well events.
| Property | Value |
|---|---|
| Sensors | P-PDG, P-TPT, T-TPT, P-MON-CKP, T-JUS-CKP, P-JUS-CKGL, T-JUS-CKGL, QGL |
| Event Types | 9 (Normal + 8 fault types) |
| Real wells | 17 production wells |
| Time resolution | 1 second |
| License | CC BY 4.0 |
# docker-compose.yml provides two services:
services:
dashboard: # Streamlit UI on port 8501
api: # FastAPI backend on port 8000# Start both services
docker compose up -d
# View logs
docker compose logs -f
# Stop
docker compose downImage details:
- Base:
python:3.11-slim(multi-stage build) - Security: Non-root user, tini init system
- Size: ~450MB compressed
# Run all tests (11 tests covering full pipeline)
pytest tests/ -v
# Run E2E demo against real 3W data
python run_demo.pyTest coverage:
- β Full pipeline integration (async)
- β Sentinel anomaly detection
- β Sentinel false positive rate
- β Diagnostician diagnosis quality
- β Diagnostician baseline validation
- β Orchestrator training
- β Orchestrator error handling
- β Pipeline state management
driftguard/
βββ driftguard/
β βββ agents/
β β βββ sentinel/ # Anomaly detection + severity triage
β β βββ diagnostician/ # Root cause analysis + domain knowledge
β β βββ prescriptor/ # Action recommendations + escalation
β β βββ compliance/ # Emissions monitoring + regulatory
β βββ orchestrator/ # Pipeline state machine + coordination
β βββ shared/
β β βββ schemas/ # Pydantic event models
β β βββ config.py # Environment configuration
β β βββ data_loader.py # 3W dataset loading + feature engineering
β β βββ logging.py # Structured logging (structlog)
β βββ api/ # FastAPI REST gateway
β βββ main.py # Uvicorn entry point
βββ dashboard/
β βββ app.py # Streamlit main application
β βββ components.py # Reusable UI components
β βββ logger.py # Process execution logger
βββ tests/ # pytest suite
βββ assets/ # Banner and images
βββ scripts/ # Docker entrypoint
βββ Dockerfile # Multi-stage container build
βββ docker-compose.yml # Service orchestration
βββ pyproject.toml # Project metadata + dependencies
βββ requirements.txt # Pinned production dependencies
βββ run_demo.py # E2E demo script
βββ .env.example # Environment template
| Component | Technology | Version |
|---|---|---|
| API | FastAPI | 0.115.0 |
| ML | scikit-learn (Isolation Forest) | 1.5.1 |
| Data | pandas + NumPy | 2.2.2 / 1.26.4 |
| Validation | Pydantic | 2.8.2 |
| Dashboard | Streamlit + Plotly | 1.37+ |
| Logging | structlog | 24.4.0 |
| Container | Docker + Compose | multi-stage |
| Testing | pytest + pytest-asyncio | 8.3.2 |
- LLM-powered Diagnostician (natural language root cause explanations)
- WebSocket real-time streaming for live sensor feeds
- Model drift detection (monitor Sentinel's own performance)
- Multi-well orchestration (fleet-level anomaly correlation)
- Grafana/Prometheus metrics export
- Kubernetes deployment manifests
We welcome contributions! Whether you're adding new ML models, cloud deployments, integrations, or documentation β check our Contributing Guide to get started.
Looking for a place to start? Browse issues labeled good first issue or help wanted.
This project builds upon the foundational work of Suleman Mohammed and his Industrial Time-Series Anomaly Detection for Oil Wells project, which demonstrated how machine learning can support predictive monitoring using the Petrobras 3W dataset with supervised classification, feature engineering, and dashboard-based monitoring.
DriftGuard extends this concept into a fully agentic architecture β moving beyond detection into autonomous diagnosis, prescription, and compliance monitoring. While the original project answers "Is this reading abnormal?", DriftGuard answers "Why is it abnormal, what should we do about it, and are we still compliant?"
MIT License. See LICENSE for details.
Because every suppressed false alarm is an operator who stays focused on what matters.