---
title: "AI agent browser"
description: "An AI agent browser in the cloud: let Claude, Cursor or your own agent log in, fill forms and click through portals over MCP or Playwright CDP."
canonical: https://www.zenrows.com/use-cases/ai-agent-browser
updated: 2026-10-18
---

# AI agent browser

An AI agent browser is a real cloud browser that an AI agent controls to act on websites: open pages, log in, click, type, fill forms and read what loads. Zenrows Browser gives agents that browser through MCP tools such as browser_navigate and browser_click, or through Playwright and Puppeteer over CDP, with Zenrows' stealth on every session.

## Sample output: one agent task, step by step

```json
{
  "task": "Find the newest invoice in the supplier portal",
  "session_id": "sess_8c41e2",
  "steps": [
    { "tool": "browser_navigate", "url": "https://portal.example.com/login" },
    { "tool": "browser_fill", "selector": "#email", "value": "ops@example.com" },
    { "tool": "browser_fill", "selector": "#password", "value": "********" },
    { "tool": "browser_click", "selector": "button[type=submit]" },
    { "tool": "browser_wait_for_selector", "selector": "table.invoices" },
    { "tool": "browser_get_text", "selector": "table.invoices tbody tr:first-child" },
    { "tool": "browser_close" }
  ],
  "result": {
    "invoice": "INV-2026-0912",
    "amount": 1240.0,
    "currency": "EUR",
    "due_date": "2026-11-05"
  },
  "session_minutes": 2
}
```

An illustrative trace of what an agent does through the Zenrows MCP server; the tool names are real, the portal and values are placeholders.

## What teams use an agent browser for

Agents need a browser when the answer sits behind an action. If a single request returns the page, Fetch is faster and simpler; a browser earns its place once the task has a login, a form or a click in it.

| Job | Data you collect | Typical sources |
|---|---|---|
| Portal logins and downloads | Invoices, statements, order and shipment status | Supplier portals, Maersk and Hapag-Lloyd tracking, utility accounts |
| Form-driven lookups | Results that appear only after a search form | State court portals, company registries, county property search |
| Availability checks | Slots, seats or stock revealed by clicks | Government appointment pages, airline booking flows, ticketing sites |
| Configurators and quotes | A price that depends on the options selected | Car configurators, insurance quote forms, B2B price calculators |
| Dynamic dashboards | Numbers rendered after tabs, filters or scroll | Marketplace seller centers, analytics dashboards |
| Checking your own flows | Whether sign-up, search and checkout still work | Your staging and production web apps |

## Why agents fail in a browser

An agent that reasons well still fails if its browser is flagged, loses its login or dies halfway through a task. These are the failures teams hit when they run a local headless browser for an agent.

| What breaks | What it looks like | How Zenrows handles it |
|---|---|---|
| Headless browser flagged | A Turnstile loop or "verify you are human" page on step one | Sessions run with Zenrows' stealth, which gets through Cloudflare Turnstile and similar protections |
| State lost between steps | The agent logs in, then the next action lands on a logged-out page | One `session_id` keeps cookies and tabs across every tool call |
| Selectors the agent guesses wrong | Clicks miss after a redesign and the agent loops | `browser_get_accessibility_tree` lets the agent pick elements by role and text |
| Sessions left running | Sessions stay open after the agent has its answer and pile up across runs | The agent calls `browser_close` at the end of each task, which frees the session |
| Browser infrastructure | Chrome versions, memory limits and crashed containers to babysit | A hosted browser at `wss://browser.zenrows.com`, nothing to run yourself |
| No record of what happened | Nobody can tell why a run returned the wrong value | `browser_screenshot` captures the page at any step for review |

## Set up an AI agent browser with Zenrows

1. **Connect the agent.** Add the MCP server to Claude Code with `claude mcp add zenrows -e ZENROWS_API_KEY=YOUR_ZENROWS_API_KEY -- npx -y @zenrows/mcp`, or point any MCP client at `https://mcp.zenrows.com/mcp` with your key as a Bearer token.
2. **Describe the goal.** Tell the agent the task and the end state you expect. It opens a session with `browser_navigate` and decides each next step from what it sees.
3. **Script the parts that never change.** For logins and fixed flows, drive the same browser from Playwright or Puppeteer over CDP, then let the model handle the variable part.
4. **Close every session.** End each task with `browser_close` and log the session minutes, so time per task stays visible.

```javascript Node.js
// npm install playwright-core
import { chromium } from "playwright-core";

const browser = await chromium.connectOverCDP(
  "wss://browser.zenrows.com?apikey=YOUR_ZENROWS_API_KEY"
);
const context = browser.contexts()[0] ?? (await browser.newContext());
const page = await context.newPage();

// Scripted login: credentials stay in env vars, never in the prompt.
await page.goto(LOGIN_URL);
await page.fill("#email", process.env.PORTAL_USER);
await page.fill("#password", process.env.PORTAL_PASSWORD);
await page.click("button[type=submit]");
await page.waitForSelector("main");

// Hand the model a compact view of the page to choose its next action.
const snapshot = await page.locator("main").ariaSnapshot();
console.log(snapshot);

await browser.close();
```

```text Claude Code (MCP)
# Connect once
claude mcp add zenrows -e ZENROWS_API_KEY=YOUR_ZENROWS_API_KEY -- npx -y @zenrows/mcp

# Then ask:
Use the Zenrows browser to open TARGET_URL, search for "ACME Holdings" in the company search form, open the first result, and tell me the registration number and status. Close the browser session when done.
```

```bash CLI
npx -y @zenrows/cli init
# Print the MCP config for your agent, so it gets the browser tools
zenrows mcp config --client claude-code
# Read a page that needs no clicks straight from the terminal
zenrows fetch TARGET_URL --output markdown
```

## Which Zenrows product fits

| If you need to | Use | Why |
|---|---|---|
| Let an agent log in, click and fill forms | [Browser](/products/browser) | A real cloud browser the agent controls over CDP or MCP |
| Give Claude, Cursor or Codex browser tools | [MCP Server](/mcp) | `browser_navigate`, `browser_click`, `browser_fill` and more as standard tools |
| Set up an agent or read pages from a coding agent's shell | [CLI](/cli) | `zenrows mcp config` prints the MCP setup, and `zenrows fetch` reads pages from the terminal |
| Read a page that needs no interaction | [Fetch](/products/fetch) | One request returns the page, with no session to open or close |
| Teach the agent which tool fits each task | [Agent Toolkit](/agents) | Skills and plugins that route reads to Fetch and actions to Browser |

## What success looks like

| Measure | What good looks like | How to check it |
|---|---|---|
| Task completion | The agent reaches the expected end state on your test tasks | Keep a fixed task set with known answers and rerun it weekly |
| Steps per task | Step counts stay stable from run to run on the same task | Count tool calls per task in the agent's trace |
| Session minutes per task | Minutes match the work done, with no idle tail | Compare session duration with the timestamp of the last action |
| Orphaned sessions | Every session the agent opens is closed | Match each `browser_navigate` that opened a session to a `browser_close` |
| Challenge pages | The agent rarely meets a block page on your target sites | Screenshot or log any page that contains a challenge marker |
| Human handoffs | Few tasks need a person to finish them | Track tasks escalated to a human per week |

## AI agent browser FAQ

### What is an AI agent browser?

It is a browser that an AI agent operates instead of a person. The agent receives a goal, opens a page, reads it, and chooses the next action: click, type, select, scroll or wait. Zenrows Browser runs that browser in the cloud, so the agent connects to it over MCP or CDP instead of launching Chrome on your machine.

### How do I give Claude or Cursor a browser?

Connect the Zenrows MCP server. In Claude Code, run claude mcp add zenrows -e ZENROWS_API_KEY=YOUR_ZENROWS_API_KEY -- npx -y @zenrows/mcp . In Cursor, Windsurf, VS Code and other clients, add https://mcp.zenrows.com/mcp as a remote server with your API key as a Bearer token. The agent then sees the browser_* tools and uses them when a task needs a browser.

### Can an AI agent log in to websites?

Yes, with credentials you are entitled to use. The session keeps cookies across steps, so the agent stays logged in for the rest of the task. A safer pattern is to script the login in Playwright with credentials from environment variables, then let the model work on the logged-in page, so passwords never pass through the prompt.

### Should I use MCP or Playwright over CDP?

Use MCP when the path is unknown in advance and you want the model to decide each step. Use Playwright or Puppeteer over CDP when the flow is fixed and you want it fast and repeatable. Both connect to the same Zenrows Browser, so you can script the login and the fixed navigation in Playwright, then hand the variable part of the task to the agent.

### What happens when a site shows a CAPTCHA or a Cloudflare challenge?

Zenrows Browser sessions run with Zenrows' stealth, so agents get through Cloudflare, Turnstile, DataDome and Akamai checks the way a regular visitor does. The agent keeps working on the page it asked for, and browser_screenshot lets you review what it saw at any step.

### Which browser tools does the Zenrows MCP server give an agent?

The browser tools cover what a person does on a page: browser_navigate to open a URL, browser_click , browser_fill , browser_type and browser_select_option to act, browser_scroll and browser_wait_for_selector to move and wait, and browser_get_text , browser_get_accessibility_tree , browser_screenshot and browser_evaluate to read. Tabs, cookies and back and forward navigation are covered too, and browser_close ends the session.

### When should an agent use Fetch instead of a browser?

Whenever the page needs no interaction. Fetch returns the page as HTML, Markdown or JSON in one request, with Adaptive Stealth Mode adding browser rendering only when the page needs it, and there is no session to manage. Most agents do best with both: Fetch for reading, Browser for the steps that need a login, a form or a click.

## Related use cases

- [Browser automation](https://www.zenrows.com/use-cases/browser-automation.md): Logins, portal lookups and report downloads run in a cloud browser your Playwright or Puppeteer code drives.
- [LLM web scraping for RAG and agents](https://www.zenrows.com/use-cases/llm-web-scraping.md): Live pages as Markdown or JSON for RAG pipelines, grounding and agent tool calls.
- [Public records API](https://www.zenrows.com/use-cases/public-records-api.md): Permits, violations, licenses and registry filings from city, county and state portals, returned as JSON on demand.

Start free: https://app.zenrows.com/register. Docs: https://docs.zenrows.com
