Skip to content

Commit f591f36

Browse files
committed
fix obs format
1 parent 02dee09 commit f591f36

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/agentlab/backends/browser/env.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ def reset(self, seed: int):
3333
logger.info(f"Task goal: {self.goal}")
3434
page_content = self.backend.page_snapshot()
3535
screenshot = self.backend.page_screenshot()
36-
logger.info(f"Initial obs: {page_content}\n{screenshot}")
3736
obs = {
3837
"goal_object": [{"type": "text", "text": self.goal}],
39-
"pruned_html": page_content,
38+
"pruned_html": "",
4039
"axtree_txt": page_content,
4140
"screenshot": screenshot,
4241
"last_action_error": "",
4342
"focused_element_bid": "none",
4443
}
45-
return self.task.obs_postprocess(obs), {}
44+
obs = self.task.obs_postprocess(obs)
45+
logger.info(f"Initial obs: {obs}")
46+
return obs, {}
4647

4748
def step(self, action: ToolCallAction | str) -> tuple[dict, float, bool, bool, dict]:
4849
if isinstance(action, str):
@@ -62,9 +63,11 @@ def step(self, action: ToolCallAction | str) -> tuple[dict, float, bool, bool, d
6263
else:
6364
observation = self._step(action)
6465
observation = self.task.obs_postprocess(observation)
66+
67+
6568
action_exec_stop = time.time()
6669
self._turns += 1
67-
logger.info(f"Obs:\n{observation['pruned_html']}")
70+
logger.info(f"Obs: {observation}")
6871

6972
truncated = self._turns >= self.max_turns
7073

src/agentlab/backends/browser/mcp_playwright.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def step(self, action: ToolCallAction) -> dict:
3535
snapshot = self.page_snapshot()
3636
screenshot = self.page_screenshot()
3737
return {
38-
"pruned_html": f"{tool_result}\n{snapshot}",
38+
"tool_result": tool_result,
39+
"pruned_html": "",
3940
"axtree_txt": snapshot,
4041
"screenshot": screenshot,
4142
}

0 commit comments

Comments
 (0)