← All writing

Developer Tools

Lightpanda PandaScript: Pay the LLM Only Once

Mani G 3 min read

Ink and watercolor sketch of a red panda explorer reading a notebook in a hedge maze, beside a paper scroll showing the route as a dotted line.

Most browser agents share the same expensive habit. Every click, every scroll, every "now find the login button" is another trip to a language model. Run the same task tomorrow and you pay again, and maybe the model picks a different button this time. Lightpanda's PandaScript takes a different view that I think is just correct: use the LLM once to figure the task out, then save the answer as plain code.

Lightpanda in one paragraph

Lightpanda is an open-source headless browser written from scratch in Zig. It's not a Chromium fork or a WebKit patch, and it skips the full graphical rendering pipeline that a desktop browser needs, which is where much of the speed comes from. The project's current benchmark crawls 933 JavaScript-dependent demo pages over the network from an AWS m5.large machine. Across 100 pages it reports 123 MB of peak memory against 2 GB for headless Chrome, and 5 seconds against 46. That's roughly 16 times less memory and 9 times faster. An earlier local benchmark from the team claimed 11 times faster and 9 times less memory, which is probably where the "9x to 11x" figure people quote comes from. Either way, vendor numbers, so test your own pages.

What PandaScript does

Lightpanda launched its agent mode and PandaScript in June 2026, with a slogan I wish I'd written: LLM at buildtime, not runtime. You run lightpanda agent, describe a task in plain English, and the built-in agent drives the browser with whatever model you've configured. When it's done, /save exports the session as a PandaScript file. From then on, lightpanda run script.js replays it with no model at all.

A PandaScript is vanilla JavaScript with a small set of browser primitives. You create a page with new Page(), await page.goto(url), then call methods like extract, click and fill. There's no Node.js, no npm, no Puppeteer, no separate Chrome process. The script runs in its own V8 context inside the Lightpanda binary and calls the engine directly, without going over CDP, the Chrome DevTools Protocol that Puppeteer and Playwright use. The team chose that on purpose: no wire protocol means no serialization on every click.

A quick example

Say you want the top three Hacker News stories and the best three comments on each, every morning. On day one, you ask the agent in English. It pokes around, finds the right selectors, and you save the result. The file is about twenty lines: go to the front page, extract rows matching tr.athing with a limit of three, then loop over the stories, visiting each thread and extracting comments inside a try/catch. On day two and every day after, a cron job runs that file. Same output, no tokens, no API key.

Lightpanda's own comparison claims a login flow runs 14 times faster than Puppeteer on Chrome, startup included, and a news-monitoring task uses four times less memory than Playwright. Again, their numbers, and I'd like to see someone independent repeat them.

Where it falls short

Determinism cuts both ways. When the site redesigns its HTML, your script breaks exactly like an old Selenium test, and you need the agent again to write a new one. I still prefer that. A broken script fails loudly, while a model improvising at runtime can fail quietly and confidently.

If Lightpanda's Zig approach interests you, compare it with Obscura, which bets on Rust and full CDP compatibility instead. One small surprise to end on: Lightpanda is licensed under the AGPL, which is worth a chat with your legal team before you bake it into a hosted product. Would you rather debug a broken script or a confused agent?