Skip to main content

B4n1Web - Agentic Browser Engine for AI agents. Ultra-lightweight headless browser with bundled binary.

Project description

B4n1Web Python SDK

PyPI version License: MIT Python 3.8+

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.9.8 Bundled binary version: 0.9.6

Links


Built by B4N1 with ❤️ · All rights reserved.

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

b4n1_web-0.11.0.tar.gz (31.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

b4n1_web-0.11.0-py3-none-any.whl (32.0 MB view details)

Uploaded Python 3

File details

Details for the file b4n1_web-0.11.0.tar.gz.

File metadata

  • Download URL: b4n1_web-0.11.0.tar.gz
  • Upload date:
  • Size: 31.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for b4n1_web-0.11.0.tar.gz
Algorithm Hash digest
SHA256 ee5dbc5552b7213a4b423acabbca9ffd16638395e8b538c3729fc5e5e16cc905
MD5 234a8abe7466490cc5b0e3a268e4f6a4
BLAKE2b-256 c52aa7e73d526706175f561cd0b284a677d314b597de0e8769ceefdf938225d5

See more details on using hashes here.

File details

Details for the file b4n1_web-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: b4n1_web-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for b4n1_web-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05fda8b3ed25a187d962510c4c3a50d0a1cfa4cf2db77ea56a9cf6474afb245e
MD5 62193694d5ba1bd57566285a396cbc64
BLAKE2b-256 7a453cd9066d1a5dd581b78e61c26edfb2ad24c4e2eab2d07bd4787e86eaa8a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page