Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dramatic-worm-of-pizza.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stagehand": patch
---

Fix search, navigate, go back, and go forward for gemini cua agent
40 changes: 12 additions & 28 deletions stagehand/agent/google_cua.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
AgentConfig,
AgentExecuteOptions,
AgentResult,
FunctionAction,
)
from .client import AgentClient

Expand Down Expand Up @@ -567,34 +566,19 @@ async def run_task(
)
current_url = self.handler.page.url

function_name_called_for_feedback = ""
if agent_action.action_type == "function" and isinstance(
agent_action.action.root, FunctionAction
):
function_name_called_for_feedback = (
agent_action.action.root.name
if not invoked_function_name:
self.logger.error(
"Original Google function name not found for feedback loop (was None).",
category="agent",
)
self._format_action_feedback(
function_name_called=function_name_called_for_feedback,
action_result=action_result,
new_screenshot_base64=current_screenshot_b64,
current_url=current_url,
function_call_args=function_call_args,
)
else:
if not invoked_function_name:
self.logger.error(
"Original Google function name not found for feedback loop (was None).",
category="agent",
)
else:
self._format_action_feedback(
function_name_called=invoked_function_name,
action_result=action_result,
new_screenshot_base64=current_screenshot_b64,
current_url=current_url,
function_call_args=function_call_args,
)

self._format_action_feedback(
function_name_called=invoked_function_name,
action_result=action_result,
new_screenshot_base64=current_screenshot_b64,
current_url=current_url,
function_call_args=function_call_args,
)

if task_completed:
self.logger.info(
Expand Down