Skip to content

Commit 29ba1c4

Browse files
committed
few comments
1 parent 7a682a0 commit 29ba1c4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

experiments/run_miniwob.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def parse_args():
3535
parser.add_argument(
3636
"--agent",
3737
choices=["tape", "generic", "react"],
38-
default="tape",
39-
help="Agent type to use (default: tape)",
38+
default="react",
39+
help="Agent type to use (default: react)",
4040
)
4141
parser.add_argument(
4242
"--config",

src/agentlab/agents/react_toolcall_agent.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919

2020
@dataclass
2121
class Observation:
22-
data: dict
22+
data: dict # expected keys: goal_object, pruned_html, axtree_txt, screenshot, last_action_error, action_result
2323

2424
def to_messages(self) -> list[dict]:
25+
"""
26+
Convert the observation dictionary into a list of chat messages for Lite LLM
27+
"""
2528
messages = []
2629
tool_call_id = self.data.get("tool_call_id")
2730
if self.data.get("goal_object") and not tool_call_id: # its a first observation when there are no tool_call_id, so include goal
@@ -69,6 +72,9 @@ def to_messages(self) -> list[dict]:
6972

7073
@dataclass
7174
class LLMOutput:
75+
"""
76+
LiteLLM output message containing all the llm response details, suitable for putting back into prompt to reuse KV cache
77+
"""
7278
message: Message
7379
def to_messages(self) -> list[Message]:
7480
return [self.message]
@@ -138,6 +144,7 @@ def obs_preprocessor(self, obs: dict) -> dict:
138144
if not self.config.use_screenshot:
139145
obs.pop("screenshot", None)
140146
if self.last_tool_call_id:
147+
# add tool_call_id to obs for linking observation to the last executed action
141148
obs["tool_call_id"] = self.last_tool_call_id
142149
return obs
143150

0 commit comments

Comments
 (0)