Browser Frameworks
Kernel provides first-class support for browser automation frameworks, supporting CDP (Chrome DevTools Protocol) connections like Playwright and Puppeteer out of the box.
Unlike other browsers-as-a-service platforms, Kernel co-locates your app code with the browser environment in the cloud. This solves common issues with remote browsers:
- Reduced latency: Your code runs directly alongside the browser, reducing round-trip latency
- Improved reliability: No unexpected disconnects between your code and browser
- Higher throughput: Eliminates bandwidth bottlenecks during data-intensive operations like screenshots
- Simplified debugging: Access to browser logs and execution context in the same environment
Creating a browser automation app
To create a browser automation app with Kernel, simply define an app and action that creates a Kernel browser.
Install our sample apps to get up and running with Playwright, Browser Use, or Stagehand!
1. Create an app and define a browser action
Start by creating your app and defining an action for your browser automation:
2. Connect to a browser in your action
Within your action, use Kernel’s browsers.create()
method to generate a CDP websocket URL for your browser automation framework.
browsers.create()
requires the runtime’s invocation_id
to be passed. This is provided to you in the runtimeContext
object generated during the invocation’s lifecycle:
3. Complete example
Make sure to call browser.close()
at the end of your action to ensure the browser connection is properly closed.
Browser frameworks: environment variables
Browser frameworks sometimes require environment variables (e.g. LLM API keys). Set them when deploying your app.
Next steps
Once you’ve created your browser automation app:
- Deploy it on Kernel’s cloud platform
- Learn how to invoke your app’s actions
- Explore browser configuration options for advanced use cases