""" FastAPI application for the DQA-OpenEnv Environment. Exposes the DqaOpenenvEnvironment over HTTP and WebSocket endpoints. All routes are auto-generated by create_app() from openenv-core. Endpoints (auto-generated): POST /reset — Reset environment, returns initial observation POST /step — Execute action, returns observation + reward GET /state — Get current episode state GET /health — Container health check GET /docs — Auto-generated OpenAPI documentation WS /ws — WebSocket for persistent low-latency sessions """ try: from openenv.core.env_server.http_server import create_app except Exception as e: raise ImportError( "openenv-core is required. Install with: pip install openenv-core" ) from e try: from ..models import DQAAction, DQAObservation from .dqa_openenv_environment import DqaOpenenvEnvironment except (ModuleNotFoundError, ImportError): try: from models import DQAAction, DQAObservation from server.dqa_openenv_environment import DqaOpenenvEnvironment except ModuleNotFoundError: import sys, os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from models import DQAAction, DQAObservation from server.dqa_openenv_environment import DqaOpenenvEnvironment app = create_app( DqaOpenenvEnvironment, DQAAction, DQAObservation, env_name="dqa_openenv", max_concurrent_envs=1, ) def main(host: str = "0.0.0.0", port: int = 7860): """Start the uvicorn server directly.""" import uvicorn uvicorn.run(app, host=host, port=port) if __name__ == "__main__": main()