@@ -165,34 +165,28 @@ def example_error_handling():
165165 print ()
166166
167167
168- def example_special_requirements ():
168+ def example_hf_space ():
169169 """Example 7: Environments with special requirements"""
170- print ("=" * 70 )
171- print ("Example 7: Special Requirements" )
172- print ("=" * 70 )
173- print ()
170+ env = AutoEnv .from_name ("wukaixingxp/coding-env-test" )
174171
175- # DIPG environment requires dataset path
176- print ("DIPG environment requires DIPG_DATASET_PATH:" )
177- print ()
178- print (" # This would show a warning:" )
179- print (" # env = AutoEnv.from_name('dipg-env')" )
180- print ()
181- print (" # Correct usage:" )
182- print (" env = AutoEnv.from_name(" )
183- print (" 'dipg-env'," )
184- print (" env_vars={'DIPG_DATASET_PATH': '/data/dipg'}" )
185- print (" )" )
186- print ()
172+ # Reset environment
173+ observation = env .reset ()
174+ print (f"Reset observation: { observation } " )
187175
188- # FinRL environment has optional config
189- print ("FinRL environment accepts optional config:" )
190- print ()
191- print (" env = AutoEnv.from_name(" )
192- print (" 'finrl-env'," )
193- print (" env_vars={'FINRL_CONFIG_PATH': '/config.json'}" )
194- print (" )" )
195- print ()
176+ # Get action class
177+ CodeAction = AutoAction .from_name ("wukaixingxp/coding-env-test" )
178+
179+ # Create and execute action
180+ action = CodeAction (code = "print('Hello!')" )
181+ result = env .step (action ) # Returns StepResult object, not tuple
182+
183+ # Access result properties
184+ print (f"Observation: { result .observation } " )
185+ print (f"Reward: { result .reward } " )
186+ print (f"Done: { result .done } " )
187+
188+ # Clean up
189+ env .close ()
196190
197191
198192def test_specific_environment (env_name : str ):
@@ -285,7 +279,7 @@ def main():
285279 example_list_actions ()
286280 example_environment_info ()
287281 example_error_handling ()
288- example_special_requirements ()
282+ example_hf_space ()
289283
290284 else :
291285 # Show usage info and examples that don't need Docker
@@ -305,7 +299,7 @@ def main():
305299 example_list_actions ()
306300 example_environment_info ()
307301 example_error_handling ()
308- example_special_requirements ()
302+ example_hf_space ()
309303
310304 print ()
311305 print ("To test with actual Docker environments:" )
0 commit comments