AmbekarKush/etl-review-env
0
๐ง Pipeline Doctor โ AI ETL Debugging Environment
An AI agent acts as a data engineer on-call. It receives broken multi-stage ETL pipelines, diagnoses bugs, and applies targeted fixes โ earning rewards proportional to output correctness.
OpenEnv environment | 4 tasks (easy โ expert) | Hybrid pandas + SQLite | 41 tests
๐ Environment Overview
Pipeline Doctor simulates a real-world scenario every data team faces: a production ETL pipeline has failed. The AI agent must inspect intermediate data, form hypotheses, and apply precise fixes โ exactly like a senior data engineer debugging a failing Airflow DAG.
Why this domain is hard:
- Most failures are silent โ no exception, just wrong data downstream
- Bugs cascade across stages: fixing one reveals the next
- Schema drift, type coercion, join key mismatches โ all realistic failure modes
๐งฉ OpenEnv Compliance
๐ฏ Observation Space
โก Action Space
Pandas stage: Python block where df = input, assign result SQL stage: SELECT statement where input table = data
๐ Reward Function
reward = (row_accuracy ร 0.50)
+ (stage_pass_rate ร 0.30 + column_match ร 0.20) ร efficiency_multiplier
+ comment_bonus (up to +0.05)- Efficiency multiplier: 1.0 at steps 1-5, decays to 0.85 at step 10
- Applies only to structural scores โ correct output always scores โฅ0.99
- Partial progress always rewarded: fixing 1 of 2 bugs โ ~0.35 score
๐ Tasks
๐ Baseline Scores
`OPENAI_API_KEY=sk-... OPENAI_MODEL=gpt-4o-mini python baseline/run_baseline.py`
๐ฎ 2-Minute Demo Walkthrough
# 1. Reset
POST /reset {"task_id": "dtype_cast_failure"}
# stage cast_revenue=FAILING, others=SKIPPED
# 2. Inspect
POST /step {"action_type": "inspect_data", "stage_id": "cast_revenue"}
# sample rows show revenue=NaN
# 3. Diagnose
POST /step {"action_type": "add_comment",
"comment": "Comma thousands separator breaks pd.to_numeric"}
# 4. Fix
POST /step {"action_type": "submit_fix", "stage_id": "cast_revenue",
"fixed_code": "result = df.copy()\nresult['revenue'] = pd.to_numeric(result['revenue'].str.replace(',',''), errors='coerce')\n"}
# reward=1.0, done=True
# 5. Grade
POST /grader โ {"score": 1.0, "stage_pass_rate": 1.0, "output_row_score": 1.0}๐ Setup
# Local
pip install -r requirements.txt
uvicorn server.app:app --port 7860 --reload
streamlit run demo/streamlit_app.py # separate terminal
# Docker (FastAPI + Streamlit)
docker build -t pipeline-doctor .
docker run -p 7860:7860 -p 8501:8501 pipeline-doctor
# API: http://localhost:7860/docs
# UI: http://localhost:8501๐ Structure
etl-review-env/
โโโ env/ # models.py ยท environment.py ยท pipeline.py
โโโ tasks/ # task_easy ยท task_medium ยท task_hard ยท task_expert
โโโ graders/ # deterministic Jaccard grader
โโโ server/ # FastAPI (7 endpoints)
โโโ demo/ # Streamlit UI
โโโ baseline/ # OpenAI inference script
โโโ tests/ # 41 tests, 0 warnings
โโโ docker/ # supervisord (FastAPI + Streamlit)MIT License
