Skip to content

Commit ed0f1bd

Browse files
add timeout error for hilt agent.
1 parent c9852ec commit ed0f1bd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/agentlab/agents/hilt_agent/hilt_agent.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import bgym
88
import numpy as np
99
from PIL import Image
10+
import playwright
1011

1112
from agentlab.agents.hilt_agent.hint_labelling import (
1213
HintLabeling,
@@ -114,6 +115,14 @@ def get_action(self, obs):
114115
if self.ui:
115116
self.ui.close()
116117
raise
118+
except playwright.sync_api.TimeoutError:
119+
# Handle timeout specifically: fall back to first candidate
120+
print("UI timeout; falling back to first candidate.")
121+
selected_candidate = candidates[0]
122+
self.subagent.update_agent_state_from_selected_candidate(selected_candidate)
123+
action = selected_candidate["action"]
124+
agent_info = selected_candidate["agent_info"]
125+
return action, agent_info
117126
except Exception as e:
118127
print(f"Error in human intervention UI: {e}")
119128
if self.ui:

0 commit comments

Comments
 (0)