{"openapi":"3.1.0","info":{"title":"SQL Debug Environment","description":"OpenEnv-compliant SQL query debugging environment for RL agent training.","version":"0.1.0"},"paths":{"/":{"get":{"summary":"Space Home","description":"Hugging Face Space opens here — HTML demo first; Gradio lives at /gradio/.","operationId":"space_home__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/info":{"get":{"summary":"Api Info","description":"Machine-readable index (JSON clients that used to hit `/`).","operationId":"api_info_api_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/favicon.ico":{"get":{"summary":"Favicon","operationId":"favicon_favicon_ico_get","responses":{"204":{"description":"Successful Response"}}}},"/demo":{"get":{"summary":"Demo Page","description":"Submission-ready demo + proof page.","operationId":"demo_page_demo_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/server/demo_page.html":{"get":{"summary":"Demo Page Repo Path","description":"Same page as /demo — URL matches the repo path for HF Space links and bookmarks.","operationId":"demo_page_repo_path_server_demo_page_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/tasks":{"get":{"summary":"List Tasks","description":"List all available tasks with metadata.","operationId":"list_tasks_tasks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/benchmark":{"get":{"summary":"Benchmark","description":"Real-time benchmark endpoint (fresh measurements on every call).\nSafe to call from dashboards/web pages for live verification.","operationId":"benchmark_benchmark_get","parameters":[{"name":"runs","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Runs"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reset":{"post":{"summary":"Reset","description":"Reset the environment for a new episode.\n\nReturns initial observation with task description and broken query.","operationId":"reset_reset_post","parameters":[{"name":"x-session-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Session-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetRequest","default":{"task_id":"easy_syntax_fix"}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/step":{"post":{"summary":"Step","description":"Execute one action in the environment.\n\nAction types:\n- submit_query: Submit SQL for evaluation (requires 'query' field)\n- inspect_schema: Get table schema (free action)\n- inspect_error: Get last error message (free action)\n- inspect_sample: Get sample rows from table (requires 'table_name')\n- reset_query: Reset to original broken query (small penalty)","operationId":"step_step_post","parameters":[{"name":"x-session-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Session-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StepRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/step_with_review":{"post":{"summary":"Step With Review","description":"Execute a step with a Reviewer Agent layer.\nIf the action is a query submission, the Reviewer validates it first.","operationId":"step_with_review_step_with_review_post","parameters":[{"name":"x-session-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Session-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StepRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/state":{"get":{"summary":"State","description":"Return current full episode state.","operationId":"state_state_get","parameters":[{"name":"x-session-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Session-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ActionType":{"type":"string","enum":["submit_query","inspect_schema","inspect_error","inspect_sample","reset_query"],"title":"ActionType"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ResetRequest":{"properties":{"task_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Id","default":"easy_syntax_fix"}},"type":"object","title":"ResetRequest"},"SQLDebugAction":{"properties":{"action_type":{"$ref":"#/components/schemas/ActionType","description":"Type of action to take"},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"SQL query string. Required when action_type is 'submit_query'."},"table_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Table Name","description":"Table name. Required when action_type is 'inspect_sample'."}},"type":"object","required":["action_type"],"title":"SQLDebugAction","description":"Action model for the SQL Debug Environment.\n\nThe agent can either:\n- submit_query: Submit a fixed SQL string for evaluation\n- inspect_schema: Get table schema info (free action, no reward change)\n- inspect_error: Get detailed error message from last query run\n- inspect_sample: Get sample rows from a specified table\n- reset_query: Go back to original broken query (costs -0.05 penalty)","example":{"action_type":"submit_query","query":"SELECT u.name, COUNT(o.id) as order_count FROM users u LEFT JOIN orders o ON u.id = o.user_id GROUP BY u.id, u.name ORDER BY order_count DESC"}},"StepRequest":{"properties":{"action":{"$ref":"#/components/schemas/SQLDebugAction"}},"type":"object","required":["action"],"title":"StepRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}