← Blog

BLOG

Browser-Use Book: A Practical Guide to Agent-Browser Runtimes

A browser-use book for builders: how agent-browser CLI, schema, and skills map to a hosted Chromium runtime you can run in production.

October 11, 20268 min readRemote Browser

# Browser-Use Book: A Practical Guide to Agent-Browser Runtimes

If you searched for a browser-use book, you probably want one thing: a single reference that explains how browser-use agents actually run, what the agent-browser CLI and schema do, and where a hosted runtime fits. This is that reference, condensed into one page. It covers the mental model, the moving parts (items, CLI, skills, schema), a comparison of local versus hosted execution, and a working TypeScript example that connects a browser-use style agent to hosted Chromium over CDP.

The short version: browser-use is the agent layer. agent-browser is the interface layer. A hosted runtime like Remote Browser is the execution layer. Most production failures happen because teams treat all three as one thing.

What a browser-use book should actually cover

A useful book on this topic answers four questions in order:

  1. What does the agent decide? Planning, tool selection, retries, and stopping conditions.
  2. What does the interface expose? Commands, schemas, and skills the agent can call.
  3. Where does the browser run? Local Chrome, a container, or a hosted session.
  4. How do you observe and control it? Live viewer, session logs, CDP access, profiles.

Most tutorials stop at question one. That is why demos work and production does not. The agent is rarely the bottleneck. The runtime is.

The three layers, separated

Layer 1: The agent

The agent is the reasoning loop. It receives a task, inspects the current page state, picks an action, and repeats. In browser-use style systems, the agent typically works from a structured view of the DOM or an accessibility tree rather than raw pixels. This matters because it determines what the agent can "see" and therefore what it can reliably act on.

Layer 2: The interface (agent-browser CLI, schema, skills)

This is where the agent-browser vocabulary lives, and it is worth defining each term precisely because they get used interchangeably.

  • agent-browser CLI — a command-line surface for driving a browser. You run commands like navigate, click, type, and extract, and the CLI translates them into browser actions. It is useful for scripting, debugging, and giving an agent a small, stable set of verbs.
  • agent-browser schema — the contract that describes what actions exist, what parameters they take, and what they return. A schema is what lets a model call tools without guessing. If your schema is loose, your agent will hallucinate parameters.
  • agent-browser skills — higher-level, composable capabilities built on top of the schema. A skill might be "fill and submit a login form" or "paginate through results and collect rows." Skills reduce the number of decisions the agent has to make per step.
  • items agent-browser — the discrete units the agent operates on: a page, a form field, a result row, a file. Treating the page as a set of items rather than a blob is what makes extraction reliable.

If you only remember one thing from this section: the schema is the interface, and the runtime is the substrate. A good schema on a flaky runtime still fails. A mediocre schema on a stable runtime usually works.

Layer 3: The runtime

The runtime is the browser itself — where it executes, how it is isolated, and how you connect to it. This is the layer that decides whether your agent survives contact with real sites.

Local browser vs hosted Chromium

Here is the comparison most browser-use guides skip.

DimensionLocal Chrome / containerHosted Chromium (Remote Browser)
SetupInstall browsers, manage versions, patch OS depsConnect over CDP; no local browser install
ScalingOne machine, manual parallelism, resource contentionSession isolation per task; scale by opening sessions
StateDies with the processPersistent profiles survive across sessions
NetworkingYour IP; proxy setup is manualConfigurable proxy and browser settings
DebuggingAttach a local debuggerLive viewer plus CDP access
Failure recoveryRestart the whole scriptReconnect to a session or start a clean one
Cost modelFixed infra + your timeMetered per browser-hour; see /pricing

The trade-off is real. Local Chrome is free and fully under your control. Hosted Chromium costs money and adds a network hop. The reason teams move is not speed — it is isolation, persistence, and observability. When you run twenty agents against twenty sites, local Chrome becomes a scheduling problem, not a browser problem.

For a deeper look at the runtime layer specifically, see Remote Browser for AI Agents.

Connecting a browser-use agent to hosted Chromium

The connection mechanism is the Chrome DevTools Protocol (CDP). Playwright, Puppeteer, and Selenium can all attach to a remote browser over CDP. The official Playwright CDP documentation is the authoritative reference for connectOverCDP, and the Chrome DevTools Protocol spec covers the underlying protocol.

Here is a minimal TypeScript example. It connects to a hosted session, runs a browser-use style extraction loop, and closes cleanly.

import { chromium, Browser, Page } from 'playwright';

type SessionInfo = {
  cdpUrl: string;      // e.g. wss://... from your runtime
  sessionId: string;
};

async function runAgentTask(session: SessionInfo, task: string) {
  let browser: Browser | null = null;

  try {
    // Attach to the hosted Chromium session over CDP.
    browser = await chromium.connectOverCDP(session.cdpUrl, {
      timeout: 30_000,
    });

    const context = browser.contexts()[0] ?? (await browser.newContext());
    const page: Page = context.pages()[0] ?? (await context.newPage());

    // 1. Navigate to the target.
    await page.goto('https://example.com/search', {
      waitUntil: 'domcontentloaded',
    });

    // 2. Act on discrete items rather than the whole page.
    await page.getByRole('textbox', { name: /search/i }).fill(task);
    await page.getByRole('button', { name: /submit/i }).click();

    // 3. Wait for a stable signal, not a fixed sleep.
    await page.waitForLoadState('networkidle');

    // 4. Extract structured items the agent can reason over.
    const items = await page.locator('[data-result]').evaluateAll((nodes) =>
      nodes.map((n) => ({
        title: n.querySelector('h3')?.textContent?.trim() ?? '',
        url: (n.querySelector('a') as HTMLAnchorElement)?.href ?? '',
      })),
    );

    return { ok: true, items };
  } catch (err) {
    // Surface the failure; do not silently retry forever.
    return { ok: false, error: (err as Error).message };
  } finally {
    // Disconnect without killing the hosted session if you plan to resume.
    if (browser) await browser.close();
  }
}

Three details in that snippet matter more than the rest:

  • `connectOverCDP` with a timeout. Hosted sessions can be cold. A 30-second timeout with an explicit error beats a hung process.
  • `waitForLoadState('networkidle')` instead of `sleep`. Fixed sleeps are the single most common cause of flaky agent runs.
  • `browser.close()` disconnects, it does not necessarily destroy the session. Whether the session persists depends on your runtime's configuration. Persistent profiles are what let you resume authenticated flows.

Where agent-browser skills and schema fit in practice

Once you have a stable connection, the schema and skills become the productivity layer.

A practical pattern:

  1. Define a small schema. Five to ten actions: navigate, click, type, extract, wait, screenshot. Resist adding more.
  2. Wrap common flows as skills. Login, search, paginate, download. Each skill is a tested function, not a prompt.
  3. Let the agent choose skills, not primitives. Fewer choices, fewer failures.
  4. Log every action with the item it touched. When something breaks, you want to know which item, not just which step.

This is also where the agent-browser CLI earns its place. During development, the CLI is a fast way to reproduce a failing step by hand. In production, the same actions run through your schema. Keeping the CLI and the schema aligned means your debugging environment matches your runtime.

Production criteria before you commit

Before you move a browser-use workload to any hosted runtime, check these:

  • Session isolation. Can two agents run concurrently without sharing cookies or storage? If not, you will get cross-contamination.
  • Persistent profiles. Can a session survive a process restart? Auth flows depend on it.
  • Proxy and network controls. Are proxy settings configurable per session? Some sites require specific egress.
  • Live viewer. Can a human watch a session in real time? This is the difference between a five-minute fix and a five-hour investigation.
  • CDP access. Can you attach Playwright, Puppeteer, or Selenium directly? Vendor-locked APIs are a migration risk.
  • Usage controls. Are browser-hours metered and visible? Unbounded sessions are unbounded bills.
  • Data handling. What is retained, for how long, and under what agreement? This matters for regulated workloads.

Remote Browser exposes hosted Chromium sessions with CDP access, a live viewer, persistent profiles, configurable browser and proxy settings, and per-session isolation. Current limits and pricing are on /pricing, and the connection details are in the /documentation.

Common mistakes this "book" wants you to avoid

  • Treating the agent as the whole system. The runtime is where reliability is won or lost.
  • Overloading the schema. Every extra action is another way for the model to choose wrong.
  • Using fixed sleeps. Wait on state, not on time.
  • Ignoring session lifecycle. Know whether closing a connection destroys the session or just detaches.
  • Skipping the viewer. If you cannot see what the agent saw, you cannot debug it.
  • Assuming local equals cheap. Local Chrome is free until you count the engineering hours spent on version drift and resource contention.

A short reading path

If you are building a browser-use style system, read in this order:

  1. This page — the three-layer model and the CDP connection.
  2. Remote Browser for AI Agents — the runtime layer in depth.
  3. Remote Browser Online — running real Chromium without local setup.
  4. Remote Web Browser — the practical automation angle.
  5. Remote Control Browser — driving sessions from anywhere.

Then wire one real task end to end. A single working flow through schema, skills, and a hosted session teaches more than ten more pages of theory.

The takeaway

A browser-use book is only useful if it separates the agent from the interface from the runtime. The agent decides. The agent-browser CLI, schema, and skills expose what it can do. The runtime determines whether any of it holds up under real sites, real concurrency, and real failures.

Start with a small schema, connect over CDP, wait on state instead of time, and pick a runtime that gives you isolation, persistence, and a live viewer. Everything else is tuning.