ScaleCUA

repository·main·Indexed 22 days ago

https://github.com/opengvlab/scalecua

A framework for scaling open-source Computer Use Agents (CUAs) using large-scale cross-platform data. It provides datasets, models, an interactive playground, and an evaluation suite for GUI automation across Ubuntu, Android, macOS, Windows, and Web. The repository includes training codebases for Supervised Fine-Tuning (SFT) of InternVL and Qwen2.5-VL models, as well as evaluation environments for AndroidLab, AndroidWorld, and MacOS Arena.

Tokens
38.3K
Snippets
128
Records
193
Agent score
77%

What's inside ScaleCUA

  1. Overview of ScaleCUA evaluation benchmarks

    main

    ScaleCUA uses a suite of offline and online GUI interaction benchmarks for end-to-end agent evaluations. All evaluations employ a vision-only approach where models are accessed via API. The benchmarks cover multiple operating systems and environments:

    • Android: AndroidWorld and AndroidLab for Android environments.
    • macOS: MacOSArena for macOS environments.
    • Ubuntu: OSWorld for Ubuntu environments.
    • Web: WebArenaLiteV2 for web environments (specifically refined for visual-based web agents).
    • Windows: WindowsAgentArena for Windows environments.
  2. Understand the ScaleCUA Project Structure

    main

    The repository is organized into three primary functional components:

    • evaluation/: Contains code and benchmarks for end-to-end agent evaluation.
    • playground/: Provides interactive environments (Android, Ubuntu, Web) and model implementations for hands-on testing.
    • agent-sft/: Contains training code, configurations, and instructions for reproducing ScaleCUA using the ScaleCUA-Data dataset.
  3. What is SeeAct-V for AndroidWorld

    main

    SeeAct-V is a modular system for implementing agents in the AndroidWorld environment. It operates in two main steps:

    1. Planner: A model (e.g., GPT-4o) predicts the next action.
    2. GUI Visual Grounding: A model (e.g., UGround) provides precise action coordinates if the action requires them.

    The entire pipeline relies exclusively on images for observation and grounding.

  4. Configure LibreOffice Calc and use `compare_table`

    main

    LibreOffice Calc evaluation requires specific libraries and a method for comparing spreadsheet data.

    Required Libraries

    pip install openpyxl pandas lxml xmltodict

    Generating CSV from XLSX

    To compare displayed cell values, you must first convert the XLSX to CSV using the following command structure:

    libreoffice --convert-to "csv:Text - txt - csv (StarCalc):44,34,UTF8,,,,false,true,true,false,false,1" --out-dir /home/user /home/user/abc.xlsx

    Note: The final 1 in the conversion options specifies the sheet number (starting from 1) to export.

    Using compare_table

    Evaluation relies on the compare_table function, which accepts two filenames and an options list of rules. Each rule requires a type:

    • sheet_data: Compares internal cell values via pandoc.
    • sheet_print: Compares shown cell values via CSV (requires the CSV generation step above).

    Sheet Indexing (sheet_idx0, sheet_idx1, or sheet_idx):

    • Integer i: Extracts the $i$-th sheet from the result (starts at 0).
    • String with prefix:
      • R: Extract from result xlsx.
      • E: Extract from expected (golden) xlsx.
      • I: Indicates a sheet number (starting from 0).
      • N: Indicates a sheet name (e.g., "Sheet1").

    Rules can also use matching patterns like {"method": "eq", "ref": "abc"}, which are processed by utils._match_value_to_rule.

    libreoffice --convert-to "csv:Text - txt - csv (StarCalc):44,34,UTF8,,,,false,true,true,false,false,1" --out-dir /home/user /home/user/abc.xlsx
  5. Extend WebArena-Lite-v2 with custom tasks and agents

    main

    The framework is designed to be extensible:

    • Custom Tasks: Add new tasks by referencing the structure in the tasks folder and config/env/webarena/tasks folder.
    • Custom Agents/Workflows: Define custom model workflows in the agents folder. Ensure each step returns an action in the correct format.
    • Custom Prompts: Modify planning and grounding prompts in the config/prompt_template folder. For ScaleCUA models, it is recommended to use the provided default prompts.
  6. Customize Tasks, Agents, and Prompts

    main

    The framework is extensible via the following locations:

    • Custom Tasks: Add new tasks by following the structure in the tasks and config/env/webarena/tasks folders.
    • Custom Agents/Workflows: Implement new logic in the agents folder. Ensure each step returns actions in the expected format.
    • Custom Prompts: Modify planning and grounding templates in config/prompt_template. For ScaleCUA models, using the provided default prompts is recommended.
  7. QuickStart the ScaleCUA Playground

    main

    To run the ScaleCUA playground interactively, follow these steps:

    1. Deploy Models: Deploy ScaleCUA models using vLLM. Record the model name and the deployment URL.
    2. Configure Models: Update the base_url and model fields in your agent configuration file (e.g., playground/config/agent/scalecua_native_agent.yaml) to point to your deployed model.
    3. Configure Environment: Set up the environment parameters (Ubuntu, Web, or Android) in the corresponding YAML config file.
    4. Run the Agent: Execute the interactive agent script using the agent_run_interactive.py command.

    Supported platforms for the --platform flag include: ubuntu, web, android, and ubuntu_web.

    ```bash
    python agent_run_interactive.py \
      --platform ubuntu \
      --env_config_path playground/config/envs/ubuntu.yaml \
      --agent_config_path playground/config/agent/scalecua_native_agent.yaml
    ```埋
  8. Bring Your Own Agent (BYOA) to Windows Agent Arena

    main

    To test your own agents within the Windows Agent Arena, you can use the default agent as a template. Create a new folder under src/win-arena-container/client/mm_agents.

    Your custom agent must implement an agent.py file containing the following two functions:

    • predict()
    • reset()

    For detailed development instructions, refer to the BYOA Doc.

    # agent.py requirements
    def predict():
        pass
    
    def reset():
        pass
  9. Explore file system storage via ADB

    main

    To understand how an app stores data in files, you can inspect them directly on the device or pull them to your local machine for analysis.

    • Inspect content on device: Use cat to print file contents.
    • Download files: Use adb pull to copy files to your local machine.
    # View file contents on the device
    adb shell cat data/data/<package_name>/files/<file_name>.txt
    
    # Pull a file to your local machine
    adb pull data/data/<package_name>/files/<file_name>.txt /local/directory/
  10. Define a new task in WindowsAgentArena (WAA)

    main

    To develop a new task in WAA, you must create a JSON configuration that defines the task's identity, the natural language instruction, the initial environment setup, the evaluation logic, and the expected result format.

    Best Practices:

    • Reuse existing machinery: If your task involves a category already supported (e.g., Chrome, Edge, LibreOffice), do not start from scratch. Instead, study and modify the existing getters and evaluators for that application.
    • Study existing examples: Review the repository's current task examples to understand common command patterns and configuration setups.

    Task Components:

    • id: A unique identifier for the task.
    • instruction: A natural language string describing what the agent should do.
    • config: An array of setup actions to prepare the environment (e.g., launch a program or execute a command).
    • evaluator: Defines the success criteria. It includes a function name (func) and the expected outcome to compare against for reward calculation.
    • result: (Optional) Specifies the type of evaluation result expected (e.g., checking a specific configuration file).
    {
        "id": "8ba5ae7a-5ae5-4eab-9fcc-5dd4fe3abf89-W0S",
        "instruction": "Help me modify the folder used to store my recordings to the Desktop",
        "config": [
            {
                "type": "launch",
                "parameters": {
                    "command": "vlc"
                }
            },
            {
                "type": "execute",
                "parameters": {
                    "command": [
                        "python",
                        "-c",
                        "import pyautogui; import time; pyautogui.click(960, 540); time.sleep(0.5);"
                    ]
                }
            }
        ],
        "evaluator": {
            "func": "vis_vlc_recordings_folder",
            "expected": {
                "type": "rule",
                "rules": {
                    "recording_file_path": "C:\\Users\\Docker\\Desktop"
                }
            }
        },
        "result": {
            "type": "vlc_config",
            "dest": "vlcrc"
        }
    }