Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tbd-6fc993ce-hypeship-intro-create-control-observe.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Kernel browsers are sandboxed Chromium instances that boot in under 30ms. Your agent creates them on demand, drives them, and tears them down — no infra to provision, no warm pool to manage.

Your first browser

import Kernel from '@onkernel/sdk';

const kernel = new Kernel();

const kernelBrowser = await kernel.browsers.create();
console.log(kernelBrowser.session_id);
The response includes everything you need to drive the browser: session_id, cdp_ws_url, webdriver_ws_url, and browser_live_view_url.

Pick the right shape

Most of what you’ll tune at creation time falls into four buckets:

Headless vs headful

Headful (the default) supports live view and replays. Headless is lighter (1 GB vs 8 GB) and faster — good for short-lived or highly concurrent jobs.

Stealth and proxies

Turn on stealth mode and route through residential, ISP, or datacenter proxies when you’re hitting sites with bot detection.

GPU acceleration

Required for WebGL, video, and canvas-heavy workloads. Trades off standby support.

Profiles and auth

Persist cookies, storage, and logged-in sessions across runs with a profile, or hand auth off to Kernel entirely with managed auth.

Lifecycle

A browser stays alive as long as something is driving it — a CDP or WebDriver client, a Live View viewer, or an in-flight computer controls request. After five seconds with none of those active, it enters standby — state is preserved, billing stops. After the configurable timeout (60s by default) it’s deleted. You can also delete a browser explicitly when you’re done:
await kernel.browsers.deleteByID(kernelBrowser.session_id);
See Termination & timeouts for the full set of teardown options.

Full example

Putting it together — create, connect over CDP, do work, tear down:
Kernel browsers launch with a default context and page. Make sure to access the existing context and page (contexts()[0] and pages()[0]) rather than creating a new one.
import Kernel from '@onkernel/sdk';
import { chromium } from 'playwright';

const kernel = new Kernel();

const kernelBrowser = await kernel.browsers.create();
const browser = await chromium.connectOverCDP(kernelBrowser.cdp_ws_url);

try {
  const context = browser.contexts()[0] || (await browser.newContext());
  const page = context.pages()[0] || (await context.newPage());
  await page.goto('https://www.onkernel.com');
  const title = await page.title();
} catch (error) {
  console.error(error);
} finally {
  await browser.close();
  await kernel.browsers.deleteByID(kernelBrowser.session_id);
}

What’s next

Once you have a browser, you need to drive it. Head to Control to see the three primitives Kernel exposes — computer use, CDP, and WebDriver BiDi — and when to reach for each.