@kody/browser-run
Call Cloudflare Browser Run Quick Actions and reuse shared sessions with createBrowserContext.
- Integrations
- cloudflare
- browser-run
- browser-rendering
- puppeteer
- screenshot
- cdp
- sessions
- Version
- 1.0.0
- License
- Published
- September 29, 2026
- Pinned commit
ee5297c- Rating
- No ratings yet
- Forks
- 0
- Adaptation effort
- —
README
Agent docs@kody/browser-run
Intent
Give agents and humans a thin, isolate-safe way to call Cloudflare Browser Run
(formerly Browser Rendering): one-shot Quick Actions (screenshot, PDF, scrape,
…) plus shared-session helpers that bake in session reuse and per-request
createBrowserContext() isolation. Success means reliable browser automation
without cold-starting a new browser for every request, and without recommending
browser.close() on a shared session.
What this package does
- Quick Actions — REST POST to
/accounts/{accountId}/browser-rendering/{action}forcontent,screenshot,pdf,markdown,scrape,links,json,snapshot, andaccessibilityTree. - Sessions — list, get, acquire, connect metadata, and guarded close.
open-isolated(default for automation) — list → reuse (random start) → acquire; returns WS endpoint + instructions to isolate withcreateBrowserContext, thencontext.close()+browser.disconnect().worker-recipe— copy-paste Worker + wrangler guidance using@cloudflare/puppeteer≥ 1.1.0 (not runnable inside Kody).
This package does not depend on Puppeteer or Playwright (those graphs blow up Worker isolates). Heavy CDP control runs in your Cloudflare Worker or Node process; Kody only orchestrates the REST/CDP metadata.
Setup
API token — Create a Cloudflare API token with Browser Rendering - Edit. Save it as the Kody user secret
cloudflareApiTokenwith allowed hostapi.cloudflare.com:Account id — Pass
accountIdon live calls. Find it in the dashboard URL (dash.cloudflare.com/<accountId>/…) or Workers & Pages → Overview → Account ID. Forkers bring their own account — this package does not hardcode any Cloudflare account.Optional: pass
apiTokenSecretwith an alternate secret name only (never a raw token value).
When to use what
| Need | Use |
|---|---|
| One screenshot / PDF / scrape / markdown | ./quick-action or ./screenshot, ./pdf, … |
| Multi-step automation / shared browser | ./open-isolated (default) |
| Deploy Puppeteer on Workers | ./worker-recipe |
| Verify secrets / wiring | ./smoke-test |
Docs: Cloudflare Browser Run · Reuse sessions
Pit of success
Multiple clients can share one Browser Run session (puppeteer.connect per
Worker, separate browser contexts). After connect:
const context = await browser.createBrowserContext()- Do work in that context
await context.close()await browser.disconnect()
Never call browser.close() while the session may be shared — that kills
every concurrent client.
Done when
smoke-testreturns setup guidance without opaque errors whenaccountId/secret are missing- With a configured token +
accountId,sessions/listorsmoke-testlists sessions (or a clear auth error) - Agents pick
open-isolatedfor shared automation and Quick Actions for one-shots
Report this listing
Log in to report this listing.