From 8513e8c89e33b783adf672eb441dde6cb8a772e9 Mon Sep 17 00:00:00 2001 From: aneeshprasad1 Date: Mon, 1 Sep 2025 08:14:24 -0700 Subject: [PATCH] Add quickstart script and update README (#325) Co-authored-by: Aneesh Prasad --- README.md | 42 ++++------------------------------ quickstart.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 quickstart.py diff --git a/README.md b/README.md index 4487f46..172b312 100644 --- a/README.md +++ b/README.md @@ -106,45 +106,13 @@ We are working on supporting more ๐Ÿ‘ท. Please hold tight! ## ๐Ÿš€ Quick Start Run the following minimal example to interact with the environment: -```python -from desktop_env.desktop_env import DesktopEnv +```bash +# Basic usage with default settings +python quickstart.py -example = { - "id": "94d95f96-9699-4208-98ba-3c3119edf9c2", - "instruction": "I want to install Spotify on my current system. Could you please help me?", - "config": [ - { - "type": "execute", - "parameters": { - "command": [ - "python", - "-c", - "import pyautogui; import time; pyautogui.click(960, 540); time.sleep(0.5);" - ] - } - } - ], - "evaluator": { - "func": "check_include_exclude", - "result": { - "type": "vm_command_line", - "command": "which spotify" - }, - "expected": { - "type": "rule", - "rules": { - "include": ["spotify"], - "exclude": ["not found"] - } - } - } -} +# Customize provider and VM path +python quickstart.py --provider_name vmware --path_to_vm "path/to/your/vm.vmx" -env = DesktopEnv(action_space="pyautogui") - -obs = env.reset(task_config=example) -obs, reward, done, info = env.step("pyautogui.rightClick()") -``` You will see all the logs of the system running normally, including the successful creation of the environment, completion of setup, and successful execution of actions. In the end, you will observe a successful right-click on the screen, which means you are ready to go. ## ๐Ÿงช Experiments diff --git a/quickstart.py b/quickstart.py new file mode 100644 index 0000000..73d3510 --- /dev/null +++ b/quickstart.py @@ -0,0 +1,63 @@ +from desktop_env.desktop_env import DesktopEnv +import argparse + +example = { + "id": "94d95f96-9699-4208-98ba-3c3119edf9c2", + "instruction": "I want to install Spotify on my current system. Could you please help me?", + "config": [ + { + "type": "execute", + "parameters": { + "command": [ + "python", + "-c", + "import pyautogui; import time; pyautogui.click(960, 540); time.sleep(0.5);" + ] + } + } + ], + "evaluator": { + "func": "check_include_exclude", + "result": { + "type": "vm_command_line", + "command": "which spotify" + }, + "expected": { + "type": "rule", + "rules": { + "include": ["spotify"], + "exclude": ["not found"] + } + } + } +} + +# Parse arguments +parser = argparse.ArgumentParser() +parser.add_argument("--provider_name", type=str, default="vmware") +parser.add_argument("--path_to_vm", type=str, default="vmware_vm_data/Ubuntu-arm/Ubuntu.vmx") +parser.add_argument("--os_type", type=str, default="Ubuntu") +parser.add_argument("--action_space", type=str, default="pyautogui") +parser.add_argument("--headless", type=bool, default=False) # Set to True if you want to run without GUI +args = parser.parse_args() + +# Initialize DesktopEnv +env = DesktopEnv( + provider_name=args.provider_name, + path_to_vm=args.path_to_vm, + os_type=args.os_type, + action_space=args.action_space, + headless=args.headless +) + +print("Starting OSWorld environment...") +obs = env.reset(task_config=example) +print("Environment reset complete!") + +print("Executing action: pyautogui.rightClick()") +obs, reward, done, info = env.step("pyautogui.rightClick()") +print("Action executed successfully!") + +# Clean up +env.close() +print("Environment closed.") \ No newline at end of file