BrowserGym Experiments

raw JSON →
0.14.3 verified Fri May 01 auth: no python

Experimentation tools for BrowserGym, providing wrappers and utilities to run experiments with LLM-based agents in web environments. Current version: 0.14.3, requires Python >3.7. Release cadence: irregular.

pip install browsergym-experiments
error ModuleNotFoundError: No module named 'browsergym_experiments'
cause Using the package name (with hyphens) as the import path.
fix
Use 'import browsergym.experiments' (note: dot instead of underscore).
error 'ExpArgs' object has no attribute 'run'
cause Misunderstanding that ExpArgs is callable or has a run method; actual API uses experiment functions.
fix
Use 'from browsergym.experiments import run_experiment' and pass ExpArgs to it.
gotcha The package name uses hyphens (browsergym-experiments) but the Python import uses underscores (browsergym.experiments). Ensure you use the correct import path.
fix Use 'from browsergym.experiments import ...' instead of 'from browsergym_experiments import ...'
deprecated Some functions from earlier versions (e.g., 'make_experiment') have been deprecated in favor of ExpArgs. Check the changelog for migration.
fix Replace make_experiment with ExpArgs and exp_args.run() pattern.
gotcha Experiment directory creation may fail if the base path contains spaces or special characters. Always use get_experiment_dir() to handle path sanitization.
fix Use 'from browsergym.experiments import get_experiment_dir' to get a safe directory.

Basic usage of ExpArgs and experiment directory utilities.

import os
from browsergym.experiments import ExpArgs, get_experiment_dir

exp_dir = get_experiment_dir()
print(f"Experiment directory: {exp_dir}")
# Example: define experiment arguments
exp_args = ExpArgs(
    task_name="miniwob.click-test",
    agent_args={"model": "gpt-4"},
    exp_dir=exp_dir
)
print(f"ExpArgs: {exp_args}")