| name | kernel-python-sdk |
| description | build browser automation scripts using the kernel python sdk with playwright and remote browser management. use when writing python code that creates browsers, runs playwright, or automates websites with kernel. |
kernel python sdk
install: pip install kernel
core architecture
same namespaces as typescript: kernel.browsers, kernel.playwright, kernel.computer, kernel.pools, kernel.profiles, kernel.auth, kernel.proxies, kernel.extensions, kernel.deployments, kernel.invocations.
two automation approaches
1. CDP connection (complex automations)
from kernel import Kernel
from playwright.async_api import async_playwright
kernel = Kernel()
browser = kernel.browsers.create(stealth=True, timeout_seconds=300)
async with async_playwright() as pw:
browser_ctx = await pw.chromium.connect_over_cdp(browser.cdp_ws_url)
page = browser_ctx.contexts[0].pages[0]
try:
await page.goto("https://example.com")
title = await page.title()
print(title)
:
browser_ctx.close()
kernel.browsers.delete_by_id(browser.session_id)