-
Notifications
You must be signed in to change notification settings - Fork 3
Add Agent Browser integration documentation #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
rgarcia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
| agent-browser -p kernel open https://example.com | ||
| ``` | ||
|
|
||
| Or use environment variables for CI/scripts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the "Or use environment variables for CI/scripts" section is unnecessary - consider removing lines 20-27 and just documenting that AGENT_BROWSER_PROVIDER=kernel is an alternative to the -p kernel flag in the configuration table below
| agent-browser -p kernel open https://example.com | ||
| ``` | ||
|
|
||
| ## Connecting via CDP (alternative) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section should only apply when you need full control of the Kernel browser session creation logic beyond what the agent-browser environment variables support. also, the example should use CLI throughout (not SDK + CLI mix):
# Create a Kernel browser and extract the CDP URL
SESSION=$(kernel browsers create --stealth -o json)
CDP_URL=$(echo "$SESSION" | jq -r '.cdp_ws_url')
SESSION_ID=$(echo "$SESSION" | jq -r '.session_id')
# Connect agent-browser to the Kernel session
agent-browser connect "$CDP_URL"
# Run your automation
agent-browser open https://example.com
agent-browser snapshot
# Clean up
agent-browser close
kernel browsers delete "$SESSION_ID"| await kernel.browsers.deleteByID(kernelBrowser.session_id); | ||
| ``` | ||
|
|
||
| ## Programmatic usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider adding context for when you'd use this approach - e.g., "Use this approach if you want to use agent-browser as an alternative to Playwright within a Node.js or Python application while maintaining programmatic control over browser session lifecycle."
also, the example has a bug - kernel.browsers.delete() should be kernel.browsers.deleteByID(). here are verified working examples:
TypeScript:
import Kernel from '@onkernel/sdk';
import { execSync } from 'child_process';
const kernel = new Kernel();
const browser = await kernel.browsers.create({ stealth: true });
console.log("Live view url:", browser.browser_live_view_url);
try {
execSync(`agent-browser connect "${browser.cdp_ws_url}"`, { stdio: 'inherit' });
execSync('agent-browser open https://example.com', { stdio: 'inherit' });
execSync('agent-browser snapshot', { stdio: 'inherit' });
execSync('agent-browser close', { stdio: 'inherit' });
} finally {
await kernel.browsers.deleteByID(browser.session_id);
}Python:
import subprocess
from kernel import Kernel
kernel = Kernel()
browser = kernel.browsers.create(stealth=True)
print(f"Live view url: {browser.browser_live_view_url}")
try:
subprocess.run(["agent-browser", "connect", browser.cdp_ws_url], check=True)
subprocess.run(["agent-browser", "open", "https://example.com"], check=True)
subprocess.run(["agent-browser", "snapshot"], check=True)
subprocess.run(["agent-browser", "close"], check=True)
finally:
kernel.browsers.delete_by_id(browser.session_id)
Added comprehensive documentation for integrating Agent Browser with Kernel via CDP connection. Includes setup instructions, configuration examples, and usage patterns for browser automation.
Created by Mintlify agent
Note
Introduces documentation for integrating
Agent Browserwith Kernel and surfaces it in site navigation.integrations/agent-browser.mdxwith quick start using native Kernel provider, env-based configuration, profile persistence, CDP connection workflow, programmatic usage, and cleanup stepsdocs.jsonnavigation to includeintegrations/agent-browserintegrations/overview.mdxto list and link the newAgent BrowserguideWritten by Cursor Bugbot for commit 210f212. This will update automatically on new commits. Configure here.