B4n1Web Agentic Browser Engine - Ultra-lightweight headless browser for AI agents
Project description
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://web.b4n1.com/install | bash")
Version
SDK version: 0.4.0 Bundled binary version: 0.4.0
Links
Built by B4N1 with ❤️ · All rights reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 b4n1_web-0.5.0-py3-none-any.whl.
File metadata
- Download URL: b4n1_web-0.5.0-py3-none-any.whl
- Upload date:
- Size: 2.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f4446f62949848017956c7d175d76bad544b3be5e01603500dcbc40ffe77a17
|
|
| MD5 |
578a53d49f29dee7c2ce5a0cfeb0da2b
|
|
| BLAKE2b-256 |
81b467e03c8718c389b559d5ec76fa18aa36badc55f52b965dd4ce2d19209003
|