Registry / llm-agents / browsergym-core

browsergym-core

JSON →
library0.14.3pypypi✓ verified 23d ago

BrowserGym Core (version 0.14.3) is a Python library that provides the fundamental Gymnasium environment for web task automation within the Chromium browser. It serves as the base for various web agent benchmarks and is designed for researchers and developers evaluating and building web agents, particularly those leveraging Large Language Models (LLMs) for web interaction tasks. The project is under active development with a rapid release cadence.

pip install browsergym-core
INSTALL
IMPORT
SIG · BROWSERGYM-CORE
B
browsergym-core
llm-agentspythonv0.14.3
Install
12.3s avg
Import
480ms
Disk
288MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.14.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 14.7s
py 3.11
✕ build_error
✓ 13.6s
py 3.12
✕ build_error
✓ 11.3s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 9.5s
288MB installed
● package 288MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gym
import gymnasium as gym
BrowserEnv
from browsergym.core.env import BrowserEnv
AbstractBrowserTask
from browsergym.core.task import AbstractBrowserTask

This quickstart demonstrates how to initialize a `browsergym-core` environment for an open-ended task, perform a reset, take a sample action, and ensure proper cleanup. It uses `gymnasium` for the environment API and `playwright.sync_api` to manage the browser context.

import gymnasium as gym from playwright.sync_api import sync_playwright # Register the 'openended' task provided by browsergym-core import browsergym.core # It's good practice to install playwright chromium if not already done: # playwright install chromium with sync_playwright() as p: # Initialize the BrowserGym environment for an open-ended task # 'headless=True' runs the browser without a visible UI env = gym.make( "browsergym/openended", headless=True, task_kwargs={'start_url': 'about:blank'} ) try: obs, info = env.reset() print(f"Initial observation keys: {obs.keys()}") print(f"Initial info: {info}") # Example: taking a no-op step action = env.action_space.sample() obs, reward, terminated, truncated, info = env.step(action) print(f"Reward after one step: {reward}") print(f"Terminated: {terminated}, Truncated: {truncated}") finally: # Ensure the browser environment is closed properly env.close()
browsergym --version
Debug
Known issues
gotchaBrowserGym requires Playwright and its Chromium browser to be installed separately. Missing `playwright install chromium` is a common setup error.
fix
Run `playwright install chromium` after `pip install browsergym-core`.
affects: All versions
gotchaBrowserGym is explicitly stated as a research tool and not a consumer product. Users should be aware it's under active development and may have rough edges.
fix
Set appropriate expectations for stability and feature completeness; contribute to its development if issues arise.
affects: All versions
gotchaTimeout errors are frequently encountered when interacting with web pages. These can be due to slow loading, complex elements, or agent actions that don't complete in time.
fix
Implement robust error handling, increase timeout parameters where applicable, and refine agent logic for complex web interactions. Consider debugging with `headless=False` to observe browser behavior.
affects: All versions
gotchaWhen integrating `browsergym-core` with specific benchmarks (e.g., WebArena), additional environment variables (e.g., `WA_PORT`) or benchmark-specific setup steps are often required to correctly configure task URLs and instances.
fix
Consult the `README.md` or documentation for the specific `browsergym-*` benchmark package you are using for its unique setup instructions.
affects: All versions
breakingFollowing Gymnasium API changes, `env.reset()` now returns `(observation, info)` and `env.step()` returns `(observation, reward, terminated, truncated, info)`. Older `(observation, info)` from `reset()` or `(observation, reward, done, info)` from `step()` patterns are deprecated.
fix
Update your code to match the `gymnasium` API: `obs, info = env.reset()` and `obs, reward, terminated, truncated, info = env.step(action)`.
affects: Pre-Gymnasium v0.26 environments, impacting older BrowserGym versions
Errors
Common errors & fixes
playwright._impl._errors.Error: BrowserType.launch: Executable doesn't exist at
The Playwright Chromium browser executable is not installed, which `browsergym-core` relies on to launch web environments.
fix
After installing `browsergym-core`, run `playwright install chromium` in your terminal to download the necessary browser binaries.
playwright._impl._errors.TimeoutError: Page.wait_for_function: Timeout 30000ms exceeded.
A Playwright operation, often within the `browsergym-core` environment's `reset()` or `step()` methods, timed out while waiting for a specific function or condition on the web page. This can be due to slow page loading, complex JavaScript execution, or the task not reaching a 'ready' state within the default timeout.
fix
Increase the default Playwright timeout by passing a `timeout` option to the environment initialization or to specific Playwright calls if you are directly interacting with Playwright outside of the `browsergym-core` API. For `browsergym-core` environments, consider increasing the `timeout` parameter during environment creation or task setup if available, or investigate the specific web page for performance bottlenecks.
playwright._impl._errors.Error: BrowserType.launch: EACCES: permission denied, mkdir '/workspace'
Playwright, when attempting to launch Chromium, lacks the necessary file system permissions to create or write to its default browser profile or cache directories, often `/workspace` or a temporary directory, especially in restricted environments or when using local runtimes outside of Docker.
fix
Ensure that the user running the `browsergym-core` application has write permissions to the directory where Playwright attempts to create its browser profile (e.g., `/workspace`). Alternatively, configure Playwright to use a different, writable directory by setting environment variables or Playwright launch options if `browsergym-core` exposes such configurations.
ModuleNotFoundError: No module named 'browsergym.core'
The `browsergym-core` library is either not installed, or the Python environment where the code is being run does not have access to the installed package.
fix
Install `browsergym-core` using pip: `pip install browsergym-core`. If already installed, ensure you are running your code in the correct Python environment where the package is present.
Upgrade
Version history
0.14.3latest on PyPI · released Jan 20, 2026
Audit
Dependencies
playwrightrequiredBrowserGym uses Playwright to control the Chromium browser for web interactions.
gymnasiumrequiredBrowserGym provides a gym-like environment, inheriting from Gymnasium for its API (e.g., env.step, env.reset).
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
browsergym-core — pip install browsergym-core · libregistry