Skip to content

trading_agent.tools.browser_click_tool

The browser_click tool: clicks a numbered element from the latest snapshot.

Typical usage example:

tool = BrowserClickTool(session)

BrowserClickArguments

Bases: BaseModel

The arguments of browser_click.

Attributes:

Name Type Description
element int

The element's number from the latest snapshot.

BrowserClickTool

BrowserClickTool(session)

Bases: BrowserTool

Clicks an element.

Source code in src/trading_agent/tools/browser_tool.py
def __init__(self, session: browser_session_module.BrowserSession):
    """Creates the tool.

    Args:
        session (browser_session_module.BrowserSession): The desk's browser.
    """
    self._session = session

run async

run(arguments)

Clicks the element.

Parameters:

Name Type Description Default
arguments BrowserClickArguments

The element's number.

required

Returns:

Type Description
ToolResult

The new snapshot, or an error.

Source code in src/trading_agent/tools/browser_click_tool.py
async def run(self, arguments: BrowserClickArguments) -> tool.ToolResult:
    """Clicks the element.

    Args:
        arguments (BrowserClickArguments): The element's number.

    Returns:
        tool.ToolResult: The new snapshot, or an error.
    """
    return await self._text_result(self._session.click(arguments.element))