Skip to content

trading_agent.tools.browser_back_tool

The browser_back tool: goes back one page.

Typical usage example:

tool = BrowserBackTool(session)

BrowserBackTool

BrowserBackTool(session)

Bases: BrowserTool

Goes back one page in the current tab.

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)

Goes back.

Parameters:

Name Type Description Default
arguments NoArguments

No arguments.

required

Returns:

Type Description
ToolResult

The previous page's snapshot, or an error.

Source code in src/trading_agent/tools/browser_back_tool.py
async def run(self, arguments: tool.NoArguments) -> tool.ToolResult:
    """Goes back.

    Args:
        arguments (tool.NoArguments): No arguments.

    Returns:
        tool.ToolResult: The previous page's snapshot, or an error.
    """
    del arguments
    return await self._text_result(self._session.back())