strix/strix/tools/browser/browser_actions_schema.xml
2026-04-01 13:49:30 -07:00

308 lines
15 KiB
XML

<tools>
<tool name="browser_actions">
<description>Control a browser via natural language or granular commands. Supports two modes:
**Sandboxed** (default): The browser runs inside the sandbox container (with Caido proxy
intercepting all traffic) and is controlled remotely via Chrome DevTools Protocol (CDP).
**Local** (use_local=true): Uses the system Chrome installation directly. No sandbox
required. Preserves existing login sessions, cookies, and extensions. You may need to
fully close Chrome before launching. Optionally select a Chrome profile.
The browser is PERSISTENT and remains active until explicitly closed, allowing for
multi-step workflows. State (cookies, auth, tabs) carries over between calls.
Two usage styles:
- **Agent mode** (action="run"): Give a natural-language task and the browser-use agent
autonomously navigates, clicks, fills forms, and extracts information.
- **Granular mode**: Use specific actions (open, click, type, scroll, etc.) for precise,
deterministic control of the browser via CDP.</description>
<parameters>
<parameter name="action" type="string" required="true">
<description>The action to perform:
**Lifecycle:**
- launch: Start the browser. MUST be called before any other actions.
Pass use_local=true for local Chrome. Optionally pass profile_directory.
- close: Shut down the browser session.
**Agent mode:**
- run: Execute a natural-language browser task. Requires 'task' parameter.
Optionally pass 'return_fields' to select which history data to include in the response.
**Navigation:**
- open: Navigate to a URL. Requires 'url'.
- back: Navigate back in history.
**Interaction:**
- click: Click an element by 'index' or coordinates ('x', 'y').
- type: Insert text at the current cursor position. Requires 'text'.
- input: Click an element then type into it. Requires 'index' and 'text'.
- hover: Hover over an element. Requires 'index'.
- dblclick: Double-click an element. Requires 'index'.
- rightclick: Right-click an element. Requires 'index'.
- keys: Send keyboard keys (e.g. "Enter", "Ctrl+a"). Requires 'keys'.
- select: Select a dropdown option. Requires 'index' and 'value'.
- scroll: Scroll the page. Optional 'direction' (up/down/left/right) and 'amount'.
**Information:**
- screenshot: Capture a screenshot. Optional 'full' (full page) and 'path' (save to file).
- state: Get the current page DOM state with element indices.
- eval: Execute JavaScript. Requires 'js'.
- get: Get page info. Requires 'subcommand': title, html, text, value, attributes, bbox.
**Cookies:**
- cookies: Cookie operations. Requires 'subcommand': get, set, clear, export, import.
**Waiting:**
- wait: Wait for conditions. Requires 'subcommand': selector, text.
**Tabs:**
- switch: Switch to a tab by index. Requires 'tab'.
- close_tab: Close a tab. Optional 'tab' (defaults to focused tab).</description>
</parameter>
<parameter name="task" type="string" required="false">
<description>Required for 'run' action. A natural-language description of what to do in
the browser, e.g. "Go to example.com and find the contact email".</description>
</parameter>
<parameter name="use_local" type="boolean" required="false">
<description>Only used with action='launch'. When true, uses the local system Chrome
installation instead of connecting to the sandbox container via CDP. Default: false.</description>
</parameter>
<parameter name="profile_directory" type="string" required="false">
<description>Only used with action='launch' and use_local=true. The Chrome profile
directory to use, e.g. "Default", "Profile 1". If not specified, auto-selected.</description>
</parameter>
<parameter name="url" type="string" required="false">
<description>URL to navigate to. Required for 'open' action. Also used by cookies get/clear/export.</description>
</parameter>
<parameter name="index" type="integer" required="false">
<description>Element index from the DOM state. Used by: click, input, select, hover, dblclick,
rightclick, and get (text/value/attributes/bbox).</description>
</parameter>
<parameter name="text" type="string" required="false">
<description>Text content. Required for 'type' and 'input' actions. Also used by wait text.</description>
</parameter>
<parameter name="value" type="string" required="false">
<description>Value to select. Required for 'select' action. Also used for cookie value in cookies set.</description>
</parameter>
<parameter name="selector" type="string" required="false">
<description>CSS selector. Used by wait selector and get html.</description>
</parameter>
<parameter name="keys" type="string" required="false">
<description>Keyboard keys to send. Required for 'keys' action. Examples: "Enter", "Ctrl+a", "Escape".</description>
</parameter>
<parameter name="js" type="string" required="false">
<description>JavaScript code to execute. Required for 'eval' action.</description>
</parameter>
<parameter name="direction" type="string" required="false">
<description>Scroll direction: "up", "down", "left", "right". Default: "down".</description>
</parameter>
<parameter name="amount" type="integer" required="false">
<description>Scroll amount in pixels. Default: 500.</description>
</parameter>
<parameter name="tab" type="integer" required="false">
<description>Tab index. Required for 'switch', optional for 'close_tab'.</description>
</parameter>
<parameter name="x" type="number" required="false">
<description>X coordinate for click action (use with 'y' for coordinate-based clicking).</description>
</parameter>
<parameter name="y" type="number" required="false">
<description>Y coordinate for click action (use with 'x' for coordinate-based clicking).</description>
</parameter>
<parameter name="full" type="boolean" required="false">
<description>For 'screenshot': capture the full page. Default: false.</description>
</parameter>
<parameter name="path" type="string" required="false">
<description>For 'screenshot': save to this file path instead of returning base64.</description>
</parameter>
<parameter name="subcommand" type="string" required="false">
<description>Sub-action for compound commands:
- cookies: "get", "set", "clear", "export", "import"
- wait: "selector", "text"
- get: "title", "html", "text", "value", "attributes", "bbox"</description>
</parameter>
<parameter name="query" type="string" required="false">
<description>Query for 'extract' action (requires agent mode).</description>
</parameter>
<parameter name="name" type="string" required="false">
<description>Cookie name. Used by cookies set.</description>
</parameter>
<parameter name="domain" type="string" required="false">
<description>Cookie domain. Used by cookies set.</description>
</parameter>
<parameter name="file" type="string" required="false">
<description>File path for cookies export/import.</description>
</parameter>
<parameter name="timeout" type="integer" required="false">
<description>Timeout in milliseconds for wait actions. Default: 30000.</description>
</parameter>
<parameter name="state" type="string" required="false">
<description>Wait state for wait selector: "visible", "hidden", "attached", "detached". Default: "visible".</description>
</parameter>
<parameter name="secure" type="boolean" required="false">
<description>Cookie secure flag. Used by cookies set. Default: false.</description>
</parameter>
<parameter name="http_only" type="boolean" required="false">
<description>Cookie httpOnly flag. Used by cookies set. Default: false.</description>
</parameter>
<parameter name="same_site" type="string" required="false">
<description>Cookie SameSite policy. Used by cookies set. Values: "Strict", "Lax", "None".</description>
</parameter>
<parameter name="expires" type="number" required="false">
<description>Cookie expiration timestamp. Used by cookies set.</description>
</parameter>
<parameter name="return_fields" type="array" required="false">
<description>Only used with action='run'. A list of history fields to include in the
response under a "fields" key. By default only the final result is returned. Use this
to request additional data from the agent run.
Available fields:
- urls: List of visited URLs
- screenshot_paths: List of screenshot file paths
- screenshots: List of screenshots as base64 strings
- action_names: Names of executed actions
- extracted_content: Extracted content from all actions
- errors: List of errors (None for steps without errors)
- model_actions: All actions with their parameters
- model_outputs: All model outputs
- last_action: Last action in history
- final_result: Final extracted content (last step)
- is_done: Whether the agent completed
- has_errors: Whether any errors occurred
- model_thoughts: Agent reasoning process
- action_results: All ActionResult objects
- action_history: Truncated action history with essential fields
- number_of_steps: Number of steps taken
- total_duration_seconds: Total duration of all steps</description>
</parameter>
</parameters>
<returns type="Dict[str, Any]">
<description>Returns a dict with action-specific results. On error, returns an error field.
For 'run': message + result. For granular actions: action-specific keys.</description>
</returns>
<notes>
Important usage rules:
1. PERSISTENCE: The browser remains active and maintains its state (cookies, auth, tabs)
until explicitly closed with the 'close' action.
2. Browser interaction MUST start with 'launch' and end with 'close'.
3. You MUST call 'launch' before any other actions. Calling actions without launching
first will return an error.
4. For 'run' action: the browser-use agent autonomously handles the task. You MUST wait
for the result — it is returned synchronously.
5. For granular actions: use 'state' first to get element indices, then use those indices
with click, input, select, hover, etc.
6. The browser persists across tasks. Do NOT close it between actions.
7. ALWAYS close the browser with 'close' when completely finished.
8. There is a 5-minute timeout per 'run' task. Break large tasks into smaller steps.
9. Granular actions are faster and more deterministic than 'run' for simple operations.
Use 'run' for complex multi-step tasks; use granular actions for precise control.
</notes>
<examples>
# Launch the sandbox browser (default, must be done first)
<function=browser_actions>
<parameter=action>launch</parameter>
</function>
# Launch the local system Chrome instead
<function=browser_actions>
<parameter=action>launch</parameter>
<parameter=use_local>true</parameter>
</function>
# Navigate to a URL
<function=browser_actions>
<parameter=action>open</parameter>
<parameter=url>https://example.com</parameter>
</function>
# Get current page state with element indices
<function=browser_actions>
<parameter=action>state</parameter>
</function>
# Click element by index (from state output)
<function=browser_actions>
<parameter=action>click</parameter>
<parameter=index>5</parameter>
</function>
# Click by coordinates
<function=browser_actions>
<parameter=action>click</parameter>
<parameter=x>100</parameter>
<parameter=y>200</parameter>
</function>
# Type into an input field (click + type)
<function=browser_actions>
<parameter=action>input</parameter>
<parameter=index>3</parameter>
<parameter=text>admin@example.com</parameter>
</function>
# Send keyboard keys
<function=browser_actions>
<parameter=action>keys</parameter>
<parameter=keys>Enter</parameter>
</function>
# Scroll down
<function=browser_actions>
<parameter=action>scroll</parameter>
<parameter=direction>down</parameter>
<parameter=amount>500</parameter>
</function>
# Take a screenshot
<function=browser_actions>
<parameter=action>screenshot</parameter>
<parameter=full>true</parameter>
<parameter=path>/tmp/page.png</parameter>
</function>
# Get page title
<function=browser_actions>
<parameter=action>get</parameter>
<parameter=subcommand>title</parameter>
</function>
# Wait for an element to appear
<function=browser_actions>
<parameter=action>wait</parameter>
<parameter=subcommand>selector</parameter>
<parameter=selector>#login-form</parameter>
<parameter=timeout>10000</parameter>
</function>
# Get cookies for a URL
<function=browser_actions>
<parameter=action>cookies</parameter>
<parameter=subcommand>get</parameter>
<parameter=url>https://example.com</parameter>
</function>
# Execute JavaScript
<function=browser_actions>
<parameter=action>eval</parameter>
<parameter=js>document.title</parameter>
</function>
# Run a natural-language browser task
<function=browser_actions>
<parameter=action>run</parameter>
<parameter=task>Go to https://example.com/login, fill in username "admin" and password "secret", then click the login button</parameter>
</function>
# Run a task and request specific output fields
<function=browser_actions>
<parameter=action>run</parameter>
<parameter=task>Navigate through the site and collect all page titles</parameter>
<parameter=return_fields>["urls", "extracted_content", "number_of_steps"]</parameter>
</function>
# Close the browser when done
<function=browser_actions>
<parameter=action>close</parameter>
</function>
</examples>
</tool>
</tools>