training-monkey/dataoncallenv
DataOnCallEnv
An RL benchmark that simulates the workflow of an on-call data analyst debugging broken reports. The agent investigates realistic data pipeline bugs across three difficulty tiers — diagnosing root causes, writing corrected SQL, and earning a multi-dimensional reward score.
Why This Exists
AI agents are being deployed as data analysts. But there is no benchmark that measures whether these agents can actually debug — not just query. DataOnCallEnv fills that gap by simulating exactly the workflow a real on-call analyst performs, scored against deterministic ground truth.
Features
Tasks
Action Space
Every action has tool, query, and an optional reasoning field (rewarded by the grader).
Observation Space
{
"task_id": 1,
"result": { "...tool output..." },
"steps_taken": 3,
"done": false,
"max_steps": 15,
"cost_spent": 4.5,
"budget_remaining": 15.5
}Reward Function
Total: 0.0–1.0 (dense reward — every action contributes signal)
API Endpoints
Setup
Prerequisites
- Python 3.10+
- pip
Install and Run Locally
git clone https://github.com/ajaypushparaj5/dataoncallenv.git
cd dataoncallenv
pip install -r requirements.txt
# Start the API server
uvicorn api.app:app --reload --port 8000Quick API Test
# Health check
curl http://localhost:8000/health
# Start Task 1
curl -X POST http://localhost:8000/reset \
-H "Content-Type: application/json" \
-d '{"task_id": 1}'
# Discover tables
curl -X POST http://localhost:8000/step \
-H "Content-Type: application/json" \
-d '{"tool": "list_tables", "query": "", "reasoning": "Discover available tables"}'
# Inspect schema
curl -X POST http://localhost:8000/step \
-H "Content-Type: application/json" \
-d '{"tool": "inspect_schema", "query": "sales", "reasoning": "Check sales table structure"}'Run with Docker
docker build -t dataoncallenv .
docker run -p 7860:7860 dataoncallenvRun Baseline Inference
Requires an API key for an OpenAI-compatible inference provider.
# Create .env file
cat > .env << EOF
HF_TOKEN=your_hf_token_here
API_BASE_URL=https://router.huggingface.co/v1
MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
EOF
python inference.pyRun Tests
python test_env.py
# Expected: 36 passed, 0 failedEnvironment Variables
Hugging Face Spaces Deployment
- Create a new Space on huggingface.co/new-space
- Select Docker as the SDK
- Upload the project files (or connect via Git)
- Add
HF_TOKENas a secret in Space Settings - The Space will auto-build using the
Dockerfileand expose the API on port 7860
Project Structure
dataoncallenv/
├── models.py # Pydantic types: Action, Observation, Reward, EnvState
├── tasks.py # Task definitions with ground truth and diagnosis tiers
├── database.py # SQLite database builder, tool implementations, anti-cheat
├── environment.py # Core RL env: partial obs, query costs, step/reset/state
├── graders.py # Tiered scoring, investigation quality, penalties
├── inference.py # Baseline agent using OpenAI-compatible API
├── test_env.py # 36 integration tests
├── api/
│ └── app.py # FastAPI server with /health, /reset, /step, /state
├── openenv.yaml # OpenEnv spec metadata
├── Dockerfile # HF Spaces container (port 7860)
├── requirements.txt # Python dependencies
├── baseline_scores.json # Reproducible baseline results
└── .env # API credentials (not committed)OpenEnv Spec
This environment implements the full OpenEnv specification:
- Typed Pydantic models for
Action,Observation,Reward, andEnvState reset()/step()/state()APIopenenv.yamlwith full metadata- Minimum 3 tasks with agent graders (easy → medium → hard)
- Scores in range 0.0–1.0 with partial progress signals
- Deterministic evaluation
- Baseline inference script with reproducible scores
