← Blog

BLOG

Agent Control Browser: How to Drive Hosted Chromium in Production

Learn how an agent control browser works with CDP and Playwright to give AI agents reliable, persistent browser access in production.

August 31, 20268 min readRemote Browser

# Agent Control Browser: How to Drive Hosted Chromium in Production

If you're building an AI agent that needs to browse the web, you've probably hit the same wall: local Chrome works in a demo, but falls apart in production. Sessions die, IPs get blocked, and you can't debug what your agent actually saw. The solution is an agent control browser—a hosted Chromium runtime that your code or AI agent can drive remotely over the Chrome DevTools Protocol (CDP) or Playwright. This guide explains how agent control browsers work, why they matter for production workloads, and how to connect your agent to one using concrete code.

What Is an Agent Control Browser?

An agent control browser is a browser instance that runs on a remote server, not on your local machine. Your AI agent or automation script connects to it over a network protocol—typically CDP or the Playwright driver—and issues commands like goto, click, type, and extract. The browser executes those commands in a real Chromium environment and returns the results.

The term "agent control browser" is broader than "remote browser" or "cloud browser." It emphasizes the *control* aspect: your agent doesn't just view a page; it drives the browser programmatically. This is distinct from a remote desktop browser, where a human controls the UI. With an agent control browser, the control plane is code.

Why Your AI Agent Needs a Dedicated Browser Runtime

Running a browser inside your agent's process is tempting. You install Playwright, launch Chromium, and start automating. But production workloads expose several problems:

  1. Session persistence: When your agent crashes or a worker restarts, the browser session is gone. Cookies, localStorage, and login states vanish.
  2. Resource contention: Browsers are memory-hungry. Running multiple agents on one machine means managing CPU and RAM carefully.
  3. Network reputation: Cloud provider IP ranges are often flagged by anti-bot systems. Your agent gets CAPTCHAs or 403s.
  4. Debugging: When your agent fails, you need to see what it saw. Local browsers don't give you a replayable session log.
  5. Concurrency: Scaling from 1 agent to 100 requires a browser pool, not a single local instance.

A hosted agent control browser solves these by decoupling the browser from your agent's execution environment. The browser lives in a managed runtime, and your agent connects to it on demand.

How Agent Control Browsers Work: CDP and Playwright

The two primary protocols for controlling a remote browser are CDP and the Playwright driver. Both are supported by Remote Browser's hosted Chromium sessions.

Chrome DevTools Protocol (CDP)

CDP is the protocol that Chrome DevTools uses to inspect and control Chromium. It exposes a WebSocket endpoint that accepts JSON commands. Playwright, Puppeteer, and Selenium all speak CDP under the hood.

To connect to a remote browser via CDP, you need:

  • A WebSocket URL (e.g., wss://remote-browser.dev/ws/...)
  • A client library that speaks CDP (Puppeteer, Playwright, or raw WebSocket)

Playwright's connect_over_cdp

Playwright provides a connect_over_cdp method that lets you attach to an existing browser instance. This is the cleanest way to control a remote browser if you're already using Playwright.

import { chromium } from 'playwright';

// Connect to a Remote Browser session over CDP
const browser = await chromium.connectOverCDP('wss://remote-browser.dev/ws/your-session-id');

// Get the default context and page
const defaultContext = browser.contexts()[0];
const page = defaultContext.pages()[0];

// Drive the browser
await page.goto('https://example.com');
await page.fill('#search', 'agent control browser');
await page.click('button[type="submit"]');

// Extract data
const results = await page.locator('.result').allTextContents();
console.log(results);

// Keep the session alive for debugging
await page.waitForTimeout(5000);

await browser.close();

This code connects to a hosted Chromium session, navigates to a page, performs a search, and extracts results. The session stays alive after the script ends, so you can inspect it in the live viewer.

Key Features of a Production-Grade Agent Control Browser

Not all remote browsers are equal. When evaluating an agent control browser for production, look for these capabilities:

FeatureWhy It MattersLocal BrowserRemote Browser
Session persistenceKeep login state across agent runs❌ Lost on restart✅ Persistent profiles
Live debuggingSee what the agent sees in real time❌ Not possible✅ Live viewer
CDP supportConnect with any CDP-compatible client✅ Native✅ Native
Playwright connect_over_cdpAttach to existing browser⚠️ Same machine only✅ Remote
Proxy supportRoute traffic through different IPs❌ Manual setup✅ Configurable
Session isolationSeparate agents don't interfere❌ Shared process✅ Isolated sessions
Usage controlsCap spending and runtime❌ N/A✅ Configurable limits

Production Criteria for Agent Control Browsers

Before you deploy an agent control browser, verify these five criteria:

1. Session Lifecycle Management

Your agent will crash. Your worker will restart. Your network will drop. The browser session must survive these events. Look for:

  • Persistent profiles: Cookies and localStorage stored on the server, not in memory.
  • Session IDs: A stable identifier you can reconnect to.
  • Idle timeout: Configurable so you don't pay for unused sessions.

2. Protocol Compatibility

Your agent might use Playwright today and Puppeteer tomorrow. The browser runtime should support both. CDP is the common denominator—if the runtime exposes a CDP endpoint, any CDP-compatible client can connect.

3. Network Configuration

Anti-bot systems are aggressive. Your agent needs control over the IP address it appears to come from. A production agent control browser should support:

  • Proxy configuration: Route traffic through residential or datacenter proxies.
  • Geolocation: Set the browser's apparent location.
  • User agent control: Override the default Chromium user agent.

4. Observability

You can't debug what you can't see. A production browser runtime should provide:

  • Live viewer: Watch the browser in real time.
  • Session recording: Replay what the agent did.
  • Console logs: Capture browser console output.

5. Cost Control

Browser hours add up. A production runtime should let you:

  • Set a maximum session duration.
  • Cap concurrent sessions.
  • Monitor usage per agent or per project.

Common Use Cases for Agent Control Browsers

AI Web Agents

The most common use case is giving an AI agent (like a LangChain or AutoGPT-style agent) browser access. The agent receives a task, plans a sequence of browser actions, and executes them via the control browser. The hosted runtime keeps the session alive while the agent thinks, and the live viewer lets you watch the agent work.

Browser Automation at Scale

If you're running thousands of browser tasks (e.g., scraping, form filling, testing), you need a browser pool. An agent control browser API lets you spin up sessions on demand and tear them down when done. This is more efficient than managing a fleet of VMs.

Persistent Login Sessions

Some tasks require staying logged in across multiple runs. A persistent profile in a hosted browser keeps the login state, so your agent doesn't need to re-authenticate every time.

How Remote Browser Implements Agent Control

Remote Browser provides a hosted Chromium runtime designed specifically for AI agents and automation. Here's how it maps to the criteria above:

  • CDP endpoint: Every session exposes a WebSocket URL for CDP connections.
  • Playwright compatibility: Use connect_over_cdp directly, as shown in the code above.
  • Persistent profiles: Sessions can be configured to persist data across connections.
  • Live viewer: A web-based viewer lets you watch the browser in real time.
  • Proxy settings: Configure outbound IPs per session.
  • Usage controls: Set session timeouts and concurrency limits.

The service is designed to be a drop-in replacement for local Chromium. If your agent already uses Playwright or Puppeteer, you change the connection string and nothing else.

Trade-offs: Hosted vs. Self-Managed

Hosting your own browser infrastructure gives you full control, but it comes with operational overhead. Here's the honest trade-off:

AspectSelf-ManagedHosted (Remote Browser)
Setup timeDays to weeksMinutes
MaintenanceYou handle updates, scaling, monitoringProvider handles it
CostPay for VMs 24/7Pay per browser hour
CustomizationFull controlConfigurable, but limited to API
ReliabilityDepends on your opsProvider SLA

If you're running a small number of agents, self-managed might be fine. If you're scaling to many agents, the operational burden of managing browsers becomes a distraction from your core product.

Getting Started with an Agent Control Browser

Here's a practical path to production:

  1. Start with a local Playwright script that works against a regular browser.
  2. Swap the connection to use connect_over_cdp with a Remote Browser session.
  3. Test session persistence by disconnecting and reconnecting.
  4. Add observability by checking the live viewer during a run.
  5. Set usage controls to cap session duration and concurrency.

The Remote Browser documentation covers the API in detail, and the pricing page shows current rates for browser hours.

If you're evaluating browser runtimes for AI agents, these posts cover adjacent topics:

External References

For a deeper dive into the underlying protocol, see the Chrome DevTools Protocol documentation and the Playwright CDP connection guide.

Conclusion

An agent control browser is the missing runtime layer for AI web agents. It gives you persistent sessions, remote control via CDP or Playwright, and the observability you need to debug production failures. Whether you're building a research agent, a scraping pipeline, or a browser-based QA harness, the pattern is the same: connect your code to a hosted Chromium session and let the runtime handle the infrastructure.

Start with a simple connect_over_cdp script, verify session persistence, and then scale. The browser is the hard part—your agent should focus on the task, not on keeping Chrome alive.