Abhinav Singh commited on
Commit
cc0da5c
·
1 Parent(s): 026bc6e

feat: add OpenEnv spec, README, and gitignore

Browse files

- openenv.yaml: full OpenEnv-compliant spec with observation/action
space definitions, 3 tasks (easy->medium->hard), reward schema,
and deployment config targeting HuggingFace Spaces on port 7860
- README.md: HF Space header (sdk: docker), full environment
description, action/observation space docs, task breakdown,
reward table, API endpoints, baseline scores, and setup instructions
- .gitignore: standard Python ignores (__pycache__, .env, venv, dist)

Files changed (2) hide show
  1. .gitignore +12 -0
  2. openenv.yaml +83 -0
.gitignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .env
8
+ .venv
9
+ venv/
10
+ *.log
11
+ .DS_Store
12
+ Thumbs.db
openenv.yaml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: sql-optim-env
2
+ version: "1.0.0"
3
+ description: >
4
+ An OpenEnv-compliant reinforcement learning environment where AI agents
5
+ learn to analyze, diagnose, and optimize SQL queries. Agents identify
6
+ performance anti-patterns — from basic SELECT * issues to advanced
7
+ window function and correlated subquery problems — across three difficulty
8
+ levels and produce rewritten, optimized SQL.
9
+
10
+ tags:
11
+ - openenv
12
+ - sql
13
+ - database
14
+ - performance
15
+ - optimization
16
+ - llm-agent
17
+
18
+ language: python
19
+ framework: openenv
20
+
21
+ observation_space:
22
+ type: object
23
+ fields:
24
+ task_id: string
25
+ task_name: string
26
+ task_description: string
27
+ sql_query: string
28
+ schema_info: string
29
+ dialect: string
30
+ difficulty: string
31
+ step_count: integer
32
+ max_steps: integer
33
+ issues_found_so_far: array
34
+
35
+ action_space:
36
+ type: object
37
+ fields:
38
+ suggestions: array
39
+ optimized_query: string
40
+ summary: string
41
+ estimated_improvement: string
42
+ approved: boolean
43
+
44
+ reward:
45
+ type: float
46
+ min: 0.0
47
+ max: 1.0
48
+ description: >
49
+ Composite score: issue detection (60%), optimized query quality (15%),
50
+ approval correctness (10%), summary quality (8%),
51
+ improvement estimate (4%), severity labels (3%).
52
+
53
+ tasks:
54
+ - id: task_1_basic_antipatterns
55
+ name: "Basic SQL Anti-pattern Detection"
56
+ difficulty: easy
57
+ max_steps: 3
58
+ description: "Identify SELECT *, non-SARGable predicates, and implicit type casts that prevent index usage."
59
+
60
+ - id: task_2_join_optimization
61
+ name: "N+1 Pattern & Join Optimization"
62
+ difficulty: medium
63
+ max_steps: 4
64
+ description: "Detect correlated subqueries, missing join indexes, and inefficient sorting in complex queries."
65
+
66
+ - id: task_3_advanced_optimization
67
+ name: "Advanced Query & Window Function Audit"
68
+ difficulty: hard
69
+ max_steps: 5
70
+ description: "Deep performance audit: JSONB index misses, CTE materialization, window function planning, lock contention, and implicit casts."
71
+
72
+ endpoints:
73
+ reset: POST /reset
74
+ step: POST /step
75
+ state: GET /state
76
+ tasks: GET /tasks
77
+ grader: POST /grader
78
+ baseline: POST /baseline
79
+
80
+ deployment:
81
+ platform: huggingface-spaces
82
+ port: 7860
83
+ dockerfile: Dockerfile