agentmb Python SDK
Python client for the agentmb daemon — local Chromium runtime for AI agents.
Install
pip install agentmb
Or from source (editable):
pip install -e sdk/python
Quick start
from agentmb import BrowserClient
with BrowserClient() as client:
with client.sessions.create(profile="myprofile") as sess:
sess.navigate("https://example.com")
shot = sess.screenshot()
shot.save("/tmp/out.png")
Async:
import asyncio
from agentmb import AsyncBrowserClient
async def main():
async with AsyncBrowserClient() as client:
sess = await client.sessions.create(profile="demo")
async with sess:
await sess.navigate("https://example.com")
result = await sess.eval("document.title")
print(result.result)
asyncio.run(main())
Action methods
| Method | Description |
|---|---|
sess.navigate(url) |
Navigate to URL |
sess.screenshot() |
Capture screenshot → ScreenshotResult |
sess.eval(expr) |
Run JS → EvalResult |
sess.extract(selector) |
Extract text/attrs → ExtractResult |
sess.click(selector) |
Click element |
sess.fill(selector, value) |
Fill form field |
sess.type(selector, text) |
Type char-by-char |
sess.press(selector, key) |
Press key / combo (e.g. "Enter", "Control+a") |
sess.select(selector, values) |
Select <option> in a <select> |
sess.hover(selector) |
Hover over element |
sess.wait_for_selector(selector, state) |
Wait for element visibility state |
sess.wait_for_url(pattern) |
Wait for URL to match glob pattern |
sess.wait_for_response(url_pattern, trigger) |
Wait for a network response |
sess.upload(selector, file_path) |
Upload file to <input type="file"> |
sess.download(selector) |
Click download link → DownloadResult |
sess.handoff_start() |
Switch to headed mode for human login |
sess.handoff_complete() |
Return to headless after login |
sess.cdp_send(method, params) |
Send raw CDP command |
sess.logs(tail) |
Fetch audit log entries |
File upload / download
# Upload
result = sess.upload("#file-input", "/path/to/file.csv", mime_type="text/csv")
print(result.filename, result.size_bytes)
# Download: triggers click, returns base64 file content
dl = sess.download("#download-link")
dl.save("/tmp/report.pdf")
Wait actions
# Wait for element to appear
sess.wait_for_selector("#modal", state="visible", timeout_ms=3000)
# Wait for URL after SPA navigation
sess.wait_for_url("**/dashboard**", timeout_ms=5000)
# Wait for a specific network response (with navigate trigger)
resp = sess.wait_for_response(
url_pattern="/api/data",
timeout_ms=10000,
trigger={"type": "navigate", "url": "https://app.example.com"},
)
print(resp.status_code)
Requirements
- Python 3.9+
- agentmb daemon running (
agentmb start)
Environment variables
| Variable | Default | Description |
|---|---|---|
AGENTMB_PORT |
19315 |
Daemon port |
AGENTMB_API_TOKEN |
(none) | API token if daemon started with one |
License
MIT
Metadata
Release files for agentmb 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentmb-0.4.1.tar.gz | 23.9 kB | With provenance | Details for agentmb-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentmb-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for agentmb-0.4.1-py3-none-any.whl |
Total release size: 49.6 kB
Release files / agentmb-0.4.1.tar.gz
| Download URL | agentmb-0.4.1.tar.gz |
|---|---|
| Size | 23.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2305da9b4e39fa77f3b9ca8f335ec905955b7a766153847cbce25ae0569d42bd
|
|
BLAKE2b-256 checksum How to use checksums |
905e7aa4b11f3b2cf2ed1b97b8e7fab0de000ae1004292eaa3c6023f0e1aaa97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logRelease files / agentmb-0.4.1-py3-none-any.whl
| Download URL | agentmb-0.4.1-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de7f6e5c6cc39f28a67dc893f43fcd170c77fd2e80f13742ca5ed70b76a0f901
|
|
BLAKE2b-256 checksum How to use checksums |
3e98863686bdcf616ebcbbd794c6a3b26676747ba79c545aa8c7e5da1e41c33b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logSecurity for agentmb 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for agentmb-0.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.