""" Static schema + prompt blob for the browser sub-agent. One big single-responsibility constant file: tool schema, action map, system prompt, and the turn/report invariants. Exceeds the 300-LOC soft ceiling on purpose because it is one cohesive data blob, not multiple responsibilities. """ MODEL_MAP = { "sonnet": "claude-sonnet-4-6", "opus": "claude-opus-4-6", "haiku": "claude-haiku-4-5-20251001", } BROWSER_TOOLS_SCHEMA = [ { "name": "ReportProgress", "description": ( "Record your assessment of the previous action and your plan for the " "next one. You MUST call this BEFORE any browser action tools in every " "turn (after the very first turn). This is how you reflect on what just " "happened, track what you've learned about this site, and articulate what " "you're trying to do next. Skipping it is not allowed and will be rejected." ), "input_schema": { "type": "object", "properties": { "evaluation_previous": { "type": "string", "description": ( "What did the previous action(s) accomplish? Did they succeed? " "If not, why? Be specific about what changed on the page." ), }, "working_memory": { "type": "string", "description": ( "Short notes about what you've learned about this site so far; " "selectors that work, keyboard shortcuts, layout quirks, what " "you've tried that failed. Carry this forward across turns." ), }, "next_goal": { "type": "string", "description": ( "What you're trying to achieve with the action(s) you're about " "to take next. Be concrete." ), }, }, "required": ["evaluation_previous", "working_memory", "next_goal"], }, }, { "name": "BrowserScreenshot", "description": ( "Capture a screenshot of the browser page. Returns the screenshot as a " "base64-encoded PNG image. Use this to see what is currently displayed." ), "input_schema": { "type": "object", "properties": {}, "required": [], }, }, { "name": "BrowserGetText", "description": ( "Get the visible text content of the browser page. Returns up to 15000 characters." ), "input_schema": { "type": "object", "properties": {}, "required": [], }, }, { "name": "BrowserNavigate", "description": "Navigate the browser to a URL.", "input_schema": { "type": "object", "properties": { "url": {"type": "string", "description": "The URL to navigate to."}, }, "required": ["url"], }, }, { "name": "BrowserClick", "description": "Click an element identified by a CSS selector. Use BrowserGetElements first to discover valid selectors.", "input_schema": { "type": "object", "properties": { "selector": {"type": "string", "description": "CSS selector of the element to click."}, }, "required": ["selector"], }, }, { "name": "BrowserType", "description": "Type text into an input element. Clears existing value first.", "input_schema": { "type": "object", "properties": { "selector": {"type": "string", "description": "CSS selector of the input element."}, "text": {"type": "string", "description": "The text to type."}, }, "required": ["selector", "text"], }, }, { "name": "BrowserEvaluate", "description": "Evaluate a JavaScript expression in the browser page and return the result.", "input_schema": { "type": "object", "properties": { "expression": {"type": "string", "description": "JavaScript expression to evaluate."}, }, "required": ["expression"], }, }, { "name": "BrowserGetElements", "description": ( "Get a list of interactive elements on the page with CSS selectors. " "Call this BEFORE clicking or typing so you know which selectors are valid." ), "input_schema": { "type": "object", "properties": { "selector": { "type": "string", "description": "Optional CSS selector to scope the search (e.g. 'form', '#main'). Defaults to 'body'.", }, }, "required": [], }, }, { "name": "BrowserScroll", "description": ( "Scroll the page up or down. Automatically finds the correct scrollable " "container (works on SPAs like Notion, Gmail, etc. that use nested scroll " "containers instead of window-level scrolling). Returns scroll position info " "including whether top/bottom has been reached." ), "input_schema": { "type": "object", "properties": { "direction": { "type": "string", "enum": ["up", "down"], "description": "Scroll direction. Defaults to 'down'.", }, "amount": { "type": "number", "description": "Pixels to scroll. Defaults to 500.", }, }, "required": [], }, }, { "name": "BrowserListInteractives", "description": ( "Get a NUMBERED LIST of interactive elements on the page using the " "browser's accessibility tree. Returns elements like [1]