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.
- for miniwob, see miniwob/README.md
- for webarena, see webarena/README.md
- for workarena, see the WorkArena README
- (optional) if you want to run the UI assistant to create demos
cd ui_assist
conda env create -f environment.yml; conda activate ui-assist
# or simply `pip install -r requirements`
playwright install
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file browsergym-0.1.0rc1.tar.gz
.
File metadata
- Download URL: browsergym-0.1.0rc1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77115c5251abb97f2a896790058bfefa94f79013d306d025c53ba4744e302385 |
|
MD5 | f1926e5cc4aff896176e61d9c2a9ea6a |
|
BLAKE2b-256 | 8f4b27ada79cac3b02d935067dde1f63cae5c23843f24c686e5abc3b5e7e230d |
File details
Details for the file browsergym-0.1.0rc1-py3-none-any.whl
.
File metadata
- Download URL: browsergym-0.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96c202620df65cb8baae51f6b6a76a29b01066144aa093f49d48dec81841ebbe |
|
MD5 | a789b56368d79aeefc705d7c4d1b0d3d |
|
BLAKE2b-256 | 25cbd80f4c261f38e7840bcfd6cfdfe8b15687e284515b59fe9704d7f9183116 |