Pools can be pre-configured with options like custom extensions, stealth mode, residential proxies, profiles, and more. See the API reference for more details.
Acquire a browser from the pool. The request returns immediately if a browser is available, or waits until one becomes available. The acquire_timeout_seconds parameter controls how long to wait; it defaults to the calculated time it would take to fill the pool at the pool’s configured fill rate.
The acquired browser includes all the same properties as a regular browser session, including cdp_ws_url for CDP connections and browser_live_view_url for live viewing.
Browsers remain in the pool indefinitely until acquired. Once acquired, the pool’s timeout_seconds applies just like a regular browser timeout—if the browser is idle (no CDP or live view connection) for longer than the timeout, it is destroyed and not returned to the pool. The pool will automatically create a replacement browser at the pool’s configured fill rate.
When you’re done with a browser, release it back to the pool. By default, the browser instance is reused. Set reuse: false to destroy it and create a fresh one.
The size parameter is always required when updating a pool, even if you only want to change other settings.
By default, updating a pool discards all idle browsers and rebuilds them with the new configuration. Set discard_all_idle: false to keep existing idle browsers and only apply the new configuration to newly created browsers.
Delete a browser pool and all browsers in it. By default, deletion is blocked if browsers are currently acquired. Use force: true to terminate acquired browsers and force deletion.
Copy
Ask AI
// Delete a pool (fails if browsers are acquired)await kernel.browserPools.delete("my-pool");// Force delete even if browsers are acquiredawait kernel.browserPools.delete("my-pool", { force: true });
This example assumes you’ve already created a pool named “my-pool”. In practice, you’d create pools once (via the SDK, CLI, or dashboard) and then acquire from them repeatedly.
Copy
Ask AI
import Kernel from '@onkernel/sdk';import { chromium } from 'playwright';const kernel = new Kernel();// Acquire a browser from an existing poolconst kernelBrowser = await kernel.browserPools.acquire("my-pool", {});try { // Connect via CDP const browser = await chromium.connectOverCDP(kernelBrowser.cdp_ws_url); const context = browser.contexts()[0]; const page = context.pages()[0]; await page.goto('https://example.com'); const title = await page.title(); console.log(title);} finally { // Release back to pool for reuse await kernel.browserPools.release("my-pool", { session_id: kernelBrowser.session_id, });}