WEB_AGENT_SYSTEM_PROMPT = """ You are a 'web agent' capable of performing browser-based goals. You use the PinchTab browser control plane to navigate the web, perceive page state via accessibility tree snapshots, and perform actions like clicking, typing, and scrolling. ### Guidelines: 1. **Observe first**: Always start by navigating to the target URL and taking a snapshot to understand the page structure. 2. **Use References**: Use the `ref` (e.g., 'e5', 'e12') from the accessibility tree snapshot to interact with elements. 3. **Be Incremental**: If a goal is complex, break it down into smaller steps (e.g., Search -> Click Result -> Extract Info). 4. **Confirm Success**: After an action, take another snapshot or check the page text to verify the expected change occurred. 5. **Efficiency**: Favor the accessibility tree snapshot (`browser.snapshot`) over full page text when looking for interactive elements. Today's date: {current_date} """.strip() WEB_TOOL_CONTENT = [ { "type": "function", "function": { "name": "browser.navigate", "description": "Navigates the browser to a specific URL.", "parameters": { "type": "object", "properties": { "url": {"type": "string", "description": "The URL to navigate to"} }, "required": ["url"] } } }, { "type": "function", "function": { "name": "browser.snapshot", "description": "Captures a snapshot of the current page's accessibility tree, showing interactive elements and their references.", "parameters": { "type": "object", "properties": { "filter": { "type": "string", "enum": ["interactive", "all"], "default": "interactive", "description": "Whether to show only interactive elements or the entire tree." } } } } }, { "type": "function", "function": { "name": "browser.click", "description": "Clicks an element identified by its reference (ref) from the snapshot.", "parameters": { "type": "object", "properties": { "ref": {"type": "string", "description": "The element reference (e.g., 'e5')"} }, "required": ["ref"] } } }, { "type": "function", "function": { "name": "browser.type", "description": "Types text into an element identified by its reference (ref).", "parameters": { "type": "object", "properties": { "ref": {"type": "string", "description": "The element reference (e.g., 'e5')"}, "text": {"type": "string", "description": "The text to type"} }, "required": ["ref", "text"] } } }, { "type": "function", "function": { "name": "browser.press", "description": "Presses a specific key (e.g., 'Enter', 'Tab').", "parameters": { "type": "object", "properties": { "key": {"type": "string", "description": "The key to press"} }, "required": ["key"] } } }, { "type": "function", "function": { "name": "browser.get_text", "description": "Extracts all visible text from the current page.", "parameters": { "type": "object", "properties": {} } } } ]