kernel-python-sdk▌
kernel/skills · updated Apr 8, 2026
Use the Kernel Python SDK when you need to:
When to Use This Skill
Use the Kernel Python SDK when you need to:
- Build browser automation scripts - Create Python programs that control remote browsers
- Execute server-side automation - Run Playwright code directly in the browser VM without local dependencies
- Manage browser sessions programmatically - Create, configure, and control browsers from code
- Build scalable scraping/testing tools - Use browser pools and profiles for high-volume automation
- Deploy automation as actions - Package scripts as Kernel actions for invocation via API
When NOT to use:
- For CLI commands (e.g.,
kernel browsers create), use thekernel-cliskill instead - For quick one-off tasks, the CLI may be simpler than writing code
Core Concepts
SDK Architecture
The 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 invocation
Two Automation Approaches
1. Server-side Execution (RECOMMENDED)
- Execute Playwright code directly in browser VM using
kernel.browsers.playwright.execute(session_id, code="...") session_idmust be passed as a positional argument (first parameter), not asid=keyword- Response accessed via
response.result- MUST usereturnin code to get data back - Best for: Most use cases, production automation, parallel execution, actions
2. CDP Connection (Client-side)
- Connect Playwright to browser via CDP WebSocket URL
- Code runs locally, browser runs remotely; requires local Playwright installation
- Best for: Complex debugging, specific local development needs
Patterns Reference
Import Patterns
- Standard:
from kernel import Kernel - For actions:
import kernelandfrom kernel import Kernel - For typed payloads:
from typing import TypedDict - For CDP:
from playwright.async_api import async_playwright
SDK Initialization
client = Kernel()readsKERNEL_API_KEYfrom environment automatically
Action 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 kernelorpip install kernel- For CDP:
uv pip install playwright
References
- Kernel Documentation: https://www.kernel.sh/docs
- API Reference: https://www.kernel.sh/docs/api-reference/
- Templates: https://www.kernel.sh/docs/reference/cli/create#available-templates
- Quickstart Guide: https://www.kernel.sh/docs/quickstart
- Examples: examples
Ratings
4.6★★★★★49 reviews- ★★★★★Ishan Ndlovu· Dec 28, 2024
kernel-python-sdk has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Anika Khanna· Dec 20, 2024
kernel-python-sdk reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Amina Reddy· Dec 12, 2024
kernel-python-sdk is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Ganesh Mohane· Dec 8, 2024
kernel-python-sdk is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Zara Jain· Dec 4, 2024
Useful defaults in kernel-python-sdk — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Kaira Okafor· Dec 4, 2024
I recommend kernel-python-sdk for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Sakshi Patil· Nov 27, 2024
Keeps context tight: kernel-python-sdk is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Tariq Mehta· Nov 27, 2024
I recommend kernel-python-sdk for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Ama Diallo· Nov 23, 2024
kernel-python-sdk has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Meera Torres· Nov 19, 2024
Useful defaults in kernel-python-sdk — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
showing 1-10 of 49