> _**HTTP skill · `browser` namespace** · ~15,846 tokens · hoody-sdk v1.0.0-beta.17_ # `browser` — Per-container Chromium or Firefox instances, one per slot ## Purpose - Long-lived browser instances per container, one per `browser-X` hostname slot (the proxy maps slot X to `browser_port` 30000+X and `display` 500+X). - Chromium runs the stealth engine by default (`stealth` defaults to `true`; metadata reports `engine: patchright`). `stealth=false` selects the standard engine (`engine: playwright`). Firefox always runs the standard engine. - Surfaces: nav, screenshot, JS eval, PDF, HTML/text, cookies, console+network logs, history, CDP, accessibility snapshot with element refs, element actions, waits, runtime viewport. ## When to use - JS-heavy pages, screenshots, PDFs. - Authenticated sessions across navs. - Anti-fingerprint via `stealth=true`. - Console/network capture. - Dedicated recorded "project browser" the user can watch live and you can inspect anytime (workflow 6). - Clicking, typing and waiting on page elements without writing JS (workflow 7). - External CDP on Chromium through the URL that `GET /api/v1/browser/devtools-url` returns (on by default; `useRemoteDebuggingPort=false` turns it off; Firefox never exposes it). ## When NOT to use - Plain HTTP, persistence, server scripts, stream UI, shell → `curl`/`sqlite`/`exec`/`display`/`terminal`. ## Prerequisites - Headful (default `showBrowser=true`) needs X display: `?display=` or `DISPLAY`. Extensions also require `showBrowser=true`. - `GET /api/v1/browser/pdf` works only on a headless Chromium instance: start it with `showBrowser=false`. Firefox and headful instances return `501 NOT_SUPPORTED`. ## Capability URL → See `SKILL-HTTP.md § Proxy URLs`. ## Common workflows ### 1. Start + navigate 1. `GET /api/v1/browser/start` on the slot's hostname + overrides (proxy, stealth, fingerprintId, viewport, locale, timezoneId, userAgent, geolocation). 2. `POST /api/v1/browser/browse` — `tabId`, `onlyIfNotExists=true`. 3. `GET /api/v1/browser/metadata`. ### 2. Extract content After browse: `GET /api/v1/browser/html`/`GET /api/v1/browser/text`/`GET /api/v1/browser/screenshot`/`GET /api/v1/browser/pdf` — params in Reference. `GET /api/v1/browser/pdf` needs a headless Chromium instance (see Prerequisites). ### 3. Authenticated scraping 1. `GET /api/v1/browser/start` matching `userAgent`/`viewport`/`locale`. 2. `POST /api/v1/browser/cookies` with a `cookies` list of `{name, value, url}` entries; each cookie needs `name`, `value` and either an absolute http(s) `url` or both `domain` and `path` (never `url` together with `domain` or `path`). 3. `POST /api/v1/browser/browse` to protected URL. 4. `GET /api/v1/browser/html`/`GET /api/v1/browser/text`. 5. `DELETE /api/v1/browser/cookies`. ### 4. JS eval + logs 1. `GET /api/v1/browser/start` with `stealth=false` for full console capture (stop a slot that already runs with `stealth=true` first) → `POST /api/v1/browser/browse`. 2. `POST /api/v1/browser/eval` (`{script}` JSON body; a raw `text/plain` body also works, and `GET /api/v1/browser/eval?script=` takes the script in the query). On the default stealth engine the script cannot see page JS globals (see Quirks). 3. `GET /api/v1/browser/console` (`since`,`type`,`clear=true`). 4. `GET /api/v1/browser/network`. ### 5. History `GET /api/v1/browser/history` (filters: `since`/`domain`/`browser_id`) and `DELETE /api/v1/browser/history` (`before` + `browser_id` AND). In history, `browser_id` is the slot number X the navigation ran on. ### 6. Dedicated project browser — suggest it to the user When the work is a website project or business research, **offer** the user a dedicated recorded browser. This is a suggestion to the user only — set it up when they ask, don't spin it up unprompted. 1. Pick a slot number X (e.g. 2) and start headful on that slot: `GET /api/v1/browser/start` addressed to the `browser-X` hostname (the `browser-X` host) with `showBrowser=true`. The proxy derives `browser_port` 30000+X and `display` 500+X from the hostname and overrides any values you send. Add any per-project identity: own egress proxy (`proxyServer`/`proxyUsername`/`proxyPassword`/`proxyBypass`), `stealth`, `userAgent`, `viewport`, `locale`, `geolocation`, extensions. 2. Give the user the direct live-view URL — the standard kit URL with the `browser-` slug and `?view=display`: `https://{P}-{C}-browser-X.{N}.containers.hoody.com/?view=display`. That page embeds display 500+X live (the bare root URL shows an instance status page with a View Display link instead), so an instance started on display 500+X gets its own stable viewing URL — changing the X in the URL is how you address each browser's live window. `GET /api/v1/browser/devtools-url` adds a live DevTools inspector as a second link; that link gives full control of the browser, so hand it only to someone you would give the browser to. 3. Everything browsed there — by the user clicking around in the live view or by the agent via the API — lands in persistent per-slot history (`GET /api/v1/browser/history` with `browser_id=X`): live debugging and business research accumulate into one durable project trail. The instance itself is reaped once it has been idle past the deployment's max age (see Quirks) — history survives; re-run `GET /api/v1/browser/start` with the same options to revive the window. 4. Then offer log capture as a follow-up: console/network buffers hold only the last 500 entries and die with the instance, so a recurring `cron` job (or agent loop) draining `GET /api/v1/browser/console`/`GET /api/v1/browser/network` with `clear=true` into `sqlite`/`files`/agent memory preserves the captured entries for later sessions. For full console capture start the slot with `stealth=false`: the default stealth engine omits the page's console calls and errors. ### 7. Drive a page: snapshot, act, wait These three operations never start an instance (404 `NOT_FOUND` on an empty slot), so run `GET /api/v1/browser/start` and `POST /api/v1/browser/browse` first. 1. `GET /api/v1/browser/metadata` and keep `instanceGeneration`. Passing it back on the calls below turns "the instance was replaced" into a 409 `INSTANCE_CHANGED` instead of acting on a fresh browser. 2. `GET /api/v1/browser/snapshot` returns the tab's accessibility tree as YAML with `[ref=eN]` markers, plus a `snapshotId`. Entered form values read as `