Skip to main content

BrowserGym: a gym environment for web task automation in the Chromium browser

Project description

BrowserGym

This package provides browsergym, a gym environment for web task automation in the Chromium browser.

Setup

To install browsergym, you can either install one of the browsergym-miniwob, browsergym-webarena and browsergym-workarena packages, or you can simply install browsergym which includes all of these by default.

pip install browsergym

Then, a required step is to setup playwright by running

playwright install

Finally, each benchmark comes with its its own specific setup that requires to follow additional steps.

Usage

Open-ended task example

Boilerplate code to run an agent on an interactive, openended task:

import gymnasium as gym
import browsergym.core  # register the openended task as a gym environment

env = gym.make(
    "browsergym/openended", start_url="https://www.google.com/", wait_for_user_message=True
)
obs, info = env.reset()
done = False
while not done:
    action = ...  # implement your agent here
    obs, reward, terminated, truncated, info = env.step(action)

MiniWoB++ task example

Boilerplate code to run an agent on a miniwob task:

import gymnasium as gym
import browsergym.miniwob  # register miniwob tasks as gym environments

env = gym.make("browsergym/miniwob.choose-list")
obs, info = env.reset()
done = False
while not done:
    action = ...  # implement your agent here
    obs, reward, terminated, truncated, info = env.step(action)

List of all the available MiniWoB++ environments

env_ids = [id for id in gym.envs.registry.keys() if id.startswith("browsergym/miniwob")]
print("\n".join(env_ids))

WebArena task example

Boilerplate code to run an agent on a webarena task:

import gymnasium as gym
import browsergym.webarena  # register webarena tasks as gym environments

env = gym.make("browsergym/webarena.310")
obs, info = env.reset()
done = False
while not done:
    action = ...  # implement your agent here
    obs, reward, terminated, truncated, info = env.step(action)

List of all the available WebArena environments

env_ids = [id for id in gym.envs.registry.keys() if id.startswith("browsergym/webarena")]
print("\n".join(env_ids))

WorkArena task example

Boilerplate code to run an agent on a workarena task:

import gymnasium as gym
import browsergym.workarena  # register workarena tasks as gym environments

env = gym.make("browsergym/workarena.servicenow.order-ipad-pro")
obs, info = env.reset()
done = False
while not done:
    action = ...  # implement your agent here
    obs, reward, terminated, truncated, info = env.step(action)

List of all the available WorkArena environments

env_ids = [id for id in gym.envs.registry.keys() if id.startswith("browsergym/workarena")]
print("\n".join(env_ids))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browsergym-0.1.0rc0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

browsergym-0.1.0rc0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file browsergym-0.1.0rc0.tar.gz.

File metadata

  • Download URL: browsergym-0.1.0rc0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for browsergym-0.1.0rc0.tar.gz
Algorithm Hash digest
SHA256 9b751341ce473862c02a627d7e3f151fdbca598e0cd7615b4df0f7491107f34d
MD5 14db4da190570c47846439d245463e37
BLAKE2b-256 e572c77549ba7c0cdc3c142c751a906940f718e6545026ad754a3e50ebd977ff

See more details on using hashes here.

File details

Details for the file browsergym-0.1.0rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for browsergym-0.1.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 7414c0653e7fb44c857c5c49e01ad529e7a938e199222f56392a5b5e0824fad6
MD5 8b7913aa99721275727cca670e358824
BLAKE2b-256 b540d03e2a5b36b46169ca67773aedf3d64dbcadcd452bc244c0dfe89316345f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page