moli README

The project's README from github.com/lexmount/moli. As one markdown file: README.md.

Moli Browser — Structure first. Pixels on demand. Open source browser for AI agents.

Moli

English | 简体中文 | 日本語 | Deutsch | Français | Español | 한국어

Discord WeChat

Moli by Lexmount - #1 Product of the Day | Product Hunt lexmount%2Fmoli | Trendshift lexmount%2Fmoli | Trendshift

Moli is a production-ready headless browser for AI agents. Its on-demand layout and rendering design combines a complete browser runtime with a lightweight resource footprint.

Moli helps your AI agent fetch and extract web pages, search the web, and automate browser tasks.

Use it through the CLI, CDP, WebDriver Classic, or WebDriver BiDi.

Moli supports Linux, macOS, and Windows.

Quick start

Give this prompt to your AI agent:

Install the skills under https://github.com/lexmount/moli/tree/main/skills,
follow their instructions to download and install the latest prebuilt Moli
binary, then use moli-webfetch to fetch https://example.com and show me the
result.

Direct installation

On Linux or macOS:

curl --proto '=https' --tlsv1.2 -fsSL \
  https://github.com/lexmount/moli/releases/latest/download/moli-installer.sh | sh

On Windows, run in PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://github.com/lexmount/moli/releases/latest/download/moli-installer.ps1 | iex"

Showcase

An HTML5 game rendered by Moli and inspected through Chrome DevTools

An HTML5 game rendered by Moli and inspected live through Chrome DevTools.

rust-lang.org rendered by Moli and inspected through Chrome DevTools

rust-lang.org rendered by Moli, with its live DOM, CSS, and geometry available in Chrome DevTools.

CLI usage

Extract a page

Render the page as Markdown with Moli's default completion strategy:

moli fetch \
  --dump markdown \
  --wait done \
  https://example.com

Or directly return a compact, model-friendly semantic tree:

moli fetch \
  --dump semantic_tree_text \
  --wait-selector body \
  https://example.com

For visual output, enable on-demand layout and write a viewport PNG, a full-document PNG, or a paginated PDF:

moli fetch --layout --dump screenshot https://example.com > page.png
moli fetch --layout --dump screenshot_full https://example.com > full-page.png
moli fetch --layout --dump pdf https://example.com > page.pdf

To export a page after an explicit interaction, combine --eval (or --eval-file) with --dump. The expression runs after page readiness; promises are awaited, and any pending navigation is followed before export. Its return value is discarded without serialization. An exception fails the command without emitting a dump.

moli fetch --eval 'document.querySelector("button.show-details").click()' \
  --dump markdown https://example.com

Only the supplied expression performs interactions. Without --dump, --eval retains its expression-value output behavior.

Run fetch --help for the complete option list, including output formats, page-load/response waits, profiles, proxy settings, resource policies, and tracing options.

Start the automation server

# Basic automation server for DOM-first workloads
moli serve

# Enable real geometry, coordinate input, and screenshot/screencast surfaces
moli serve --layout

# Also fetch optional image, font, audio, video, media, and text-track resources
moli serve --layout --resource

The same endpoint serves all three protocols: CDP, WebDriver Classic, and WebDriver BiDi. Playwright can connect directly over CDP:

import { chromium } from "playwright";

const browser = await chromium.connectOverCDP("http://127.0.0.1:9222");
const context = browser.contexts()[0];
const page = context.pages()[0] ?? await context.newPage();

await page.goto("https://example.com");
console.log(await page.locator("body").innerText());

await browser.close();

The WebMCP playground includes a CLI to list and call any site's native WebMCP tools, plus booking, restaurant, and pizza demos.

Why Moli

Three qualities matter most for agent workloads, and Moli brings them together:

What most browser automation tasks actually need is page structure, not a continuously rendered visual world. Moli treats the native DOM and style state as the single source of truth, triggering layout or software paint only for operations that genuinely require them.

Agent request What Moli does
Extract HTML/Markdown, query the DOM, run JS, inspect network/storage Reads browser runtime state directly — does not trigger layout or paint
Read an element's box, hit-test coordinates, send coordinate input Runs one layout calculation and retains only the latest frozen layout tree
Capture a screenshot Rebuilds from the current DOM/style, replaces the frozen tree, renders a fresh frame, and discards its paint state after use
Poll a screencast Compares generation metadata only; clean state emits no frame, while changed state rebuilds and emits one fresh frame

How Moli handles a request: DOM-first by default, with layout and paint built fresh only on demand

Moli still includes the complete set of capabilities: V8, CSS, layout, text shaping, hit-testing, software paint, and more. The only difference is when visual work runs and how long its results are retained. This cost model is especially well suited to crawling, browser-use agents, retrieval pipelines, evaluation environments, and reinforcement-learning workloads.

Current capabilities

Moli's relationship with Lexmount

Moli is Lexmount's open-source headless browser; Lexmount Browser is the managed cloud runtime and control plane built around it.

The open-source headless browser is fully usable without Lexmount Browser.

Cost controls

Expensive browser operations in Moli require an explicit opt-in and are never enabled by default:

Mode or option Behavior
Default LayoutPolicy::Mock — deterministic geometry in a compatible format, with no real layout or paint
--layout LayoutPolicy::OnDemand — real layout, geometry, hit-testing, coordinate input, screenshots, screencast
--resource Fetch all optional visual/media resource families
--image, --font, --audio, --video, --media, --text-track Enable one specific optional resource family
--profile-dir, --http-cache-dir, --cookie Selectively enable the persistence required by the workload

Layout is an on-demand snapshot rather than continuously maintained state. The first geometry request (a cold start) builds a working layout tree from the current DOM/style, freezes its canonical geometry into an immutable, DOM-independent FrozenLayoutTree, and retains only that latest tree. Ordinary geometry reads may reuse it even if the page has changed. Screenshots always rebuild and replace the frozen tree. Each screencast subscription remembers only an opaque visual-state token: an unchanged token suppresses the poll, while a changed token triggers one fresh frame. Paint results are never reused.

Architecture

Moli is a standalone browser kernel, not a Chromium wrapper. It is built in Rust, has its own ownership and lifecycle rules, and relies on:

Document and style have a single source of truth: the native DOM and its Stylo integration. Every real refresh builds a temporary working tree from that source, optionally produces and consumes one fresh paint snapshot, freezes the canonical box/fragment geometry into a compact FrozenLayoutTree, and discards the working tree, style borrows, layout caches, diagnostics, and paint state. Screencast tokens contain generation metadata, never layout or paint data. Source lookup and hit-test candidates are derived from the frozen tree when queried. The system has no incrementally maintained layout tree, damage graph, retained display list, GPU compositor, or persistent window.

Benchmark

The following measurements show Moli's current capability envelope. They cover real websites, automation clients, Chromium/WPT behavior checks, and a large nextest regression suite.

Theme Tests Moli
Web crawl and fetch Mixed public-web crawl, 192 URLs; Web Fetch, 430 live-site tasks and 545 saved pages 103 useful pages (53.6%); 89.8% pass rate and 39.27% extraction score, first of five browsers
Browser automation Lexbench-Headless-Browser, 1,308 comparable tasks 81.9% success; Chrome 99.8%
Resource use 557 tasks all four local engines completed; one sample agent episode 15% of Chrome's CPU time and 13% of its peak memory
Web standards Selected WPT tests 1.612 million tests passed

Web crawl and fetch

Mixed public-web crawl test

The test covers 192 public URLs from major Chinese and international sites. A page only counts as successful if it produces meaningful content after JavaScript runs — an HTTP 200, challenge page, login wall, empty response, or shell-only application does not count.

Browser Useful pages Success rate Median time Median RSS
Moli 103 53.6% 1.43 s 73 MiB
Chrome Headless 101 52.6% 1.43 s 773 MiB
Lightpanda 85 44.3% 0.97 s 40 MiB
Obscura 57 29.7% 1.30 s 39 MiB

Web Fetch

Moli is compared with four other browsers on live sites and on saved pages. Click a title to switch; each row shows Moli (green) against the range of the other four. Full report · reproduce with Webstone (guide).

Live sites · LexBench-Web-Fetch, 430 tasks Pass rate on 430 live-site tasks. Overall: Moli 386/430 (89.8%), Chromium 234, Lightpanda 228, Obscura 223, Kitesurf 192. Anti-bot: Moli 88/100, best other 37. Popular: Moli 91, best other 58. Dynamic: Moli 90, best other 58. Static: Moli 97, Chromium 99. Documents and media: Moli 20/30, best other 17.

A pass needs both site access and correct content (dataset, v1.0.0 edition).

Exact numbers
Method Overall Static /100 Anti-bot /100 Popular /100 Dynamic /100 Documents and media /30
Moli 386/430 · 89.8% 97 88 91 90 20
Chromium 234/430 · 54.4% 99 5 58 58 14
Lightpanda 228/430 · 53.0% 92 37 38 44 17
Obscura 223/430 · 51.9% 94 16 53 43 17
Kitesurf 192/430 · 44.7% 90 10 40 41 11

Cells show tasks passed. The last column combines document content, direct media, and media embedded in web pages.

Saved pages · WebMainBench, 545 pages Extraction quality on 545 saved pages. Overall: Moli 39.27%, Lightpanda 35.00%, Kitesurf 33.43%, Obscura 31.03%, Chromium 27.02%. Code: Moli 91.06%, best other 84.71%. Moli trails the best other method on text, formula, table content and table structure.

Main-content extraction scored against human annotations, without live access (dataset).

Exact numbers
Method Body produced Overall Text Code Formula Table content Table structure
Moli 545/545 39.27% 40.73% 91.06% 28.20% 22.62% 13.75%
Lightpanda 545/545 35.00% 41.52% 84.71% 12.97% 21.81% 14.00%
Obscura 543/545 31.03% 41.88% 81.82% 31.39% 0.03% 0.00%
Chromium 545/545 27.02% 39.40% 35.86% 21.12% 25.01% 13.73%
Kitesurf 524/545 33.43% 36.99% 80.70% 19.32% 18.25% 11.87%

Browser automation

Moli's performance in Lexbench-Headless-Browser

The full Lexbench-Headless-Browser corpus contains 1,928 tasks covering raw CDP, 13 pinned automation tools including Playwright, Puppeteer and Selenium, and web-platform semantics. To include Kitesurf, which is only available as a remote endpoint, the chart below uses 1,308 comparable tasks. All browsers use the same task selection rules.

Task success rate of five headless browsers over 1,308 comparable tasks: Chrome 99.8%, Moli 81.9%, Kitesurf 62.1%, Lightpanda 53.3%, Obscura 44.9%

Moli 0.1.1 passed 1,071 tasks, a success rate of 81.88%, ahead of Kitesurf at 62.08%, Lightpanda at 53.29%, and Obscura at 44.88%; Chrome, the reference engine, reached 99.85%. Kitesurf ran at k=1, uncovered tasks count as not passed, and the reproduction conditions of a remote service differ from those of local binaries. See the benchmark's five-engine report for the full results.

Resource use

Task success rate plotted against median peak memory per task for the four local engines: Chrome at 99.9% and 697 MiB, Moli at 80.7% and 92 MiB, Lightpanda at 43.8% and 34 MiB, Obscura at 39.5% and 39 MiB

Kitesurf is a remote service, so its CPU, memory, and process counts cannot be measured. The resource comparison therefore covers only the four local engines. A separate 557-task run includes only work completed by all four. Moli's median CPU time per task was 100.6 ms and its median peak memory was 92 MiB; Chrome recorded 687 ms and 697 MiB, respectively. Moli used about 15% of Chrome's CPU time and 13% of its peak memory. See the benchmark's resource card for the methodology and full data.

Sample agent workload

Metric Moli Chromium
CDP ready 34.85 ms 169.37 ms
Episode active p50 33.40 ms 57.13 ms
Peak PSS 102.46 MiB 348.82 MiB
Peak processes / threads 1 / 24 11 / 123

Web standards

WPT tests

In the current WPT selection used to validate Moli's agent-browser scope, one full run passed 1.612 million tests.

Project scope

Within the agent-browser scenarios defined in its documentation, Moli is ready for production use and remains under active development.

Its current intentional boundaries include:

Unsupported protocol paths return explicit errors — Moli never pretends that a browser action, event, network observation, or visual result occurred.

Star history

Generated hourly from the stargazer timeline by lexmount/moli-metrics.

Star history of lexmount/moli

Moli's Friends

Find projects, integrations, and deployment options in Awesome Moli.

moli (lexmount/moli)

Searching Database…

24.8K ·GitHub
What is this?Moli is a production-ready headless browser for AI agents, built in Rust. It helps agents fetch and extract web pages, search the web, and automate browser tasks through the CLI, CDP, WebDriver Classic, or WebDriver BiDi.
Is this a wrapper around Chrome, or its own browser engine?Moli is a standalone browser kernel written from scratch in Rust, using its own DOM, V8, Servo/Stylo for CSS, and Taffy/Parley for layout — it is not a Chromium wrapper.
How do I get it running?You install it directly with a one-line script on Linux/macOS or a PowerShell command on Windows, then run the fetch command to extract a page or start the automation server for CDP/WebDriver.
Do I need to install Chrome, ChromeDriver, or geckodriver separately?No. Moli ships as one unified binary that implements CDP, WebDriver Classic, and WebDriver BiDi over the same kernel, so no separate ChromeDriver, geckodriver, or browser install is needed.
Does it render pages visually by default, or is it the same fidelity as Chrome?By default Moli returns deterministic mock geometry with no real layout or paint; you need the --layout flag for real layout, hit-testing, and screenshots. Even then it doesn't aim for pixel-perfect Chrome parity or full Canvas/WebGL/media support.
Which operating systems does it run on?Moli supports Linux, macOS, and Windows as a native binary.
How does Moli's performance compare to headless Chrome?In Lexbench-Headless-Browser, Moli used about 15% of Chrome's CPU time and 13% of its peak memory per task, while passing 81.88% of tasks versus Chrome's 99.85% reference pass rate.
What is Lexmount Browser, and do I need it?Lexmount Browser is a separate managed cloud runtime and control plane built around Moli; the open-source Moli browser is fully usable on its own without it.
What automation protocols can I connect with?Moli serves CDP, WebDriver Classic, and WebDriver BiDi from the same endpoint, so tools like Playwright can connect directly over CDP without any extra driver.
Why is Moli faster than a normal headless browser?Most agent requests only need DOM/HTML data, so Moli skips layout and painting entirely for those and only builds real geometry or pixels on demand, discarding the paint state right after use.
Creator
lexmount
Size
165.6 MB
Stars
24.8K
Age
3mo
Commits · 90 Days