browseruse_bench.utils.task_utils
Task processing utility functions.Import
load_tasks
Load task data.Path to tasks JSON file
Optional prompt template, format like
"{task}\n...{url}...". If provided, a prompt field will be added to the task dictionary.List of tasks, each containing
task_id, task_text, url. Includes prompt if prompt_fmt is provided.load_tasks_with_benchmark_support
Load tasks with support for different benchmarks (including BrowseComp).Path to tasks JSON file
Optional prompt template (ignored for BrowseComp which has its own template)
filter_tasks
Filter tasks based on mode.List of tasks
Filter mode:
single- Run first task onlyfirst_n- Run first N taskssample_n- Randomly sample N tasksspecific- Run tasks with specified IDsby_id- Run single task by IDall- Run all tasks
Number of tasks for
first_n or sample_n modeList of task IDs for
specific modeSingle task ID for
by_id modefilter_completed_tasks
Filter out completed tasks.List of tasks
Output directory
Function to check if a task is completed
(List of remaining tasks, number of skipped tasks)
is_task_completed_by_result_json
Check if task is completed (via result.json).Task ID
Output directory path
True if result.json exists and is not empty
resolve_tasks_json_path
Resolve task JSON file path.Path passed via command line
Default path
Environment variable name
print_task_summary
Print task execution summary.Total number of tasks
Number of tasks run in this session
Number of successful tasks
Number of failed tasks
Output directory path