Official library for AgentRewardBench: Evaluating Automatic Evaluations of Web Agent Trajectories
Project description
AgentRewardBench
Using the agent-reward-bench library
This library provides a set of tools for evaluating the performance of agents in various environments. It includes a set of environments, a set of agents, and a set of evaluation metrics.
Installation
To install the library:
pip install agent-reward-bench
You can now import the library in your Python code:
# Using agents and environments:
import agent_reward_bench.modeling as arbm
import agent_reward_bench.benchmarks as arbb
# Using the judge for evaluating agents:
import agent_reward_bench.judge as arbj
from agent_reward_bench.judge.existing import aer, nnetnav
from agent_reward_bench.judge.args import default_judge_args, judge_args
See scripts/run_agent.py and scripts/run_judge.py for examples of how to use the library to run an agent in an environment.
Judgments
First, make sure that the cleaned trajectories are in trajectories/cleaned. You can do this by downloading the official ones from Huggingface Hub and place them in the trajectories/ folder, or see instructions below on how to generate them.
To run the judge, use the following command:
python scripts/run_judge.py
This will generate the output of the judge and save them to trajectories/judgments by default, which can be changed with the --base_save_dir argument.
Generating trajectories
Setup
First, clone this repo and create a virtual environment:
git clone https://github.com/mcgill-nlp/agent-reward-bench.git
cd po-web-agents
python3 -m venv venv
pip install -r requirements.txt
playwright install
Web Environments
To set up the environments, please see gasse/webarena-setup for WA and VWA, and ServiceNow/WorkArena for WorkArena and WorkArena++.
Environment variables
You need to set the following environment variables for using the web environments.
# for workarena:
export SNOW_INSTANCE_URL="https://dev275972.service-now.com"
export SNOW_INSTANCE_UNAME="admin"
export SNOW_INSTANCE_PWD="<password>"
# for webarena:
export WA_HOMEPAGE="https://wa-homepage-${SUFFIX}.${WEBHOST}"
export WA_SHOPPING="https://wa-shopping-${SUFFIX}.${WEBHOST}/"
export WA_SHOPPING_ADMIN="https://wa-shopping-admin-${SUFFIX}.${WEBHOST}/admin"
export WA_REDDIT="https://wa-forum-${SUFFIX}.${WEBHOST}"
export WA_GITLAB="https://wa-gitlab-${SUFFIX}.${WEBHOST}"
export WA_WIKIPEDIA="https://wa-wikipedia-${SUFFIX}.${WEBHOST}/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing"
export WA_MAP="https://wa-openstreetmap-${SUFFIX}.${WEBHOST}"
export WA_FULL_RESET="https://wa-reset-${SUFFIX}.${WEBHOST}"
# for visualwebarena:
export VWA_HOMEPAGE="https://vwa-homepage-${SUFFIX}.${WEBHOST}"
# ...
export VWA_FULL_RESET="https://vwa-reset-${SUFFIX}.${WEBHOST}"
export VWA_CLASSIFIEDS="https://vwa-classifieds-${SUFFIX}.${WEBHOST}"
export VWA_CLASSIFIEDS_RESET_TOKEN="4b61655535e7ed388f0d40a93600254c"
See vars/set_envs.sh for an example of how to set up the environment variables automatically.
You might want to set up various API keys for the different services. You can do this by by adding the following to your .bashrc or .bash_profile:
export OPENAI_ORG_ID="your-openai-org-id"
# API keys
export OPENAI_API_KEY="your-openai-api-key"
export TOGETHER_API_KEY="your-together-api-key"
export VLLM_API_KEY="your-vllm-api-key"
export OPENROUTER_API_KEY="your-openrouter-api-key"
export VLLM_BASE_URL="https://vllm.your.domain.com/v1"
export TOGETHER_BASE_URL="https://api.together.xyz/v1"
export OPENROUTER_BASE_URL="https://openrouter.ai/api/v1"
Running the agent
# For WA:
export SUFFIX="-v1" # change this to your setup
export WEBHOST="your.domain.com" # change this to your web host
source vars/set_envs.sh # set up the environment variables
# starting a new run
python run_agent.py --model "<name>" --benchmark "<benchmark>"
# e.g., for a gpt-4o agent on WA:
python run_agent.py --model "gpt-4o" --benchmark "webarena_100"
The accepted benchmarks and models can be found with the following commands:
python run_agent.py --help
Processing trajectories
To process the trajectories, you can run:
python scripts/convert_trajectories_to_json.py
This will save the trajectories to trajectories/processed (make sure to set the --base_save_dir argument to the correct path). Then, you can further clean them (optional) by running:
python scripts/clean_processed_trajectories.py
This will save the cleaned trajectories to trajectories/cleaned (make sure to set the --base_save_dir argument to the correct path).
Contributing
If you are publishing a new version of this library, run:
rm -r dist
python3 setup.py sdist bdist_wheel
twine upload dist/*
Request the api token from the repo owner.
Acknowledgements
- webarena.csv and visualwebarena.csv were created for the browsergym/agentlab ecosystem paper: https://github.com/ServiceNow/BrowserGym/tree/main/browsergym/experiments/src/browsergym/experiments/benchmark/metadata
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_reward_bench-0.1.1.tar.gz.
File metadata
- Download URL: agent_reward_bench-0.1.1.tar.gz
- Upload date:
- Size: 68.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afeecc11ce19701ce08137884bc209420228f072aabcefabe3cda2e5193adf3d
|
|
| MD5 |
d03a375c3326daff567577706ac68f0d
|
|
| BLAKE2b-256 |
7dc8b344d4f46239a89319acc62b7a20bc960c0fa1e5f020a80029fddbed41e9
|
File details
Details for the file agent_reward_bench-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agent_reward_bench-0.1.1-py3-none-any.whl
- Upload date:
- Size: 71.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfb053605a6ff03ce6860ec6b40e2e9b792ac557b6d8b5fa71dcbc3f81d3fccb
|
|
| MD5 |
d6bb660be6fc163644f01edb294cd7f1
|
|
| BLAKE2b-256 |
5ebfdccca4f513051b1964a3f12d59e21435f4608198e71033290c1cc204a961
|