# agent-browser

Adopt this skill: https://proskills.md/skills/other/oxylabs-agent-skills-skills-agent-browser

Page: https://proskills.md/skills/other/oxylabs-agent-skills-skills-agent-browser
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/agent-browser/SKILL.md
size: 8033
upstream: https://github.com/oxylabs/agent-skills/blob/main/skills/agent-browser/SKILL.md

````text
---
name: agent-browser
description: Connects to Oxylabs remote agent browsers over the Chrome DevTools Protocol (CDP) with Playwright or Puppeteer. Built-in anti-detection, residential proxies, geo-targeting, persistent sessions and profiles, session recording and live VNC inspection for debugging. Use instead of WebFetch or a local browser whenever a site renders with JavaScript, blocks bots (DataDome, Cloudflare, Akamai), needs a real browser session, screenshots or PDFs. Covers connection, retries, error recovery and safe scraping of protected targets without any human help.
---

# Oxylabs Agent Browser

Remote Chrome sessions with anti-detection, proxy rotation and geo-targeting built in.
Nothing runs locally: you connect over a WebSocket, drive the browser with the CDP library you already
use, and close the session when done. This file holds the rules; the detail lives next to it:
`scripts/` (copyable templates), `parameters.md`, `errors.md`, `examples.md`, `targets.md`.

## 1. Connect

| Item | Value |
|------|-------|
| Endpoint | `wss://USERNAME:PASSWORD@hb.oxylabs.io` |
| Credentials | `OXY_UNBLOCKER_USERNAME` / `OXY_UNBLOCKER_PASSWORD` (aliases: `OXY_HB_USERNAME` / `OXY_HB_PASSWORD`) |
| Options | URL query parameters only, e.g. `?p_cc=US&session_name=job-42` (see `parameters.md`) |
| Libraries | Playwright `chromium.connectOverCDP` (recommended), Puppeteer `puppeteer.connect`, any CDP client |
| Dashboard / support | `https://hb.oxylabs.io/dashboard` · `support@oxylabs.io` |

Rules that prevent the most common `401`:

- Use `wss://`. Plain `ws://` is accepted but sends your password unencrypted.
- Build the URL by string concatenation with the **raw** password. Do not pass the finished URL through
  `new URL()` or `urllib.parse`: they percent-encode the password and authentication fails.
- Use the full username exactly as shown in the dashboard, including any suffix such as `_ab12`.
- A password containing `:` cannot be sent in the URL. Ask for a new password or send the
  `Authorization: Basic` header yourself (see `examples.md`).
- Authentication is checked before parameters: fix a `401` before looking at anything else.

## 2. Quick start

Minimal shape (Playwright, JavaScript):

```javascript
const { chromium } = require("playwright");
const url = `wss://${process.env.OXY_UNBLOCKER_USERNAME}:${process.env.OXY_UNBLOCKER_PASSWORD}@hb.oxylabs.io?p_cc=US`;
const browser = await chromium.connectOverCDP(url, { timeout: 60000 });
try {
  const page = await browser.contexts()[0].newPage(); // default context: backed by fingerprint, proxy, o_profile
  await page.goto("https://example.com", { waitUntil: "domcontentloaded", timeout: 30000 });
  console.log(await page.content());
} finally {
  await browser.close(); // always: an unclosed session keeps its concurrency slot
}
```

For real work copy `scripts/playwright_scrape.js` or `scripts/playwright_scrape.py` whole instead of
reimplementing. They add the five behaviours everything else in this file assumes:

- **Connect with backoff** (1 s base, 60 s cap, jitter, 6 attempts) only on retryable errors: `429`, `5xx`,
  `CDP_SESSION_IN_USE`, `CDP_NO_BROWSERS_AVAILABLE`, `CDP_BROWSER_OVERWORKED`, `CDP_BAD_PROXY`,
  `CDP_GENERAL_ERROR`, timeouts. `400`/`401`/`403` mean the request is wrong: fix, never retry unchanged.
- **Redact the password** from every error message before logging; Playwright embeds the connection URL in it.
- **Block `image`, `stylesheet`, `media`, `font`** by default; they cost time and are not needed for data extraction.
- **Register listeners before navigating**: the `X-Error-Description` response header marks an Oxylabs-side
  error on page traffic.
- **`browser.close()` in `finally`**, and wrap the job in an overall deadline so a wedged session still gets there.

Puppeteer, Python async, raw CDP, session hand-over, profiles, recording and fan-out: `examples.md`.

## 3. Sessions and limits

| Limit (account defaults) | Value | When exceeded |
|--------------------------|-------|---------------|
| New sessions per second | 10 | `429 CDP_SESSION_RATE_LIMIT_REACHED` (space launches >= 150 ms) |
| Concurrent sessions | 100 | `429 CDP_MAX_CONCURRENT_SESSIONS_REACHED` |
| Named (resumable) sessions | 5 | `429 CDP_MAX_PERSISTENT_SESSIONS_REACHED` |
| Stored profiles (`o_profile`) | 5 | `403 profile limit reached (5 profiles maximum)` |
| Recordings | 10 | `403 recording limit reached (10 recordings maximum)` |
| Concurrent inspection viewers | 10 | `CDP_VNC_MAX_CONCURRENT_SESSIONS_REACHED` |

- `session_name` (`^[A-Za-z0-9-]{3,36}$`) makes a session resumable for **10 minutes** after disconnect.
  `keep_alive` is implied by it; **never send `keep_alive=true` alone** (`400 keep_alive requires session_name`).
- Reconnecting while the old connection is still attached returns `429 CDP_SESSION_IN_USE`: close it first.
- Any session lives at most **1 hour**. Plan long jobs as several sessions.
- An abandoned session keeps its concurrency slot (about 20 s, or the full 10 min when named) and surfaces later
  as an unrelated `429 CDP_MAX_CONCURRENT_SESSIONS_REACHED`. Closing the Playwright/Puppeteer object is enough.
- `browser.close()` wipes open pages and cookies even though a named session stays resumable. To hand a session
  over use Puppeteer `browser.disconnect()` (see `examples.md`, "Resume a named session"). State that must
  outlive a session (logins, clearance cookies) belongs in `o_profile`, not keep-alive.
- Every distinct parameter combination is provisioned separately: keep the set stable across a job.
- Under load a connection may queue and end with `503 queue timeout` after about a minute: back off and retry.
  Higher limits via support.

## 4. Errors

Three channels. **Handshake**: HTTP status plus a short body (Playwright: `WebSocket error: <URL with password>
<status>` then the body; Puppeteer: `Unexpected server response: <status>`). **Post-connect**: the WebSocket closes
with code `3000` and a `CDP_*` reason that only raw clients see; Playwright/Puppeteer just report `Target closed`,
so treat any disconnect in the first seconds of a session as retryable. **In-page**: CDP error `1337` for one
refused command. On page traffic, a response **with** `X-Error-Description` is an Oxylabs network error (retry);
a block page **without** it is the target's decision (change approach, do not retry).

```text
connect failed?
  ├─ 401 ............ fix credentials/scheme, do not retry
  ├─ 400/403/409 .... fix the named parameter, do not retry unchanged (409: wait 30 s+ for the other session)
  ├─ 429 ............ backoff; if MAX_CONCURRENT: hunt for unclosed sessions
  └─ 5xx/503 ........ backoff, up to ~2 min total
session dropped (close 3000)?
  └─ new session with backoff; rotate sticky id on CDP_BAD_PROXY
navigate failed with 1337 Invalid target?
  └─ stop; restricted target (section 7)
page shows block / 403 wall?
  ├─ X-Error-Description present .... Oxylabs network issue: backoff + retry
  └─ absent ......................... target decision: change identity, geo, device, pacing (section 5)
```

Every message text with cause and fix: `errors.md`.

## 5. Target safety (DataDome and similar)

**Default parameter set for most jobs: `p_cc`, nothing else.** Every session already gets a fresh fingerprint
and a fresh residential IP, which is what one-shot fetches and fan-outs of independent pages need. Sticky IPs
and stored profiles are opt-in tools for a specific need, never a baseline.

**Work order for a protected target.** First write a plain script and make it pass: one fresh session per page,
the right geo and device, human pacing, then the escalation ladder below. Only when that script still fails
after the ladder do you **recommend persistent profiles to the user** (the setup/consumer pattern below, with
why it should help and what it costs: a setup step, the profile cap of 5) and implement them only on their
go-ahead. Never add a profile or sticky id on your own initiative.

|
````

## File: README.md
upstream: https://github.com/oxylabs/agent-skills/blob/main/README.md

````text
# Oxylabs Agent Skills
[![Oxylabs promo code](https://github.com/oxylabs/agent-skills/blob/main/Agent%20Skills.png)](https://oxylabs.io/web-api-early-access?utm_source=github&utm_medium=referral&utm_content=agent-skills&utm_campaign=banner&groupid=877)

<p align="left">
  <a href="https://dashboard.oxylabs.io"><img src="https://img.shields.io/badge/%F0%9F%9A%80_Get_Started-FF6B35?style=for-the-badge" alt="Get started"></a>
  <a href="https://developers.oxylabs.io/products/web-api?utm_source=github&utm_medium=referral&utm_content=agent-skills&utm_campaign=banner&groupid=877"><img src="https://img.shields.io/badge/%F0%9F%93%9A_Documentation-4A90E2?style=for-the-badge" alt="Documentation"></a>
  <a href="https://dashboard.oxylabs.io"><img src="https://img.shields.io/badge/%F0%9F%93%8A_Dashboard-2EA44F?style=for-the-badge" alt="Dashboard"></a>
  <a href="https://discord.gg/Pds3gBmKMH"><img src="https://img.shields.io/badge/%F0%9F%92%AC_Discord-5865F2?style=for-the-badge" alt="Discord"></a>
  <a href="https://www.youtube.com/@oxylabs"><img src="https://img.shields.io/badge/%E2%96%B6%EF%B8%8F_YouTube-FF0000?style=for-the-badge" alt="YouTube"></a>
</p>

Official agent skills for Oxylabs products. Each skill provides structured instructions that AI agents can use to interact with Oxylabs services.

## Available Skills

| Skill | Directory | Description |
|-------|-----------|-------------|
| Proxies | [`skills/proxies`](skills/proxies/SKILL.md) | Residential, Mobile, Datacenter, Dedicated Datacenter, ISP and Dedicated ISP proxy network with geo-targeting, IP rotation, and session persistence |
| Web Unblocker | [`skills/web-unblocker`](skills/web-unblocker/SKILL.md) | AI-powered proxy that handles fingerprinting, JavaScript rendering, CAPTCHAs, and improves access reliability automatically |
| Web Scraper API | [`skills/web-scraper-api`](skills/web-scraper-api/SKILL.md) | Production-grade web scraping with structured JSON parsing for 40+ targets and geo-targeting |
| Agent Browser | [`skills/agent-browser`](skills/agent-browser/SKILL.md) | Remote agent browsers via CDP (Playwright/Puppeteer) with built-in request handling and residential proxies |
| Video Data | [`skills/video-data`](skills/video-data/SKILL.md) | Video data extraction (metadata, subtitles, search, channels) and high-bandwidth proxy video downloads |

## Product Routing

| Need | Use |
|------|-----|
| Bring your own HTTP client, proxy auth, IP rotation, sticky sessions, or raw geo-targeted proxy traffic | Proxies |
| Fetch protected pages without browser interactions | Web Unblocker |
| Get structured data from supported targets, search results, e-commerce pages, or parsed JSON | Web Scraper API |
| Clicks, forms, screenshots, browser state, or Playwright/Puppeteer automation | Agent Browser |
| YouTube metadata, subtitles, search, channel data, or video/audio downloads | Video Data |

Start with the most specific product that fits the task. Validate one small request first, confirm auth, status, and expected output, then scale with explicit limits.

## Installation

### Claude Code (plugin marketplace)

Inside Claude Code, run:

```
/plugin marketplace add oxylabs/agent-skills
/plugin install oxylabs@oxylabs-agent-skills
```

This installs all 5 skills as a single plugin. To update later:

```
/plugin marketplace update oxylabs-agent-skills
```

### Other agents (generic)

```bash
npx skills add https://github.com/oxylabs/agent-skills.git
```

## Configuration

All skills authenticate via environment variables defined in a `.env` file.

| Variable | Used By | Description |
|----------|---------|-------------|
| `OXY_RES_USERNAME` | Residential/Mobile Proxies | Residential or Mobile proxy username |
| `OXY_RES_PASSWORD` | Residential/Mobile Proxies | Residential or Mobile proxy password |
| `OXY_DC_USERNAME` | Datacenter/ISP Proxies | Datacenter or ISP proxy username |
| `OXY_DC_PASSWORD` | Datacenter/ISP Proxies | Datacenter or ISP proxy password |
| `OXYLABS_USERNAME` | Web Unblocker | Web Unblocker username |
| `OXYLABS_PASSWORD` | Web Unblocker | Web Unblocker password |
| `OXY_WSA_USERNAME` | Web Scraper API, Video Data | Web Scraper API username |
| `OXY_WSA_PASSWORD` | Web Scraper API, Video Data | Web Scraper API password |
| `OXY_AB_USERNAME` | Agent Browser | Agent Browser username |
| `OXY_AB_PASSWORD` | Agent Browser | Agent Browser password |
| `OXY_HB_ENDPOINT` | Video Data | Dedicated high-bandwidth proxy endpoint (for video downloads) |

Read more on our [agent skills documentation](https://developers.oxylabs.io/products/proxies/residential-proxies/agent-skills/?utm_source=github&utm_medium=referral&utm_content=agent-skills&groupid=877)
````
