Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Changesets

This project uses [Changesets](https://github.com/changesets/changesets) for versioning and changelog generation.

## Adding a changeset

When you make a change that should be released, run:

```bash
pnpm changeset
```

This will prompt you to:
1. Select the type of change (patch, minor, major)
2. Write a summary of your changes

The changeset file will be committed with your PR.

## Release process

When changesets are merged to `main`, the release workflow will:
1. Create a "Version Packages" PR that updates version numbers and changelogs
2. When that PR is merged, packages are automatically published to npm
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
225 changes: 225 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm ci:version
publish: pnpm ci:publish
title: 'chore: version packages'
commit: 'chore: version packages'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_VERCEL_TOKEN_ELEVATED }}

# Build native binaries for all platforms (only after changesets publishes)
build-binaries:
name: Build ${{ matrix.name }}
needs: release
if: needs.release.outputs.published == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux x64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: agent-browser-linux-x64
use_zigbuild: true
- name: Linux ARM64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary: agent-browser-linux-arm64
use_zigbuild: true
- name: Windows x64
os: ubuntu-latest
target: x86_64-pc-windows-gnu
binary: agent-browser-win32-x64.exe
use_zigbuild: false
- name: macOS x64
os: macos-latest
target: x86_64-apple-darwin
binary: agent-browser-darwin-x64
use_zigbuild: false
- name: macOS ARM64
os: macos-latest
target: aarch64-apple-darwin
binary: agent-browser-darwin-arm64
use_zigbuild: false

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: pnpm

- name: Install npm dependencies
run: pnpm install --frozen-lockfile

- name: Sync version
run: pnpm run version:sync

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install cross-compilation tools (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu mingw-w64

- name: Install cargo-zigbuild
if: matrix.use_zigbuild
run: |
pip3 install ziglang
cargo install cargo-zigbuild

- name: Configure Rust linkers
if: runner.os == 'Linux'
run: |
mkdir -p ~/.cargo
cat >> ~/.cargo/config.toml << 'EOF'
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
EOF

- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
cli/target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-

- name: Build with zigbuild
if: matrix.use_zigbuild
run: cargo zigbuild --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }}

- name: Build with cargo
if: '!matrix.use_zigbuild'
run: cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }}

- name: Copy binary
run: |
mkdir -p artifacts
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
cp cli/target/${{ matrix.target }}/release/agent-browser.exe artifacts/${{ matrix.binary }}
else
cp cli/target/${{ matrix.target }}/release/agent-browser artifacts/${{ matrix.binary }}
chmod +x artifacts/${{ matrix.binary }}
fi

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: artifacts/${{ matrix.binary }}
retention-days: 7

# Create GitHub release with binaries after npm publish
github-release:
name: Create GitHub Release
needs: [release, build-binaries]
if: needs.release.outputs.published == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: main

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: bin/

- name: Move binaries to bin directory
run: |
for dir in bin/*/; do
mv "$dir"* bin/
rmdir "$dir"
done
chmod +x bin/agent-browser-* 2>/dev/null || true
ls -la bin/

- name: Verify binaries exist
run: |
BINARY_COUNT=$(ls bin/agent-browser-* 2>/dev/null | wc -l)
if [ "$BINARY_COUNT" -lt 5 ]; then
echo "Error: Expected 5 binaries, found $BINARY_COUNT"
ls -la bin/
exit 1
fi
echo "Found $BINARY_COUNT binaries"

- name: Create GitHub Release
run: |
VERSION=$(node -p "require('./package.json').version")
gh release create "v$VERSION" \
--title "v$VERSION" \
--generate-notes \
bin/agent-browser-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,14 +708,24 @@ curl -o .claude/skills/agent-browser/SKILL.md \

[Browserbase](https://browserbase.com) provides remote browser infrastructure to make deployment of agentic browsing agents easy. Use it when running the agent-browser CLI in an environment where a local browser isn't feasible.

To enable Browserbase, set these environment variables:
To enable Browserbase, use the `-p` flag:

```bash
export BROWSERBASE_API_KEY="your-api-key"
export BROWSERBASE_PROJECT_ID="your-project-id"
agent-browser -p browserbase open https://example.com
```

When both variables are set, agent-browser automatically connects to a Browserbase session instead of launching a local browser. All commands work identically.
Or use environment variables for CI/scripts:

```bash
export AGENT_BROWSER_PROVIDER=browserbase
export BROWSERBASE_API_KEY="your-api-key"
export BROWSERBASE_PROJECT_ID="your-project-id"
agent-browser open https://example.com
```

When enabled, agent-browser connects to a Browserbase session instead of launching a local browser. All commands work identically.

Get your API key and project ID from the [Browserbase Dashboard](https://browserbase.com/overview).

Expand Down
58 changes: 56 additions & 2 deletions docs/src/app/cdp-mode/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,26 @@ agent-browser close
# Or pass --cdp on each command
agent-browser --cdp 9222 snapshot`} />

<h2>Remote WebSocket URLs</h2>
<p>Connect to remote browser services via WebSocket URL:</p>
<CodeBlock code={`# Connect to remote browser service
agent-browser --cdp "wss://browser-service.com/cdp?token=..." snapshot

# Works with any CDP-compatible service
agent-browser --cdp "ws://localhost:9222/devtools/browser/abc123" open example.com`} />
<p>The <code>--cdp</code> flag accepts either:</p>
<ul>
<li>A port number (e.g., <code>9222</code>) for local connections via <code>http://localhost:&#123;port&#125;</code></li>
<li>A full WebSocket URL (e.g., <code>wss://...</code> or <code>ws://...</code>) for remote browser services</li>
</ul>

<h2>Use cases</h2>
<p>This enables control of:</p>
<ul>
<li>Electron apps</li>
<li>Chrome/Chromium with remote debugging</li>
<li>WebView2 applications</li>
<li>Remote browser services (via WebSocket URL)</li>
<li>Any browser exposing a CDP endpoint</li>
</ul>

Expand All @@ -39,6 +53,14 @@ agent-browser --cdp 9222 snapshot`} />
<td><code>--session &lt;name&gt;</code></td>
<td>Use isolated session</td>
</tr>
<tr>
<td><code>--profile &lt;path&gt;</code></td>
<td>Persistent browser profile directory</td>
</tr>
<tr>
<td><code>-p &lt;provider&gt;</code></td>
<td>Cloud browser provider (<code>browserbase</code>, <code>browseruse</code>)</td>
</tr>
<tr>
<td><code>--headers &lt;json&gt;</code></td>
<td>HTTP headers scoped to origin</td>
Expand All @@ -47,6 +69,22 @@ agent-browser --cdp 9222 snapshot`} />
<td><code>--executable-path</code></td>
<td>Custom browser executable</td>
</tr>
<tr>
<td><code>--args &lt;args&gt;</code></td>
<td>Browser launch args (comma-separated)</td>
</tr>
<tr>
<td><code>--user-agent &lt;ua&gt;</code></td>
<td>Custom User-Agent string</td>
</tr>
<tr>
<td><code>--proxy &lt;url&gt;</code></td>
<td>Proxy server URL</td>
</tr>
<tr>
<td><code>--proxy-bypass &lt;hosts&gt;</code></td>
<td>Hosts to bypass proxy</td>
</tr>
<tr>
<td><code>--json</code></td>
<td>JSON output for agents</td>
Expand All @@ -68,15 +106,31 @@ agent-browser --cdp 9222 snapshot`} />
<td>Show browser window</td>
</tr>
<tr>
<td><code>--cdp &lt;port&gt;</code></td>
<td>CDP connection port</td>
<td><code>--cdp &lt;port|url&gt;</code></td>
<td>CDP connection (port or WebSocket URL)</td>
</tr>
<tr>
<td><code>--debug</code></td>
<td>Debug output</td>
</tr>
</tbody>
</table>

<h2>Cloud providers</h2>
<p>Use cloud browser infrastructure when local browsers aren&apos;t available:</p>
<CodeBlock code={`# Browserbase
export BROWSERBASE_API_KEY="your-api-key"
export BROWSERBASE_PROJECT_ID="your-project-id"
agent-browser -p browserbase open https://example.com

# Browser Use
export BROWSER_USE_API_KEY="your-api-key"
agent-browser -p browseruse open https://example.com

# Or via environment variable
export AGENT_BROWSER_PROVIDER=browserbase
agent-browser open https://example.com`} />
<p>The <code>-p</code> flag takes precedence over <code>AGENT_BROWSER_PROVIDER</code>.</p>
</div>
</div>
);
Expand Down
Loading