Skip to content

Add core concepts section#74

Open
cdebled wants to merge 5 commits into
mainfrom
add-core-concepts-section
Open

Add core concepts section#74
cdebled wants to merge 5 commits into
mainfrom
add-core-concepts-section

Conversation

@cdebled

@cdebled cdebled commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Adds a new "Core concepts" section with four explanation pages:

  • What is Lightpanda — what Lightpanda is, why it's built from scratch instead of forking Chrome/Blink/WebKit, and how it fits into a browser automation stack.
  • Architecture overview — how the layers fit together: from the control surface (CDP, agent, MCP) to the browser engine (V8, Web APIs, HTML parser, network layer)
  • Benchmarks — Lightpanda's three published benchmarks against headless Chrome (crawling, page automation, AI agent workloads).
  • When to use local vs cloud — how to decide between running Lightpanda locally vs on Lightpanda Cloud, comparing CDP, MCP, agent, HTTP API, proxy, and telemetry coverage across both.

Registers the new section and pages in _meta.ts.


## How Lightpanda solves it

Lightpanda drops the graphical rendering engine entirely and rebuilds the rest around automation: JavaScript execution, the DOM, and the Web APIs a script needs. The result is around 9x faster execution and 16x less peak memory than headless Chrome.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to benchmarks section in docs.


<Callout type="warning">
Lightpanda is fast, so it is easy to send a high volume of requests. Respect
`robots.txt` and avoid hammering small sites. Pass `--obey-robots` to have

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds odd. Avoid sending high volume to small sites?


Lightpanda publishes three benchmarks against headless Chrome:

- **Crawling at scale**: following every link on a 933-page demo site.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add links to the sub sections in the article here to make it easy to jump to the relevant section


The agent-oriented modes stack the same engine under different amounts of the browser. With `serve`, your client drives the engine over CDP. With `mcp`, the binary also carries the tool server. With `agent`, it carries the whole loop, so no protocol sits between the model and the engine.

![The browser agent stack: model, harness, browser driver, and engine layers across lightpanda serve, mcp, and agent, showing what the single binary covers in each mode](https://cdn.lightpanda.io/website/assets/images/blog/posts/the-browser-agent-stack-explained/browser-agent-stack-diagram-2.svg)

@cdebled cdebled Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krichprollsch is it ok to re-use the url of this image that is already in the CDN?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is

unit each browser scales with.
</Callout>

| Parallel tabs/processes | Lightpanda duration | Lightpanda memory peak | Chrome duration | Chrome memory peak |

@cdebled cdebled Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krichprollsch add this graph?

more understandable than the table

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can :)


The stack, top to bottom:

```

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krichprollsch would you find it useful to change this 'text diagram' into an image? how to add the image then?


## The problem with Chrome for automation

Most browser automation today runs on headless Chrome, through tools like Puppeteer or Playwright. Headless Chrome still computes graphical output, even though nothing renders it to a screen. Running hundreds or thousands of instances is heavy on RAM and CPU, and instances need frequent restarts to stay stable. That overhead exists because Chrome was built for a human sitting in front of a monitor, not for a script driving it at scale.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also say something about CDP's inefficiency with a link to https://4083bc9b.website-5jk.pages.dev/blog/posts/cdp-under-the-hood#example-2-the-coordinate-problem


- **CDP**: [Puppeteer](https://pptr.dev/), [Playwright](https://playwright.dev/), and [Chromedp](https://github.com/chromedp/chromedp) connect to it the same way they connect to Chrome. Point the client at Lightpanda's endpoint and keep your existing scripts.
- **MCP**: control the browser from AI applications over the [Model Context Protocol](https://modelcontextprotocol.io).
- **HTTP API**: retrieve results directly over HTTP, without writing or running a CDP script.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's only in cloud env, should we point that?


<Callout type="info">
Because Lightpanda does not render, it does not compute visual layout. APIs
that depend on pixel geometry (for example element bounding boxes) return

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly, we have kind of bounding boxes emulation, see https://4083bc9b.website-5jk.pages.dev/blog/posts/cdp-under-the-hood#how-we-handle-coordinates-in-lightpanda

But is has been improved, and now we take care of box visibility, CSS and HTML attributes to compute the element size. https://github.com/lightpanda-io/browser/blob/main/src/browser/webapi/Element.zig#L1249-L1280

So I wouldn't say it's a best effort value, but a fair approximation :)

What we really simulate and which is far for reality is box positioning https://github.com/lightpanda-io/browser/blob/main/src/browser/webapi/Element.zig#L1459-L1503

| `src/browser/` | Browser, Session, Page, Frame |
| `src/browser/js/` | The Browser's JavaScript engine, a V8 isolate (thin wrappers over the V8 C++ API) |
| `src/browser/webapi/` | Inside each Page and Frame: the Web APIs and the DOM |
| `src/browser/parser/` | Inside each Page and Frame: the HTML parser (html5ever, Rust) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it's relevant/useful

- [`serve`](/run-locally/commands/serve) starts a WebSocket CDP server. Clients like [Puppeteer](/usage/cdp/puppeteer), [Playwright](/usage/cdp/playwright), and [chromedp](/usage/cdp/chromedp) connect over the Chrome DevTools Protocol on port `9222` by default. This is the mode most automation uses.
- [`fetch`](/run-locally/commands/fetch) loads one or more URLs and dumps the result to stdout as HTML or Markdown. It is a one-shot command with no server.
- [`agent`](/usage/agent) starts an interactive AI agent that browses the web from natural language and can record reproducible scripts.
- [`mcp`](/usage/mcp) starts a Model Context Protocol server over stdio, so an LLM host can use the browser as a tool.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be over HTTP also now.


**JavaScript engine.** Lightpanda runs page scripts on V8 and does not reimplement JavaScript. The Zig code in `src/browser/js/` is a thin wrapper around V8's C++ API: isolates, contexts, values, promises, and modules. The Web API objects that scripts touch are implemented in Zig, so `document`, `window`, and `fetch` are backed by native code, not more JavaScript. Startup is fast because of a V8 startup snapshot: a serialized, pre-initialized V8 heap embedded in the binary at build time. On each start V8 loads it instead of rebuilding its built-in objects from scratch, which removes most of the isolate warm-up cost.

**Web APIs and the DOM.** These are implemented natively in Zig, grouped by area: the DOM (`Document`, `Element`, `Node`), events, `fetch` and networking, `Crypto`, observers (mutation, intersection, resize), and storage. Coverage is partial and grows over time. Lightpanda implements the APIs headless automation exercises, not the entire web platform. The source of truth for what exists is `src/browser/webapi/` in the browser repository. When a script calls one of these APIs it runs compiled Zig, which is why DOM-heavy pages stay cheap in both time and memory.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about linking https://perf.lightpanda.io/wpt to illustrate the coverage?

Lightpanda follow `robots.txt` for you.
</Callout>

## Memory model

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the praragraph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants