Spaces:
Running
Running
Initial OpenEnv SQL debug environment
Browse files
README.md
CHANGED
|
@@ -1,42 +1,14 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: sql-debug-env
|
| 3 |
-
emoji: "π§ͺ"
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: green
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
# SQL Debug Environment (`sql-debug-env`)
|
| 11 |
|
| 12 |
-

|
| 13 |
-

|
| 14 |

|
| 15 |

|
| 16 |

|
| 17 |
-
" src="https://img.shields.io/badge/React-UI_optional-61DAFB?logo=react&logoColor=111111">
|
| 23 |
-
<img alt="Vite (not used in this backend repo)" src="https://img.shields.io/badge/Vite-UI_optional-646CFF?logo=vite&logoColor=white">
|
| 24 |
-
<img alt="Node.js (not used in this backend repo)" src="https://img.shields.io/badge/Node.js-UI_optional-339933?logo=nodedotjs&logoColor=white">
|
| 25 |
-
<img alt="Express (not used in this backend repo)" src="https://img.shields.io/badge/Express-UI_optional-000000?logo=express&logoColor=white">
|
| 26 |
-
<img alt="PostgreSQL (not used in this backend repo)" src="https://img.shields.io/badge/PostgreSQL-Not_used-4169E1?logo=postgresql&logoColor=white">
|
| 27 |
-
<img alt="MongoDB (not used in this backend repo)" src="https://img.shields.io/badge/MongoDB-Not_used-47A248?logo=mongodb&logoColor=white">
|
| 28 |
-
<img alt="Tailwind CSS (not used in this backend repo)" src="https://img.shields.io/badge/Tailwind-UI_optional-06B6D4?logo=tailwindcss&logoColor=white">
|
| 29 |
-
<img alt="Axios (not used in this backend repo)" src="https://img.shields.io/badge/Axios-UI_optional-5A29E4?logo=axios&logoColor=white">
|
| 30 |
-
</p>
|
| 31 |
|
| 32 |
An OpenEnv environment for a real task people do every day: **debugging SQL**. The agent gets a broken query, a live (in-memory) SQLite database, and a description of the expected output. It can inspect schema/errors/samples and submit fixed queries until it solves the task.
|
| 33 |
|
| 34 |
-
## Why this project matters
|
| 35 |
-
- SQL debugging is a real operational task across analytics and backend teams.
|
| 36 |
-
- The environment is deterministic, fast, and local-first for reliable evaluation.
|
| 37 |
-
- Reward shaping gives useful partial progress signals instead of only pass/fail.
|
| 38 |
-
- The benchmark endpoint provides live runtime evidence for reviewers.
|
| 39 |
-
|
| 40 |
## Whatβs in this repo
|
| 41 |
- **FastAPI server**: `server/main.py` (endpoints: `/health`, `/tasks`, `/reset`, `/step`, `/state`)
|
| 42 |
- **Environment logic**: `server/env.py` + `server/database.py`
|
|
@@ -59,20 +31,6 @@ An OpenEnv environment for a real task people do every day: **debugging SQL**. T
|
|
| 59 |
- Docker-first deployment path (local and Hugging Face Spaces)
|
| 60 |
- Local benchmark endpoint for live latency checks (`/benchmark`)
|
| 61 |
|
| 62 |
-
## Architecture
|
| 63 |
-
```mermaid
|
| 64 |
-
flowchart LR
|
| 65 |
-
Client[Client Agent or Evaluator] --> API[FastAPI Server]
|
| 66 |
-
API --> Env[SQLDebugEnv]
|
| 67 |
-
Env --> DB[InMemory SQLite Episode DB]
|
| 68 |
-
Env --> Tasks[Task Set easy medium hard]
|
| 69 |
-
Env --> Reward[Reward Engine]
|
| 70 |
-
Tasks --> Grader[Deterministic Graders]
|
| 71 |
-
Grader --> Reward
|
| 72 |
-
Reward --> API
|
| 73 |
-
API --> Client
|
| 74 |
-
```
|
| 75 |
-
|
| 76 |
## API Docs (FastAPI Auto Docs)
|
| 77 |
Use these for interactive testing in browser:
|
| 78 |
|
|
@@ -80,35 +38,6 @@ Use these for interactive testing in browser:
|
|
| 80 |
- ReDoc: `http://localhost:7860/redoc`
|
| 81 |
- OpenAPI spec: `http://localhost:7860/openapi.json`
|
| 82 |
|
| 83 |
-
## Project Structure
|
| 84 |
-
```text
|
| 85 |
-
sql-debug-env/
|
| 86 |
-
βββ Dockerfile
|
| 87 |
-
βββ openenv.yaml
|
| 88 |
-
βββ inference.py
|
| 89 |
-
βββ README.md
|
| 90 |
-
βββ requirements.txt
|
| 91 |
-
βββ pyproject.toml
|
| 92 |
-
βββ uv.lock
|
| 93 |
-
βββ scripts/
|
| 94 |
-
β βββ benchmark_local.py
|
| 95 |
-
βββ server/
|
| 96 |
-
β βββ main.py
|
| 97 |
-
β βββ env.py
|
| 98 |
-
β βββ models.py
|
| 99 |
-
β βββ database.py
|
| 100 |
-
β βββ reward.py
|
| 101 |
-
β βββ tasks/
|
| 102 |
-
β βββ base.py
|
| 103 |
-
β βββ task_easy.py
|
| 104 |
-
β βββ task_medium.py
|
| 105 |
-
β βββ task_hard.py
|
| 106 |
-
βββ tests/
|
| 107 |
-
βββ test_env.py
|
| 108 |
-
βββ test_graders.py
|
| 109 |
-
βββ test_reward.py
|
| 110 |
-
```
|
| 111 |
-
|
| 112 |
## Action Space
|
| 113 |
| Action | Required fields | Cost / reward effect |
|
| 114 |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# SQL Debug Environment (`sql-debug-env`)
|
| 2 |
|
|
|
|
|
|
|
| 3 |

|
| 4 |

|
| 5 |

|
| 6 |
+

|
| 7 |
+

|
| 8 |
+

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
An OpenEnv environment for a real task people do every day: **debugging SQL**. The agent gets a broken query, a live (in-memory) SQLite database, and a description of the expected output. It can inspect schema/errors/samples and submit fixed queries until it solves the task.
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
## Whatβs in this repo
|
| 13 |
- **FastAPI server**: `server/main.py` (endpoints: `/health`, `/tasks`, `/reset`, `/step`, `/state`)
|
| 14 |
- **Environment logic**: `server/env.py` + `server/database.py`
|
|
|
|
| 31 |
- Docker-first deployment path (local and Hugging Face Spaces)
|
| 32 |
- Local benchmark endpoint for live latency checks (`/benchmark`)
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
## API Docs (FastAPI Auto Docs)
|
| 35 |
Use these for interactive testing in browser:
|
| 36 |
|
|
|
|
| 38 |
- ReDoc: `http://localhost:7860/redoc`
|
| 39 |
- OpenAPI spec: `http://localhost:7860/openapi.json`
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
## Action Space
|
| 42 |
| Action | Required fields | Cost / reward effect |
|
| 43 |
|---|---|---|
|