π Website β’ π Paper β’ π» Code β’ ποΈ Trajectories β’ π§ͺ WebReplayBench
 ## π Abstract LLM-based agents often operate in a greedy, step-by-step manner, selecting actions solely based on the current observation without considering long-term consequences or alternative paths. This lack of foresight is particularly problematic in web environments, which are only partially observableβlimited to browser-visible content (e.g., DOM and UI elements)βwhere a single misstep often requires complex and brittle navigation to undo. Without an explicit backtracking mechanism, agents struggle to correct errors or systematically explore alternative paths. Tree-search methods provide a principled framework for such structured exploration, but applying them to the web introduces two challenges: replaying an action sequence may not reconstruct the same page, and some actions may irreversibly change the website. To address these challenges, we introduce **WebOperator**, a tree-search framework that enables validated backtracking and strategic exploration. Our method incorporates a best-first search strategy that ranks actions by both reward and reversibility, along with a robust backtracking mechanism that verifies reconstructed pages before continuing from them. It prioritizes reversible actions, postpones potentially irreversible ones, and discards earlier branches when its post-execution heuristic flags a possible persistent change. Experiments on WebArena and WebVoyager demonstrate the effectiveness of the framework. On WebArena, it achieves **54.6%** task success with gpt-4o, outperforming all prior tree-search methods using the same backbone. Controlled ablations show that naive tree search can reduce performance, whereas action-aware selection and validated backtracking improve corrective search. We further introduce **WebReplayBench**, a web environment that records which actions actually change the website's state, to evaluate whether WebOperator detects irreversible actions and avoids repeating them during backtracking. ## π Results on WebArena Benchmark | Agent | Model | Overall (#812) | Reddit (#106) | GitLab (#180) | Shopping (#187) | CMS (#182) | Map (#109) | Multisite (#48) | |-------|:--------:|:----------------:|:----------------:|:----------------:|:------------------:|:-------------:|:--------------:|:------------------:| | BrowserGym | gpt-4 | 15.0 | 20.2 | 19.0 | 17.2 | 14.8 | 25.5 | - | | LM-TS | gpt-4o | 19.2 | 11.3 | 13.9 | 27.8 | 16.5 | 26.6 | 16.7 | | Go-Browse | qwen-2.5-7b | 21.7 | 30.7 | 15.3 | 22.4 | 25.3 | 17.9 | - | | AWM | gpt-4 | 35.5 | 50.9 | 31.8 | 30.8 | 29.1 | 43.3 | - | | Branch-n-Browse | gpt-4o | 35.8 | 50.9 | 36.7 | 34.6 | 26.4 | 46.8 | 18.8 | | WebPilot | gpt-4o | 37.2 | 65.1 | 39.4 | 36.9 | 24.7 | 33.9 | - | | AgentOccam | gpt-4-turbo | 45.7 | 67.0 | 43.3 | 46.2 | 38.9 | 52.3 | 16.7 | | AgentSymbiotic | claude-3.5 | 52.1 | 66.0 | 51.0 | 48.0 | 49.0 | **60.0** | 29.0 | | ScribeAgent | gpt-4o | 53.0 | 73.7 | **59.7** | 45.8 | 37.9 | 56.3 | - | || | **_WebOperator_** | gpt-4o | **54.56** | **76.42** | 52.78 | **49.20** | **54.95** | 55.05 | **31.25** | **Experimental trajectories:** run logs, search trees and step-by-step viewers for every task. - WebArena (812 tasks): [Hugging Face](https://huggingface.co/datasets/mahirlabibdihan/weboperator-experiments/tree/main/webarena/main) Β· [GitHub](https://github.com/mahirlabibdihan/WebOperator-Experiments/tree/main/webarena/main/) Β· viewer, e.g. [task 421](https://mahirlabibdihan.github.io/WebOperator-Experiments/webarena/main/tasks/task_421/trajectory.html) - WebArena-lite ablations (155 tasks, one run per ablation row, with scripts that recompute the tables): [Hugging Face](https://huggingface.co/datasets/mahirlabibdihan/weboperator-experiments/tree/main/webarena-lite) ## π Project Structure ```bash . βββ weboperator/ # Source code for the web agent β βββ configs/ # Agent configurations (demo, WebArena, WebVoyager) βββ webshepherd/ # Source code for the Process Reward Model βββ browsergym/ # Source code for the web environment simulator βββ gobrowse/ # Source code for the experience retrieval module βββ webarena/, webvoyager/ # Benchmark task files and evaluation code βββ webreplaybench_eval/ # Harness that runs WebOperator on WebReplayBench βββ utils/ # Scripts that collect runs and compute benchmark scores βββ run.py, demo.py # Entry points βββ README.md # The project page lives on the gh-pages branch. ``` ## βοΈ Installation ### 1οΈβ£ Clone the repository ```bash git clone https://github.com/kagnlp/WebOperator.git cd WebOperator ``` ### 2οΈβ£ Create environment ```bash conda create -n weboperator_env python=3.12 conda activate weboperator_env # or using pip and virtualenv (if python3.12 is the system python) python -m venv weboperator_env source weboperator_env/bin/activate # On Windows use `weboperator_env\Scripts\activate` ``` ### 3οΈβ£ Install dependencies _Refer to the [Running with Docker](#running-with-docker) section if you don't have admin rights to install Playwright dependencies._ ```bash pip install -r requirements.txt playwright install chromium --with-deps # Need admin rights ``` ### 4οΈβ£ Set up environment variables Create a `.env` file by copying the example configuration: ```bash cp .env.example .env ``` Then open the `.env` file and update any necessary values (such as API keys, website urls) according to your environment. ## π Usage ### Run the Demo ```bash python demo.py ``` **or** ```bash python run.py --config weboperator/configs/demo.yml ``` #### π³ Running with Docker _Useful if you don't have admin rights to install Playwright dependencies. No need to create a virtual environment or install dependencies._ ```bash docker compose run --user $(id -u) weboperator --config weboperator/configs/demo.yml ``` ### Skeleton Code Boilerplate code ([demo.py](demo.py)) to run WebOperator on an interactive, open-ended task: ```python import gymnasium as gym import browsergym.core # register the openended task as a gym environment from weboperator.tree_search_agent import TreeSearchAgent from weboperator.action_generator import ActionGenerator from weboperator.models.openrouter import OpenRouterModel # start an openended environment env = gym.make( "browsergym/openended", task_kwargs={"start_url": "https://map.google.com/"}, # starting URL wait_for_user_message=True, # wait for a user message after each agent message sent to the chat headless=False ) # Create an agent action_generator = ActionGenerator( model=OpenRouterModel("openai/gpt-oss-20b:free") # Set OPENROUTER_API_KEYS in .env file ) agent = TreeSearchAgent( chat_mode=True, action_generator= action_generator, ) # run the environment <> agent loop until termination obs, info = env.reset() while True: preprocessed_obs = agent.obs_preprocessor(obs) # Preprocess observation action = agent.get_action(preprocessed_obs, env) # Decide action obs, reward, terminated, truncated, info = env.step(action) # Act and Observe if terminated or truncated: break # release the environment env.close() ``` ### Sample Output *Open-ended + Google Maps*  ## π― Benchmarks ### WebArena Setup Before running WebArena experiments, you must host the WebArena websites and configure the corresponding endpoints. **Host Websites (choose one):** - Official setup: https://github.com/web-arena-x/webarena/blob/main/environment_docker/README.md - Unofficial (simplified): https://github.com/mahirlabibdihan/webarena-docker **Set Environment Variables:** ```bash PUBLIC_HOSTNAME=