hugpy-browser
Screen-driven browser control for bots — no Selenium, no WebDriver, no debugging port — standalone and trainable. The tools look at the screen and move the real pointer, so a site sees an ordinary user's browser. Measured: pointer error 0 px on VM and desktop; description aims 11/12 on target, 1 px median error (Qwen2.5-VL-7B).
This package is self-contained. The engine is inside it —
hugpy_browser.engine is a verbatim copy of the abstract-toolserver 0.0.70
browser stack (browser.py, aim.py, surfaces.py, labcheck.py, vl.py,
vmgui.py, uitools.py, plus a minimal tools.py shim). Nothing was removed
from abstract-toolserver; the toolserver still ships and serves the same code.
Provenance is recorded in engine/__init__.py.
| piece | where |
|---|---|
| engine | hugpy_browser.engine.browser — browser_go/look/click/type/move/drag/scroll/wait/read/shot/locate/surfaces/lab; also reachable as hugpy_browser.browser etc. |
| trainable | hugpy-browser dataset --out DIR [--format qwenvl] [--zoom-aug] [--wire] → native-grounding fine-tune set |
| operator guide | hugpy-browser guide (same text as toolserver instructions/hugpy/hugpy-browser) |
| measured numbers | hugpy-browser numbers (docs/final_numbers.md) |
| re-measurement kit | hugpy_browser/bench/ — evalrun.py, pipelines.py, vlclient.py, rescore.py, final_table.py, and the synthetic target set (data/, data2/) |
| end-to-end scripts | hugpy_browser/e2e/ — e2e_desktop.py, e2e_vm.py, lab_prepare.sh, cleanup_e2e.sh |
| lab-VM assets | hugpy_browser/assets/ — precision.html, hugpy-browser-lab.xml, clone.xml, base-inactive.xml, prep_guest.sh, lab-image.json |
| lab VM image | hugpy-browser lab-image — archival compressed qcow2 + sha256 + install steps |
Install
pip install hugpy-browser # engine + docs + data (pillow only)
pip install 'hugpy-browser[full]' # + OCR, OpenCV snapping, desktop input, renderer, click macros
Extras map to features (everything degrades gracefully): [ocr] text= aims and
browser_look; [cv] region OCR pass + element snapping + lab checks;
[desktop] on="screen" capture/input; [render] headless page render fallback;
[clicks] the lab's qemu/firefox macros. Description (target=) aims need a
reachable vision model (HUGPY_BASE, or any OpenAI-style endpoint for the bench).
Quickstart
Through a toolserver the tools are served as browser_*; as a library:
from hugpy_browser import browser
browser.browser_go(url="https://example.com", on="vm:ubuntu-desktop")
items = browser.browser_look()["items"]
browser.browser_click(text="Sign in")
browser.browser_type(text="me@example.com", into_text="Email", submit=True)
Aim four ways: text= (OCR, exact visible words), target= (vision-model
description, confirmed on a magnified crop), cell="J2.D5" (labelled grid for a
bot that reads images itself), or x=, y=. Every click is verified:
before/after frames, diff regions, a verdict
(changed_at_click | changed_elsewhere | no_change).
Training
The engine aims descriptions with the VL model's native grounding — the prompts
in engine.aim._point_prompt, answers {"bbox_2d": [x1, y1, x2, y2]}. The
exporter emits exactly that distribution from the bundled target set:
hugpy-browser dataset --out /tmp/ds --format qwenvl --zoom-aug --wire
# -> train.jsonl (chat-messages records: image + grounding prompt -> bbox JSON)
# screen views, the engine's magnified confirm views, and wire-geometry views
Generate more synthetic pages with bench/make_bench.py (playwright), then
re-score the tuned model with bench/evalrun.py against any OpenAI-style
endpoint (bench/vlclient.py, env VL_BASE). Results of record:
docs/final_numbers.md.
The lab
A repeatable desktop for tests: libvirt image hugpy-browser-lab (Firefox opens
on the bundled precision page). browser_lab(action="start") boots an ephemeral
clone; browser_lab(action="check") runs the 17-check self-test and reports the
measured pointer error. hugpy-browser lab-image prints the archival image's
location, checksum and install steps; assets/ has the libvirt XML and
prep_guest.sh to rebuild the guest from scratch.
Tests
tests/test_engine_aim.py — the engine's own 60+ test suite (wire geometry,
grid drawing and parsing, both aim strategies end-to-end against a fake model
answering from real pixels, OCR matching, QMP event streams, verified clicks,
the lab readiness logic), run against the vendored engine.
Metadata
Release files for hugpy-browser 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hugpy_browser-0.2.0.tar.gz | 921.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hugpy_browser-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.8 MB
Release files / hugpy_browser-0.2.0.tar.gz
| Download URL | hugpy_browser-0.2.0.tar.gz |
|---|---|
| Size | 921.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69d658a0a604126e4550eb490760d647965f169f5107b1a86a3c130ef00e5411
|
|
BLAKE2b-256 checksum How to use checksums |
fcda7a1d13066d4bb289018ee847dd94f42ffc527dfce06224da036f7223c6ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / hugpy_browser-0.2.0-py3-none-any.whl
| Download URL | hugpy_browser-0.2.0-py3-none-any.whl |
|---|---|
| Size | 922.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4ed383db4999994a449b36fbf20f76d002bdf7eff930556886ac27ac5f6de6d
|
|
BLAKE2b-256 checksum How to use checksums |
7ad9d9830609a4bbb3e56f3c2380c308ed4b88b69936ac9f3027d9aa5817b2c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|