Native browser automation with typed Python APIs and before-and-after evidence.
Documentation · Get started · Examples · PyPI · Issues
pyagentbrowser embeds the native Rust
agent-browser engine in a
Python process. A Browser controller owns startup, ordered native work,
snapshot-scoped element refs, safety policy, direct browser capabilities, and
terminal cleanup.
Alpha: The public API and native integration can change between minor releases. Pin a version for production automation.
Quickstart
Install pyagentbrowser from the Python Package Index:
python -m pip install pyagentbrowser
The first local launch selects a configured, cached, or installed Chrome or Chromium executable. When discovery finds none, pyagentbrowser downloads Chrome for Testing. Local browsers run headlessly by default.
from agentbrowser import Browser
with Browser.launch() as browser:
browser.page.set_content(
"<button onclick=\"this.textContent='Done'\">Run</button>"
)
snapshot = browser.observe()
result = snapshot.one(role="button", name="Run").click()
print(result.after.one(role="button").name)
print(result.diff.changed)
Done
True
The evidence model
Browser.observe() returns an accessibility Snapshot. Each Ref identifies
one element inside that snapshot. A ref mutation returns an ActionResult with
the source snapshot, resulting snapshot, and their SnapshotDiff.
Snapshot A -> Ref -> action and wait -> Snapshot B -> SnapshotDiff
Use browser.find for live CSS, XPath, role, text, label, placeholder,
alternative text, title, and test ID queries. Live queries resolve when each
operation runs. Snapshot-scoped refs preserve the inspected page state and add
transition evidence.
What you can automate
- Navigate, inspect, and act on pages
- Read documents and capture screenshots, PDFs, diffs, and downloads
- Manage tabs, named sessions, cookies, Web Storage, and restored state
- Route requests, record HTTP Archive files, and inspect diagnostics
- Evaluate targets, frames, and contexts through the Chrome DevTools Protocol
- Invoke page-provided WebMCP tools
- Observe a Python-owned browser session in the dashboard
- Use agent skills and marimo code mode
- Call the raw native protocol
Choose a runtime
Browser is synchronous. AsyncBrowser mirrors its browser, snapshot, ref,
query, policy, and capability APIs with awaitable native operations.
Browser.launch() starts a local browser before returning. Browser() starts
lazily. Browser.attach(CDPTarget(...)) connects to an existing Chrome DevTools
Protocol endpoint. All three paths share the same typed result and lifecycle
model.
Installation options
Wheels support Python 3.11 through 3.14 on macOS arm64 and x86-64, manylinux 2.28-compatible Linux arm64 and x86-64, and Windows x86-64.
uv add pyagentbrowser
uv add "pyagentbrowser[images]" # Pillow image loading for Screenshot
uv add "pyagentbrowser[cdp]" # Direct Chrome DevTools Protocol clients
Learn and contribute
Serve the documentation through Portless with
make docs-dev. The main checkout uses
https://docs.pyagentbrowser.localhost/, while linked worktrees receive a
branch-prefixed subdomain.
License
pyagentbrowser is licensed under the Apache License 2.0. See NOTICE for bundled software attribution.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyagentbrowser-0.36.0.1.tar.gz.
File metadata
- Download URL: pyagentbrowser-0.36.0.1.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c104da7b8a674a27ea7465b104b5defd31aacca92716b9a7556befe96895188e
|
|
| MD5 |
2de9e32114d8c928718de41759651915
|
|
| BLAKE2b-256 |
54df9b59c5dd807823cd571fca4fba893556952927450ca8c91be5f35632e175
|
File details
Details for the file pyagentbrowser-0.36.0.1-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: pyagentbrowser-0.36.0.1-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 9.1 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96b849b1b725f66c902ed6300a2a68b8424c0895fee7728e28bf74e2eab3a5b0
|
|
| MD5 |
db90f446b17c8c6df3432265a8f409c8
|
|
| BLAKE2b-256 |
6c89bf2490aa8e9bf53a148cf9b8b09feed650ad52bceed4ee3c5102e035365c
|
File details
Details for the file pyagentbrowser-0.36.0.1-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyagentbrowser-0.36.0.1-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 9.8 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
292cbaf286a89f1078bbfc6a2190b58269a07e2de7eb4ca5112ce56d2543dcf0
|
|
| MD5 |
14f6dad7d06feeaa98cd1957579853c1
|
|
| BLAKE2b-256 |
b3790611b826e59a1165392941128e18cb17a9fc7e4d9a4539e79bb56c3a67bd
|
File details
Details for the file pyagentbrowser-0.36.0.1-cp311-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyagentbrowser-0.36.0.1-cp311-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 9.3 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24d74b708dfc29cdf1f078696c49e57e1e15a6ab132644097ae51d0ee5e60c9a
|
|
| MD5 |
4e144f4efec8f3677503a2ed8c1692aa
|
|
| BLAKE2b-256 |
de9ee3c9bbd2840c86a7780730b4e036ad79b21674eb389877f71fd3c80f5088
|
File details
Details for the file pyagentbrowser-0.36.0.1-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyagentbrowser-0.36.0.1-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.7 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c414cf8e06a86cffb531e1a653f1ef786177800808e2b47230dffd42794fb95
|
|
| MD5 |
d7ab1619c8355ab02566a80b50cd086d
|
|
| BLAKE2b-256 |
6a3f01b57ca888567c3562411d06064ff552251a1df47349da2fe0fbe2031f4e
|
File details
Details for the file pyagentbrowser-0.36.0.1-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pyagentbrowser-0.36.0.1-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 9.3 MB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a12291aba0fe4e905518b684f2bb38ddf750801ca1f4a7ec604a948c04e1cd9
|
|
| MD5 |
1fc2b94a2717fac44942e123199e3fa0
|
|
| BLAKE2b-256 |
87e1928d1809da9565fc208f888623a9f90104f2a6f2dda2f3b87de46abf2e2e
|