Skip to content

Commit d4780b0

Browse files
committed
Disable mouse pointer addition in Obs class; refine summarizer instructions and improve observation message handling in ToolUseAgent
1 parent a17c119 commit d4780b0

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/agentlab/agents/tool_use_agent/multi_tool_agent.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Obs(Block):
108108
use_dom: bool = False
109109
use_som: bool = False
110110
use_tabs: bool = False
111-
add_mouse_pointer: bool = True
111+
add_mouse_pointer: bool = False
112112
use_zoomed_webpage: bool = False
113113

114114
def apply(
@@ -215,13 +215,12 @@ def apply_init(self, llm, messages: list[MessageBuilder]) -> dict:
215215
# Add a system message to the LLM to indicate that it should summarize
216216
system_msg.add_text(
217217
"""# Summarizer instructions:\nWhen asked to summarize, do the following:
218-
1) Summarize the effect of the last action, with attention to details.
219-
2) Give a semantic description of the current state of the environment, with attention to details. If there was a repeating mistake, mention the cause of it.
220-
3) Reason about the overall task at a high level.
221-
4) What hint can be relevant for the next action? Only chose from the hints provided in the task description. Or select none.
222-
5) What is the currently activated item if any.
223-
6) Reason about the next action to take, based on the current state and the goal.
224-
"""
218+
1) Summarize the effect of the last action, with attention to details.
219+
2) Give a semantic description of the current state of the environment, with attention to details. If there was a repeating mistake, mention the cause of it.
220+
3) Reason about the overall task at a high level.
221+
4) What hint can be relevant for the next action? Only chose from the hints provided in the task description. Or select none.
222+
5) Reason about the next action to take, based on the current state and the goal.
223+
"""
225224
)
226225
else:
227226
system_msg.add_text(
@@ -343,6 +342,7 @@ def __init__(
343342
self.messages: list[MessageBuilder] = []
344343
self.last_response: LLMOutput = LLMOutput()
345344
self._responses: list[LLMOutput] = []
345+
self.obs_msg_set = list()
346346

347347
def obs_preprocessor(self, obs):
348348
obs = copy(obs)
@@ -386,15 +386,14 @@ def get_action(self, obs: Any) -> float:
386386
self.config.general_hints.apply(self.llm, self.messages)
387387
self.task_hint.apply(self.llm, self.messages, self.task_name)
388388

389-
logging.info("Appending observation to messages")
390-
self.config.obs.apply(self.llm, self.messages, obs, last_llm_output=self.last_response)
391-
logging.info("Calling summarizer")
389+
obs_msg = self.config.obs.apply(
390+
self.llm, self.messages, obs, last_llm_output=self.last_response
391+
)
392+
self.obs_msg_set
392393
self.config.summarizer.apply(self.llm, self.messages)
393-
logging.info("Main tool calling")
394394
response: LLMOutput = self.llm(
395395
messages=self.messages, tool_choice="any", cache_tool_definition=True
396396
)
397-
logging.info(f"Obtained response {response}")
398397

399398
action = response.action
400399
think = response.think

0 commit comments

Comments
 (0)