English | 简体中文 | 日本語 | Deutsch | Français | Español
Moli is a headless browser for AI agents, built around an "on-demand rendering" design and ready for production use.
By default, it executes real JavaScript, maintains a real DOM, and exposes real browser APIs. It computes layout or renders pixels only when they are actually needed.
Use it through the CLI, CDP, WebDriver Classic, or WebDriver BiDi.
An HTML5 game rendered by Moli and inspected live through Chrome DevTools.
rust-lang.org rendered by Moli, with its live DOM, CSS, and geometry available in Chrome DevTools.
Build from the workspace root:
cargo build --release -p moliRender the page as Markdown with Moli's default completion strategy:
./target/release/moli fetch \
--dump markdown \
--wait-until done \
https://example.comOr directly return a compact, model-friendly semantic tree:
./target/release/moli fetch \
--dump semantic_tree_text \
--wait-selector body \
https://example.comRun fetch --help for the complete option list, including output formats,
page-load/response waits, profiles, proxy settings, resource policies, and
tracing options.
# Basic automation server for DOM-first workloads
./target/release/moli serve
# Enable real geometry, coordinate input, and screenshot/screencast surfaces
./target/release/moli serve --layout
# Also fetch optional image, font, audio, video, media, and text-track resources
./target/release/moli serve --layout --resourceThe 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();Three qualities matter most for agent workloads, and Moli brings them together:
- Full-featured — real JavaScript, DOM, CSS, networking, storage, layout, screenshots, and standard automation protocols, all integrated into one headless browser.
- Fast — most automation requests never need visual rendering, so structure-first operations skip layout and paint entirely.
- Resource-efficient — layout and pixels are generated only when needed, so Moli does not have to continuously maintain and update a fully rendered visual state.
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 keeps only the latest geometry snapshot |
| Capture a screenshot or refresh a screencast | Rebuilds from the current DOM/style, renders a fresh frame, and discards it after use |
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.
- Complete web runtime — streaming HTML parsing, native DOM, V8 JavaScript, modules/timers/microtasks/events, iframes and workers, CSS cascade, Fetch/XHR/WebSocket, cookies, WebCrypto, and profile-scoped storage (localStorage, IndexedDB, OPFS).
- Extraction-optimized outputs — the CLI directly produces HTML, Markdown, JSON, semantic text trees, and frame-aware serialization, with selector/script/response waits and network tracing.
- Unified automation binary — CDP, WebDriver Classic, and WebDriver BiDi share the same kernel and scheduler. No separate ChromeDriver, geckodriver, or browser installation is required.
- Real visual capabilities on demand — add
--layoutto enable complete box construction, Taffy layout, Parley text layout, layout-backed hit-testing/input, viewport screenshots, and low-frequency CPU-rendered DevTools screencast frames. - Controllable operational options — profiles, cookies, HTTP cache, proxies, resource families, connection limits, timeouts, private-network policy, user-agent overrides, structured logging, and network diagnostics are all available.
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.
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-file |
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 one complete layout from the
current DOM/style and retains only the latest LayoutPassOutput. After that,
ordinary geometry reads may reuse the snapshot even if the page has changed;
screenshots and screencasts always rebuild and never reuse stale results.
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:
libcurl— network transport and multi-request runtimehtml5ever— HTML parsingrusty_v8/ V8 — JavaScript execution- Servo/Stylo — selectors, cascade, computed style
- Taffy + Parley — box and text layout
- AnyRender/Vello CPU,
usvg, and the Rust image ecosystem — software rendering
Document and style have a single source of truth: the native DOM and its Stylo integration. Every real refresh rebuilds layout from that source, converts the result into immutable, DOM-independent data, and then discards the temporary state created during that layout and paint pass. The system has no incremental layout tree, damage graph, retained display list, GPU compositor, or persistent window.
The following two measured data sets show Moli's current capability envelope. The tests cover real websites, real automation clients, focused Chromium/WPT behavior checks, and a large nextest regression suite.
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 |
| 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 |
In the current WPT selection used to validate Moli's agent-browser scope, one complete run recorded 1.612 million passing tests.
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:
- No GUI browser, persistent window, GPU compositor, or retained multi-frame paint architecture.
- It does not pursue pixel-for-pixel parity with Chrome or provide high-fidelity Canvas/WebGL/media playback.
- It covers selected CDP, WebDriver Classic, and WebDriver BiDi functionality rather than implementing full protocol parity.
--layoutsupports software screenshots and raster-backed CDP PDF generation, but not every Chrome screenshot or print mode is implemented.- Resource loading, geometry freshness, and visual rendering cost remain explicit policy choices instead of being continuously enabled by default.
Unsupported protocol paths return explicit errors — Moli never pretends that a browser action, event, network observation, or visual result occurred.
Maintainers can publish a tagged binary release from GitHub Actions by following the release guide.
Unless a file or directory states otherwise, you may use Moli under either the Apache License 2.0 or the MIT License, at your option. Separately licensed third-party components and fixtures remain subject to their own licenses and notices.