yashodipmore/queryforge-v1
0
QueryForge-v1
A real-world SQL query optimization and debugging environment for AI agents.
QueryForge trains and evaluates agents on tasks that database engineers do every day: fixing broken queries, optimizing slow ones, and redesigning inefficient schemas.
Submission Quick Links
- GitHub Repository: https://github.com/yashodipmore/queryforge-v1
- Hugging Face Space: https://huggingface.co/spaces/yashodipmore/queryforge-v1
- Team Name: Sarthak
- Team Members: Yashodip More, Komal Kumavat, Jaykumar Girase
Environment Overview
Tasks
Task 1: Fix Broken SQL Query (Easy)
Agent receives a query with syntax or logic errors. Goal: fix the query so it executes and returns the correct rows.
Task 2: Optimize Slow Query (Medium)
Agent receives a syntactically correct but slow query. Goal: add indexes and/or rewrite the query to eliminate expensive operations.
Task 3: Redesign Inefficient Schema (Hard)
Agent receives a denormalized table. Goal: propose a normalized schema, write migration queries, and verify data integrity.
Action Space
Reward Function
reward = syntax_score (0.3)
+ correctness_score (0.4)
+ performance_score (0.2)
+ efficiency_bonus (0.1)
- penaltiesReward is computed at every step to provide continuous signal.
Setup
Local Development
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 7860 --reloadDocker
docker build -t queryforge-v1 .
docker run -p 7860:7860 queryforge-v1API Usage
curl -X POST http://localhost:7860/reset \
-H "Content-Type: application/json" \
-d '{"task_id": "fix_broken_query"}'
curl -X POST http://localhost:7860/step \
-H "Content-Type: application/json" \
-d '{"action_type": "rewrite_query", "query": "SELECT customer_id, SUM(amount) FROM orders WHERE status = '\''paid'\'' GROUP BY customer_id"}'
curl http://localhost:7860/stateRun Baseline Inference
# HF_TOKEN is required
export HF_TOKEN=your_token_here
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
export QUERYFORGE_URL=http://localhost:7860
python inference.pyOpenEnv Validation
pip install openenv-core
# If the CLI is available in your environment
openenv validatePre-Submission Checklist
- openenv.yaml present and task IDs match implementation
- inference.py in repository root and START/STEP/END log format preserved
- /health, /reset, /step, /state endpoints return valid responses
- Rewards stay in [0.0, 1.0] and graders remain deterministic
- docker build succeeds and container serves on port 7860
- GitHub repository and Hugging Face Space links are public and accessible
License
MIT
