Miquel Farré commited on
Commit ·
2defc46
1
Parent(s): 6da76f0
stoping agent when desktop not available
Browse files397 unmodified lines398399400401402403397 unmodified lines"""Callback that takes a screenshot + memory snapshot after a step completes"""current_step = memory_step.step_numberprint(f"Taking screenshot for step {current_step}")try:time.sleep(2.0) # Let things happen on the desktopscreenshot_bytes = self.desktop.screenshot()397 unmodified lines398399400401402403404405406407408409410411412413397 unmodified lines"""Callback that takes a screenshot + memory snapshot after a step completes"""current_step = memory_step.step_numberprint(f"Taking screenshot for step {current_step}")# Check if desktop is still runningif not self.desktop.is_running():print("Desktop is no longer running. Terminating agent.")self.close()# Add a final observation indicating why the agent was terminatedmemory_step.observations = "Desktop session ended. Agent terminated."# Store final metadata before exitingself.store_metadata_to_file(agent)return # Exit the callback without attempting to take a screenshottry:time.sleep(2.0) # Let things happen on the desktopscreenshot_bytes = self.desktop.screenshot()
e2bqwen.py+10