B4n1Web Python SDK
Ultra-lightweight agentic browser engine with bundled binary. Navigate URLs, extract structured content (markdown, links, screenshots), and build AI agent workflows.
Install
pip install b4n1-web
No additional binary installation needed — the SDK bundles the b4n1web binary.
Quick Start
from b4n1web import AgentBrowser, BrowserMode
# Light mode - fastest
browser = AgentBrowser(mode=BrowserMode.LIGHT)
page = browser.goto("https://example.com")
print(page.markdown)
print(f"Found {len(page.links)} links")
browser.close()
# JS mode - extract scripts
browser = AgentBrowser(mode=BrowserMode.JS)
page = browser.goto("https://example.com")
browser.close()
# Render mode - full Chromium (requires chromium install)
# browser = AgentBrowser(mode=BrowserMode.RENDER)
# page = browser.goto("https://example.com")
# print(page.screenshot) # base64 screenshot
Context Manager
with AgentBrowser() as browser:
page = browser.goto("https://example.com")
print(page.markdown)
Page Object
page.url # str: final URL
page.markdown # str: page content as markdown
page.links # list[str]: all links on page
page.screenshot # str|None: base64 screenshot (render mode)
page.get_main_content() # str: content without headers
page.find_links_by_text("more") # list[str]: links containing "more"
Browser Modes
| Mode | Description | RAM | Startup |
|---|---|---|---|
LIGHT |
HTTP fetch + HTML parsing | ~15MB | Instant |
JS |
Light + JavaScript extraction | ~15MB | Instant |
RENDER |
Full Chromium + screenshots | ~100MB | ~2s |
Security
from b4n1web.security import SecurityShield
shield = SecurityShield()
shield.mark_domain("evil.com", is_safe=False)
is_safe, needs_api = shield.is_url_safe("https://evil.com/page")
# (False, False)
MCP Integration
from b4n1web.mcp import AsyncMcpClient
async with AsyncMcpClient() as client:
page = await client.goto("https://example.com")
print(page.markdown)
Start MCP server:
b4n1web mcp -p 8080
Error Handling
from b4n1web import BinaryNotFoundError
try:
browser = AgentBrowser()
except BinaryNotFoundError:
print("b4n1web binary not found. Install with:")
print(" curl -sL https://b4n1.com/install | bash")
Version
SDK version: 0.15.0 Bundled binary version: 0.15.0
Links
Built by B4N1 with ❤️ · All rights reserved.
Metadata
Release files for b4n1-web 0.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| b4n1_web-0.15.0-py3-none-any.whl | Python 3 | none | any | Details for b4n1_web-0.15.0-py3-none-any.whl |
Release files / b4n1_web-0.15.0-py3-none-any.whl
| Download URL | b4n1_web-0.15.0-py3-none-any.whl |
|---|---|
| Size | 29.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3d2d61ce20c14ccec91eb5248a95f61f3091bb063a0743c51101bf84dec94b4
|
|
BLAKE2b-256 checksum How to use checksums |
717dff22ed321adba040ec8e45007449e145eadb4d714e685fc7e1eefa901e75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for b4n1-web 0.15.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.