3131 State ,
3232 StepRequest ,
3333 StepResponse ,
34+ EnvironmentMetadata ,
3435)
3536
3637
@@ -135,7 +136,11 @@ async def reset(
135136 if k in sig .parameters or has_kwargs :
136137 valid_kwargs [k ] = v
137138
138- observation = self .env .reset (** valid_kwargs )
139+ # Run synchronous reset in thread pool to avoid blocking event loop
140+ loop = asyncio .get_event_loop ()
141+ observation = await loop .run_in_executor (
142+ self ._executor , lambda : self .env .reset (** valid_kwargs )
143+ )
139144 return ResetResponse (** self ._serialize_observation (observation ))
140145
141146 @app .post (
@@ -217,8 +222,11 @@ async def step(request: StepRequest) -> StepResponse:
217222 if k in sig .parameters or has_kwargs :
218223 valid_kwargs [k ] = v
219224
220- # Execute step
221- observation = self .env .step (action , ** valid_kwargs )
225+ # Run synchronous step in thread pool to avoid blocking event loop
226+ loop = asyncio .get_event_loop ()
227+ observation = await loop .run_in_executor (
228+ self ._executor , lambda : self .env .step (action , ** valid_kwargs )
229+ )
222230
223231 # Return serialized observation
224232 return StepResponse (** self ._serialize_observation (observation ))
@@ -239,6 +247,27 @@ async def get_state() -> State:
239247 """State endpoint - returns current environment state."""
240248 return self .env .state
241249
250+ @app .get (
251+ "/metadata" ,
252+ response_model = EnvironmentMetadata ,
253+ tags = ["Environment Info" ],
254+ summary = "Get environment metadata" ,
255+ description = """
256+ Get metadata about this environment.
257+
258+ Returns information about the environment including name, description,
259+ version, author, and documentation links.
260+ """ ,
261+ )
262+ async def get_metadata () -> EnvironmentMetadata :
263+ """
264+ Get metadata about this environment.
265+
266+ Returns information about the environment including name, description,
267+ version, author, and documentation links.
268+ """
269+ return self .env .get_metadata ()
270+
242271 @app .get (
243272 "/health" ,
244273 tags = ["Health" ],
@@ -473,6 +502,10 @@ def create_fastapi_app(
473502 "name" : "State Management" ,
474503 "description" : "Operations for inspecting environment state" ,
475504 },
505+ {
506+ "name" : "Environment Info" ,
507+ "description" : "Information about the environment" ,
508+ },
476509 {
477510 "name" : "Schema" ,
478511 "description" : "JSON Schema endpoints for actions, observations, and state" ,
0 commit comments