Inspiration

Machine learning pipelines can fail silently when upstream data changes without warning. A renamed column, corrupted data type, or sudden spike in missing values can break downstream inference or degrade model performance — while traditional monitoring often tells engineers that something failed, not why or how to fix it.

I built DataMedic to address this gap: an autonomous ML Site Reliability Engineering (SRE) agent that can detect, investigate, diagnose, repair, validate, and verify production ML data incidents in a closed loop.

The goal was simple: move from "alert an engineer" to "investigate the incident, safely generate a repair, prove that the repair works, and verify ML recovery."

What I Built

DataMedic is a closed-loop autonomous ML SRE system powered by Gemini and the Google Agent Development Kit (ADK).

Its workflow is:

DETECT → INVESTIGATE → DIAGNOSE → REPAIR → VALIDATE → RECOVER → VERIFY

The system starts with a healthy credit-risk ML pipeline and deliberately injects a realistic production incident containing:

  • Schema drift: customer_agecustomerAge
  • Type corruption: numeric income values become currency strings
  • Missing-value spike: critical debt_to_income values become null

DataMedic then uses Gemini reasoning through Google ADK to autonomously determine which diagnostic tools are needed and investigate the incident.

Deterministic tools inspect the schema, profile the corrupted dataset, trace data lineage, and evaluate the downstream ML model. Gemini then synthesizes a targeted Python remediation patch.

The generated patch is not blindly trusted.

It is executed inside a controlled sandbox and must pass strict invariant checks covering:

  • Schema preservation
  • Data type correctness
  • Null-value remediation
  • Row-count preservation

Only after validation does DataMedic produce the repaired production batch and re-evaluate the downstream Scikit-learn model.

The final stage verifies whether the ML pipeline has recovered and generates an incident post-mortem with the investigation trace, repair, validation results, and recovery metrics.

Why Gemini and ADK Matter

Gemini is not used merely as a chatbot or text generator.

It acts as the reasoning layer of the SRE agent.

Through Google ADK, DataMedic can reason over the incident context, select the appropriate diagnostic tools, interpret their structured results, and synthesize a remediation strategy.

The deterministic tools remain responsible for measurements and validation, preventing the language model from inventing data-quality or ML metrics.

This creates a hybrid architecture:

Gemini/ADK = reasoning and orchestration

Deterministic tools = evidence and verification

This separation makes the autonomous workflow both more useful and more trustworthy.

What I Learned

Building DataMedic taught me that autonomous AI systems should not simply generate an answer — they should generate an action that can be independently verified.

The most important design decision was therefore to place deterministic validation between AI-generated remediation and production recovery.

A repair is only considered successful when the system can prove that the repaired data satisfies the required invariants and that the downstream ML pipeline can be evaluated again.

I also learned that observability is essential for autonomous systems. Instead of hiding the agent's decisions, DataMedic exposes the execution timeline, tool calls, generated repair, validation results, ML metrics, lineage, and post-mortem through a Streamlit SRE console.

Challenges

The biggest challenge was designing the system so that Gemini could reason about a real data incident without allowing generated code or reasoning to become an unverified source of truth.

I addressed this by separating the system into an agentic reasoning layer and deterministic verification layer.

Another challenge was creating a reproducible incident that demonstrates the entire lifecycle. I built a controlled failure injector so the same production corruption can be reproduced consistently for testing and demonstration.

Finally, I designed the recovery workflow so that every remediation step leaves observable evidence rather than simply reporting "fixed."

Impact

DataMedic demonstrates how agentic AI can reduce the operational burden of maintaining production ML systems.

Instead of requiring an engineer to manually inspect corrupted data, identify the root cause, write a repair, test the repair, and verify model recovery, DataMedic automates the complete investigation and remediation loop while keeping deterministic validation as the safety boundary.

The result is an ML SRE workflow that is autonomous, observable, reproducible, and verifiable.

Built With

Share this project:

Updates

Submission history