From kernel-sdks
Build browser automation scripts using the Kernel Python SDK with Playwright and remote browser management.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kernel-sdks:kernel-python-sdkThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use the Kernel Python SDK when you need to:
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 playwrightnpx claudepluginhub kernel/skills --plugin kernel-sdksAutomates browser tasks via Playwright CLI for AI agents: navigate pages, take snapshots/screenshots, fill forms, click elements from command line. Use with shell access.
Automates real browser tasks: viewing pages, login-gated sites, UI operations, social media scraping (Xiaohongshu/Weibo/X), JS-rendered pages, bot bypass, form filling, e2e checks via CLI/Python SDK.
Deploys serverless browser automation as cloud functions using Browserbase and Playwright. Use for scheduling browser tasks, creating webhook endpoints, or running automation in the cloud.