一键导入
kernel-python-sdk
Build browser automation scripts using the Kernel Python SDK with Playwright and remote browser management.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build browser automation scripts using the Kernel Python SDK with Playwright and remote browser management.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Systematically debug a Kernel cloud browser session — VM issues, network errors, Chrome crashes, page-load failures, and live-view problems. Use when a browser session misbehaves (e.g. ERR_HTTP2_PROTOCOL_ERROR, "browser not responding", blank/error pages, captcha or "checking your browser" blocks, live view not loading) and you have the session ID. Drives the Kernel CLI to inspect session status, screenshots, page state, VM logs, and network connectivity.
Generate crisp, perfectly smooth MP4 videos from a web page or animated visualization by driving headless Chromium over the Chrome DevTools Protocol (CDP) with deterministic frame-stepping, then encoding with ffmpeg and (if remote) sharing via a cloudflared tunnel. Use when asked to make/generate a demo video, explainer clip, launch/marketing animation, social teaser, or any short rendered video from a web scene — especially animated stat/timeline/diagram visualizations — and when you need to iterate on it (tweak, re-render, compare). Solves the common "the recording has hitches / judder / dropped frames" problem.
Best practices for using browser-use's open-source browser-harness with Kernel cloud browsers over CDP. Use when driving a Kernel browser from browser-harness, extracting a CDP URL from `kernel browsers create`, or running multi-step or parallel harness sessions against Kernel.
Complete guide to Kernel CLI - cloud browser platform with automation, deployment, and management
Compare two Kernel profile archives to investigate behavioral differences. Use when an issue (e.g. login failure, captcha, broken automation, vendor mismatch) reproduces on one profile but not another, or when a "good" vs "bad" profile needs to be diffed. Takes two profile IDs/names plus an issue description, downloads both archives via the Kernel CLI, and surfaces differences in cookies, storage, preferences, extensions, and login state that could explain the issue.
Profile a website for bot detection vendors using stealth vs non-stealth Kernel browsers. Use when analyzing bot detection on a website, comparing stealth effectiveness, identifying anti-bot vendors and products, or detecting challenge types.
| name | kernel-python-sdk |
| description | Build browser automation scripts using the Kernel Python SDK with Playwright and remote browser management. |
| context | fork |
Use the Kernel Python SDK when you need to:
When NOT to use:
kernel browsers create), use the kernel-cli skill insteadThe SDK is organized into resource-based modules:
kernel.browsers - Browser session management (create, list, delete)kernel.browsers.playwright - Server-side Playwright executionkernel.browsers.computer - OS-level controls (mouse, keyboard, screenshots)kernel.browser_pools - Pre-warmed browser pool managementkernel.profiles - Persistent browser profiles (auth state)kernel.auth.connections - Managed auth (create, login, submit, follow, retrieve, delete)kernel.credential_providers - External credential providers (1Password)kernel.proxies - Proxy configurationkernel.extensions - Chrome extension managementkernel.deployments - App deploymentkernel.invocations - Action invocation1. Server-side Execution (RECOMMENDED)
kernel.browsers.playwright.execute(session_id, code="...")session_id must be passed as a positional argument (first parameter), not as id= keywordresponse.result - MUST use return in code to get data back2. CDP Connection (Client-side)
Import Patterns
from kernel import Kernelimport kernel and from kernel import Kernelfrom typing import TypedDictfrom playwright.async_api import async_playwrightSDK Initialization
client = Kernel() reads KERNEL_API_KEY from environment automaticallyAction Handler Pattern
from typing import TypedDict
from kernel import Kernel
app = kernel.App("app-name")
class TaskInput(TypedDict):
task: str
@app.action("action-name")
async def my_action(ctx: kernel.KernelContext, input_data: TaskInput):
# Access input: input_data["task"] or input_data.get("task")
...
CDP Connection Pattern (Client-side)
async with async_playwright() as playwright:
browser = await playwright.chromium.connect_over_cdp(kernel_browser.cdp_ws_url)
context = browser.contexts[0] if browser.contexts else await browser.new_context()
page = context.pages[0] if context.pages else await context.new_page()
Binary Data Handling
Binary data (screenshots, PDFs) returns as Node.js Buffer: {'data': [byte_array], 'type': 'Buffer'}
# Follow canonical pattern above, then:
if response.success and response.result:
data = bytes(response.result['data'])
with open("output.png", "wb") as f:
f.write(data)
Installation
uv pip install kernel or pip install kerneluv pip install playwright