3636from alias .agent .agents .common_agent_utils import (
3737 WorkerResponse ,
3838 get_user_input_to_mem_pre_reply_hook ,
39+ agent_load_states_pre_reply_hook ,
40+ save_post_reasoning_state ,
41+ save_post_action_state ,
3942)
4043from alias .agent .agents ._build_in_helper_browser ._image_understanding import (
4144 image_understanding ,
@@ -281,6 +284,11 @@ def __init__(
281284 # Register hooks (kwargs-only signature)
282285 # compatible with directly using session service,
283286 # add input msg to memory
287+ self .register_instance_hook (
288+ "pre_reply" ,
289+ "agent_load_states_pre_reply_hook" ,
290+ agent_load_states_pre_reply_hook ,
291+ )
284292 self .register_instance_hook (
285293 "pre_reply" ,
286294 "get_user_input_to_mem_pre_reply_hook" ,
@@ -291,11 +299,21 @@ def __init__(
291299 "browser_pre_reply_hook" ,
292300 browser_pre_reply_hook ,
293301 )
302+ self .register_instance_hook (
303+ "post_reasoning" ,
304+ "save_post_reasoning_state" ,
305+ save_post_reasoning_state ,
306+ )
294307 self .register_instance_hook (
295308 "post_acting" ,
296309 "browser_post_acting_hook" ,
297310 browser_post_acting_hook ,
298311 )
312+ self .register_instance_hook (
313+ "post_acting" ,
314+ "save_post_action_state" ,
315+ save_post_action_state ,
316+ )
299317
300318 def _register_skill_tool (
301319 self ,
@@ -1373,7 +1391,9 @@ async def _validate_finish_status(self, summary: str) -> str:
13731391 sys_prompt = (
13741392 "You are an expert in task validation. "
13751393 "Your job is to determine if the agent has completed its task"
1376- " based on the provided summary. If the summary is `NO_ANSWER`, this task is not over. If finished, strictly reply "
1394+ " based on the provided summary. If the summary is `NO_ANSWER`, this task "
1395+ "is not over unless the task is determined as definitely not completed. "
1396+ "If finished, strictly reply "
13771397 '"BROWSER_AGENT_TASK_FINISHED" and your reason, otherwise return the remaining '
13781398 "tasks or next steps."
13791399 )
0 commit comments