From 0ee76f05a307c3b1a9e0da0c66feb3366e00c9bc Mon Sep 17 00:00:00 2001 From: Celine Debled Date: Thu, 6 Aug 2026 14:43:18 +0200 Subject: [PATCH 1/7] Add Playground page for Lightpanda Cloud --- src/content/run-on-lightpanda-cloud/_meta.ts | 1 + .../run-on-lightpanda-cloud/playground.mdx | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 src/content/run-on-lightpanda-cloud/playground.mdx diff --git a/src/content/run-on-lightpanda-cloud/_meta.ts b/src/content/run-on-lightpanda-cloud/_meta.ts index a500e94..62ba41c 100644 --- a/src/content/run-on-lightpanda-cloud/_meta.ts +++ b/src/content/run-on-lightpanda-cloud/_meta.ts @@ -2,6 +2,7 @@ import type { MetaRecord } from 'nextra' const meta: MetaRecord = { 'getting-started': 'Getting started', + playground: 'Playground', 'limits-and-billing': 'Limits and billing', } diff --git a/src/content/run-on-lightpanda-cloud/playground.mdx b/src/content/run-on-lightpanda-cloud/playground.mdx new file mode 100644 index 0000000..558d681 --- /dev/null +++ b/src/content/run-on-lightpanda-cloud/playground.mdx @@ -0,0 +1,109 @@ +--- +title: Playground +description: Write and run browser automation scripts from the Lightpanda Cloud console, with Puppeteer and Playwright preinstalled and no local setup. +--- + +import { Tabs, Callout } from 'nextra/components' + +# Playground + +The playground is a code editor in the console that runs your automation scripts on Lightpanda Cloud. You write JavaScript or TypeScript, pick the browser and region to run against, and read the output on the same screen. Nothing runs on your machine. + +## Write and run a script + +Open [Scripts](https://console.lightpanda.io/playground/scripts) under Playground in the console and create one. The editor opens on the Playwright example below. Both clients reach your cloud browser through `CDP_WS_URL`, and both examples work unchanged in either language: + + + +```js copy +import { chromium } from 'playwright-core'; + +// Connect Playwright's chromium driver to the browser. +const browser = await chromium.connectOverCDP(process.env.CDP_WS_URL); + +const context = await browser.newContext({}); +const page = await context.newPage(); + +await page.goto('https://wikipedia.com/'); + +const title = await page.locator('h1').textContent(); +console.log(title); + +await page.close(); +await context.close(); +await browser.close(); +``` + + +```js copy +import puppeteer from 'puppeteer-core'; + +// Connect Puppeteer to the browser. +const browser = await puppeteer.connect({ + browserWSEndpoint: process.env.CDP_WS_URL, +}); + +const context = await browser.createBrowserContext(); +const page = await context.newPage(); + +await page.goto('https://wikipedia.com/'); + +const title = await page.$eval('h1', el => el.textContent); +console.log(title); + +await page.close(); +await context.close(); +await browser.disconnect(); +``` + + + +Name the script, set the language to JavaScript or TypeScript in the Settings panel, then select Run script. The Output tab fills in as the run proceeds, with anything your script writes to stderr shown in red. Edits are saved as you type, so a script you leave is there when you come back. + +## Connect with CDP_WS_URL + +Your script never carries a token. The playground sets one environment variable, `CDP_WS_URL`, which holds the WebSocket address your client uses to reach the browser over the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP). The playground assembles it from the choices in the Default variables panel: + +| Variable | Values | What it controls | +| --- | --- | --- | +| Region | `euwest`, `uswest` | Which region serves the browser | +| Token | one of your active tokens | Which token the run authenticates with | +| Browser | `lightpanda`, `chrome` | Which browser runs. Chrome is for debugging, not production traffic | +| Proxy | one of your proxies, or none | The outbound IP the browser uses | + +Pass `process.env.CDP_WS_URL` to whichever client you use. With Playwright that is `chromium.connectOverCDP`, and with Puppeteer it is the `browserWSEndpoint` option. + + +`console.log(process.env.CDP_WS_URL)` prints `***`, not the URL. The URL carries an access token created for the run, and run output is stored in the console, so the playground masks the URL wherever it appears in output. + + +## What the runtime provides + +Scripts run in an isolated container. Both CDP clients are preinstalled at fixed versions, so there is no install step: + +| Package | Version | +| --- | --- | +| `playwright-core` | 1.50.0 | +| `puppeteer-core` | 24.0.0 | + +The rest of the environment is fixed too: + +- **Language.** JavaScript and TypeScript both run through [tsx](https://tsx.is/), so `import` syntax and top-level `await` work in either without configuration. +- **Packages.** You cannot install anything beyond the two clients above. +- **Filesystem.** Read-only, apart from a writable `/tmp`. + +Every run is capped: + +| Limit | Value | +| --- | --- | +| Run time | 5 minutes | +| Memory | 256 MB | +| CPU | 1 core | +| Output captured | 256 KB | +| Processes | 64 | + +A run that reaches 5 minutes stops and reports `timeout running program`. Output beyond 256 KB is dropped, and the run is flagged as truncated. + +## Review past runs + +Every run is kept. [Runs](https://console.lightpanda.io/playground/script-runs) under Playground lists them with their state, start time, and duration, and you can filter the list by script. Open a run to read the output it produced. From eb86de6a09479e63ce603f3c69ed57767e07c3e9 Mon Sep 17 00:00:00 2001 From: Celine Debled Date: Thu, 6 Aug 2026 15:10:07 +0200 Subject: [PATCH 2/7] Point to the playground from the cloud getting started page --- src/content/run-on-lightpanda-cloud/getting-started.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/run-on-lightpanda-cloud/getting-started.mdx b/src/content/run-on-lightpanda-cloud/getting-started.mdx index 40d66b0..8e11928 100644 --- a/src/content/run-on-lightpanda-cloud/getting-started.mdx +++ b/src/content/run-on-lightpanda-cloud/getting-started.mdx @@ -27,6 +27,8 @@ Connect to the region nearest your script. The snippets below all use `euwest`: - `wss://euwest.cloud.lightpanda.io/ws` (west Europe) - `wss://uswest.cloud.lightpanda.io/ws` (west US) +Prefer not to run it locally either? The [playground](/run-on-lightpanda-cloud/playground) keeps the script in the console and runs it there against a cloud browser. + The raw endpoint every CDP client connects to: From 87d3db7471c4b2809fe0e840aaa3d7de82916a55 Mon Sep 17 00:00:00 2001 From: Celine Debled Date: Thu, 6 Aug 2026 16:04:32 +0200 Subject: [PATCH 3/7] Note the playground connection variable on the Puppeteer and Playwright pages --- src/content/usage/cdp/playwright.mdx | 2 ++ src/content/usage/cdp/puppeteer.mdx | 1 + 2 files changed, 3 insertions(+) diff --git a/src/content/usage/cdp/playwright.mdx b/src/content/usage/cdp/playwright.mdx index a214173..b7a80b3 100644 --- a/src/content/usage/cdp/playwright.mdx +++ b/src/content/usage/cdp/playwright.mdx @@ -61,6 +61,8 @@ await context.close(); await browser.close(); ``` +In the [playground](/run-on-lightpanda-cloud/playground), the console builds this URL for you and exposes it as `CDP_WS_URL`. Pass `process.env.CDP_WS_URL` to `connectOverCDP` there, since `LPD_TOKEN` does not exist in that runtime. + ## Cloud options ### Endpoints diff --git a/src/content/usage/cdp/puppeteer.mdx b/src/content/usage/cdp/puppeteer.mdx index c0725db..380b4ab 100644 --- a/src/content/usage/cdp/puppeteer.mdx +++ b/src/content/usage/cdp/puppeteer.mdx @@ -67,6 +67,7 @@ await context.close() await browser.disconnect() ``` +In the [playground](/run-on-lightpanda-cloud/playground), the console builds this URL for you and exposes it as `CDP_WS_URL`. Pass `process.env.CDP_WS_URL` to `browserWSEndpoint` there, since `LPD_TOKEN` does not exist in that runtime. ## Cloud options From 32364e4cd677ad5b631d52838a8fd5b8e809bcbf Mon Sep 17 00:00:00 2001 From: Celine Debled Date: Thu, 6 Aug 2026 16:13:01 +0200 Subject: [PATCH 4/7] Note that playground runs count toward plan limits --- src/content/run-on-lightpanda-cloud/limits-and-billing.mdx | 2 ++ src/content/run-on-lightpanda-cloud/playground.mdx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx b/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx index b3e4324..d7b63f5 100644 --- a/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx +++ b/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx @@ -27,6 +27,8 @@ Upgrade, download invoices, or cancel from the [billing page](https://console.li **Concurrent sessions** are the sessions open at one instant. This limit is about parallelism, not total volume: a plan's concurrency cap still lets you run many sessions a day, as long as no more than that cap overlap at once. +Sessions opened from the [playground](/run-on-lightpanda-cloud/playground) are ordinary sessions, so they count toward both limits. + ## When you reach a limit If you open more sessions than your concurrency limit allows, the extra sessions are rejected with HTTP `429 Too Many Requests`. Retry once a running session ends, or upgrade for more concurrency. diff --git a/src/content/run-on-lightpanda-cloud/playground.mdx b/src/content/run-on-lightpanda-cloud/playground.mdx index 558d681..d7b13c5 100644 --- a/src/content/run-on-lightpanda-cloud/playground.mdx +++ b/src/content/run-on-lightpanda-cloud/playground.mdx @@ -104,6 +104,8 @@ Every run is capped: A run that reaches 5 minutes stops and reports `timeout running program`. Output beyond 256 KB is dropped, and the run is flagged as truncated. +These caps apply to the script process. The browser it drives is an ordinary cloud session, so it also counts toward your [plan limits](/run-on-lightpanda-cloud/limits-and-billing). + ## Review past runs Every run is kept. [Runs](https://console.lightpanda.io/playground/script-runs) under Playground lists them with their state, start time, and duration, and you can filter the list by script. Open a run to read the output it produced. From 8b43ceaa470d4947cfc256c4b57182f923cb6eed Mon Sep 17 00:00:00 2001 From: Celine Debled Date: Fri, 7 Aug 2026 13:57:02 +0200 Subject: [PATCH 5/7] Adapt the playground cross-references to the reworked cloud pages --- src/content/run-on-lightpanda-cloud/getting-started.mdx | 5 ++--- src/content/run-on-lightpanda-cloud/limits-and-billing.mdx | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/content/run-on-lightpanda-cloud/getting-started.mdx b/src/content/run-on-lightpanda-cloud/getting-started.mdx index 8e11928..05c0035 100644 --- a/src/content/run-on-lightpanda-cloud/getting-started.mdx +++ b/src/content/run-on-lightpanda-cloud/getting-started.mdx @@ -27,8 +27,6 @@ Connect to the region nearest your script. The snippets below all use `euwest`: - `wss://euwest.cloud.lightpanda.io/ws` (west Europe) - `wss://uswest.cloud.lightpanda.io/ws` (west US) -Prefer not to run it locally either? The [playground](/run-on-lightpanda-cloud/playground) keeps the script in the console and runs it there against a cloud browser. - The raw endpoint every CDP client connects to: @@ -103,9 +101,10 @@ The cloud serves Lightpanda by default. For debugging, append `browser=chrome` t The same URL takes a `proxy` parameter to route the session through a shared proxy, or through one you added on the [proxies page](https://console.lightpanda.io/proxies) in the console. -## Other features: HTTP API and MCP +## Other features: playground, HTTP API and MCP The cloud also exposes: +- a **[playground](/run-on-lightpanda-cloud/playground)** to write and run a script from the console, with no local setup at all. - an **[HTTP API](/usage/api)** to fetch a page's HTML or Markdown in a single request, with no CDP script. - an **[MCP](/usage/mcp)** server to drive the browser from AI applications over the Model Context Protocol. diff --git a/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx b/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx index d7b63f5..71b80ba 100644 --- a/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx +++ b/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx @@ -27,7 +27,7 @@ Upgrade, download invoices, or cancel from the [billing page](https://console.li **Concurrent sessions** are the sessions open at one instant. This limit is about parallelism, not total volume: a plan's concurrency cap still lets you run many sessions a day, as long as no more than that cap overlap at once. -Sessions opened from the [playground](/run-on-lightpanda-cloud/playground) are ordinary sessions, so they count toward both limits. +Both apply however you open the session: over CDP, MCP, the HTTP API, or from the playground. ## When you reach a limit From 2a0dd013cab6dddc5043555834e72a3655c8b57f Mon Sep 17 00:00:00 2001 From: Celine Debled Date: Fri, 7 Aug 2026 13:57:02 +0200 Subject: [PATCH 6/7] Trim the playground page: drop the UI walkthrough and duplicated explanations --- src/content/run-on-lightpanda-cloud/playground.mdx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/content/run-on-lightpanda-cloud/playground.mdx b/src/content/run-on-lightpanda-cloud/playground.mdx index d7b13c5..807efff 100644 --- a/src/content/run-on-lightpanda-cloud/playground.mdx +++ b/src/content/run-on-lightpanda-cloud/playground.mdx @@ -7,11 +7,11 @@ import { Tabs, Callout } from 'nextra/components' # Playground -The playground is a code editor in the console that runs your automation scripts on Lightpanda Cloud. You write JavaScript or TypeScript, pick the browser and region to run against, and read the output on the same screen. Nothing runs on your machine. +The playground is a code editor in the console that runs your automation scripts on Lightpanda Cloud. ## Write and run a script -Open [Scripts](https://console.lightpanda.io/playground/scripts) under Playground in the console and create one. The editor opens on the Playwright example below. Both clients reach your cloud browser through `CDP_WS_URL`, and both examples work unchanged in either language: +Open [Scripts](https://console.lightpanda.io/playground/scripts) under Playground in the console and create one. The editor opens on the Playwright example below: @@ -58,20 +58,18 @@ await browser.disconnect(); -Name the script, set the language to JavaScript or TypeScript in the Settings panel, then select Run script. The Output tab fills in as the run proceeds, with anything your script writes to stderr shown in red. Edits are saved as you type, so a script you leave is there when you come back. - ## Connect with CDP_WS_URL Your script never carries a token. The playground sets one environment variable, `CDP_WS_URL`, which holds the WebSocket address your client uses to reach the browser over the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP). The playground assembles it from the choices in the Default variables panel: -| Variable | Values | What it controls | +| Default variable | Values | What it controls | | --- | --- | --- | | Region | `euwest`, `uswest` | Which region serves the browser | | Token | one of your active tokens | Which token the run authenticates with | | Browser | `lightpanda`, `chrome` | Which browser runs. Chrome is for debugging, not production traffic | | Proxy | one of your proxies, or none | The outbound IP the browser uses | -Pass `process.env.CDP_WS_URL` to whichever client you use. With Playwright that is `chromium.connectOverCDP`, and with Puppeteer it is the `browserWSEndpoint` option. +Pass `process.env.CDP_WS_URL` to whichever client you use. `console.log(process.env.CDP_WS_URL)` prints `***`, not the URL. The URL carries an access token created for the run, and run output is stored in the console, so the playground masks the URL wherever it appears in output. From b279cacae39100892eca0ad0a6a382770bd077ec Mon Sep 17 00:00:00 2001 From: Celine Debled Date: Fri, 7 Aug 2026 17:33:31 +0200 Subject: [PATCH 7/7] Apply review feedback on the playground and limits pages --- .../run-on-lightpanda-cloud/limits-and-billing.mdx | 2 +- src/content/run-on-lightpanda-cloud/playground.mdx | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx b/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx index 71b80ba..bd768d8 100644 --- a/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx +++ b/src/content/run-on-lightpanda-cloud/limits-and-billing.mdx @@ -27,7 +27,7 @@ Upgrade, download invoices, or cancel from the [billing page](https://console.li **Concurrent sessions** are the sessions open at one instant. This limit is about parallelism, not total volume: a plan's concurrency cap still lets you run many sessions a day, as long as no more than that cap overlap at once. -Both apply however you open the session: over CDP, MCP, the HTTP API, or from the playground. +Both limits apply regardless of how you open a session: over CDP, MCP, the HTTP API, or from the playground. ## When you reach a limit diff --git a/src/content/run-on-lightpanda-cloud/playground.mdx b/src/content/run-on-lightpanda-cloud/playground.mdx index 807efff..626f54f 100644 --- a/src/content/run-on-lightpanda-cloud/playground.mdx +++ b/src/content/run-on-lightpanda-cloud/playground.mdx @@ -7,11 +7,11 @@ import { Tabs, Callout } from 'nextra/components' # Playground -The playground is a code editor in the console that runs your automation scripts on Lightpanda Cloud. +The playground is a [code editor](https://console.lightpanda.io/playground/scripts) in the console that runs your automation scripts on Lightpanda Cloud. ## Write and run a script -Open [Scripts](https://console.lightpanda.io/playground/scripts) under Playground in the console and create one. The editor opens on the Playwright example below: +Your script reaches the browser through `CDP_WS_URL`, an environment variable the playground sets for you: @@ -58,9 +58,9 @@ await browser.disconnect(); -## Connect with CDP_WS_URL +## What CDP_WS_URL contains -Your script never carries a token. The playground sets one environment variable, `CDP_WS_URL`, which holds the WebSocket address your client uses to reach the browser over the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP). The playground assembles it from the choices in the Default variables panel: +You do not need to hard-code a token in your script. `CDP_WS_URL` holds the WebSocket address your client uses to reach the browser over the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP), assembled from the choices in the Default variables panel: | Default variable | Values | What it controls | | --- | --- | --- | @@ -102,8 +102,6 @@ Every run is capped: A run that reaches 5 minutes stops and reports `timeout running program`. Output beyond 256 KB is dropped, and the run is flagged as truncated. -These caps apply to the script process. The browser it drives is an ordinary cloud session, so it also counts toward your [plan limits](/run-on-lightpanda-cloud/limits-and-billing). +These caps apply to the script process. The browser session driven by the script also counts toward your [plan limits](/run-on-lightpanda-cloud/limits-and-billing). -## Review past runs - -Every run is kept. [Runs](https://console.lightpanda.io/playground/script-runs) under Playground lists them with their state, start time, and duration, and you can filter the list by script. Open a run to read the output it produced. +The [Runs page](https://console.lightpanda.io/playground/script-runs) shows your run history and output for the past 30 days. \ No newline at end of file