BLOG
Browser-Use Production: Moving from Local Chrome to Hosted Sessions
Browser-use production requires more than a local Chrome tab. Learn how hosted Chromium sessions solve reliability, scale, and concurrency issues.
# Browser-Use Production: Moving from Local Chrome to Hosted Sessions
Browser-use production workloads fail when they run on a local Chrome instance. The open-source browser-use library has made it trivial to prototype AI agents that navigate the web, but the gap between a working demo and a reliable production service is wide. This post explains why hosted Chromium sessions are the practical answer for browser-use production, what changes when you move off local Chrome, and how to structure your migration.
The Local Chrome Bottleneck
When you run browser-use locally, you are coupling your agent's uptime, throughput, and security to a single desktop process. That works for a script you run occasionally. It breaks down when you need:
- Concurrency: Local Chrome can handle a few tabs, but running 50 parallel agent sessions will exhaust memory and CPU.
- Persistence: A laptop reboot, a closed browser window, or a network drop kills the session state. Production agents need to survive infrastructure failures.
- Isolation: A single misbehaving agent can crash the entire browser process, taking down every other task sharing that instance.
- Observability: Debugging a headless Chrome process on a remote server is painful. You need to see what the agent sees, in real time, without SSHing into a box.
These are not edge cases. They are the standard requirements for any browser-use production deployment that handles real user requests or scheduled jobs.
What Hosted Sessions Change
A hosted browser runtime, like the one provided by Remote Browser, decouples the browser process from your application code. Your agent sends commands over the Chrome DevTools Protocol (CDP) or through a standard library like Playwright, and the browser executes them in a remote Chromium instance.
This shift solves the core production problems:
| Concern | Local Chrome | Hosted Chromium Session |
|---|---|---|
| Concurrency | Limited by local resources | Scale horizontally; each session is an isolated process |
| Uptime | Tied to your machine's power state | Runs 24/7 on managed infrastructure |
| Session state | Lost on restart | Persistent profiles survive disconnects |
| Debugging | Requires local tooling | Live viewer and CDP access from anywhere |
| Network identity | Your IP address | Configurable proxy settings per session |
| Resource cleanup | Manual or scripted | Automatic session termination and billing |
The table above is not theoretical. It reflects the architectural differences that matter when you move from a prototype to a service.
Why browser-use Production Needs a Dedicated Runtime
The browser-use library is excellent at what it does: translating natural language or structured prompts into browser actions. But it is not a runtime. It does not manage browser processes, handle network egress, or provide a debugging interface. In production, you need those capabilities.
Consider what happens when your agent hits a CAPTCHA, a slow-loading page, or a popup. Locally, you might manually intervene. In production, you need programmatic control. A hosted runtime gives you:
- CDP access: Direct control over the browser's internal state, including network interception and DOM manipulation.
- Playwright/Puppeteer compatibility: Use the same code you wrote for local automation, pointed at a remote endpoint.
- Live viewer: Watch the browser session in real time to debug failures or verify behavior.
- Session isolation: Each agent run gets a clean or persistent profile, preventing cross-contamination.
This is the difference between running a script and running a service. For a deeper look at the runtime architecture, see our post on remote browsers for AI agents.
Migration Path: From Local Script to Hosted Session
Moving to browser-use production does not require rewriting your agent logic. The browser-use library abstracts the browser connection, so the migration is mostly about changing where the browser runs.
Step 1: Identify Your Session Requirements
Before you migrate, decide on the following:
- Persistence: Does your agent need to maintain login state across runs? If so, use a persistent profile.
- Concurrency: How many parallel sessions do you need at peak? This determines your resource allocation.
- Network egress: Does your agent need to appear from a specific geographic region? Configure proxy settings accordingly.
- Debugging: Do you need a live view of the session, or is post-hoc logging sufficient?
Step 2: Connect to the Hosted Browser
The simplest migration path is to use Playwright's connectOverCDP method. If your agent already uses Playwright under the hood, you can point it at your hosted session endpoint.
Here is a TypeScript example that connects to a hosted Chromium session and performs a basic navigation:
import { connectOverCDP } from 'playwright';
async function runAgent() {
// Connect to the hosted browser session via CDP
const browser = await connectOverCDP('wss://your-remote-browser-endpoint');
// Create a new context (or use a persistent profile)
const context = await browser.newContext();
const page = await context.newPage();
// Navigate and interact
await page.goto('https://example.com');
await page.click('text=Get Started');
// Extract data or perform actions
const title = await page.title();
console.log(`Page title: ${title}`);
// Clean up
await context.close();
await browser.close();
}
runAgent().catch(console.error);This code is nearly identical to what you would run locally. The only difference is the connectOverCDP URL, which points to your hosted session instead of localhost.
Step 3: Handle Session Lifecycle
In production, you cannot rely on a single long-lived connection. Your agent should:
- Acquire a session when a task starts.
- Release the session when the task completes or times out.
- Retry on failure with a new session if the connection drops.
Remote Browser's session API handles this lifecycle for you. You create a session, get a CDP endpoint, and terminate it when done. This prevents resource leaks and ensures you only pay for what you use.
Step 4: Add Observability
The live viewer is not a nice-to-have; it is essential for debugging browser-use production issues. When an agent fails, you need to see the exact state of the page. With a hosted runtime, you can replay the session or watch it live, which is far more efficient than parsing logs.
Comparing browser-use Alternatives
The browser-use ecosystem has several options for running agents. Here is how hosted sessions stack up against the common alternatives:
| Approach | Pros | Cons | Best For |
|---|---|---|---|
| Local Chrome | Free, familiar, full control | No scaling, no isolation, tied to one machine | Prototyping, single-user scripts |
| Self-hosted Selenium Grid | Open source, customizable | Requires infrastructure management, complex setup | Teams with dedicated DevOps |
| Browser-use Cloud (BUX) | Managed, 24/7 VM, pre-configured | Less flexible for custom runtimes | Long-running autonomous agents |
| Remote Browser API | Session-based, CDP access, live debugging | Requires network connectivity to the API | Production workloads with variable concurrency |
The choice depends on your operational constraints. If you need a 24/7 VM with a pre-installed harness, BUX is worth evaluating. If you need fine-grained control over individual sessions, a session-based API is more appropriate. For a detailed comparison of browser-use benchmarks, see our benchmarks post.
Common Production Pitfalls and How to Avoid Them
Moving to browser-use production introduces new failure modes. Here are the ones we see most often, and how to handle them.
Pitfall 1: Ignoring Session Timeouts
Local Chrome sessions can run indefinitely. Hosted sessions are billed by the hour, so you need explicit timeouts.
Solution: Set a maximum session duration in your agent code. If a task exceeds the limit, terminate the session and start fresh. This also prevents stuck agents from consuming resources.
Pitfall 2: Sharing State Across Sessions
If you use a persistent profile, be careful about what you store in it. Cookies and local storage are useful, but they can also cause cross-session contamination if your agent writes unexpected data.
Solution: Use separate profiles for different tasks. If you need a shared login state, create a "seed" profile and clone it for each session.
Pitfall 3: Assuming Network Identity Is Static
Your local machine has a fixed IP. Hosted sessions may egress from different IPs unless you configure a proxy.
Solution: If your agent interacts with services that rate-limit or geo-block, configure a residential or static proxy for the session. This ensures consistent behavior across runs.
Pitfall 4: Not Handling CDP Disconnects
Network issues can drop the CDP connection. Your agent should treat this as a recoverable error, not a fatal one.
Solution: Wrap your agent logic in a retry loop. On disconnect, acquire a new session and resume from the last known state.
The Cost Reality of Browser-Use Production
Pricing is a common concern when moving from free local Chrome to a hosted service. The key insight is that hosted sessions are not more expensive; they are differently expensive. You pay for the time a browser is actually running, not for the idle time of your laptop.
For browser-use production, the cost model is straightforward:
- Session time: You pay for the duration the browser is active.
- Concurrency: You pay for the number of simultaneous sessions you run.
- Data transfer: Some providers charge for egress; check your plan.
The exact numbers vary by provider and usage pattern. For current pricing details, refer to the Remote Browser pricing page. The important thing is to design your agent to minimize session time: close sessions when done, reuse contexts where possible, and avoid long-running idle loops.
Security Considerations for Hosted Browsers
Running your agent in a hosted environment means your code and data are on infrastructure you do not control. This is a legitimate concern, but it is manageable.
- Data in transit: CDP connections should be over WSS (WebSocket Secure). Ensure your provider supports this.
- Data at rest: Persistent profiles store cookies and local storage. Understand your provider's data retention policy.
- Isolation: Verify that sessions are isolated at the process level. A compromised agent should not be able to access another tenant's session.
The Chrome DevTools Protocol documentation covers the security model of CDP, which is the foundation for most hosted browser runtimes. Review the CDP docs to understand what is exposed and how to secure it.
When to Move to Hosted Sessions
Not every browser-use workload needs a hosted runtime. If you are running a script once a day on your laptop, local Chrome is fine. But you should move to hosted sessions when you hit any of these triggers:
- You need to run agents unattended for more than a few hours.
- You need more than 5-10 concurrent sessions.
- You need to debug failures without access to the physical machine.
- You need consistent network identity for your agents.
- You need to share browser access with a team or an external service.
These triggers are common in production, which is why we built Remote Browser around session-based infrastructure rather than a local-first tool.
Conclusion: Browser-Use Production Is a Runtime Problem
The browser-use library solves the agent logic problem. Hosted Chromium sessions solve the runtime problem. For browser-use production, you need both.
Moving from local Chrome to hosted sessions is not a migration of code; it is a migration of infrastructure. You gain concurrency, isolation, persistence, and observability. You lose the simplicity of running everything on your machine, but you gain the ability to run a reliable service.
If you are evaluating this move, start with a single non-critical workflow. Connect it to a hosted session, add timeouts and retries, and measure the difference in reliability. Once you see the improvement, you will understand why browser-use production belongs on a hosted runtime.
For more context on how hosted browsers fit into your automation stack, read our guide on cloud browser automation or the hosted browser API post.