Openenv / app /main.py
vishaldhakad's picture
intial push
eda351c
Raw
History Blame Contribute Delete
1.33 kB
"""
SecureCodeEnv V2 — FastAPI Entry Point
Production-Ready Secure Code Generation RL Environment
Meta × HuggingFace OpenEnv Hackathon 2026
"""
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .routes import router
app = FastAPI(
title="SecureCodeEnv",
description=(
"RL environment for training LLM agents to write production-ready, "
"secure Python code. 9 CWE-grounded tasks, behavioral adversarial attack grading, "
"CodeGraph cross-file consistency system."
),
version="2.0.0",
docs_url="/docs",
redoc_url="/redoc",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(router)
@app.get("/health")
def health():
return {
"status": "ok",
"env": "SecureCodeEnv",
"version": "2.0.0",
"tasks": 9,
"graders": 8,
}
@app.get("/")
def root():
return {
"name": "SecureCodeEnv",
"version": "2.0.0",
"description": "RL environment for secure code generation training",
"endpoints": {
"reset": "POST /reset",
"step": "POST /step",
"state": "GET /state",
"health": "GET /health",
"docs": "GET /docs",
},
}