Kernel provides cloud browser infrastructure for AI agents with features like stealth mode and persistent profiles.
When to Use Kernel
- Bot detection avoidance (stealth mode)
- Persistent login sessions across runs
- Cloud deployment without local browser
- Fingerprint resistance
- Enterprise-grade browser infrastructure
Prerequisites
Setup
Get your API key
- Visit the Kernel Dashboard
- Navigate to API settings
- Create and copy your API key
Set environment variable
export KERNEL_API_KEY="your-api-key"
Usage
Via CLI Flag
Use the -p kernel flag:
agent-browser -p kernel open https://example.com
agent-browser -p kernel snapshot -i
agent-browser -p kernel click @e1
Via Environment Variable
Set the provider globally:
export AGENT_BROWSER_PROVIDER=kernel
export KERNEL_API_KEY="your-api-key"
# Now all commands use Kernel automatically
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser click @e1
Configuration
Environment Variables
| Variable | Description | Default |
|---|
AGENT_BROWSER_PROVIDER | Set to kernel | - |
KERNEL_API_KEY | Your Kernel API key | Required |
KERNEL_HEADLESS | Run browser in headless mode (true/false) | false |
KERNEL_STEALTH | Enable stealth mode to avoid bot detection (true/false) | true |
KERNEL_TIMEOUT_SECONDS | Session timeout in seconds | 300 |
KERNEL_PROFILE_NAME | Browser profile name for persistent cookies/logins | None |
Stealth Mode
Stealth mode (enabled by default) helps avoid bot detection:
# Stealth enabled (default)
export KERNEL_STEALTH=true
agent-browser -p kernel open https://example.com
# Disable stealth if not needed
export KERNEL_STEALTH=false
agent-browser -p kernel open https://example.com
Persistent Profiles
Use profiles to persist cookies, logins, and session data across browser restarts:
export KERNEL_PROFILE_NAME="myapp-session"
# First run - login and session is saved
agent-browser -p kernel open https://app.example.com/login
agent-browser -p kernel snapshot -i
agent-browser -p kernel fill @e1 "[email protected]"
agent-browser -p kernel fill @e2 "password"
agent-browser -p kernel click @e3
agent-browser -p kernel close # Profile saved automatically
# Second run - reuses saved session
agent-browser -p kernel open https://app.example.com/dashboard
# Already logged in!
When KERNEL_PROFILE_NAME is set, the profile is created if it doesn’t exist. Cookies, logins, and session data are automatically saved when the browser session ends.
Features
All standard agent-browser commands work with Kernel:
- Navigation: Full page navigation support
- Snapshots: Accessibility tree with refs
- Interactions: Click, fill, type, press, hover
- Screenshots: Standard and annotated screenshots
- State Management: Cookies, localStorage, sessionStorage
- Network Control: Route, intercept, mock responses
Example: Persistent Login Session
#!/bin/bash
# login-once.sh - Login is saved to profile
export AGENT_BROWSER_PROVIDER=kernel
export KERNEL_API_KEY="your-api-key"
export KERNEL_PROFILE_NAME="github-session"
export KERNEL_STEALTH=true
# Login once
agent-browser open https://github.com/login
agent-browser snapshot -i
agent-browser fill @e1 "username"
agent-browser fill @e2 "password"
agent-browser click @e3
agent-browser wait --url "**/github.com"
agent-browser close
echo "Session saved to profile: github-session"
#!/bin/bash
# reuse-session.sh - Reuses saved login
export AGENT_BROWSER_PROVIDER=kernel
export KERNEL_API_KEY="your-api-key"
export KERNEL_PROFILE_NAME="github-session"
# Already logged in from previous session
agent-browser open https://github.com/settings
agent-browser snapshot -i
Example: Stealth Scraping
# Avoid bot detection with stealth mode
export AGENT_BROWSER_PROVIDER=kernel
export KERNEL_API_KEY="your-api-key"
export KERNEL_STEALTH=true
agent-browser open https://protected-site.com
agent-browser wait --load networkidle
agent-browser snapshot -i --json > data.json
agent-browser close
Example: CI/CD with Persistent Auth
# .github/workflows/deploy.yml
name: Deploy Dashboard
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install agent-browser
run: npm install -g agent-browser
- name: Deploy via admin panel
env:
AGENT_BROWSER_PROVIDER: kernel
KERNEL_API_KEY: ${{ secrets.KERNEL_API_KEY }}
KERNEL_PROFILE_NAME: admin-session
KERNEL_STEALTH: true
run: |
# Profile persists between CI runs
agent-browser open https://admin.example.com/deploy
agent-browser snapshot -i
agent-browser click @e5 # Click deploy button
agent-browser wait --text "Deployment successful"
agent-browser screenshot deploy-success.png
Profile Management
Profiles are managed server-side by Kernel:
- Auto-creation: Profiles are created automatically on first use
- Persistence: Session data persists across browser restarts
- Isolation: Each profile name is isolated from others
- Cleanup: Profiles expire based on your Kernel plan settings
Pricing
Check current pricing and plans at kernel.sh/pricing.
Use KERNEL_PROFILE_NAME to maintain authenticated sessions across deployments, CI/CD runs, or scheduled tasks without re-logging in every time.