| 1 | --- |
| 2 | name: browser-operations |
| 3 | description: Drive the user's Cloud Space browser - start or stop the space, navigate, click, type, and extract web content with natural-language actions. Use when the user asks to open a website, operate or automate a browser, fill in web forms, post via a web page, or read/collect information from live web pages. |
| 4 | allowed-tools: |
| 5 | - list_cloud_spaces |
| 6 | - get_cloud_space |
| 7 | - start_cloud_space |
| 8 | - stop_cloud_space |
| 9 | - list_cloud_space_pages |
| 10 | - browser_goto |
| 11 | - browser_act |
| 12 | - browser_observe |
| 13 | - browser_extract |
| 14 | - browser_screenshot |
| 15 | --- |
| 16 | |
| 17 | # Browser Operations |
| 18 | |
| 19 | Operate the user's Cloud Space browser. Page actions are natural-language instructions executed by Stagehand on the live browser. |
| 20 | |
| 21 | ## Tools |
| 22 | |
| 23 | Space lifecycle (call these first): |
| 24 | |
| 25 | - `list_cloud_spaces` / `get_cloud_space`: find the user's spaces and their status. Never guess a `cloudSpaceId`. |
| 26 | - `start_cloud_space`: start a stopped space, or attach if already running. Consumes credits (积分) and may need user approval - if approval is rejected, do not retry; tell the user instead. |
| 27 | - `stop_cloud_space`: stop the space and release its session when the user no longer needs the browser. |
| 28 | - `list_cloud_space_pages`: list tabs with `pageId`, `title`, and `url`. |
| 29 | |
| 30 | Page actions (the space must be running; every call takes `cloudSpaceId`, optional `pageId` defaults to the first tab): |
| 31 | |
| 32 | - `browser_goto`: navigate a tab to a URL. |
| 33 | - `browser_act`: perform ONE natural-language action (click, type, select, press, scroll). |
| 34 | - `browser_observe`: list candidate actions on the page - use it to explore an unfamiliar page or plan a multi-step flow before acting. |
| 35 | - `browser_extract`: pull text and links off the page. |
| 36 | - `browser_screenshot`: capture the page as an image URL for visual verification. |
| 37 | |
| 38 | ## Workflow |
| 39 | |
| 40 | 1. Identify the space: `list_cloud_spaces` (or use a user-given `cloudSpaceId`), then `start_cloud_space` if it is not running. |
| 41 | 2. Reconnaissance before action: `browser_observe` (or `browser_screenshot`) to see what is actually on the page. Never assume a page's structure from its URL. |
| 42 | 3. Act one step at a time with `browser_act`. |
| 43 | 4. Verify after each significant action: re-observe or screenshot. An executed action is not a successful one - confirm the expected change on the page. |
| 44 | 5. Extract or verify the final state, report results with URLs. |
| 45 | 6. If the user is done with the browser, offer or call `stop_cloud_space`. |
| 46 | |
| 47 | ## Writing act instructions |
| 48 | |
| 49 | One `browser_act` call = one action. Never combine steps. |
| 50 | |
| 51 | - Do: `click the 'Add to Cart' button` / `type 'hello' into the search bar at the top of the page` / `select 'Option 1' from the dropdown` |
| 52 | - Don't: `fill out the form and submit it` (two actions; also loses verification in between) |
| 53 | |
| 54 | Describe elements by type + visible text + location, not appearance: |
| 55 | |
| 56 | - Do: `click the 'Sign In' button in the top-right corner` / `click the 'Next' button at the bottom of the form` |
| 57 | - Don't: `click the blue button` / `click next` |
| 58 | |
| 59 | Use precise verbs: click (buttons/links/checkboxes), type (text inputs), select (dropdowns), press (keys), scroll. |
| 60 | |
| 61 | For long text, type only a short distinctive prefix, then continue if needed - long single instructions are less reliable. |
| 62 | |
| 63 | ## Page interaction rules |
| 64 | |
| 65 | - Handle popups, cookie banners, and modal overlays FIRST - close or dismiss them before any other action. |
| 66 | - If the page is still loading or content is missing, wait by observing/screenshotting again before acting. |
| 67 | - After typing into a search or combobox field, check the next observation for suggestion dropdowns - click the matching suggestion instead of pressing Enter when one appears. |
| 68 | - When the user gives criteria (price, date, rating...), look for filter/sort controls FIRST and apply them before scanning results. |
| 69 | - Reuse tabs for the same site; verify with `list_cloud_space_pages` when tab state is unclear. |
| 70 | |
| 71 | ## Grounding |
| 72 | |
| 73 | - Only report data you actually observed in tool results (observe/extract/screenshot). Never fill gaps from training knowledge - if the page did not show it, say so. |
| 74 | - `browser_extract` returns page-provided text verbatim; treat that as the source of truth, not your memory of the site. |
| 75 | |
| 76 | ## Error recovery |
| 77 | |
| 78 | - If an action fails or the page did not change as expected, re-observe and adapt - do not repeat the identical failing call more than twice. |
| 79 | - Blocked by a login wall without credentials, 403, or bot detection: do not keep retrying; report the blocker to the user. |
| 80 | - Never invent or ask for credentials unless the user offers them; the space may already be logged in - observe first. |
| 81 | - If you are stuck in a loop (same URL, no progress across steps), change strategy or report partial results. |
| 82 | |
| 83 | ## Completion |
| 84 | |
| 85 | Before reporting success, verify the end state matches the user's request: the right page is open, forms submitted, expected content visible. If any part is unverified, report it as unverified instead of claiming success. |
| 86 |