BLOG
Hosted Chromium Chrome: The Runtime for Browser Agents
Hosted Chromium Chrome gives AI agents a real, isolated browser in the cloud. Learn how CDP, Playwright, and Puppeteer connect to it in production.
# Hosted Chromium Chrome: The Runtime for Browser Agents
"Hosted Chromium Chrome" is the shorthand developers use when they mean a real Chromium browser running on someone else's infrastructure, reachable over a network instead of launched as a child process on your laptop. You don't install Chrome, you don't manage a headless shell, and you don't keep a fleet of containers alive. You request a session, get a connection endpoint, and drive it with Playwright, Puppeteer, or raw CDP. That is the whole idea, and it is the difference between a demo that works once and a workload that runs every hour.
This guide covers what hosted Chromium actually is, how it differs from local Chrome and from a plain headless container, how to connect to it, and what to check before you put it in front of real traffic.
What "Hosted Chromium Chrome" Actually Means
Chromium is the open-source project; Chrome is Google's branded build on top of it. When a vendor says "hosted Chromium," they almost always mean a Chromium-based browser binary running in a managed cloud environment, exposed through a control protocol. Some run stock Chromium, some run a hardened build with patches for automation stability. The practical distinction that matters to you is not the branding — it's the interface.
A hosted Chromium session typically exposes:
- A CDP endpoint. Chrome DevTools Protocol is the wire protocol Chromium speaks natively. Playwright's
connectOverCDP, Puppeteer'sbrowserWSEndpoint, and Selenium's debugger address all ride on it. - An isolated browser context. Your cookies, localStorage, and cache live in a session that other tenants can't read.
- A lifecycle you control. Sessions start on demand and terminate on a timer or an explicit call.
- Optional persistent state. Profiles that survive across sessions so logins and preferences stick.
If you've read our remote browser overview for AI agents, this is the same layer described from the protocol side rather than the product side.
Hosted Chromium vs Local Chrome vs Headless Containers
These three get conflated constantly. They are not the same trade-off.
| Dimension | Local Chrome | Self-hosted headless container | Hosted Chromium |
|---|---|---|---|
| Setup | Install per machine | Build image, wire CDP, manage lifecycle | Connect to an endpoint |
| Scaling | One machine, one browser | You provision and drain nodes | Sessions requested via API |
| Isolation | Shared with your desktop | Per container, if configured | Per session by default |
| State | Your real profile | Ephemeral unless you mount volumes | Persistent profiles available |
| Network | Your IP | Your datacenter IP | Configurable proxy settings |
| Debugging | DevTools on your screen | VNC or screenshots | Live viewer + CDP |
| Failure mode | Your laptop sleeps | Node dies, you restart it | Session ends, you reconnect |
Local Chrome is the fastest way to write a script and the worst way to run one. A self-hosted container is a real step up, but you inherit the operational surface: image builds, Chromium version drift, zombie processes, and the memory math of running N browsers on one box. Hosted Chromium trades that operational surface for a network dependency and a per-session cost.
The honest trade-off: if you run ten browser tasks a day, local Chrome is fine. If you run ten thousand, the container management becomes the product, and you probably don't want it to be.
How Connections Work: CDP, Playwright, and Puppeteer
Chrome DevTools Protocol is the lowest common denominator. Everything else is a wrapper. Playwright's chromium.connectOverCDP() and Puppeteer's puppeteer.connect({ browserWSEndpoint }) both open a WebSocket to the browser's debugging port and speak CDP from there. The Playwright CDP documentation is the authoritative reference for the client side; the Chrome DevTools Protocol spec covers the domains themselves.
Here's a minimal Playwright connection against a hosted Chromium endpoint, with the parts you actually need in production:
import { chromium, Browser, BrowserContext, Page } from 'playwright';
const CDP_ENDPOINT = process.env.REMOTE_BROWSER_CDP_URL!;
async function runTask(): Promise<void> {
let browser: Browser | undefined;
try {
browser = await chromium.connectOverCDP(CDP_ENDPOINT, {
timeout: 30_000,
});
// A hosted session usually starts with one default context.
const context: BrowserContext = browser.contexts()[0]
?? await browser.newContext({
viewport: { width: 1440, height: 900 },
locale: 'en-US',
});
const page: Page = context.pages()[0] ?? await context.newPage();
await page.goto('https://example.com/dashboard', {
waitUntil: 'domcontentloaded',
timeout: 45_000,
});
await page.getByRole('button', { name: 'Export' }).click();
await page.waitForEvent('download');
console.log('task complete');
} catch (err) {
console.error('session failed', err);
throw err;
} finally {
// Disconnect, don't close — the session lifecycle is server-side.
await browser?.close();
}
}
runTask();Two details worth internalizing. First, connectOverCDP returns a Browser whose contexts you did not create — you adopt what's there rather than assuming a clean slate. Second, calling browser.close() on a CDP connection disconnects your client; whether the remote session terminates depends on the runtime's lifecycle policy. Check that policy before you assume a session is gone.
If you're coming from Puppeteer, the shape is nearly identical — you pass a WebSocket endpoint instead of a launch options object. The remote browser online guide walks through the connection-string pattern in more detail.
What to Evaluate Before You Commit
Hosted Chromium is infrastructure, so evaluate it like infrastructure. Five criteria separate a usable runtime from a demo.
1. Session isolation and lifecycle
Every session should be its own browser process with its own profile directory. If two tenants can see each other's cookies, nothing else matters. Ask how sessions are terminated: idle timeout, hard cap, or explicit API call. You want all three to be configurable.
2. Profile persistence
Agents that log in once and act many times need profiles that survive session boundaries. This is where hosted Chromium earns its keep over ephemeral containers — you get persistent storage without mounting volumes yourself. The trade-off is that persistent profiles are state, and state needs a retention policy.
3. Network configuration
IP reputation drives success rates on protected sites more than any browser flag. Look for configurable proxy settings, regional egress, and per-session network options. Be skeptical of any vendor claiming a specific success rate without publishing the benchmark and the target sites.
4. Observability
When a task fails at step seven, you need to see what the browser saw. A live viewer, session recordings, and CDP access for ad-hoc inspection cover most debugging needs. Screenshots alone are not enough — you want the DOM and the network log.
5. Version and patch cadence
Chromium ships a major version roughly every four weeks. A hosted runtime that lags six months behind will break on sites that gate on browser features. Ask how versions are pinned and whether you can request a specific build.
Where Hosted Chromium Fits in an Agent Stack
The pattern that holds up in production looks like this:
- Agent decides what to do next (LLM or deterministic logic).
- Runtime executes the browser action against a hosted session.
- Session persists state across steps via profile and context.
- Viewer and logs capture what happened for debugging and audit.
- Metering tracks browser-hours so cost stays predictable.
The agent layer and the browser layer should be separable. If your agent code imports a browser launcher, you've coupled them, and moving to hosted infrastructure later means a rewrite. Connect over CDP from day one and the migration is a config change.
This is also why "hosted Chromium Android" shows up in search — teams want the same CDP-driven model against mobile Chromium builds. The protocol is the same; the device emulation and touch input handling differ. Treat mobile as a separate target with its own testing, not a flag you flip.
Cost and Capacity: What to Model
Hosted browser pricing is usually metered per browser-hour, sometimes with separate charges for network egress. That model is honest — it tracks the resource you actually consume — but it means your cost is a function of session duration, not task count.
Model it as:
monthly_cost ≈ (tasks_per_day × avg_session_minutes × 30 / 60) × rate_per_hourIf your average session is 90 seconds and you run 5,000 tasks a day, you're consuming roughly 3,750 browser-hours a month. That number should drive your architecture decisions more than any per-task price. Long-running agent loops with idle waits are the expensive pattern; aggressive timeouts and event-driven waits are the cheap one.
Current rates and any included allowances are on the pricing page — check there rather than trusting a number in a blog post, including this one.
Common Failure Modes
- Assuming a clean browser. Hosted sessions may reuse a profile. Always assert the state you need before acting.
- Ignoring disconnect semantics.
browser.close()on a CDP connection is not the same as terminating a session. Read the lifecycle docs. - Hardcoding selectors against a moving target. Hosted Chromium doesn't fix flaky selectors; it just makes the flakiness reproducible.
- No timeout budget. Every
goto,click, andwaitForneeds a timeout. A hung session bills by the hour. - Skipping the viewer. Debugging blind costs more than the session did.
Getting Started
The shortest path: get a CDP endpoint, connect with Playwright or Puppeteer, run one task end to end, then look at the session in the live viewer. If the viewer shows what you expected and the session terminated cleanly, you have a working runtime. Everything after that is hardening.
Start with the documentation for connection details and session lifecycle, and read the remote control browser guide if you need to drive sessions interactively during development. The remote web browser overview covers the broader architecture if you're still deciding whether hosted Chromium belongs in your stack at all.
Hosted Chromium Chrome is not a product category so much as a deployment decision: stop running browsers on machines you own, and start treating them as sessions you connect to. Once you make that shift, the interesting problems — agent reliability, task success, cost per outcome — become tractable.