# Scrapfly Documentation

## Table of Contents

### Dashboard

- [Intro](https://scrapfly.io/docs)
- [Project](https://scrapfly.io/docs/project)
- [Account](https://scrapfly.io/docs/account)
- [Workspace & Team](https://scrapfly.io/docs/workspace-and-team)
- [Billing](https://scrapfly.io/docs/billing)

### Products

#### MCP Server

- [Getting Started](https://scrapfly.io/docs/mcp/getting-started)
- [Tools & API Spec](https://scrapfly.io/docs/mcp/tools)
- [Authentication](https://scrapfly.io/docs/mcp/authentication)
- [Examples & Use Cases](https://scrapfly.io/docs/mcp/examples)
- [FAQ](https://scrapfly.io/docs/mcp/faq)
##### Integrations

- [Overview](https://scrapfly.io/docs/mcp/integrations)
- [Claude Desktop](https://scrapfly.io/docs/mcp/integrations/claude-desktop)
- [Claude Code](https://scrapfly.io/docs/mcp/integrations/claude-code)
- [Codex](https://scrapfly.io/docs/mcp/integrations/codex)
- [Gemini CLI](https://scrapfly.io/docs/mcp/integrations/gemini-cli)
- [Antigravity](https://scrapfly.io/docs/mcp/integrations/antigravity)
- [OpenCode](https://scrapfly.io/docs/mcp/integrations/opencode)
- [ChatGPT](https://scrapfly.io/docs/mcp/integrations/chatgpt)
- [Cursor](https://scrapfly.io/docs/mcp/integrations/cursor)
- [Cline](https://scrapfly.io/docs/mcp/integrations/cline)
- [Windsurf](https://scrapfly.io/docs/mcp/integrations/windsurf)
- [Zed](https://scrapfly.io/docs/mcp/integrations/zed)
- [Roo Code](https://scrapfly.io/docs/mcp/integrations/roo-code)
- [VS Code](https://scrapfly.io/docs/mcp/integrations/vscode)
- [LangChain](https://scrapfly.io/docs/mcp/integrations/langchain)
- [LlamaIndex](https://scrapfly.io/docs/mcp/integrations/llamaindex)
- [CrewAI](https://scrapfly.io/docs/mcp/integrations/crewai)
- [OpenAI](https://scrapfly.io/docs/mcp/integrations/openai)
- [n8n](https://scrapfly.io/docs/mcp/integrations/n8n)
- [Make](https://scrapfly.io/docs/mcp/integrations/make)
- [Zapier](https://scrapfly.io/docs/mcp/integrations/zapier)
- [Vapi AI](https://scrapfly.io/docs/mcp/integrations/vapi)
- [Agent Builder](https://scrapfly.io/docs/mcp/integrations/agent-builder)
- [Custom Client](https://scrapfly.io/docs/mcp/integrations/custom-client)


#### Web Scraping API

- [Getting Started](https://scrapfly.io/docs/scrape-api/getting-started)
- [API Specification]()
- [Monitoring](https://scrapfly.io/docs/monitoring)
- [Monitoring - Prometheus Metrics](https://scrapfly.io/docs/monitoring/prometheus)
- [Customize Request](https://scrapfly.io/docs/scrape-api/custom)
- [Debug](https://scrapfly.io/docs/scrape-api/debug)
- [Unblocker (formerly ASP)](https://scrapfly.io/docs/scrape-api/unblocker)
- [Proxy](https://scrapfly.io/docs/scrape-api/proxy)
- [Proxy Mode](https://scrapfly.io/docs/scrape-api/proxy-mode)
- [Proxy Mode - Screaming Frog](https://scrapfly.io/docs/scrape-api/proxy-mode/screaming-frog)
- [Proxy Mode - Apify](https://scrapfly.io/docs/scrape-api/proxy-mode/apify)
- [(Auto) Data Extraction](https://scrapfly.io/docs/scrape-api/extraction)
- [Javascript Rendering](https://scrapfly.io/docs/scrape-api/javascript-rendering)
- [Javascript Scenario](https://scrapfly.io/docs/scrape-api/javascript-scenario)
- [SSL](https://scrapfly.io/docs/scrape-api/ssl)
- [DNS](https://scrapfly.io/docs/scrape-api/dns)
- [Cache](https://scrapfly.io/docs/scrape-api/cache)
- [Batch (Multi-URL Scraping)](https://scrapfly.io/docs/scrape-api/batch)
- [Session](https://scrapfly.io/docs/scrape-api/session)
- [Webhook](https://scrapfly.io/docs/scrape-api/webhook)
- [Schedule](https://scrapfly.io/docs/scrape-api/schedule)
- [Screenshot](https://scrapfly.io/docs/scrape-api/screenshot)
- [Errors](https://scrapfly.io/docs/scrape-api/errors)
- [Timeout](https://scrapfly.io/docs/scrape-api/understand-timeout)
- [Throttling](https://scrapfly.io/docs/throttling)
- [Troubleshoot](https://scrapfly.io/docs/scrape-api/troubleshoot)
- [Billing](https://scrapfly.io/docs/scrape-api/billing)
- [FAQ](https://scrapfly.io/docs/scrape-api/faq)

#### Crawler API

- [Getting Started](https://scrapfly.io/docs/crawler-api/getting-started)
- [API Specification]()
- [Retrieving Results](https://scrapfly.io/docs/crawler-api/results)
- [WARC Format](https://scrapfly.io/docs/crawler-api/warc-format)
- [Data Extraction](https://scrapfly.io/docs/crawler-api/extraction-rules)
- [Search](https://scrapfly.io/docs/crawler-api/search)
- [Prompt & Extract](https://scrapfly.io/docs/crawler-api/prompt)
- [Auto Refresh](https://scrapfly.io/docs/crawler-api/refresh)
- [Webhook](https://scrapfly.io/docs/crawler-api/webhook)
- [Schedule](https://scrapfly.io/docs/crawler-api/schedule)
- [Billing](https://scrapfly.io/docs/crawler-api/billing)
- [Errors](https://scrapfly.io/docs/crawler-api/errors)
- [Troubleshoot](https://scrapfly.io/docs/crawler-api/troubleshoot)
- [FAQ](https://scrapfly.io/docs/crawler-api/faq)

#### Screenshot API

- [Getting Started](https://scrapfly.io/docs/screenshot-api/getting-started)
- [API Specification]()
- [Accessibility Testing](https://scrapfly.io/docs/screenshot-api/accessibility)
- [Webhook](https://scrapfly.io/docs/screenshot-api/webhook)
- [Schedule](https://scrapfly.io/docs/screenshot-api/schedule)
- [Billing](https://scrapfly.io/docs/screenshot-api/billing)
- [Errors](https://scrapfly.io/docs/screenshot-api/errors)

#### Extraction API

- [Getting Started](https://scrapfly.io/docs/extraction-api/getting-started)
- [API Specification]()
- [Rules Template](https://scrapfly.io/docs/extraction-api/rules-and-template)
- [LLM Extraction](https://scrapfly.io/docs/extraction-api/llm-prompt)
- [AI Auto Extraction](https://scrapfly.io/docs/extraction-api/automatic-ai)
- [Webhook](https://scrapfly.io/docs/extraction-api/webhook)
- [Billing](https://scrapfly.io/docs/extraction-api/billing)
- [Errors](https://scrapfly.io/docs/extraction-api/errors)
- [FAQ](https://scrapfly.io/docs/extraction-api/faq)

#### Data API


#### Proxy Saver

- [Getting Started](https://scrapfly.io/docs/proxy-saver/getting-started)
- [Fingerprints](https://scrapfly.io/docs/proxy-saver/fingerprints)
- [Optimizations](https://scrapfly.io/docs/proxy-saver/optimizations)
- [SSL Certificates](https://scrapfly.io/docs/proxy-saver/certificates)
- [Protocols](https://scrapfly.io/docs/proxy-saver/protocols)
- [Pacfile](https://scrapfly.io/docs/proxy-saver/pacfile)
- [Secure Credentials](https://scrapfly.io/docs/proxy-saver/security)
- [Billing](https://scrapfly.io/docs/proxy-saver/billing)

#### Cloud Browser API

- [Getting Started](https://scrapfly.io/docs/cloud-browser-api/getting-started)
- [Proxy & Geo-Targeting](https://scrapfly.io/docs/cloud-browser-api/proxy)
- [Unblock API](https://scrapfly.io/docs/cloud-browser-api/unblock)
- [Captcha Solver](https://scrapfly.io/docs/cloud-browser-api/captcha-solver)
- [Network Policy](https://scrapfly.io/docs/cloud-browser-api/network-policy)
- [File Downloads](https://scrapfly.io/docs/cloud-browser-api/file-downloads)
- [Session Resume](https://scrapfly.io/docs/cloud-browser-api/session-resume)
- [Human-in-the-Loop](https://scrapfly.io/docs/cloud-browser-api/human-in-the-loop)
- [Debug Mode](https://scrapfly.io/docs/cloud-browser-api/debug-mode)
- [Browser Extensions](https://scrapfly.io/docs/cloud-browser-api/extensions)
- [Credential Vault](https://scrapfly.io/docs/cloud-browser-api/credential-vault)
- [Native Browser MCP](https://scrapfly.io/docs/cloud-browser-api/mcp)
- [DevTools Protocol](https://scrapfly.io/docs/cloud-browser-api/cdp-reference)
##### Integrations

- [Puppeteer](https://scrapfly.io/docs/cloud-browser-api/puppeteer)
- [Playwright](https://scrapfly.io/docs/cloud-browser-api/playwright)
- [Selenium](https://scrapfly.io/docs/cloud-browser-api/selenium)
- [Vercel Agent Browser](https://scrapfly.io/docs/cloud-browser-api/agent-browser)
- [Browser Use](https://scrapfly.io/docs/cloud-browser-api/browser-use)
- [Stagehand](https://scrapfly.io/docs/cloud-browser-api/stagehand)
- [1Password](https://scrapfly.io/docs/cloud-browser-api/1password)

- [Billing](https://scrapfly.io/docs/cloud-browser-api/billing)
- [Errors](https://scrapfly.io/docs/cloud-browser-api/errors)


### Tools

- [Antibot Detector](https://scrapfly.io/docs/tools/antibot-detector)

### SDK

- [Golang](https://scrapfly.io/docs/sdk/golang)
- [PHP](https://scrapfly.io/docs/sdk/php)
- [Python](https://scrapfly.io/docs/sdk/python)
- [Rust](https://scrapfly.io/docs/sdk/rust)
- [TypeScript](https://scrapfly.io/docs/sdk/typescript)
- [Scrapy](https://scrapfly.io/docs/sdk/scrapy)

### Integrations

- [Getting Started](https://scrapfly.io/docs/integration/getting-started)
- [LangChain](https://scrapfly.io/docs/integration/langchain)
- [LlamaIndex](https://scrapfly.io/docs/integration/llamaindex)
- [CrewAI](https://scrapfly.io/docs/integration/crewai)
- [Zapier](https://scrapfly.io/docs/integration/zapier)
- [Make](https://scrapfly.io/docs/integration/make)
- [n8n](https://scrapfly.io/docs/integration/n8n)

### Academy

- [Overview](https://scrapfly.io/academy)
- [Web Scraping Overview](https://scrapfly.io/academy/scraping-overview)
- [Tools](https://scrapfly.io/academy/tools-overview)
- [Reverse Engineering](https://scrapfly.io/academy/reverse-engineering)
- [Static Scraping](https://scrapfly.io/academy/static-scraping)
- [HTML Parsing](https://scrapfly.io/academy/html-parsing)
- [Dynamic Scraping](https://scrapfly.io/academy/dynamic-scraping)
- [Hidden API Scraping](https://scrapfly.io/academy/hidden-api-scraping)
- [Headless Browsers](https://scrapfly.io/academy/headless-browsers)
- [Hidden Web Data](https://scrapfly.io/academy/hidden-web-data)
- [JSON Parsing](https://scrapfly.io/academy/json-parsing)
- [Data Processing](https://scrapfly.io/academy/data-processing)
- [Scaling](https://scrapfly.io/academy/scaling)
- [Walkthrough Summary](https://scrapfly.io/academy/walkthrough-summary)
- [Scraper Blocking](https://scrapfly.io/academy/scraper-blocking)
- [Proxies](https://scrapfly.io/academy/proxies)

---

# Vercel Agent Browser Integration

1. [Cloud Browser](https://scrapfly.io/docs/cloud-browser-api/getting-started)
2. Vercel Agent Browser

 [agent-browser](https://github.com/vercel-labs/agent-browser) is an open-source command-line tool for headless browser automation by Vercel Labs. Connect it to Scrapfly Cloud Browser for scalable browser automation with built-in proxies and fingerprinting.

## What is Vercel Agent Browser?

 agent-browser lets you control headless browsers directly from the terminal. Open pages, extract text, take screenshots, and capture DOM snapshots, all via simple CLI commands. It connects to browsers using the [Chrome DevTools Protocol (CDP)](https://chromedevtools.github.io/devtools-protocol/), which is exactly how Scrapfly Cloud Browser works.

###  CLI-First

 No code needed, automate browser tasks directly from the terminal or shell scripts.

###  Fast &amp; Lightweight

 Minimal overhead with native binaries. Connects to remote browsers via WebSocket CDP.

###  CDP Native

 Uses the same protocol as Puppeteer and Playwright, connects natively to Cloud Browser.

## Installation

```
# Install via npm (recommended)
npm install -g agent-browser

# Or download a pre-built binary from GitHub releases:
# https://github.com/vercel-labs/agent-browser/releases
```

## Quick Start

 Connect agent-browser to Cloud Browser using the `--cdp` flag with a WebSocket URL:

```
# Set the Cloud Browser WebSocket URL
BROWSER_WS="wss://browser.scrapfly.io?api_key="

# Open a product page in a cloud browser session
agent-browser --cdp "$BROWSER_WS" open "https://web-scraping.dev/product/1"
# => web-scraping.dev product Box of Chocolate Candy

# Extract the product price using a CSS selector
agent-browser get text ".product-price"
# => $9.99

# Extract the product title
agent-browser get text ".product-title"
# => Box of Chocolate Candy

# Take a screenshot
agent-browser screenshot product.png

# Capture a DOM snapshot for AI processing
agent-browser snapshot -i

# Close the browser session (stops billing)
agent-browser close
```

## Connection Parameters

Configure your Cloud Browser connection with these WebSocket URL parameters:

| Parameter | Required | Default | Description |
|---|---|---|---|
| `api_key` | Yes | - | Your Scrapfly API key for authentication |
| `proxy_pool` | No | `datacenter` | Proxy network type: `datacenter` or `residential` |
| `target_url` | No | - | The URL this session will scrape. It is not navigated to, but declaring it helps our proxy network route the traffic accordingly and pick a fingerprint suited to that site.   **Recommended.** Routing is decided once, when the session opens, so a session declared without a target cannot be re-routed afterwards.   Absolute URL required (`https://example.com`); a bare hostname is rejected. `url` is an alias, and `target_url` wins if both are set. |
| `os` | No | random desktop | Operating system fingerprint: `linux`, `windows`, or `macos`. The Web Scraping API's names work too: `mac` is `macos`, and `win`, `win10` and `win11` are `windows`. Any other value is refused with [`ERR::BROWSER::CONFIG_ERROR`](https://scrapfly.io/docs/cloud-browser-api/error/ERR::BROWSER::CONFIG_ERROR) rather than replaced by a random one.   **Mobile:** `android`, `iphone`, `ipad`. A mobile value makes the browser a real phone or tablet as a whole (screen, device pixel ratio, GPU, cores and memory of the same device), so the viewport and screen reported to the page match a genuine phone or tablet rather than a resized desktop. Left unset, the random pick is always a desktop platform. Request a mobile one explicitly. |
| `browser_brand` | No | `chrome` | Chromium-based browser brand used for fingerprint generation. Valid values: `chrome`, `edge`, `brave`, `opera`. Invalid values are silently dropped and the default applies.   **Platform constraint:** `edge` is **Windows-only**; pairing it with `os=macos` or `os=linux` returns [`ERR::BROWSER::CONFIG_ERROR`](https://scrapfly.io/docs/cloud-browser-api/error/ERR::BROWSER::CONFIG_ERROR). `chrome`, `brave`, and `opera` support all three platforms. |
| `session` | No | - | Identifier for a resumable browser. Omit it for a one-shot run that cannot be reconnected. Pass a fresh value (a UUID is the safest choice) to start a new resumable session, or reuse the same value to reconnect to the existing browser. See [Session Resume](https://scrapfly.io/docs/cloud-browser-api/session-resume). |
| `share_cdp` | No | `false` | Set to `true` on a client joining an active named session. Requires `session` and is unavailable with `hitl=true`. The client gets a new tab in the same browser context while other clients stay connected. A session supports five simultaneous CDP connections, including the original client while it is connected. A joining client shares the session's network policies: one that passes a `network_policy` the session does not hold is refused. See [Share a browser across CDP connections](https://scrapfly.io/docs/cloud-browser-api/session-resume#share-cdp). |
| `country` | No | - | Proxy country code (ISO 3166-1 alpha-2), e.g., `us`, `uk`, `de` |
| `auto_close` | No | `true` | Automatically stop the browser session when the last CDP client disconnects. Set to `false` to keep the browser alive for reconnection. |
| `timeout` | No | `900` | Maximum session duration in seconds (15 minutes default, 30 minutes max). |
| `debug` | No | `false` | Enable session recording for debugging. See [Debug Mode](https://scrapfly.io/docs/cloud-browser-api/debug-mode). |
| `network_policy` | No | - | Hosts this session may reach, as URL-encoded JSON: `{"allow": ["web-scraping.dev"], "block": ["ads.web-scraping.dev"]}`. The policy of your project always applies and this one can only narrow it. A session policy travels in the connection URL: keep it to a few dozen entries and put a longer list on the project policy. A value that is not a policy returns [`ERR::BROWSER::INVALID_NETWORK_POLICY`](https://scrapfly.io/docs/cloud-browser-api/error/ERR::BROWSER::INVALID_NETWORK_POLICY). See [Network Policy](https://scrapfly.io/docs/cloud-browser-api/network-policy). |
| `downloads_stream` | No | `false` | Set to `1` (or `true`) to receive large downloaded files as stream handles you read in chunks, instead of inline base64 in a single message. `ScrapiumBrowser.getDownloads` then returns each file once, and any file over about 6 MB under `streams`. Recommended whenever a download may exceed a few megabytes. See [Large Downloads](https://scrapfly.io/docs/cloud-browser-api/file-downloads#large-downloads). |
| `block_images` | No | `false` | Stub image requests with a transparent 1x1 pixel. Reduces bandwidth while remaining invisible to anti-bot systems. |
| `block_styles` | No | `false` | Stub stylesheet requests with an empty CSS response. |
| `block_fonts` | No | `false` | Stub font requests with an empty response. |
| `block_media` | No | `false` | Stub video and audio media requests. |
| `blacklist` | No | `false` | Stub known analytics, tracking, and telemetry URLs. |
| `cache` | No | `false` | Enable HTTP cache for static resources. Cached bandwidth billed at 1 credit/MB. |
| `enable_mcp` | No | `false` | Enable the browser's built-in **Model Context Protocol** (MCP) support. When enabled, the browser exposes a streamable-HTTP MCP endpoint that AI agents can connect to for standardized browser interaction and access to any tools registered by the page via `navigator.modelContext`. The MCP endpoint URL is returned in the allocation response as `mcp_endpoint`. See [Native Browser MCP documentation](https://scrapfly.io/docs/cloud-browser-api/mcp). |
| `solve_captcha` | No | `false` | Arm the browser's built-in **captcha detector and solver** on every tab your client attaches to, up to 8 tabs at once. Turnstile, DataDome slider, reCAPTCHA, GeeTest, PerimeterX hold, and puzzle captchas are handled automatically, no extra CDP calls required from the client. Billed per solve; a `captchaError` costs nothing unless the captcha's solve had started. Kept for the rest of a session: a reconnect to a kept-alive session arms the solver again, with or without this parameter. See [Captcha Solver documentation](https://scrapfly.io/docs/cloud-browser-api/captcha-solver). |
| `lang` | No | - | Primary browser UI language base tag (e.g. `en`, `de`, `fr`). Sets `navigator.language`. When omitted, the language is derived from the `country` parameter. |
| `languages` | No | - | Ordered `Accept-Language` preference list as a comma-separated string of BCP-47 locale tags (e.g. `fr-FR,fr,en-US`). Drives `navigator.languages` and the HTTP `Accept-Language` header. Maximum 3 entries - order indicates priority. When omitted, the language list is derived from the `country` parameter. |

 **Stubbing vs Blocking:** Resources are **stubbed**, not blocked, the browser receives a valid but empty response (e.g. a transparent 1x1 pixel for images). This saves bandwidth while remaining invisible to anti-bot systems that detect blocked requests.

## Command Reference

Once connected via `--cdp`, agent-browser remembers the session. Subsequent commands operate on the same browser:

| Command | Description |
|---|---|
| `agent-browser --cdp <url> open <target>` | Open a URL in the cloud browser. |
| `agent-browser get text body` | Extract all visible text from the page body. |
| `agent-browser get text <selector>` | Extract text from a specific CSS selector. |
| `agent-browser snapshot -i` | Capture an interactive DOM snapshot. |
| `agent-browser screenshot <file.png>` | Save a screenshot of the current page. |
| `agent-browser close` | Close the browser session (stops billing). |

## Data Extraction

Extract text content from a page using CSS selectors:

```
BROWSER_WS="wss://browser.scrapfly.io?api_key="

# Open a product page
agent-browser --cdp "$BROWSER_WS" open "https://web-scraping.dev/product/1"

# Extract the sale price
agent-browser get text ".product-price"
# => $9.99

# Extract the original price
agent-browser get text ".product-price-full"
# => $12.99

# Extract the product description
agent-browser get text ".product-description"

# Save the full page text to a file
agent-browser get text body > product_data.txt

# Screenshot for visual verification
agent-browser screenshot product.png

# Always close when done
agent-browser close
```

## Geo-Targeted Browsing

Browse from different countries by setting the `country` parameter in the WebSocket URL:

```
# Browse from Germany
agent-browser --cdp "wss://browser.scrapfly.io?api_key=&country=de" open "https://web-scraping.dev/product/1"
agent-browser screenshot germany.png
agent-browser close

# Browse from Japan
agent-browser --cdp "wss://browser.scrapfly.io?api_key=&country=jp" open "https://web-scraping.dev/product/1"
agent-browser screenshot japan.png
agent-browser close
```

## Session Management

 agent-browser supports named sessions via the `--session` flag. Each session maintains its own browser instance. Combine this with Cloud Browser's `session` parameter for persistent state across connections:

```
# Create a named session with persistent Cloud Browser state
agent-browser --session my-task --cdp "wss://browser.scrapfly.io?api_key=&session=my-task" open "https://web-scraping.dev/login"

# Interact with the page
agent-browser --session my-task get text body

# Close the session
agent-browser --session my-task close
```

## Best Practices

- **Always close sessions** - Run `agent-browser close` when done to stop billing
- **Use named sessions** - The `--session` flag keeps multiple browser instances separate
- **Pipe output** - Redirect text extraction output to files for processing: `agent-browser get text body > output.txt`
- **Use in scripts** - agent-browser commands work great in shell scripts for batch automation

## Related

- [Cloud Browser Getting Started](https://scrapfly.io/docs/cloud-browser-api/getting-started)
- [Proxy &amp; Geo-Targeting](https://scrapfly.io/docs/cloud-browser-api/proxy)
- [Billing &amp; Pricing](https://scrapfly.io/docs/cloud-browser-api/billing)
- [Puppeteer Integration](https://scrapfly.io/docs/cloud-browser-api/puppeteer)
- [Playwright Integration](https://scrapfly.io/docs/cloud-browser-api/playwright)
- [agent-browser on GitHub](https://github.com/vercel-labs/agent-browser)
