Playwright Workspaces: give your AI agents real browser power

May 15, 2026

AI agents are extraordinary at reading and writing code. But ask one to check product availability on a website, verify a dynamic form submission, or navigate a JavaScript-heavy SPA? It hits a wall.

Modern websites don’t work with simple HTTP requests. They render JavaScript, enforce authentication, track geolocation, and actively resist scraping. Your agent needs a real browser — one that understands CSS, executes JavaScript, manages cookies, and sees what a human would see.

That’s where Playwright Workspaces comes in. It gives you managed, cloud-hosted browsers on demand. No local Chrome installation. No headless browser hacks. Just a WebSocket connection to a fully-managed Chromium instance running in Azure.

The infrastructure problem

If your agent’s browser runs locally, you’ve got real constraints:

  • Resource contention — Chrome eats CPU and RAM while your agent works
  • No parallelism — One browser per machine. Want to scrape 10 sites at once? Buy 10 machines
  • Consistency issues — Different OS, different Chrome versions, different results
  • Security gaps — The agent reuses your local browser, cookies, and credentials
  • No visibility — You can’t see what the agent is clicking around doing

What you need is a browser running somewhere else — managed, scalable, observable — where your agent connects over a WebSocket.

Playwright Workspaces fills the gap

Playwright Workspaces provides exactly this: remote, managed browser endpoints on Azure. You make an HTTP request, a Chromium instance spins up in the cloud, and you get back a WebSocket URL to connect via Chrome DevTools Protocol (CDP).

The beauty of this approach:

1. Massive parallelism

Spin up multiple remote browsers and work in parallel. Each gets its own isolated Chromium instance. No resource contention. No port conflicts. Want your agent to check 100 product pages simultaneously? Spin up 100 browsers.

2. Zero local dependencies

No Chrome installation. No chromedriver version mismatches. No --no-sandbox hacks or display server setup. The browser is a managed service—you just connect to it.

3. Geographic flexibility

Remote browsers run in Azure data centers. Need to see what a website looks like from East US? Southeast Asia? Pick your region. The browser’s IP and geolocation are in the cloud, not on your laptop.

4. Ephemeral & secure

Each browser session is isolated and destroyed when the WebSocket closes. No leftover cookies. No persistent state leaking between runs. Every session starts clean and secure.

Connecting it to your agent workloads

If you’re building AI agents that need to interact with the web, Playwright Workspaces becomes your infrastructure layer. Here’s how it works:

Step 1: Provision a remote browser

import os
import uuid

def get_connect_options(os_name="linux", run_id=str(uuid.uuid4())):
    service_url = os.getenv("PLAYWRIGHT_SERVICE_URL")
    service_access_token = os.getenv("PLAYWRIGHT_SERVICE_ACCESS_TOKEN")

    headers = {"Authorization": f"Bearer {service_access_token}"}
    service_run_id = os.getenv("PLAYWRIGHT_SERVICE_RUN_ID")
    ws_endpoint = f"{service_url}?os={os_name}&runId={service_run_id}&api-version=2025-09-01"

    return ws_endpoint, headers

Step 2: Connect your agent to the remote browser

You can use tools like browser-harness to give your AI agents direct control over the browser via CDP, or integrate directly with Playwright libraries in your preferred language.

Real-world example: autonomous web research

Imagine this agent prompt:

“Go to an e-commerce site, search for outdoor jackets under $150, filter by 4+ star ratings, check delivery time to ZIP 12345, and report back the three best options with links.”

Your agent would:

  1. Provision a remote Chromium browser via Playwright Workspaces
  2. Navigate to the site
  3. Interact with search forms, dropdowns, and JavaScript filters
  4. Dynamically read DOM content and verify product availability
  5. Capture screenshots for audit and debugging
  6. All without ever touching your local machine

The entire workflow runs on a remote browser in Azure.

Building MCP integrations

If you’re working with MCP (Model Context Protocol) or building connectors for Copilot Studio, Playwright Workspaces becomes even more powerful. You can:

  • Build MCP servers that discover and execute browser tools on behalf of agents
  • Create Copilot Studio connectors that automate web-based workflows
  • Execute browser actions as part of larger automation orchestrations

For example, our WebMCP Discovery project demonstrates this pattern — it discovers available tools on web pages (both WebMCP tools and Playwright fallback actions) and executes them within an agent context.

Getting started

To set up Playwright Workspaces:

  1. Create a workspace — Start with the quickstart
  2. Set your environment variablesPLAYWRIGHT_SERVICE_URL and PLAYWRIGHT_SERVICE_ACCESS_TOKEN
  3. Provision a browser — Make an HTTP request and get back your WebSocket endpoint
  4. Connect your agent — Use CDP libraries or browser-harness to control it
  5. Scale — Add more browsers as your parallelism needs grow

Resources

results matching ""

    No results matching ""