Python SDK for agentmb — local Chromium runtime daemon for AI agents
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 agentmb-0.3.1.tar.gz.
File metadata
- Download URL: agentmb-0.3.1.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
716525caacce0c6914548e290254b86172ff95d8c4a1ab3dc58811323c4e600d
|
|
| MD5 |
9ac555d9cdad54e11cd2b48ff40e8536
|
|
| BLAKE2b-256 |
0466c90ba71c6e58254dbddc9a1bf028c20d14262a7c67b43261c4f9eb1d3e6c
|
Provenance
The following attestation bundles were made for agentmb-0.3.1.tar.gz:
Publisher:
publish-pypi.yml on what552/agent-managed-browser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentmb-0.3.1.tar.gz -
Subject digest:
716525caacce0c6914548e290254b86172ff95d8c4a1ab3dc58811323c4e600d - Sigstore transparency entry: 1005079702
- Sigstore integration time:
-
Permalink:
what552/agent-managed-browser@855c14ab072f06a49790e160ddb5aff852c8560a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/what552
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@855c14ab072f06a49790e160ddb5aff852c8560a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file agentmb-0.3.1-py3-none-any.whl.
File metadata
- Download URL: agentmb-0.3.1-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7e0800542e61890c0ced1d681521be69a8709964440b5c964ebaaac1f87bcbc
|
|
| MD5 |
acbc2e5c25e74d33ecd321fcb4079c12
|
|
| BLAKE2b-256 |
59e44e80927547896abe261beefb66b58bc081b9d87aa985478192f30ec8393d
|
Provenance
The following attestation bundles were made for agentmb-0.3.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on what552/agent-managed-browser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentmb-0.3.1-py3-none-any.whl -
Subject digest:
b7e0800542e61890c0ced1d681521be69a8709964440b5c964ebaaac1f87bcbc - Sigstore transparency entry: 1005079709
- Sigstore integration time:
-
Permalink:
what552/agent-managed-browser@855c14ab072f06a49790e160ddb5aff852c8560a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/what552
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@855c14ab072f06a49790e160ddb5aff852c8560a -
Trigger Event:
workflow_dispatch
-
Statement type: