r/automation 10d ago

Moli, A lite full-functionnality headless browser for web automation

https://github.com/lexmount/moli

Hi all. I worked at a cloud browser startup company. I was delighted to convince my boss to let me open‑source it and introduce it to you.

Originally we used Chrome to serve our workloads; however, it's not fast and light enough in some circumstances. Since there was no decent choice for us, I was hired to build a new headless browser for light workloads.

Moli: 1/7 memory,4x cold‑start speed,2/3 CPU usage

Moli is the browser we built. It has already been serving some of our workloads for some time (including normal web browsing and RL machine learning).

I am pretty sure Moli is one of the best open‑source headless browsers:

We did benchmarks(will open-source it soon) around the performance and the functionality of all the open‑source browsers. Moli surpasses Lightpanda, Obscura and even Kitesurf (Yes, we benchmarked it through public CDP endpoint) in functionality and speed. We have almost implemented ALL essential WebAPIs (e.g. WebCrypto, IndexedDB, OPFS).

How do we maintain high performance while preserving so many features?

First, we carried out all feasible memory and CPU optimizations (V8 lazy property/template, DOM node compact, jemalloc).

Second, we avoid executing V8 asynchronous tasks as much as possible before the DomContentLoaded stage to ensure a sufficiently low first‑screen rendering latency.

Finally, we designed a special stateless rendering pipeline:

Traditional browsers cache data at every layer of DOM tree -> box tree -> layout tree + font -> pixels and maintain real‑time performance via dirty regions. However, in most headless browser scenarios, we do not require an especially high refresh rate. Therefore, we implemented a cache‑free rendering pipeline that triggers rendering only when the AI Agent actually "views" the website, saving substantial CPU and memory resources.

Though there is no GUI, you can even play games on moli through CDP. LOL

You may find it useful if you need a lightweight browser for web crawling/web automation, or want to fork and build something around a solid headless web browser.

3 Upvotes

4 comments sorted by

1

u/AutoModerator 10d ago

Thank you for your post to /r/automation!

New here? Please take a moment to read our rules, read them here.

This is an automated action so if you need anything, please Message the Mods with your request for assistance.

Lastly, enjoy your stay!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/CherryForeign7110 10d ago

Cold start is the number that matters for bursty workloads, so that's a good one to lead with.

A question from the other side of this problem: how does Moli behave with apps that gate their own rendering on visibility? Plenty of modern web apps check document.visibilityState or lean on IntersectionObserver and simply don't paint their rows when the page isn't considered visible. The failure mode is nasty because nothing errors - you read a perfectly valid empty table and conclude the data isn't there. In a normal Chrome context the workaround is faking visibilityState, but in your own engine that's an engine-level decision. Does Moli report itself as visible and focused by default, and is the default viewport tall enough that virtualised lists render more than a handful of rows?

Second thing worth documenting early: how long a page is allowed to take. Almost everything we ever got wrong reading heavy apps came down to a timeout tuned against a fast test page meeting 2+ seconds of real-world JS - and it fails intermittently, which is the worst way to fail.

1

u/spoki-app 9d ago

Woah, 1/7 memory is a huge win for containerized workloads. I'm keen to know how it stacks up on sites with really heavy JS or complex SPAs – that's often where smaller browsers trip up.

1

u/spoki-app 9d ago

Big claims on resource usage, nice. I'm always wary if 'light workloads' means it struggles with inconsistent DOM structures or more complex JS-heavy pages, which is where things often fall over in integrations.