Download tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/browser-live.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 16.7 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/browser-live.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/browser-live.md
-
curl -L -o browser-live.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/browser-live.md
Browser Live Agent
Oxide Browser Live is an autonomous headless-browser capability. The agent has
full control over a browser session: it can open any URL, observe pages, execute
actions, fill forms, submit data, extract structured data, and close the session.
The browser is controlled by a local browser-sidecar container running a native
Rust binary (oxide-browser-sidecar) that talks the Chrome DevTools Protocol
(CDP) directly to a headless Chromium over a single WebSocket.
Warning: Browser Live runs in Yolo mode. The agent is allowed to type passwords, secrets, and other sensitive data into web pages, and to submit forms on your behalf. It acts as an extension of your own credentials. Use it only on sites and tasks you trust.
What is supported
browser_start/browser_observe/browser_execute/browser_extract/browser_debug/browser_save_screenshot/browser_closetools- Navigation to any URL the Chromium instance can reach, including SPA hash-based URLs with
force_reload - Semantic form input via
fillandtype_textusing native value setters and framework-visible events - Strict
BrowserActionschema: per-variantoneOfwith required fields, numeric bounds, andadditionalProperties: false - Deterministic DOM value/attribute extraction through
browser_extractwithout ad-hoc JavaScript - Screenshot artifacts, DOM/a11y snapshots, network and console summaries
- Post-action observation freshness diagnostics: result-only vs capture-after actions, structured DOM snapshot errors
- Web UI preview panel and Telegram milestone/blocked/final reporting
What is not supported
- Manual control, iframe/VNC, or direct user manipulation of the browser
- Vision-based decision layer or screenshot analysis as a browser control mechanism
- MiMo or any intermediate model deciding actions; the main agent directly plans and executes actions
Page interventions (diagnostic mode only)
Two optional page interventions are available — network-level ad blocking and
cookie consent banner auto-dismissal. They run only in explicit diagnostic
sessions (diagnostic_debug: true) and are skipped entirely in the default
stealth_clean mode. Diagnostic sessions are not stealth-guaranteed: ads not
loading and consent dialogs closing are intended, observable effects.
Ad blocking
Network-level ad blocking for diagnostic sessions: ad and tracking requests are blocked before they reach Chromium, giving the agent cleaner screenshots, cleaner DOM snapshots, faster page loads, and better privacy.
Ad blocking configuration
Ad blocking is enabled by default when filter lists are available. The Docker
image includes EasyList and EasyPrivacy at /opt/adblock/ and sets
ADBLOCK_FILTERS in the Dockerfile. The engine activates for diagnostic
sessions automatically; in stealth-clean sessions it is skipped entirely.
To disable ad blocking globally, set:
ADBLOCK_ENABLED=false
ADBLOCK_FILTERS is pre-set in the Dockerfile. Only ADBLOCK_ENABLED=false
needs to be set at runtime to opt out.
What ad blocking covers
- Ad scripts (doubleclick.net, googlesyndication.com, etc.)
- Tracking pixels and beacons (google-analytics.com, facebook.net, etc.)
- Third-party ad iframes and resources
- Crypto mining scripts
Consent auto-dismiss configuration
Consent auto-dismiss is enabled by default when a rules file is available. The
Docker image bundles a merged Consent-O-Matic rules file (203 CMP variants) at
/opt/consent/rules.json and sets CONSENT_FILTERS in the Dockerfile. The
engine activates for diagnostic sessions automatically; in stealth-clean
sessions it is skipped entirely.
To disable consent auto-dismiss globally, set:
CONSENT_AUTO_DISMISS=false
CONSENT_FILTERS is pre-set in the Dockerfile. Only CONSENT_AUTO_DISMISS=false
needs to be set at runtime to opt out.
Requirements
- Docker with Compose
- The
browser-sidecarservice built fromdocker/Dockerfile.browser-sidecar(native Rust binary + Chromium only)
Configuration
Copy the Browser Live section from .env.example and set a non-empty token:
# .env
BROWSER_AGENT_SIDECAR_TOKEN=<set-a-long-random-token>
BROWSER_AGENT_ENABLED=true
BROWSER_AGENT_SIDECAR_BASE_URL=http://127.0.0.1:8787
Maximum concurrent sidecar sessions (default 8):
# BROWSER_AGENT_SIDECAR_MAX_SESSIONS=8
Deployment
Unified stack:
docker compose -f docker-compose.yml up --build -d
The sidecar REST port is bound to 127.0.0.1:8787 by default. The app service
connects to this loopback address because it runs in host-network mode. Do not
expose the sidecar port on a public interface.
Verify
Sidecar health:
curl -fsS http://127.0.0.1:8787/healthz \
-H "Authorization: Bearer ${BROWSER_AGENT_SIDECAR_TOKEN}"
Sidecar self-test (integration tests, requires Chromium):
cargo test -p oxide-browser-sidecar --test rest_contract -- --ignored --nocapture
Web app health:
curl -fsS http://127.0.0.1:8080/health
Expected sidecar response:
{"ok": true, "native": true}
Tools
browser_start
Start a task-local autonomous headless browser session. Optional start_url,
timezone, locale.
browser_observe
Return compact browser state (url, title, loading state, network/console
summaries, optional DOM snapshot) and attach the latest screenshot as a native
image for vision models. Set fresh: true to capture a new screenshot instead
of reusing the cached one. include_dom defaults to true. Set include_a11y: true to attach an accessibility-tree summary. The DOM sample contains only
interactive elements (links, buttons, inputs, selects) — use browser_extract
with a CSS selector for page content.
browser_execute
Execute a single concrete browser action. The action field uses a strict
oneOf schema with a literal kind discriminator. Variants:
| Kind | Fields | Notes |
|---|---|---|
click_xy |
x, y, target_description? |
Coordinate click |
click_selector |
selector |
CSS selector click |
fill |
selector, value |
Semantic input via native setters + framework events |
type_text |
selector, value |
Same semantic input primitive as fill |
press |
key |
Key press |
scroll |
delta_x, delta_y |
Scroll deltas |
get_element_value |
selector |
Read scalar value (result-only, no post-observation). For `input[type=checkbox |
execute_javascript |
expression |
Expression eval; captures post-observation |
wait |
timeout_ms |
Wait (1–60000 ms; no ms alias) |
wait_for_selector |
selector, timeout_ms |
Wait for element |
wait_for_text |
text, timeout_ms |
Wait for text |
script |
steps |
Sequence of non-script actions |
navigate |
url, force_reload? |
Navigate; force_reload: true restarts browser process for fresh SPA state |
For SPA hash-based URLs (e.g. one-time secret pages) use navigate with
force_reload: true to guarantee a clean page state — the sidecar replaces the
browser process without profile purge, then opens the exact target URL.
browser_extract
Extract structured data from the current page. Sources:
dom: CSSselectorselects root rows. Two modes:- Legacy single-field:
attribute(defaults toinnerText) returnsmatches[].valuewithattribute_source(property/attribute/missing) andfoundflag. Rawpropertiesandattributesare included for diagnostics. No ad-hocexecute_javascriptquerySelector hacks needed for normal form values. - Structured
fields: afieldsarray (up to 20) of{ name, selector?, attribute?, max_chars? }evaluated relative to each root row. Each match returnsmatches[].fields.<name>withvalue,source,found,truncated, andoriginal_chars. Use this for marketplace/search result tables instead of multiple single-field calls. Bounded bymax_results(default 10),max_value_chars(default 512), andmax_total_chars(default 16 000).
- Legacy single-field:
network: Filter byurl_pattern,method,status_code; includes response bodies wheninclude_bodiesis true. Network data exists only fordiagnostic_debugsessions.
browser_debug
Fetch browser console/network debug summaries as compact artifact-backed
diagnostics. Supports since_action_seq and limit.
browser_close
Close a browser session and finalize retained browser artifacts. The Chromium
profile lives in a per-session temp directory that is always cleaned up on
close (the purge_profile flag is accepted for contract compatibility and
echoed in the response, but profiles are ephemeral by design).
keep_artifacts defaults to true (screenshot artifacts are preserved for
debugging).
browser_save_screenshot
Save the latest screenshot of a browser session to the sandbox filesystem as a
JPEG file. This bridges browser-live screenshots to sandbox-based tooling
(ffmpeg, OCR, describe_image_file, etc.) or makes them downloadable later.
Call browser_observe or browser_execute first to capture a screenshot.
Requires an active sandbox; the destination defaults to
/workspace/browser-screenshots/step-NNNN.jpg (override with path).
Returns path, bytes_written, sha256, and action_seq.
Post-action observations
State-changing actions (click_*, fill, type_text, press, scroll,
execute_javascript, script with visual steps, navigate) return a fresh
post-observation with DOM snapshot or a structured dom_snapshot_error.
Read-only actions (get_element_value, wait) are result-only and skip
post-observation.
Tool output includes post_observation_diagnostics with:
mode:capture_afterorresult_onlysource:sidecarorfallback_observefresh_observation/fresh_screenshot: whether observation/screenshot changedaction_seq_current: latest action sequence numberdom_snapshot.status:captured,captured_empty, orerror- DOM snapshot elements include
tag,selector,attributes,href,value, andtext. For form inputs (input,textarea,select),valueholds the current runtime value;textisinnerTextand is empty for inputs.
Web UI usage
- Start the web compose stack and open the console.
- Create a task and ask the agent to use the browser, e.g. "Open a browser, go to example.com, and tell me what you see".
- The agent calls
browser_start,browser_observe,browser_execute,browser_extract,browser_save_screenshot, andbrowser_closeas needed. The Browser Live panel shows the latest screenshot artifact and action status. There is no manual browser control.
Limits and warnings
- Browser sessions are ephemeral; the Chromium profile (cookies, localStorage,
cache) lives in a per-session temp directory that is cleaned up on
browser_close. Artifacts are preserved whenkeep_artifactsis true. - The sidecar requires a shared bearer token; keep it secret and out of logs.
- The app and sidecar communicate over loopback only.
- Screenshots are persisted to durable storage (Postgres
BYTEA) keyed byartifact://browser/<task>/<session>/...refs; raw bytes are not embedded in chat history sent to the model — they are attached as native image attachments at call time. A retention sweep onbrowser_closedeletes artifacts older than the configured retention period. - Large or repeated pages are bounded by the live-frame byte cap and ring-buffer eviction.
- The agent is allowed to submit forms, type secrets, and interact with any page it can reach. Review agent actions before trusting them on sensitive sites.
Sub-agent access
Browser tools are available to sub-agents when the parent agent explicitly
requests them in the allowed_tools whitelist of a spawn_sub_agents call.
Sub-agents inherit the parent's browser_live_context (storage, user ID,
context key) so screenshot artifacts are stored under the parent's session
scope, not the ephemeral sub-agent scope.
When browser is disabled (feature not compiled or BROWSER_AGENT_ENABLED=false),
no browser tools are registered for sub-agents and the context is None — zero
behavioral change.
Sidecar session cap
The sidecar enforces a maximum number of concurrent browser sessions to prevent
OOM under load. When the cap is reached, new browser_start calls are rejected
with a sidecar_at_capacity error. The agent receives a human-readable message
advising it to close an existing session before retrying.
Configuration:
BROWSER_AGENT_SIDECAR_MAX_SESSIONS— env var on the sidecar binary (default8). Set indocker-compose.ymlasBROWSER_AGENT_SIDECAR_MAX_SESSIONS.None(unset viaSessionManager::default()) means unlimited — backward compatible for tests.
Troubleshooting
App fails to start with
BROWSER_AGENT_ENABLED=true requires BROWSER_AGENT_SIDECAR_TOKENSet a non-emptyBROWSER_AGENT_SIDECAR_TOKENin.envand restart both the app and sidecar services.Browser tools do not appear in the agent tool list Check that
BROWSER_AGENT_ENABLED=trueand the token is set. Check the capability list with the binary for the relevant profile.Browser tool calls fail with
Browser sidecar request was rejectedVerify the sidecar is running, the token is correct, and the REST URL is reachable at the configuredBROWSER_AGENT_SIDECAR_BASE_URL. Check the sidecar logs withdocker compose -f docker-compose.yml logs -f browser-sidecar.Browser starts but actions fail with timeout Some sites require longer waits or use anti-bot measures. Increase
timeout_ms(up to 60000) or usewait_for_selector/wait_for_textbefore acting.No screenshot preview in Web UI Confirm the artifact directory is writable and the sidecar created the artifact volume. Screenshot artifact refs are named
artifact://browser/<task>/<session>/.SPA hash navigation caches stale state Use
navigatewithforce_reload: true. The sidecar replaces the browser process to get a fresh JS heap while preserving profile data and the target URL/hash.type_textdoes not trigger SPA state updates Bothfillandtype_textuse the same semantic input primitive with native value setters and framework-visible events (focus,focusin,beforeinput,input,change,keyup). If an input still fails, check the selector and the post-action DOM snapshot diagnostics.browser_startfails withsidecar_at_capacityThe sidecar has reached its maximum concurrent session count (BROWSER_AGENT_SIDECAR_MAX_SESSIONS, default 8). Close an existing browser session withbrowser_closebefore retrying, or increase the cap in the sidecar environment.DOM value extraction returns
found: falseCheckattribute_sourcein the diagnostics. The selector may not match, or the requested attribute may not exist. Rawpropertiesandattributesin each match entry show what the element actually has.DOM snapshot shows empty
textfor input/textarea fields This is expected. DOM snapshottextisinnerText— always empty for form inputs. The current runtime value is in thevaluefield of each snapshot element. Usevalue(nottext) to verify form input state afterfillortype_text. Useget_element_valueto read a single element's value; forinput[type=checkbox|radio]it returns the checked state ("true"/"false") rather than thevalueattribute.
Staging checklist
-
BROWSER_AGENT_SIDECAR_TOKENset in.envfor both app and sidecar -
BROWSER_AGENT_ENABLED=trueset in.env -
BROWSER_AGENT_SIDECAR_BASE_URL=http://127.0.0.1:8787 - Sidecar health returns
{"ok": true, "native": true} - Sidecar integration tests pass (
cargo test -p oxide-browser-sidecar --test rest_contract -- --ignored) - Web app health returns
{"status":"ok"} - A test task can open a browser and observe
https://example.com -
browser_closereturnssidecar_errors: 0 - No browser token is present in logs or chat history
Rollback
Disable the feature without rebuilding:
# .env
BROWSER_AGENT_ENABLED=false
docker compose -f docker-compose.yml up -d --force-recreate
Or stop the sidecar service while leaving the web app running:
docker compose -f docker-compose.yml stop browser-sidecar