subhdotsol commited on
Commit
fc70913
·
1 Parent(s): 202f5d9

feat(app): add GET /state endpoint — returns current EpisodeState snapshot

Browse files
Files changed (1) hide show
  1. server/app.py +5 -1
server/app.py CHANGED
@@ -1,7 +1,7 @@
1
  from contextlib import asynccontextmanager
2
  from fastapi import FastAPI, HTTPException
3
  from fastapi.middleware.cors import CORSMiddleware
4
- from models import AttackAction, StepResult, ResetResponse
5
  from server.environment import RedTeamEnvironment
6
  from server.config import get_settings
7
 
@@ -56,3 +56,7 @@ async def step_episode(action: AttackAction):
56
  raise HTTPException(status_code=400, detail=str(e))
57
  except Exception as e:
58
  raise HTTPException(status_code=500, detail=str(e))
 
 
 
 
 
1
  from contextlib import asynccontextmanager
2
  from fastapi import FastAPI, HTTPException
3
  from fastapi.middleware.cors import CORSMiddleware
4
+ from models import AttackAction, StepResult, ResetResponse, EpisodeState
5
  from server.environment import RedTeamEnvironment
6
  from server.config import get_settings
7
 
 
56
  raise HTTPException(status_code=400, detail=str(e))
57
  except Exception as e:
58
  raise HTTPException(status_code=500, detail=str(e))
59
+
60
+ @app.get("/state", response_model=EpisodeState)
61
+ async def get_state():
62
+ return env.get_state()