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-coreVerified import paths — ran on the pinned version, not inferred.
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.
Run `playwright install chromium` after `pip install browsergym-core`.
Set appropriate expectations for stability and feature completeness; contribute to its development if issues arise.
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.
Consult the `README.md` or documentation for the specific `browsergym-*` benchmark package you are using for its unique setup instructions.
Update your code to match the `gymnasium` API: `obs, info = env.reset()` and `obs, reward, terminated, truncated, info = env.step(action)`.
After installing `browsergym-core`, run `playwright install chromium` in your terminal to download the necessary browser binaries.
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.
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.
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.