Skip to content

Commit 21be58f

Browse files
committed
Refactor Obs and Summarizer classes: remove unused tool_calls in Obs, add summary toggle in Summarizer, and adjust ToolUseAgent message handling.
1 parent 206f7c3 commit 21be58f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/agentlab/agents/tool_use_agent/multi_tool_agent.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def apply(
8787
if last_llm_output.tool_calls is None:
8888
obs_msg = llm.msg.user() # type: MessageBuilder
8989
else:
90-
messages.append(last_llm_output.tool_calls) # TODO move else where
9190
obs_msg = llm.msg.tool(last_llm_output.raw_response) # type: MessageBuilder
9291

9392
if self.use_last_error:
@@ -159,7 +158,12 @@ def apply(self, llm, messages: list[MessageBuilder]) -> dict:
159158
class Summarizer(Block):
160159
"""Block to summarize the last action and the current state of the environment."""
161160

161+
do_summary: bool = False
162+
162163
def apply(self, llm, messages: list[MessageBuilder]) -> dict:
164+
if not self.do_summary:
165+
return
166+
163167
msg = llm.msg.user().add_text(
164168
"Summarize the effect of the last action and the current state of the environment."
165169
)
@@ -306,6 +310,9 @@ def get_action(self, obs: Any) -> float:
306310

307311
action = response.action
308312
think = response.think
313+
314+
self.messages.append(response.tool_calls)
315+
309316
self.last_response = response
310317
self._responses.append(response) # may be useful for debugging
311318
# self.messages.append(response.assistant_message) # this is tool call
@@ -353,7 +360,7 @@ def get_action(self, obs: Any) -> float:
353360
use_last_error=True,
354361
use_screenshot=True,
355362
use_axtree=False,
356-
use_dom=True,
363+
use_dom=False,
357364
use_som=False,
358365
use_tabs=False,
359366
),

0 commit comments

Comments
 (0)