skip to content
$worker

browser

v0.2.9

A browser on the iii bus - shared Chromium with persistent, restorable tabs and incognito tabs. Navigate, act, read the page console, pick elements. Also parses HTML natively without a browser (browser::* - css/xpath/regex, element search, markdown).

iiiverified
117 installs0 in 7d0 today
install
$iii trigger compose::add worker=browser@0.2.9
  • macOS: arm64 · x64
  • Linux: arm64 · armv7 · x64
  • Windows: arm64 · x64 · x86

exact versions are immutable; binary and bundle artifacts are digest-pinned.

functions

64

browser::act

function

Interact with the page: click (left/right/middle, single or double), hover, type, press, scroll, or drag (press at the start point, glide to x2/y2, release). Address elements with a [ref=eN] handle from browser::snapshot (or a pick), or raw viewport coordinates.

request
  • actionstringrequired

    `click`, `hover`, `type`, `press`, `scroll`, or `drag`.

  • buttonstring

    Mouse button for `click`: `left` (default), `right`, or `middle`.

  • click_countinteger· uint32min 0

    Clicks in the gesture: 2 double-clicks (`click` only, default 1).

  • delta_ynumber· double

    Scroll distance in pixels; positive scrolls down (`scroll`).

  • keystring

    Key name for `press`: Enter, Tab, Escape, Backspace, Delete, ArrowUp/Down/Left/Right, Home, End, PageUp, PageDown.

  • refstring

    Element ref from `browser::snapshot` (`e3`) or `browser::picked` (`p1`). Refs die on navigation; re-snapshot after.

  • session_idstringrequired
  • textstring

    Text to insert (`type`).

  • xnumber· double

    Viewport x, when acting by coordinates instead of ref.

  • x2number· double

    Drag end x, in viewport pixels (`drag`). The start is `x`/`y` or a `ref`; the end is `x2`/`y2`.

  • ynumber· double

    Viewport y, when acting by coordinates instead of ref.

  • y2number· double

    Drag end y, in viewport pixels (`drag`).

response
  • detailstringrequired

    What was done, for the transcript.

  • okbooleanrequired

browser::clear-data

function

Clear the session's browsing data (cookies, cache, storage), like the browser's Clear browsing data. Scoped to this session's browser context.

request
  • cacheboolean

    Clear the HTTP cache. Default true.

  • cookiesboolean

    Clear cookies. Default true.

  • session_idstringrequired
  • storageboolean

    Clear localStorage / sessionStorage / IndexedDB for the current origin. Default true.

response
  • clearedstring[]required

    What was cleared, for the confirmation message.

  • okbooleanrequired

browser::console::read

function

Read the session's captured console: console.* calls, uncaught exceptions, and browser-level log entries. Filter with pattern/level and page with since_seq instead of dumping everything.

request
  • levelstring

    Only entries at this level: `log`, `info`, `warning`, `error`, `debug`, `exception`. `error` also matches `exception`.

  • limitinteger· uint64min 0

    Maximum entries returned, newest kept (default 100).

  • patternstring

    Regex applied to entry text. Use it: dumping an unfiltered console wastes the caller's context.

  • session_idstringrequired
  • since_seqinteger· uint64min 0

    Only entries with `seq` greater than this; resume from the cursor returned as `last_seq`.

response
  • droppedinteger· uint64requiredmin 0

    Entries evicted from the ring buffer since session start.

  • entriesobject[]required
    • levelstringrequired

      `log`, `info`, `warning`, `error`, `debug`, or `exception`.

    • seqinteger· uint64requiredmin 0

      Monotonic per-session cursor; pass back as `since_seq`.

    • sourcestring

      `url:line` of the emitting frame, when known.

    • textstringrequired
    • timestampinteger· int64required
  • last_seqinteger· uint64requiredmin 0

    Cursor for the next `since_seq`.

browser::cookies::clear

function

Clear all of the session's cookies.

request
  • session_idstringrequired
response
  • okbooleanrequired

browser::cookies::list

function

The cookies visible to the session's current page (name, value, domain, path, flags).

request
  • session_idstringrequired
response
  • cookiesobject[]required
    • domainstring
    • expiresnumber· double

      Seconds since the Unix epoch; omitted for a session cookie.

    • http_onlyboolean
    • namestringrequired
    • pathstring
    • same_sitestring

      `Strict`, `Lax`, or `None`.

    • secureboolean
    • valuestringrequired

browser::cookies::set

function

Set cookies on the session, like importing a cookie file. A cookie without a domain is scoped to the current page's URL. same_site is Strict, Lax, or None.

request
  • cookiesobject[]required

    Cookies to set. A cookie without a domain is scoped to the current page's URL.

    • domainstring
    • expiresnumber· double

      Seconds since the Unix epoch; omitted for a session cookie.

    • http_onlyboolean
    • namestringrequired
    • pathstring
    • same_sitestring

      `Strict`, `Lax`, or `None`.

    • secureboolean
    • valuestringrequired
  • session_idstringrequired
response
  • countinteger· uintrequiredmin 0

    How many cookies were sent.

  • okbooleanrequired

browser::crawl

function

BFS-crawl from start_urls (follow same-domain links), extract per page, stream items.

request
  • allowed_domainsstring[]

    only follow links on these hosts

  • concurrencyinteger
  • css_selectorstring

    scope the render to this CSS subtree (e.g. a page's content div)

  • download_delaynumber

    seconds to wait between crawl rounds

  • fetcherstringenum: http, stealthy, dynamic
  • formatstringenum: markdown, text

    render page body to this format

  • impersonatestring
  • include_htmlboolean
  • main_content_onlyboolean

    strip nav/scripts/hidden before rendering

  • max_depthinteger
  • max_pagesinteger
  • same_domainboolean

    follow only same-host links (default true)

  • selectorsobject[]
    • allboolean

      return every match as a list

    • attrstring

      extract this attribute instead of text

    • cssstring
    • htmlboolean

      extract inner HTML instead of text

    • namestringrequired
    • regexstring
    • xpathstring
  • start_urlsstring[]
  • stream_namestring

    stream to emit items on (default browser::crawl)

  • urlstring

    single start URL (alternative to start_urls)

response
  • itemsobject[]

    a small sample of streamed items

    empty object
  • statsobject
    • crawledinteger
    • errorsinteger
    • itemsinteger
    • stoppedstring
  • streamobject

    read the full item stream via stream::on with this name + group_id

    • group_idstring
    • namestring

browser::css

function

One CSS query over HTML; first-or-all; `attr` pulls an attribute else text.

request
  • adaptiveboolean

    relocate elements after a site change via saved identities

  • adaptive_domainstring

    page URL/domain that keys saved identities

  • attrstring
  • auto_saveboolean

    save matched identities (defaults on when adaptive)

  • firstboolean
  • htmlstringrequired
  • identifierstring

    stable key for the saved element

  • querystringrequired
response
  • resultstring[]

browser::describe

function

Describe the first css/xpath match: attrs, generated selectors, class list, DOM context.

request
  • htmlstringrequired
  • kindstringenum: css, xpath
  • querystringrequired
response
  • elementobject
    • attrsobject
    • childreninteger
    • classesstring[]
    • cssstring
    • full_cssstring
    • full_xpathstring
    • htmlstring
    • parent_tagstring
    • siblingsinteger
    • tagstring
    • textstring
    • xpathstring
  • foundboolean

browser::doctor

function

Read-only environment diagnostics: which Chromium the worker would launch, its version, session capacity, and any degraded capability with how to enable it. Never starts a browser.

request
empty object
response
  • active_sessionsinteger· uint64requiredmin 0
  • allow_cookie_importbooleanrequired
  • allow_history_accessbooleanrequired
  • allowed_schemesstring[]required
  • attach_enabledbooleanrequired

    Whether attach mode is enabled (allow_attach).

  • chromium_pathstring
  • chromium_versionstring
  • configured_origin_policiesinteger· uint64requiredmin 0
  • default_origin_policy_setbooleanrequired
  • headless_defaultbooleanrequired
  • issuesobject[]required
    • enable_howstringrequired
    • whatstringrequired
  • max_sessionsinteger· uint64requiredmin 0
  • okbooleanrequired

    True when sessions can start right now.

  • recording_availablebooleanrequired

    Whether ffmpeg is on PATH, which browser::recording requires.

browser::dom::read

function

Read the DOM as a tree of tags with id/class and refs. Structure-oriented complement to browser::snapshot; read deep subtrees by passing a ref.

request
  • depthinteger· uint32min 0

    Levels of children to include (default 3).

  • refstring

    Subtree root from an earlier ref (`e3`/`p1`) or dom node. Omit for the document root.

  • session_idstringrequired
response
  • rootobjectrequired

    One DOM node in the outline. `ref` resolves in `browser::act`, `browser::styles::read`, and `browser::styles::write`.

    • child_countinteger· uint32requiredmin 0

      Total children in the document, which may exceed `children` returned at this depth.

    • childrenunknown[]
    • classesstring
    • idstring
    • refstringrequired
    • tagstringrequired

      Lowercase tag (`div`, `button`) or node name (`#text`).

    • textstring

      Trimmed text content for text nodes.

  • truncatedbooleanrequired

    True when the node cap cut the tree short; read a subtree via `ref`.

browser::download

function

Read one downloaded file's bytes by guid (from browser::downloads::list), base64, for saving or attaching to the chat.

request
  • guidstringrequired

    The download's CDP guid, from `browser::downloads::list`.

  • session_idstringrequired
response
  • datastringrequired

    The file, base64.

  • file_namestringrequired
  • okbooleanrequired
  • size_bytesinteger· uint64requiredmin 0

browser::download::remove

function

Forget a download and delete its file from the session's download dir.

request
  • guidstringrequired

    The download to forget, and delete from disk.

  • session_idstringrequired
response
  • okbooleanrequired

browser::downloads::list

function

The files this session downloaded (name, url, size, state), newest first. Downloads are allowed and named per session; read one with browser::download.

request
  • session_idstringrequired
response
  • downloadsobject[]required

    Newest first.

    • file_namestringrequired
    • guidstringrequired
    • received_bytesinteger· uint64requiredmin 0
    • started_msinteger· int64required
    • statestringrequired

      `in_progress`, `completed`, or `canceled`.

    • total_bytesinteger· uint64requiredmin 0
    • urlstringrequired

browser::dynamic-fetch

function

Playwright/Chromium fetch: JS render, waits, XHR capture, CDP; extraction + bulk.

request
  • block_adsboolean
  • blocked_domainsstring[]
  • capture_xhrstring
  • cdp_urlstring
  • cookiesobject
  • css_selectorstring

    scope the render to this CSS subtree (e.g. a page's content div)

  • disable_resourcesboolean
  • dns_over_httpsboolean
  • extra_flagsstring[]
  • extra_headersobject
  • formatstringenum: markdown, text

    render page body to this format

  • google_searchboolean
  • headlessboolean
  • include_htmlboolean
  • load_domboolean
  • localestring
  • main_content_onlyboolean

    strip nav/scripts/hidden before rendering

  • max_pagesinteger
  • network_idleboolean
  • proxystring
  • real_chromeboolean
  • retriesinteger
  • retry_delaynumber
  • selectorsobject[]
    • allboolean

      return every match as a list

    • attrstring

      extract this attribute instead of text

    • cssstring
    • htmlboolean

      extract inner HTML instead of text

    • namestringrequired
    • regexstring
    • xpathstring
  • timeoutnumber

    milliseconds (browser fetcher)

  • timezone_idstring
  • urlstring
  • urlsstring[]
  • useragentstring
  • waitnumber

    extra ms to wait after load

  • wait_selectorstring
  • wait_selector_statestringenum: attached, detached, visible, hidden
response
  • captured_xhrobject[]
    empty object
  • contentstring

    markdown/text render when `format` requested

  • cookiesobject
  • encodingstring
  • errorstring
  • extractedobject
  • formatstring
  • headersobject
  • htmlstring
  • resultsobject[]
    empty object
  • statusinteger
  • urlstring

browser::evaluate

function

Evaluate a JavaScript expression in the page and return its completion value. Use for reads the snapshot can't express; prefer browser::act for interactions.

request
  • expressionstringrequired

    JavaScript expression evaluated in the page. The completion value is returned by value; wrap statements in an IIFE.

  • session_idstringrequired
  • timeout_msinteger· uint64min 0

    Upper bound on evaluation; clamped to `max_timeout_ms`.

response
  • errorstring

    Exception text when not `ok`.

  • okbooleanrequired
  • valueunknown

    JSON completion value when `ok`.

browser::execute

function

Run a multi-step async JavaScript script in the page: top-level await and return work, with log(...), sleep(ms), waitFor(selector), and a state object that persists across execute calls for the session. One call replaces a chain of act/evaluate round-trips; returns { result, logs, state }.

request
  • codestringrequired

    Async JavaScript body run in the page. Top-level `await` and `return` work. In scope: `state` (JSON object persisted across execute calls for the session), `log(...)` (collected into the response), `sleep(ms)`, and `waitFor(selector, { timeout })`. Return plain JSON.

  • session_idstringrequired
  • timeout_msinteger· uint64min 0

    Upper bound on the run; clamped to `max_timeout_ms`.

response
  • errorstring

    Exception text when not `ok`. A "context destroyed" error usually means the script navigated; split the script at the navigation.

  • logsstring[]required

    `log(...)` output collected during the run, in order.

  • okbooleanrequired
  • resultunknown

    The script's return value when `ok`.

  • stateunknownrequired

    Session state after the run; the next execute call sees this as `state`.

browser::extract

function

Parse HTML with a selector list (css/xpath/regex, text/attr/html, all-or-first).

request
  • adaptiveboolean

    relocate elements after a site change via saved identities

  • adaptive_domainstring

    page URL/domain that keys saved identities

  • auto_saveboolean

    save matched identities (defaults on when adaptive)

  • htmlstringrequired
  • selectorsobject[]required
    • allboolean

      return every match as a list

    • attrstring

      extract this attribute instead of text

    • cssstring
    • htmlboolean

      extract inner HTML instead of text

    • namestringrequired
    • regexstring
    • xpathstring
response
  • extractedobject

browser::fetch

function

Fast HTTP fetch, TLS impersonation: get/post/put/delete, inline extraction, bulk `urls`.

request
  • cookiesobject
  • css_selectorstring

    scope the render to this CSS subtree (e.g. a page's content div)

  • dataobject
  • follow_redirectsboolean
  • formatstringenum: markdown, text

    render page body to this format

  • headersobject
  • http3boolean
  • impersonatestring

    TLS/UA fingerprint, e.g. 'chrome'

  • include_htmlboolean
  • jsonobject
  • main_content_onlyboolean

    strip nav/scripts/hidden before rendering

  • max_redirectsinteger
  • methodstringenum: get, post, put, delete
  • paramsobject
  • proxiesobject

    per-scheme proxies, e.g. {"https": "http://..."}

  • proxystring
  • proxy_authstring[]

    [user, password]

  • retriesinteger
  • retry_delaynumber
  • selectorsobject[]
    • allboolean

      return every match as a list

    • attrstring

      extract this attribute instead of text

    • cssstring
    • htmlboolean

      extract inner HTML instead of text

    • namestringrequired
    • regexstring
    • xpathstring
  • stealthy_headersboolean
  • timeoutnumber

    seconds (HTTP fetcher)

  • urlstring
  • urlsstring[]
  • verifyboolean
response
  • captured_xhrobject[]
    empty object
  • contentstring

    markdown/text render when `format` requested

  • cookiesobject
  • encodingstring
  • errorstring
  • extractedobject
  • formatstring
  • headersobject
  • htmlstring
  • resultsobject[]
    empty object
  • statusinteger
  • urlstring

browser::find

function

Find elements by tag/attribute filters (+ optional text regex); BeautifulSoup-style.

request
  • attrsobject

    attribute filters, e.g. {"class": "card"}

  • firstboolean
  • htmlstringrequired
  • limitinteger
  • tagstring

    tag name or list of tag names

  • text_regexstring

    keep only elements whose text matches this regex

response
  • countinteger
  • itemsobject[]
    • attrsobject
    • cssstring
    • htmlstring
    • tagstring
    • textstring
    • xpathstring

browser::find-by-regex

function

Find elements whose visible text matches a regex pattern.

request
  • case_sensitiveboolean
  • clean_matchboolean
  • firstboolean
  • htmlstringrequired
  • limitinteger
  • patternstringrequired
response
  • countinteger
  • itemsobject[]
    • attrsobject
    • cssstring
    • htmlstring
    • tagstring
    • textstring
    • xpathstring

browser::find-by-text

function

Find elements whose visible text matches a string (exact or `partial`).

request
  • case_sensitiveboolean
  • clean_matchboolean

    ignore surrounding/collapsing whitespace

  • firstboolean
  • htmlstringrequired
  • limitinteger
  • partialboolean

    match elements that contain the text

  • textstringrequired
response
  • countinteger
  • itemsobject[]
    • attrsobject
    • cssstring
    • htmlstring
    • tagstring
    • textstring
    • xpathstring

browser::find-in-page

function

Find text in the page like the browser's find bar: highlights every match in the live document, scrolls the current one into view, and steps with next / previous. close clears the highlights. Returns count and the 1-based index.

request
  • actionstring

    `search` (default: run the query from the top), `next`, `previous`, or `close`.

  • case_sensitiveboolean

    Match case. Default false.

  • querystring

    Text to look for. Empty with `action: close` clears the search.

  • session_idstringrequired
response
  • countinteger· uint64requiredmin 0

    Number of matches in the visible text of the page.

  • indexinteger· uint64requiredmin 0

    1-based index of the highlighted match; 0 when there is none.

  • okbooleanrequired
  • querystringrequired

    The query the counts refer to.

browser::find-similar

function

Structural auto-match: given one example element, return it plus similar elements.

request
  • anchorstringrequired

    CSS selector to one example element

  • htmlstringrequired
  • match_textboolean
  • selectorsobject[]
    • allboolean

      return every match as a list

    • attrstring

      extract this attribute instead of text

    • cssstring
    • htmlboolean

      extract inner HTML instead of text

    • namestringrequired
    • regexstring
    • xpathstring
  • similarity_thresholdnumber
response
  • countinteger
  • itemsobject[]
    empty object

browser::frame

function

Internal: newest screencast frame, or nothing when since_frame is still current. No capture round-trip; poll fast. Not an agent function.

request
  • session_idstringrequired
  • since_frameinteger· uint64min 0

    Frame cursor from the previous read; when the newest frame still has this seq the response omits `frame` (nothing changed, nothing to redraw).

response
  • activebooleanrequired

    False when no screencast is running (call screencast::start first).

  • framestring

    Base64 JPEG of the newest frame; absent when `since_frame` is still current or no frame has arrived yet.

  • frame_seqinteger· uint64requiredmin 0
  • heightinteger· uint32requiredmin 0

    Page-viewport height the frame maps to.

  • timestampinteger· int64required
  • widthinteger· uint32requiredmin 0

    Page-viewport width the frame maps to (input coordinate space).

browser::handoff

function

Pause a session for a step only a human can do (CAPTCHA, 2FA, payment): show an in-page continue banner and block until the human clicks it, a browser::handoff::confirm call resolves it, or the timeout elapses. Human acknowledgment is not proof — verify the expected page state after it returns.

request
  • instructionsstringrequired

    What the human must do before the call continues. Shown in the in-page banner and the handoff-requested event.

  • session_idstringrequired
  • timeout_msinteger· uint64min 0

    Give up after this long and return with `via: "timeout"`. Defaults to the config default; clamped to `max_timeout_ms`. Set generously; a human is slow.

response
  • confirmedbooleanrequired

    True when a human confirmed; false when the wait timed out.

  • handoff_idstringrequired
  • urlstringrequired

    The page URL when the wait ended, so the caller can verify the step actually landed (human acknowledgment is not proof).

  • viastringrequired

    How the confirmation arrived: `in_page`, `confirm_call`, or `timeout`.

browser::handoff::confirm

function

Resolve a paused browser::handoff by handoff_id, or the one pending handoff for a session_id. The console calls this when the human confirms outside the page.

request
  • handoff_idstring

    Confirm a specific handoff by id. Omit to confirm the one pending handoff for `session_id`.

  • session_idstring
response
  • handoff_idstring
  • okbooleanrequired

    True when a pending handoff matched and was resolved.

browser::history

function

Go back, go forward, or reload the session's page. Back/forward at the history edge is a no-op with moved=false.

request
  • actionstringrequired

    `back`, `forward`, or `reload`.

  • session_idstringrequired
response
  • movedbooleanrequired

    False when back/forward had no entry to move to.

  • okbooleanrequired
  • urlstringrequired

    URL after the action. `back`/`forward` at the history edge is a no-op with ok=true.

browser::history::list

function

The session's visited pages, newest first, for a history panel or address-bar suggestions. Filter with query. Distinct from browser::history, which moves back / forward / reloads.

request
  • limitinteger· uintmin 0

    Cap on returned entries. Default 100.

  • querystring

    Only entries whose url or title contains this (case-insensitive).

  • session_idstringrequired
response
  • visitsobject[]required
    • timestampinteger· int64required
    • titlestringrequired
    • urlstringrequired

browser::inject-guidance

function

Internal: appends browser::* scraping and HTML parsing guidance to the agent system prompt.

request
  • generateobject
    • system_promptstring
response
  • mutationsobjectrequired
    • system_promptstring

browser::navigate

function

Navigate a session to a URL and wait for the page to load. Element refs from earlier snapshots are invalidated by navigation.

request
  • session_idstringrequired
  • timeout_msinteger· uint64min 0

    Upper bound on the navigation wait; clamped to `max_timeout_ms`.

  • urlstringrequired

    Absolute URL; scheme must be on the configured allowlist.

response
  • okbooleanrequired
  • timed_outbooleanrequired

    True when the load event did not fire inside the timeout; the page may still be usable; snapshot to check.

  • titlestring
  • urlstringrequired

    URL after redirects.

browser::network::read

function

Read the session's captured network requests (method, URL, status, failures). failed_only=true is the fast path for 'what broke'.

request
  • failed_onlyboolean

    Only failed requests (network error or status >= 400).

  • limitinteger· uint64min 0

    Maximum entries returned, newest kept (default 100).

  • patternstring

    Regex applied to the request URL.

  • session_idstringrequired
  • since_seqinteger· uint64min 0

    Only entries with `seq` greater than this.

response
  • droppedinteger· uint64requiredmin 0

    Entries evicted from the ring buffer since session start.

  • entriesobject[]required
    • errorstring
    • failedbooleanrequired
    • methodstringrequired
    • mime_typestring
    • seqinteger· uint64requiredmin 0

      Monotonic per-session cursor; pass back as `since_seq`.

    • statusinteger· int64
    • timestampinteger· int64required
    • urlstringrequired
  • last_seqinteger· uint64requiredmin 0

    Cursor for the next `since_seq`.

browser::on-config-change

function

Internal: reload browser settings from the authoritative configuration on change.

request
empty object
response
  • okbooleanrequired

browser::pdf

function

Print the page to a PDF (the browser's Print -> Save as PDF) and return it base64 with a file name from the title.

request
  • landscapeboolean

    Landscape orientation. Default portrait.

  • print_backgroundboolean

    Print background colours and images. Default true (what the page looks like, not what a printer would save ink on).

  • scalenumber· double

    Page scale, 0.1–2. Default 1.

  • session_idstringrequired
response
  • datastringrequired

    The PDF, base64.

  • file_namestringrequired

    Suggested file name, from the page title.

  • okbooleanrequired
  • size_bytesinteger· uint64requiredmin 0
  • urlstringrequired

browser::pick::hint

function

Internal: element preview at a viewport point (tag, id, classes, bounds) so the console UI can draw a hover highlight in pick mode. Not an agent function.

request
  • session_idstringrequired
  • xnumber· doublerequired

    Viewport x of the cursor.

  • ynumber· doublerequired

    Viewport y of the cursor.

response
  • boundsany of

    Viewport-space box to draw the highlight over.

    any of (2)
    variant 1
    • heightnumber· doublerequired
    • widthnumber· doublerequired
    • xnumber· doublerequired
    • ynumber· doublerequired
    variant 2
    valuenull
  • classesstring
  • hitbooleanrequired

    False when no element sits at the point.

  • idstring
  • tagstring

    Lowercase tag name.

browser::pick::resolve

function

Internal: resolve the element at a clicked viewport point and emit browser::picked. The console calls this on a pick-mode click. Not an agent function.

request
  • session_idstringrequired
  • xnumber· doublerequired

    Viewport x of the click.

  • ynumber· doublerequired

    Viewport y of the click.

response
  • okbooleanrequired

browser::pick::start

function

Internal: enter pick mode so the human can select an element in the console UI. Not an agent function.

request
  • session_idstringrequired
response
  • okbooleanrequired

browser::pick::stop

function

Internal: leave DevTools inspect mode without picking. Idempotent. Not an agent function.

request
  • session_idstringrequired

    Cancelling pick mode on an unknown session succeeds.

response
  • okbooleanrequired

browser::recording::start

function

Record a session's live viewport to a video file (webm or mp4) by piping the screencast through ffmpeg. Turns screencast on if needed. Requires ffmpeg on PATH; browser::doctor reports whether it is available.

request
  • formatstring

    `webm` (VP9) or `mp4` (H.264). Defaults to webm.

  • pathstringrequired

    Output file path. The extension should match `format`.

  • session_idstringrequired
response
  • formatstringrequired
  • okbooleanrequired
  • pathstringrequired

browser::recording::stop

function

Stop a session's recording, finalize the file, and return its path, duration, and frame count. Idempotent: stopping when nothing is recording returns ok=false.

request
  • session_idstringrequired
response
  • duration_msinteger· int64required

    Wall-clock duration captured, milliseconds.

  • framesinteger· uint64requiredmin 0

    Frames written to the encoder.

  • okbooleanrequired

    False when no recording was running.

  • pathstring

browser::regex

function

Run a regex over the visible text of provided HTML; `first` returns the first match, else all.

request
  • firstboolean
  • htmlstringrequired
  • patternstringrequired
response
  • resultstring[]

browser::resize

function

Set the session's live viewport size (CSS pixels). The console calls this as its browser pane resizes so the streamed frame fills the pane with no letterboxing and clicks map 1:1; the device toolbar calls it with a preset. Clamped 200..4000.

request
  • device_scale_factornumber· double

    Device pixel ratio. Default 1.

  • fitboolean

    This resize is a pane auto-fit, not an explicit choice. A fit is refused (current size returned) while more than one viewer watches the session, so two open panes do not fight over the shared viewport; explicit resizes (device toolbar, agents) always apply.

  • heightinteger· uint32requiredmin 0

    Viewport height in CSS pixels (clamped 200..4000).

  • mobileboolean

    Emulate a mobile device (viewport meta, overlay scrollbars, touch). Default false. The device toolbar sets this for phone presets.

  • session_idstringrequired
  • widthinteger· uint32requiredmin 0

    Viewport width in CSS pixels (clamped 200..4000).

response
  • heightinteger· uint32requiredmin 0
  • okbooleanrequired
  • widthinteger· uint32requiredmin 0

    The clamped size actually applied.

browser::screencast::start

function

Internal: start pushing live viewport frames for browser::frame. Console-UI plumbing; agents use browser::screenshot. Not an agent function.

request
  • session_idstringrequired
response
  • okbooleanrequired

browser::screencast::stop

function

Internal: stop the live frame push. Idempotent. Not an agent function.

request
  • session_idstringrequired

    Stopping the screencast on an unknown session succeeds.

response
  • okbooleanrequired

browser::screenshot

function

Capture the session viewport as a viewable JPEG. Use browser::snapshot for machine-readable structure; screenshot when layout or rendering matters.

request
  • full_pageboolean

    Capture the full scrollable page instead of the viewport.

  • session_idstringrequired
response
  • contentobject[]required
    • datastring
    • mimestring
    • textstring
    • typestringrequired
  • detailsobjectrequired
    • heightinteger· uint32requiredmin 0
    • session_idstringrequired
    • urlstringrequired
    • widthinteger· uint32requiredmin 0

browser::screenshot-url

function

Capture a page screenshot as image content blocks via a browser fetcher (dynamic or stealthy).

request
  • fetcherstringenum: dynamic, stealthy
  • formatstringenum: png, jpeg
  • full_pageboolean
  • headlessboolean
  • network_idleboolean
  • proxystring
  • timeoutnumber
  • urlstringrequired
  • wait_selectorstring
response
  • contentobject[]

    image blocks (one per tile, width<=1024/height<=1536) + a text caption

    • datastring

      base64 image bytes (image blocks)

    • mimestring
    • textstring
    • typestringrequiredenum: image, text
  • mimestring
  • urlstring

browser::session-close

function

Close a session and free its browser/connection.

request
  • session_idstringrequired
response
  • closedboolean

browser::session-fetch

function

Fetch a URL on an open scraping session (reuses its cookies/state); returns page content, shows nothing. For a page the user should see, use browser::sessions::start + browser::navigate.

request
  • css_selectorstring

    scope the render to this CSS subtree (e.g. a page's content div)

  • dataobject
  • formatstringenum: markdown, text

    render page body to this format

  • headersobject
  • include_htmlboolean
  • jsonobject
  • main_content_onlyboolean

    strip nav/scripts/hidden before rendering

  • methodstringenum: get, post, put, delete
  • paramsobject
  • selectorsobject[]
    • allboolean

      return every match as a list

    • attrstring

      extract this attribute instead of text

    • cssstring
    • htmlboolean

      extract inner HTML instead of text

    • namestringrequired
    • regexstring
    • xpathstring
  • session_idstringrequired
  • urlstringrequired
  • wait_selectorstring
response
  • captured_xhrobject[]
    empty object
  • contentstring

    markdown/text render when `format` requested

  • cookiesobject
  • encodingstring
  • errorstring
  • extractedobject
  • formatstring
  • headersobject
  • htmlstring
  • resultsobject[]
    empty object
  • statusinteger
  • urlstring

browser::session-list

function

List open sessions with their type and idle time.

request
  • typestringenum: http, dynamic, stealthy

    filter by type

response
  • sessionsobject[]
    • created_atnumber
    • idle_snumber
    • last_usednumber
    • session_idstring
    • typestring

browser::session-open

function

Open a persistent scraping session (HTTP or headless fetcher) whose session_id reuses cookies and state across fetches. Renders nothing the user can see; to open a page in the visible browser use browser::sessions::start.

request
  • capture_xhrstring

    regex; capture matching XHRs (browser sessions)

  • headersobject
  • headlessboolean
  • impersonatestring
  • proxiesobject
  • proxystring
  • real_chromeboolean
  • solve_cloudflareboolean
  • timeoutnumber
  • typestringenum: http, dynamic, stealthy

    session engine

  • useragentstring
response
  • session_idstring
  • typestring

browser::sessions::attach

function

Attach a session to an already-running browser over CDP (start Chrome with --remote-debugging-port). Opens a fresh tab the session owns, or adopts an existing user tab by URL substring and releases it untouched on stop. Reaches the real profile with its logins; disabled unless allow_attach is set in config.

request
  • adopt_url_substringstring

    Adopt the existing tab whose URL contains this substring, exclusively, and release it untouched on stop. Omit to open a fresh tab the session owns and closes on stop. Must match exactly one open tab.

  • cdp_urlstringrequired

    CDP endpoint of the running browser: `http://127.0.0.1:9222` (the worker resolves the WebSocket URL from `/json/version`) or a `ws://` debugger URL directly. Start Chrome with `--remote-debugging-port=9222` to expose one.

  • read_onlyboolean

    Inspection-only session; see browser::sessions::start.

  • urlstring

    URL to open in the fresh tab (ignored when adopting). Omit for about:blank.

response
  • adoptedbooleanrequired

    True when the session adopted an existing user tab (released, not closed, on stop); false when it opened a fresh tab it owns.

  • read_onlybooleanrequired
  • session_idstringrequired
  • urlstringrequired

browser::sessions::list

function

List live browser sessions with their current URL and activity.

request
empty object
response
  • sessionsobject[]required
    • console_entriesinteger· uint64requiredmin 0
    • created_msinteger· int64required
    • headlessbooleanrequired
    • last_used_msinteger· int64required
    • read_onlybooleanrequired
    • session_idstringrequired
    • titlestring
    • urlstringrequired

browser::sessions::start

function

Start an interactive Chromium session and return its session_id. Sessions keep console and network history; stop them with browser::sessions::stop when done.

request
  • headfulboolean

    Force a visible window for this session, overriding the configured `headless` default.

  • read_onlyboolean

    Inspection-only session: act, evaluate, execute, and styles::write are rejected while navigation, snapshots, reads, and screenshots work. Immutable for the session's lifetime.

  • urlstring

    URL to open immediately. Omit to start on about:blank.

response
  • headlessbooleanrequired
  • read_onlybooleanrequired
  • session_idstringrequired

    Pass this to every other browser function.

  • urlstringrequired

browser::sessions::stop

function

Stop a browser session and its Chromium process. Idempotent: stopping an unknown or already-stopped session succeeds with was_running=false.

request
  • session_idstringrequired

    Session to stop. Stopping an unknown or already-stopped id succeeds.

response
  • okbooleanrequired
  • was_runningbooleanrequired

    False when the session was already gone.

browser::snapshot

function

Read the page as an accessibility-tree outline. Lines carry [ref=eN] handles that browser::act accepts; refs stay valid until the next navigation. Prefer this over browser::screenshot; it is cheaper and machine-readable.

request
  • diffboolean

    Return only what changed since this session's previous snapshot instead of the full outline. Falls back to a full snapshot when there is no baseline (first snapshot, or first after a navigation).

  • session_idstringrequired
response
  • diffany of

    Present when the caller asked for `diff: true` and a baseline existed. Covers only the emitted nodes of both snapshots; check `truncated` before trusting it as a complete change set.

    any of (2)
    variant 1
    • addedstring[]required
    • removedstring[]required
    • unchangedinteger· uint64requiredmin 0
    variant 2
    valuenull
  • generationinteger· uint64requiredmin 0

    Document generation the refs belong to; navigation advances it and kills every ref from earlier generations.

  • titlestring
  • treestringrequired

    Indented outline; lines carry `[ref=eN]` handles for `browser::act`. Empty when `diff` is populated.

  • truncatedbooleanrequired

    True when the tree hit `max_snapshot_nodes` and was cut short. Also the signal that a `diff` may be incomplete: the diff is computed over emitted nodes only, so when either snapshot was truncated a node that was emitted before and capped out now can show up in `removed` even though it still exists (and vice versa for `added`).

  • urlstringrequired

browser::stealthy-fetch

function

Camoufox stealth browser: solves Cloudflare, hardens WebRTC/canvas; extraction + bulk.

request
  • allow_webglboolean
  • block_adsboolean
  • block_webrtcboolean
  • blocked_domainsstring[]
  • capture_xhrstring
  • cookiesobject
  • css_selectorstring

    scope the render to this CSS subtree (e.g. a page's content div)

  • disable_resourcesboolean
  • dns_over_httpsboolean
  • extra_flagsstring[]
  • extra_headersobject
  • formatstringenum: markdown, text

    render page body to this format

  • google_searchboolean
  • headlessboolean
  • hide_canvasboolean
  • include_htmlboolean
  • load_domboolean
  • localestring
  • main_content_onlyboolean

    strip nav/scripts/hidden before rendering

  • max_pagesinteger
  • network_idleboolean
  • proxystring
  • retriesinteger
  • retry_delaynumber
  • selectorsobject[]
    • allboolean

      return every match as a list

    • attrstring

      extract this attribute instead of text

    • cssstring
    • htmlboolean

      extract inner HTML instead of text

    • namestringrequired
    • regexstring
    • xpathstring
  • solve_cloudflareboolean
  • timeoutnumber

    milliseconds (browser fetcher)

  • timezone_idstring
  • urlstring
  • urlsstring[]
  • useragentstring
  • waitnumber

    extra ms to wait after load

  • wait_selectorstring
  • wait_selector_statestringenum: attached, detached, visible, hidden
response
  • captured_xhrobject[]
    empty object
  • contentstring

    markdown/text render when `format` requested

  • cookiesobject
  • encodingstring
  • errorstring
  • extractedobject
  • formatstring
  • headersobject
  • htmlstring
  • resultsobject[]
    empty object
  • statusinteger
  • urlstring

browser::styles::read

function

Read an element's computed styles (curated design set by default, or named properties) plus its inline style attribute.

request
  • propertiesstring[]

    Computed property names to return. Omit for a curated design-panel set; pass `["*"]` for every computed property.

  • refstringrequired

    Element ref from `browser::snapshot`, `browser::dom::read`, or a pick.

  • session_idstringrequired
response
  • inline_stylestring

    The element's inline `style` attribute, when present.

  • propertiesobject[]required
    • namestringrequired
    • valuestringrequired
  • refstringrequired

browser::styles::write

function

Set one inline CSS property on an element, live in the page. Visual experiment only: the page's source files are untouched, and the edit dies with the next navigation.

request
  • importantboolean

    Apply with `!important`.

  • propertystringrequired

    CSS property name (`background-color`).

  • refstringrequired

    Element ref to edit.

  • session_idstringrequired
  • valuestringrequired

    CSS value (`#101418`). Empty string removes the inline property.

response
  • inline_stylestringrequired

    The element's inline `style` attribute after the edit.

  • okbooleanrequired

browser::tabs::list

function

List the open tabs of a running browser reachable at a CDP endpoint (url, title, and whether a session already adopted each). Read-only; adopt one with browser::sessions::attach.

request
  • cdp_urlstringrequired

    CDP endpoint of the running browser, as in browser::sessions::attach.

response
  • tabsobject[]required
    • adoptedbooleanrequired

      True when a session already adopted this tab; it cannot be adopted again until that session stops.

    • titlestring
    • urlstringrequired

browser::to-markdown

function

Convert HTML to compact Markdown (or text/html); optional CSS scope + main-content clean.

request
  • css_selectorstring

    convert only the subtree matching this CSS selector

  • formatstringenum: markdown, text, html
  • htmlstringrequired
  • main_content_onlyboolean

    strip nav/scripts/hidden nodes first

response
  • contentstring
  • formatstring

browser::ui-content

function

Serve the browser worker's injected console UI assets (content function for its console:script / console:style triggers).

request
  • pathstringrequired

    The asset path from the trigger config (e.g. `state/page.js`).

response
  • contentstringrequired

    The asset source, verbatim.

  • content_typestringrequired

    MIME type the console should serve the asset with.

browser::upload

function

Attach up to eight base64 files to exactly one input[type=file] selected by CSS. Files are staged privately for the session and removed when it stops.

request
  • filesobject[]required

    Up to eight files, each at most 25 MB decoded.

    • datastringrequired

      File bytes, base64.

    • namestringrequired

      File name exposed to the page. Path components are rejected.

  • selectorstringrequired

    CSS selector that must match exactly one input[type=file].

  • session_idstringrequired
response
  • attachedinteger· uintrequiredmin 0
  • file_namesstring[]required
  • okbooleanrequired

browser::xpath

function

One XPath query over HTML; first-or-all; `attr` pulls an attribute else text.

request
  • adaptiveboolean

    relocate elements after a site change via saved identities

  • adaptive_domainstring

    page URL/domain that keys saved identities

  • attrstring
  • auto_saveboolean

    save matched identities (defaults on when adaptive)

  • firstboolean
  • htmlstringrequired
  • identifierstring

    stable key for the saved element

  • querystringrequired
response
  • resultstring[]

browser::zoom

function

Zoom the page in, out, to a level (50-200 %) or back to 100 %, the way the browser's zoom menu does. The viewport keeps its size; the page scales inside it. The level belongs to the loaded document and resets on navigation.

request
  • actionstring

    `in`, `out`, `reset`, `set` (default when `level` is given), or `read` to report the current level without changing it.

  • levelinteger· uint32min 0

    Explicit level in percent (50–200); snapped to the ladder.

  • session_idstringrequired
response
  • levelinteger· uint32requiredmin 0

    Level in percent now applied to the document.

  • okbooleanrequired

triggers

9

browser::console-event

trigger

A console/log/exception entry was captured on a session's page.

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::download-changed

trigger

A download started, progressed, or finished in a session.

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::handoff-requested

trigger

A session is paused waiting for a human to complete a step (CAPTCHA, 2FA, payment).

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::handoff-resolved

trigger

A paused handoff finished (confirmed in page, by call, or timed out).

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::navigated

trigger

The session's page committed a navigation.

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::network-event

trigger

A network request was captured (completed or failed) on a session's page.

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::picked

trigger

The human picked an element in inspect mode.

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::session-started

trigger

A Chromium session is up and ready.

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown

browser::session-stopped

trigger

A Chromium session ended (stopped, idle, or crashed).

invocation
  • session_idstring

    Only deliver events for this browser session.

return
valueunknown