""" Inference Script — Dalaal Browser-Use Environment =================================== MANDATORY - Before submitting, ensure the following variables are defined in your environment configuration: API_BASE_URL The API endpoint for the LLM. MODEL_NAME The model identifier to use for inference. HF_TOKEN Your Hugging Face / API key. LOCAL_IMAGE_NAME The name of the local image to use for the environment if you are using from_docker_image() - The inference script must be named `inference.py` and placed in the root directory of the project - Participants must use OpenAI Client for all LLM calls using above variables STDOUT FORMAT - The script must emit exactly three line types to stdout, in this order: [START] task= env= model= [STEP] step= action= reward=<0.00> done= error= [END] success= steps= score= rewards= """ import asyncio import json import os import textwrap from typing import List, Optional from openai import OpenAI from dalaal_env import DalaalEnvAction, DalaalEnvEnv IMAGE_NAME = os.getenv("LOCAL_IMAGE_NAME") API_KEY = os.getenv("HF_TOKEN") or os.getenv("API_KEY") API_BASE_URL = os.getenv("API_BASE_URL", "https://router.huggingface.co/v1") MODEL_NAME = os.getenv("MODEL_NAME", "Qwen/Qwen3.5-27B") TASK_NAME = os.getenv("DALAAL_TASK", "todo_add") BENCHMARK = "dalaal_env" MAX_STEPS = 15 TEMPERATURE = 0.0 MAX_TOKENS = 300 SYSTEM_PROMPT = textwrap.dedent("""\ You are a browser automation agent. You interact with web pages by reading an accessibility tree and issuing actions. ACCESSIBILITY TREE FORMAT: Each element has an [ID] followed by its role and properties: [1] heading "Page Title" [2] textbox "Search" value="" [3] button "Submit" [4] checkbox "Accept terms" checked=false AVAILABLE ACTIONS (respond with exactly one JSON object): - Click an element: {"action_type": "click", "element_id": } - Type into an element: {"action_type": "type", "element_id": , "text": ""} - Select a dropdown option: {"action_type": "select_option", "element_id": , "text": "