News for hackers. Stuff that matters.
Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @08:43AM (#42812928)
Author here. The browser is made from scratch (not based on Chromium/Webkit), in Zig, using v8 as a JS engine.

Our idea is to build a lightweight browser optimized for AI use cases like LLM training and agent workflows. And more generally any type of web automation.

It's a work in progress, there are hundreds of Web APIs, and for now we just support some of them (DOM, XHR, Fetch). So expect most websites to fail or crash. The plan is to increase coverage over time.

Happy to answer any questions.

Re:Lightpanda: The headless browser designed for AI and auto... by JoelEinbinder on Friday January 24, 2025 @11:29AM (#42814724)
When I've talked to people running this kind of ai scraping/agent workflow, the costs of the AI parts dwarf that of the web browser parts. This causes computational cost of the browser to become irrelevant. I'm curious what situation you got yourself in where optimizing the browser results in meaningful savings. I'd also like to be in that place!

I think your ram usage benchmark is deceptive. I'd expect a minimal browser to have much lower peak memory usage than chrome on a minimal website. But it should even out or get worse as the websites get richer. The nature of web scraping is that the worst sites take up the vast majority of your cpu cycles. I don't think lowering the ram usage of the browser process will have much real world impact.

Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @12:10PM (#42815171)
The cost of the browser part is still a problem. In our previous startup, we were scraping >20 millions of webpages per day, with thousands of instances of Chrome headless in parallel.

Regarding the RAM usage, it's still ~10x better than Chrome :) It seems to be coming mostly from v8, I guess that we could do better with a lightweight JS engine alternative.

Re:Lightpanda: The headless browser designed for AI and auto... by Tostino on Friday January 24, 2025 @12:38PM (#42815456)
You may reduce ram, but also performance. A good JIT costs ram.
Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @12:57PM (#42815601)
Yes, that's true. It's a balance to find between RAM and speed.

I was thinking more on use cases that require to disable JIT anyway (WASM, iOS integration, security).

Re:Lightpanda: The headless browser designed for AI and auto... by Tostino on Friday January 24, 2025 @01:02PM (#42815636)
Yeah, could be nice to allow the user to select the type of ECMAScript engine that fits their use-case / performance requirements (balancing the resources available).
Re:Lightpanda: The headless browser designed for AI and auto... by cxr on Friday January 24, 2025 @11:30PM (#42819510)
If your target is consistent enough (perhaps even stationary), then at some point "JIT" means wasting CPU cycles.
Re:Lightpanda: The headless browser designed for AI and auto... by cush on Friday January 24, 2025 @03:14PM (#42816523)
> there are hundreds of Web APIs, and for now we just support some of them (DOM, XHR, Fetch)

> it's still ~10x better than Chrome

Do you expect it to stay that way once you've reached parity?

Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Saturday January 25, 2025 @10:03AM (#42822006)
I don't expect it to change a lot. All the main components are there, it's mainly a question of coverage now.
Re:Lightpanda: The headless browser designed for AI and auto... by nwienert on Friday January 24, 2025 @04:07PM (#42816943)
Playwright can run webkit very easily and it's dramatically less resource-intensive than Chrome.
Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @06:16PM (#42817875)
Yes but WebKit is not a browser per se, it's a rendering engine.

It's less resource-intensive than Chrome, but here we are talking orders of magnitude between Lightpanda and Chrome. If you are ~10x faster while using ~10x less RAM you are using ~100x less resources.

Re:Lightpanda: The headless browser designed for AI and auto... by bdhcuidbebe on Friday January 24, 2025 @08:13PM (#42818518)
How well does it compare to specialized headless scraper browsers, like camoufox (firefox based) or secret agent (chrome based)?

Either should reduce your ram usage compared to stock chrome by a lot.

Re:Lightpanda: The headless browser designed for AI and auto... by whatevaa on Saturday January 25, 2025 @05:31AM (#42820785)
Careful, as you implement misssing features your RAM usage might grow too. Happened to many projects, lean at the beggining, get's just as slow when dealing with real world mesiness.
Re:Lightpanda: The headless browser designed for AI and auto... by msoad on Saturday January 25, 2025 @07:19AM (#42821198)
Does it work nicely on Linux? I'm very curious about this
Re:Lightpanda: The headless browser designed for AI and auto... by radium3d on Friday January 24, 2025 @08:52PM (#42818690)
As a web developer and server manager AI trainers scraping websites with no throttle is the problem. lol
Re:Lightpanda: The headless browser designed for AI and auto... by niutech on Wednesday January 29, 2025 @06:14AM (#42863707)
How about using QuickJS instead of full-blown V8? For example, Elinks has support for SpiderMonkey, QuickJS, MuJS: https://github.com/rkd77/elinks/blob/master/doc/ecmascript.t... and takes a few MB of RAM.
Re:Lightpanda: The headless browser designed for AI and auto... by refulgentis on Friday January 24, 2025 @12:01PM (#42815086)
Generally, for consumer use cases, it's best to A) do it locally, preserving some of the original web contract B) run JS to get actual content C) post-process to reduce inference cost D) get latency as low as possible

Then, as the article points out, the Big Guns making the LLMs are a big use case for this because they get a 10x speedup and can begin contemplating running JS.

It sounds like the people you've talked to are in a messy middle: no incentive to improve efficiency of loading pages, simply because there's something else in the system that has a fixed cost to it.

I'm not sure why that would rule out improving anything else, it doesn't seem they should be stuck doing nothing other than flailing around for cheaper LLM inference.

> I think your ram usage benchmark is deceptive. I'd expect a minimal browser to have much lower peak memory usage than chrome on a minimal website.

I'm a bit lost, the ram usage benchmark says its ~10x less, and you feel its deceptive because you'd expect ram usage to be less? Steelmanning: 10% of Chrome's usage is still too high?

Re:Lightpanda: The headless browser designed for AI and auto... by JoelEinbinder on Friday January 24, 2025 @12:09PM (#42815163)
The benchmark shows lower ram usage on a very simple demo website. I expect that if the benchmark ran on a random set of real websites, ram usage would not be meaningfully lower than Chrome. Happy to be impressed and wrong if it remains lower.
Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @12:15PM (#42815229)
I believe it will be still significantly lower as we skip the graphical rendering.

But to validate that we need to increase our Web APIs coverage.

Re:Lightpanda: The headless browser designed for AI and auto... by szundi on Saturday January 25, 2025 @06:42AM (#42821064)
Then came deepseek
Re:Lightpanda: The headless browser designed for AI and auto... by sesm on Friday January 24, 2025 @11:30AM (#42814730)
Great job! And good luck on your journey!

One question: which JS engines did you consider and why you chose V8 in the end?

Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @11:41AM (#42814844)
We have also considered JavaScriptCore (used by Bun) and QuickJS. We did choose v8 because it's state of the art, quite well documented and easy to embed.

The code is made to support others JS engine in the future. We do want to add a lightweight alternative like QuickJS or Kiesel https://kiesel.dev/

Re:Lightpanda: The headless browser designed for AI and auto... by ksec on Friday January 24, 2025 @10:34PM (#42819242)
Thank You I was thinking of JSC and Bun as well. Was half expecting JSC since that combination seems to work well.
Re:Lightpanda: The headless browser designed for AI and auto... by toobulkeh on Friday January 24, 2025 @11:24AM (#42814673)
I’d love to see better optimized web socket support and “save” features that cache LLM queries to optimize fallback
Re:Lightpanda: The headless browser designed for AI and auto... by dtj1123 on Friday January 24, 2025 @11:30AM (#42814729)
Very nice. Does this / will this support the puppeteer-extra stealth plugin?
Re:Lightpanda: The headless browser designed for AI and auto... by katiehallett on Friday January 24, 2025 @11:43AM (#42814865)
Thanks! Right now no, but since we use the CDP (playwright, puppeteer), I guess it would be possible to support it
Re:Lightpanda: The headless browser designed for AI and auto... by bityard on Friday January 24, 2025 @12:48PM (#42815546)
Please put a priority on making it hard to abuse the web with your tool.

At a _bare_ minimum, that means obeying robot.txt and NOT crawling a site that doesn't want to be crawled. And there should not be an option to override that. It goes without saying that you should not allow users to make hundreds or thousands of "blind" parallel requests as these tend to have the effect of DoSing sites that are being hosted on modest hardware. You should also be measuring response times and throttling your requests accordingly. If a website issues a response code or other signal that you are hitting it too fast or too often, slow down.

I say this because since around the start of the new year, AI bots have been ravaging what's left of the open web and causing REAL stress and problems for admins of small and mid-sized websites and their human visitors: https://www.heise.de/en/news/AI-bots-paralyze-Linux-news-sit...

Re:Lightpanda: The headless browser designed for AI and auto... by gkbrk on Friday January 24, 2025 @01:49PM (#42815962)
Please don't.

Software I installed on my computer needs to the what I want as the user. I don't want every random thing I install to come with DRM.

The project looks useful, and if it ends up getting popular I imagine someone would make a DRM-free version anyway.

Re:Lightpanda: The headless browser designed for AI and auto... by tossandthrow on Friday January 24, 2025 @01:53PM (#42816001)
Where do you read DRM?

Parent commenter merely and humbly asks the author of the library to make sure that it has sane defaults and support for ethical crawling.

I find it disturbing that you would recommend against that.

Re:Lightpanda: The headless browser designed for AI and auto... by gkbrk on Friday January 24, 2025 @01:58PM (#42816030)
Here's what the parent comment wrote.

> And there should not be an option to override that.

This is not just a sane default. This is software telling you what you are allowed to do based on what the rights owner wants, literally DRM.

This is exactly like Android not allowing screenshots to be taken in certain apps because the rights owner didn't allow it.

Re:Lightpanda: The headless browser designed for AI and auto... by JambalayaJimbo on Friday January 24, 2025 @03:56PM (#42816851)
This is software telling you what you are allowed to do based on what the software developer wants* (assuming the developers cares of course...). Which is how all software works. I would not want my users of my software doing anything malicious with it, so I would not give them the option.

If I create an open-source messaging app I am also not going to give users the option of clicking a button to spam recipients with dick pics. Even if it was dead-simple for a determined user to add code for this dick pic button themselves.

Re:Lightpanda: The headless browser designed for AI and auto... by blacksmith_tb on Friday January 24, 2025 @02:33PM (#42816247)
Not sure what "digital rights" that "manages"? I don't see it as an unreasonable suggestion that the tool shouldn't be set up out of the box to DoS sites it's scraping, that doesn't prevent anyone who is technical enough to know what they're doing to fork it and remove whatever limits are there by default? I can't see it as a "my computer should do what I want!" issue, if you don't like how this package works, change it or use another?
Re:Lightpanda: The headless browser designed for AI and auto... by benatkin on Friday January 24, 2025 @05:45PM (#42817655)
Digital Restrictions Management, then. Have it your way.
Re:Lightpanda: The headless browser designed for AI and auto... by concerndc1tizen on Saturday January 25, 2025 @07:09AM (#42821168)
There are so many combative people on HackerNews lately who insist to misinterpret everything.

I really wonder if it's bots or just assholes.

Re:Lightpanda: The headless browser designed for AI and auto... by cies on Saturday January 25, 2025 @08:15AM (#42821462)
Indeed DRM is a very different thing from adhering to standards like `robots.txt` as a default out of the box (there could still be a documented option to ignore it).
Re:Lightpanda: The headless browser designed for AI and auto... by concerndc1tizen on Saturday January 25, 2025 @08:17AM (#42821470)
- That's just like, your opinion, man

He was using DRM as a metaphor for restricted software. And advocating that software should do whatever the user wants. If the user is ignorant about the harm the software does, then adding robots.txt support is win-win for all. But if the user doesn't want it, then it's political, in the same way that DRM is political and anti-user.

Re:Lightpanda: The headless browser designed for AI and auto... by concerndc1tizen on Saturday January 25, 2025 @07:12AM (#42821175)
> I find it disturbing

Oh no, someone on the internet found something offensive!

Re:Lightpanda: The headless browser designed for AI and auto... by tossandthrow on Saturday January 25, 2025 @12:15PM (#42822947)
Disturbing, not offensive - it is literally right there in the quote you have been so nice to pass along.
Re:Lightpanda: The headless browser designed for AI and auto... by bityard on Friday January 24, 2025 @02:24PM (#42816195)
I feel like you may have a misunderstanding of what DRM is. Talking about DRM outside the context of media distribution doesn't really make any sense.

Yes, someone can fork this and modify it however they want. They can already do the same with curl, Firefox, Chromium, etc. The point is that this is project is deliberately advertising itself as an AI-friendly web scraper. If successful, lots of people who don't know any better are going to download it and deploy it without a full understanding (and possibly caring) of the consequences on the open web. And as I already point out, this is not hypothetical, it is already happening. Right now. As we speak.

Do you want cloudflare everywhere? This is how you get cloudflare everywhere.

My plea for the dev is that they choose to take the high road and put web-server-friendly SANE DEFAULTS in place to curb the bulk of abusive web scraping behavior to lessen the number of gray hairs it causes web admins like myself. That is all.

Re:Lightpanda: The headless browser designed for AI and auto... by randunel on Friday January 24, 2025 @04:28PM (#42817082)
It's exactly DRM, management of legal access to digital content. The "media" part has been optional for decades.

The comment they replied to didn't suggest sane defaults, but DRM. Here's the quote, no defaults work that way (inability to override):

> At a _bare_ minimum, that means obeying robot.txt and NOT crawling a site that doesn't want to be crawled. And there should not be an option to override that.

Re:Lightpanda: The headless browser designed for AI and auto... by samatman on Friday January 24, 2025 @05:49PM (#42817684)
I'll also add something that I expect to be somewhat controversial, given earlier conversations on HN[0]: I see contexts in which it would be perfectly valid to use this and ignore robots.txt.

If I were directing some LLM agent to specifically access a site on my behalf, and get a usable digest of that information to answer questions, or whever, that use of the headless browser is not a spider, it's a user agent. Just an unusual one.

The amount of traffic generated is consistent with browsing, not scraping. So no, I don't think building in a mandatory robots.txt respecter is a reasonable ask. Someone who wants to deploy it at scale while ignoring robots.txt is just going to disable that, and it causes problems for legitimate use cases where the headless browser is not a robot in any reasonable or normal interpretation of the term.

[0]: I don't entirely understand why this is controversial, but it was.

Re:Lightpanda: The headless browser designed for AI and auto... by benatkin on Friday January 24, 2025 @05:49PM (#42817693)
> Talking about DRM outside the context of media distribution doesn't really make any sense.

It’s a cultural thing, and it makes a lot of sense. This fits with DRM culture that has walled gardens in iOS and Android.

Re:Lightpanda: The headless browser designed for AI and auto... by calvinmorrison on Saturday January 25, 2025 @10:55AM (#42822351)
i still wont forgive libtorrent for not implementing sequential access.

and also, xpdf for implementing the "you cant select text" feature

Re:Lightpanda: The headless browser designed for AI and auto... by GuB-42 on Saturday January 25, 2025 @11:54AM (#42822787)
Who told you about DRM? It is an open source tool.

Simply requiring a code change and a rebuild is enough of a barrier to prevent rude behavior from most people. You won't stop competent malicious actors but you can at least encourage good behavior. If popular, someone will make a fork but having the original refuse to do stuff that are deemed abusive sends a message.

It is like for the Flipper Zero. The original version does not let you access frequency bands that are illegal in some countries, and anything involving jamming is highly frowned upon. Of course, there are forks that let you do these things, but the simple fact that you need to go out of your way to find these should tell you it is not a good idea.

Re:Lightpanda: The headless browser designed for AI and auto... by benatkin on Friday January 24, 2025 @05:50PM (#42817710)
Make it faster and furiouser.

There are so many variables involved that it’s hard to predict what it will mean for the open web to have a faster alternative to headless Chrome. At least it isn’t controlled by Google directly or indirectly (Mozilla’s funding source) or Apple.

Re:Lightpanda: The headless browser designed for AI and auto... by cchance on Friday January 24, 2025 @09:33PM (#42818942)
Its literally open source, any effort put into hamstringing it would just be forked and removed lol
Re:Lightpanda: The headless browser designed for AI and auto... by xena on Friday January 24, 2025 @11:13PM (#42819438)
Any barrier to abuse makes abuse harder.
Re:Lightpanda: The headless browser designed for AI and auto... by cchance on Saturday January 25, 2025 @08:40PM (#42826892)
Not really lol, literally if you add a robots.txt check someone can just create a fork repo with a git action that escapes that routine every time the original is pushed... Adding options for filter and respecting things is great even as defaults, but trying to force "good behavior" tends to just lead to people setting up a workaround that everyone eventually uses because why use the hamstrung version instead of the open version and make your own choices.
Re:Lightpanda: The headless browser designed for AI and auto... by MichaelMoser123 on Friday January 24, 2025 @11:48PM (#42819586)
That would make it impossible to use this as a testing tool. How should automatic testing of web applications work, if you obey all of these rules? There is also the problem of load testing. This kind of stuff is by its nature of dual use, a load test is also a kind of DDOS attack.
Re:Lightpanda: The headless browser designed for AI and auto... by holoduke on Saturday January 25, 2025 @01:18AM (#42819872)
In 10 lines of code I could create a proxy tool that removes all your suggested guidelines so the scraper still operates. In other words. Not really helping.
Re:Lightpanda: The headless browser designed for AI and auto... by internet_points on Saturday January 25, 2025 @08:37AM (#42821560)
Yes! Having long time ago done some minor web scraping, I did not put any work at all into following robots.txt, simply because it seemed like a hassle and I thought "meh it's not that much traffic is it and boss wants this done yesterday". But if the tool defaulted to following robots.txt I certainly wouldn't have minded, it would have caused me to get less noise and my tool to behave better.

Also, throttling requests and following robots.txt actually makes it less likely that your scraper will be blocked, so even for those who don't care about the ethics, it's a good thing to have ethical defaults.

Re:Lightpanda: The headless browser designed for AI and auto... by andrethegiant on Saturday January 25, 2025 @01:10PM (#42823348)
This is why I’m making crawlspace.dev, a crawling PaaS that respects robots.txt, implements proper caching, etc by default.
Re:Lightpanda: The headless browser designed for AI and auto... by hombre_fatal on Saturday January 25, 2025 @10:33AM (#42822191)
This is HN virtue signaling. Some fringe tool that ~nobody uses is held to a different, weird standard and must be the one to kneecap itself with a pointless gesture and a fake ethical burden.

The comparison to DRM makes sense. Gimping software to disempower the end user based on the desires of content publishers. There's even probably a valid syllogism that could make you bite the bullet on browsers forcing you to render ads.

Re:Lightpanda: The headless browser designed for AI and auto... by buzzerbetrayed on Saturday January 25, 2025 @12:17PM (#42822965)
Nerfing developer tools to save the "open web" is such a fucking backward argument.
Re:Lightpanda: The headless browser designed for AI and auto... by bsnnkv on Saturday January 25, 2025 @12:33PM (#42823085)
Looking at the responses here, I'm glad I just chose to paywall to protect against LLM training data collection crawling abuse.[1]

[1]: https://lgug2z.com/articles/in-the-age-of-ai-crawlers-i-have...

Re:Lightpanda: The headless browser designed for AI and auto... by mpalmer on Saturday January 25, 2025 @02:52PM (#42824195)
If it's already a problem, nothing this developer does will improve it, including crippling their software and removing arguably legitimate use cases.
Re:Lightpanda: The headless browser designed for AI and auto... by afk1914 on Friday January 24, 2025 @01:24PM (#42815780)
I am curious how Lightpanda compares to chrome-headless-shell ({headless: 'shell'} in Puppeteer) in benchmarks.
Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @01:45PM (#42815931)
We did not run benchmarks with chrome-headless-shell (aka the old headless mode) but I guess that performance wise it's on the same scale as the new headless mode.
Re:Lightpanda: The headless browser designed for AI and auto... by xena on Friday January 24, 2025 @01:37PM (#42815872)
How do I make sure that people can't use lightpanda to bypass bot protection tools?
Re:Lightpanda: The headless browser designed for AI and auto... by dolmen on Monday January 27, 2025 @06:47AM (#42840044)
One of Lightpanda's goals is to ease building bots.
Re:Lightpanda: The headless browser designed for AI and auto... by danielsht on Friday January 24, 2025 @04:24PM (#42817053)
Very impressive! At Airtop.ai we looked into lightweight browsers like this one since we run a huge fleet of cloud browsers but found that anything other than a non-headless Chromium based browser would trigger bot detection pretty quickly. Even spoofing user agents triggers bot detection because fingerprinting tools like FingerprintJS will use things like JS features, canvas fingerprinting, WebGL fingerprinting, font enumeration, etc.

Can you share if you've looked into how your browser fares against bot detection tools like these?

Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @04:46PM (#42817232)
Thanks! No we haven't worked on bot detection.
Re:Lightpanda: The headless browser designed for AI and auto... by 867-5309 on Friday January 24, 2025 @08:06PM (#42818490)
does this work with selenium/chromedriver?
Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Friday January 24, 2025 @08:08PM (#42818497)
For now we just support CDP. But Selenium is definitely in our roadmap.
Re:Lightpanda: The headless browser designed for AI and auto... by keepamovin on Friday January 24, 2025 @09:07PM (#42818771)
If you support Page.startScreencast or even just capture screenshot we could experiment with using this as a backend for BrowserBox, when lightpanda matures. Cool stuff!

https://github.com/BrowserBox/BrowserBox/

Re:Lightpanda: The headless browser designed for AI and auto... by returnofzyx on Saturday January 25, 2025 @04:13AM (#42820506)
Hi. Can I embed this as library? Is there C API exposed? I can't seem to find any documentation. I'd prefer this to a CDP server.
Re:Lightpanda: The headless browser designed for AI and auto... by fbouvier on Saturday January 25, 2025 @05:01AM (#42820685)
Not now but we might do it in the future. It's easy to export a Zig project as a C ABI library.
Re:Lightpanda: The headless browser designed for AI and auto... by returnofzyx on Saturday January 25, 2025 @08:50AM (#42821631)
Oh please do. I'm sure there are many people like me who want this.
Re:Lightpanda: The headless browser designed for AI and auto... by niutech on Wednesday January 29, 2025 @06:08AM (#42863671)
Congratulations! But does it support Google Account login? And ReCAPTCHA?