Skip to main content

Browserrig

Browserrig is an event-driven Chrome automation library for AI agents and Python applications. It combines direct browser access with a composable Harnessed agent, structured page observations, browser actions, and typed events.

Agents can navigate tabs, interact with DOM elements or screenshot coordinates, download and read files, and be paused or steered during a session. Chrome can be launched locally or connected through CDP.

flowchart LR
    App[Python application] --> Agent[browserrig.Agent]
    Agent --> Chrome
    Chrome --> State[Page observations and screenshots]
    State --> Agent
    Chrome --> Events[Typed events]
    Agent --> Files[Workspace and downloads]

Quick start

Python 3.12+ and Chrome or Chromium are required. Install the package with the provider extra you need:

python -m pip install "browserrig[openai]"

Set OPENAI_API_KEY in your environment, save the Python example below as agent.py, and run python agent.py. The anthropic, mcp, and otel extras enable the corresponding Harnessed integrations. For direct browser access without a model provider, install browserrig without an extra.

The base installation includes document readers and local CPU OCR, including ONNX Runtime and OpenCV. These native dependencies make the installation larger than the wheel for Browserrig itself.

To run the examples from a source checkout instead (uv required):

uv sync --locked --extra openai
Copy-Item .env.example .env
# Set OPENAI_API_KEY in .env.
uv run --env-file .env --extra openai python -m examples.openai_agent --headed

The example explores the Voyager missions. Use --url and --task to change the starting page and mission, OPENAI_MODEL to select a model, and --quiet to suppress streamed events. Add --done to allow standalone progress messages and require an explicit completion tool before the final answer. The final answer goes to stdout. Tests use scripted models and need no API key.

Compose an agent

Agent is a browser-ready Harnessed agent. Its plugins bring together page observations, tools, context management and the choreography of browser input. Configure the pieces you need while keeping the rest of the default kit:

import asyncio

from harnessed import PolicyDecision
from harnessed.models.pydantic_ai import PydanticAIModel
from harnessed.plugins import Approvals
from pydantic_ai.models.openai import OpenAIResponsesModel

from browserrig import (
    Agent, ContextCompaction, ImageContext, Launch, Observe,
    Screenshots, ScreenshotTrigger, UntilCompaction, WindowRatio,
)


async def main():
    agent = Agent(
        model=PydanticAIModel(OpenAIResponsesModel("gpt-6.1-terra")),
        browser=Launch(url="https://en.wikipedia.org/wiki/Voyager_program", headless=False),
        plugins=[
            Approvals(default=PolicyDecision.ALLOW),
            Observe(screenshots=Screenshots(trigger=ScreenshotTrigger.EACH_STEP)),
            ImageContext(UntilCompaction()),
            ContextCompaction(trigger=WindowRatio(0.8)),
        ],
    )
    async with agent.session() as session:
        await session.context.set("constraints", "Include source URLs.")
        result = await session.run("Compare the Voyager missions.", max_steps=20)
        print(result.text)


asyncio.run(main())

Install the openai extra and set OPENAI_API_KEY as in the quick start. The example captures a screenshot at each model step, keeps images until their steps are compacted, and summarizes older context when the model window reaches 80% (or at 100,000 tokens when its size is unknown). The session also carries application context across the task.

This example explicitly permits tool actions with Approvals(default=PolicyDecision.ALLOW). By default, actions with side effects require approval. Configure an approval handler with Approvals(approver=...) when your application should ask before acting; without a handler or an explicit allow policy, those actions are rejected.

Plugins replace matching defaults in place or add new capabilities; without=(...) removes defaults. By default, InputPacing moves the pointer and types at a person's pace, while InputVisualization stages actions for viewers through events such as cursor movement, highlights and browser UI. To run without that pacing and presentation, add without=(InputPacing, InputVisualization) to Agent (import both from browserrig). They can also be configured independently.

Sessions support streaming events, pausing, steering and resuming a running task. See the agent guide and browser composition for controls, context policies and extension points. For direct browser access or connecting to an existing Chrome instance, see browser interaction.

Mount plugins=[Done()] to opt into explicit completion and structured final answers. Without it, ordinary text responses retain Harnessed's default completion behavior.

Release status

Browserrig is an early 0.x release; public APIs may change between minor versions. CI covers Python 3.12–3.14 on Windows and Linux, with real Chrome integration tests on Linux. macOS is not covered by CI; select Chrome explicitly with Launch(executable=...) or BROWSERRIG_CHROME there.

Perspective-transformed frames and recovery from browser process crashes remain limitations. See the changelog for release notes.

Documentation

Guide Contents
Agent guide Setup, action chains, prompts, sessions and controls
Browser interaction Direct access, observations, input and page content
Files and events Downloads, workspace, file readers and event streams
Browser composition Configure and compose browser plugins
Telemetry Local traces, configuration and troubleshooting
Development Setup, checks, tests and project status
Harnessed telemetry feedback Integration findings

License

MIT.

Metadata

Release files for browserrig 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for browserrig 0.1.0
File Size Uploaded Provenance Actions
browserrig-0.1.0.tar.gz 631.1 kB With provenance Details for browserrig-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for browserrig 0.1.0
File Interpreter ABI Platform Actions
browserrig-0.1.0-py3-none-any.whl Python 3 none any Details for browserrig-0.1.0-py3-none-any.whl

Total release size: 871.5 kB

Release files / browserrig-0.1.0.tar.gz

Download URL browserrig-0.1.0.tar.gz
Size 631.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a622b774a207346cd13b89ed9ae30fc7c4382596c1cf12a0223ad44abb395e0f
BLAKE2b-256 checksum
How to use checksums
17aa968a4a8c1dbe81320575fe713773f20f6c81a062200949be6e05fcf883b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / browserrig-0.1.0-py3-none-any.whl

Download URL browserrig-0.1.0-py3-none-any.whl
Size 240.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71d7fc79757f58f18d10c34fb3095e3791e80240a80da3f2ab25bb8bcfd46d82
BLAKE2b-256 checksum
How to use checksums
569a664a5c9e7fbeaecf40cf27bee7c50131454b8d4dada1c6d334e4b2fed773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for browserrig 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for browserrig-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page