Ultra-lightweight (<30MB RAM), detection-free pure-Rust headless browser engine built specifically for AI agents, web scraping, and Go-based MCP servers.
Unlike traditional headless browsers (Puppeteer, Playwright, Selenium) that spawn resource-heavy Chromium processes consuming 300MB–800MB of RAM per instance, Headless Engine is written entirely in pure Rust. It operates with an astonishing <30MB RAM footprint, allowing you to run 20+ concurrent browser sessions seamlessly on a single 512MB RAM server.
Key Highlights
- 🪶 Ultra-Lightweight (<30MB RAM): Zero GPU overhead, zero compositor, zero native V8 instantiation. Pure data extraction and structural analysis using Rust's
scraperand isolatedboa_engineruntimes. - 🛡️ StealthGuard Tier-1 Anti-Detection: Deep JS runtime spoofing (
navigator.webdriver = false, completewindow.chromehierarchy, WebGL ANGLE RTX unmasked renderer, realisticPluginArray, Chrome 133 Client Hints, and pre-warmed consent cookies). Defeats Google anti-bot, Cloudflare, and Datadome traps with 0% detection failure. - 🤖 Google AI Mode & Generative Search (
udm=50): Built-in extraction for Google's new full-page AI Mode, live AI Overviews (SGE), Oxford Languages Knowledge Cards, YouTube Video timestamps, and People Also Ask. - 📝 Native LLM Markdown Distillation: Strips search filters, accessibility menus, and boilerplate noise, outputting pristine, high-density Markdown (~85%–90% LLM token compression).
- ⚡ Offline DOM Injection &
file://Scheme: Ingest offline rendered DOMs or local HTML files into active browser tabs viabrowser.set_content(html)ortab.navigate("file:///...")for high-speed offline parsing. - 📱 Multi-Device Fingerprint Rotator: Seamlessly switch between Windows Chrome, Linux Chrome, macOS Safari, iOS Safari (iPhone 16), and Android Chrome (Pixel 8) with deep JS BOM profile spoofing.
- 🔌 Universal Multi-Language Support: First-class SDKs for Rust, Python, Node.js / TypeScript, Go, and Docker.
- 🗂️ Multi-Tab Concurrency: Built-in arena-allocated tab manager (
BrowserEngine) for concurrent, isolated multi-tab scraping.
Universal Installation & Dependency Setup
1. 🦀 Rust Crate
2. 🐍 Python Package (pip)
# Live navigation with StealthGuard anti-detection
=
# Extract high-density LLM Markdown
=
# Extract structured search entities (AI Overview, PAA, Organic Results)
=
3. 🟢 Node.js / TypeScript (npm)
import { HeadlessBrowser } from 'headless-engine';
const browser = new HeadlessBrowser();
const report = await browser.navigate('https://news.ycombinator.com');
const markdown = await browser.extractMarkdown();
console.log('Markdown:', markdown);
browser.close();
4. 🐹 Go Module (go get)
package main
import (
"fmt"
"github.com/yutuknown/headless-engine/sdk/go"
)
func main()
5. 🐳 Docker Container (<20MB Image)
6. ⚡ 1-Line Standalone Binary Installer
- Linux & macOS:
| - Windows PowerShell:
iwr -useb https://raw.githubusercontent.com/yutuknown/headless-engine/master/install.ps1 | iex
Benchmark Comparison: Headless Engine vs. Lightpanda
We built Headless Engine after observing the architectural friction and lack of native cross-platform support in Zig-based alternatives like Lightpanda. Here is how we stack up:
| Feature | Headless Chrome (Playwright) | Lightpanda (Zig) | Headless Engine (Rust) |
|---|---|---|---|
| Memory Footprint | ~350 MB – 800 MB | ~50 MB | < 20 MB |
| Native Windows Support | ✅ Yes | ❌ No (Requires WSL2) | ✅ Native .exe + Linux + macOS |
| Dependencies | Chromium C++ (Huge) | Zig / Libcurl / V8 | Pure Rust (Zero C++ Run-time) |
| Startup Time | ~1,200 ms | ~40 ms | < 5 ms |
| WAF Bypass Mechanism | Requires stealth plugins | Basic Header Spoofing | Offline File Rendering (Zero TLS Leak) |
| Multi-Language SDKs | Yes | Partial | ✅ Rust, Python, Node, Go, Docker |
| LLM Markdown Converter | Needs 3rd party package | Basic HTML | Native Built-in (~99% token saving) |
| SERP & Multi-Modal Parser | Manual parsing | None | Built-in (AI Overview, Video, News) |
| JSON-RPC / MCP Protocol | Complex CDP (DevTools) | CDP subset | Native JSON-RPC 2.0 via STDIN/STDOUT |
💻 Rust SDK Usage
Single-Tab Example
use ;
async
Multi-Tab Concurrency (<50MB RAM)
use ;
async
🤖 Go MCP Server Integration Example
package main
import (
"bufio"
"encoding/json"
"fmt"
"os/exec"
)
func main()
📚 JSON-RPC 2.0 API Reference
All methods can be called over standard I/O in --stdio mode:
| Method | Params | Description |
|---|---|---|
tab.navigate |
{ "url": "...", "tab_id": "..." } |
Navigates to target URL with anti-detection |
tab.extractMarkdown |
{ "selector": "...", "tab_id": "..." } |
Returns filtered, token-efficient LLM Markdown |
tab.extractResults |
{ "tab_id": "..." } |
Returns multi-modal search data (AI Overview, news, video, images) |
tab.extractLinks |
{ "tab_id": "..." } |
Returns array of { text, href } |
tab.extractForms |
{ "tab_id": "..." } |
Returns interactive form schemas & input attributes |
tab.extractDom |
{ "selector": "...", "tab_id": "..." } |
Returns raw HTML of page or CSS selector |
tab.click |
{ "target": "selector_or_text", "tab_id": "..." } |
Simulates link/button click & auto-navigates |
tab.type |
{ "selector": "...", "text": "...", "tab_id": "..." } |
Injects text into input field |
tab.evaluateJs |
{ "code": "...", "tab_id": "..." } |
Evaluates JavaScript in sandboxed runtime |
tab.setProfile |
{ "profile": "SafariMac", "tab_id": "..." } |
Updates device fingerprint |
engine.createTab |
{ "profile": "ChromeWindows" } |
Spawns a new isolated tab, returns tab_id |
engine.closeTab |
{ "tab_id": "tab_1" } |
Closes and cleans up a tab instance |
engine.listTabs |
{} |
Lists all active tabs and profiles |
shutdown |
{} |
Gracefully terminates engine |
📜 License
Dual-licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.