Skip to main content

browseruse_bench.utils.task_utils

Task processing utility functions.

Import


load_tasks

Load task data.
str
required
Path to tasks JSON file
str
default:"None"
Optional prompt template, format like "{task}\n...{url}...". If provided, a prompt field will be added to the task dictionary.
list of dict
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
required
Path to tasks JSON file
str
default:"None"
Optional prompt template (ignored for BrowseComp which has its own template)

filter_tasks

Filter tasks based on mode.
list of dict
required
List of tasks
str
required
Filter mode:
  • single - Run first task only
  • first_n - Run first N tasks
  • sample_n - Randomly sample N tasks
  • specific - Run tasks with specified IDs
  • by_id - Run single task by ID
  • all - Run all tasks
int
required
Number of tasks for first_n or sample_n mode
list of str
default:"None"
List of task IDs for specific mode
str
default:"None"
Single task ID for by_id mode

filter_completed_tasks

Filter out completed tasks.
list of dict
required
List of tasks
Path
required
Output directory
function
required
Function to check if a task is completed
tuple
(List of remaining tasks, number of skipped tasks)

is_task_completed_by_result_json

Check if task is completed (via result.json).
str
required
Task ID
Path
required
Output directory path
bool
True if result.json exists and is not empty

resolve_tasks_json_path

Resolve task JSON file path.
str
default:"None"
Path passed via command line
Path
required
Default path
str
default:"'TASKS_JSON'"
Environment variable name

Print task execution summary.
int
required
Total number of tasks
int
required
Number of tasks run in this session
int
required
Number of successful tasks
int
required
Number of failed tasks
Path
required
Output directory path