Skip to content

Commit de7d883

Browse files
authored
fix search tool (#223)
* fix search tool * change fix to use original function name from gemini * remove unused import * add changeset
1 parent da570a1 commit de7d883

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stagehand": patch
3+
---
4+
5+
Fix search, navigate, go back, and go forward for gemini cua agent

stagehand/agent/google_cua.py

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
AgentConfig,
2424
AgentExecuteOptions,
2525
AgentResult,
26-
FunctionAction,
2726
)
2827
from .client import AgentClient
2928

@@ -567,34 +566,19 @@ async def run_task(
567566
)
568567
current_url = self.handler.page.url
569568

570-
function_name_called_for_feedback = ""
571-
if agent_action.action_type == "function" and isinstance(
572-
agent_action.action.root, FunctionAction
573-
):
574-
function_name_called_for_feedback = (
575-
agent_action.action.root.name
569+
if not invoked_function_name:
570+
self.logger.error(
571+
"Original Google function name not found for feedback loop (was None).",
572+
category="agent",
576573
)
577-
self._format_action_feedback(
578-
function_name_called=function_name_called_for_feedback,
579-
action_result=action_result,
580-
new_screenshot_base64=current_screenshot_b64,
581-
current_url=current_url,
582-
function_call_args=function_call_args,
583-
)
584-
else:
585-
if not invoked_function_name:
586-
self.logger.error(
587-
"Original Google function name not found for feedback loop (was None).",
588-
category="agent",
589-
)
590-
else:
591-
self._format_action_feedback(
592-
function_name_called=invoked_function_name,
593-
action_result=action_result,
594-
new_screenshot_base64=current_screenshot_b64,
595-
current_url=current_url,
596-
function_call_args=function_call_args,
597-
)
574+
575+
self._format_action_feedback(
576+
function_name_called=invoked_function_name,
577+
action_result=action_result,
578+
new_screenshot_base64=current_screenshot_b64,
579+
current_url=current_url,
580+
function_call_args=function_call_args,
581+
)
598582

599583
if task_completed:
600584
self.logger.info(

0 commit comments

Comments
 (0)