🧩 使用 OSWorld (Windows) 设置 UFO
OSWorld 是一个基准测试套件,旨在评估 AI 代理在真实世界场景中的性能。我们从原始 OSWorld 基准测试中选择了 49 个与 Windows 平台兼容的案例,并将其重命名为 OSWorld-W。这些任务涵盖了用户通常在其计算机上执行的广泛功能和交互,包括 Office 365 和浏览器。
💻 部署指南 (推荐使用 WSL)
我们强烈建议您事先查阅原始 WAA 部署指南。以下说明假定您熟悉原始设置。
1. 克隆仓库
git clone https://github.com/nice-mee/WindowsAgentArena.git
💡 要运行 OSWorld 案例,请切换到专用的开发分支:
git checkout osworld
在仓库根目录中创建 config.json
文件,其中包含一个占位符密钥 (UFO 将覆盖此密钥)
{
"OPENAI_API_KEY": "placeholder"
}
2. 构建 Docker 镜像
导航到 scripts
目录并构建 Docker 镜像
cd scripts
chmod +x build-container-image.sh prepare-agents.sh # (if needed)
./build-container-image.sh --build-base-image true
这将使用 src/
中最新的代码库生成 windowsarena/winarena:latest
镜像。
3. 集成 UFO
- 通过
ufo/config/config.json
配置 UFO(详情请参阅UFO 仓库)。 - 将整个
ufo
文件夹复制到 WAA 容器客户端目录
cp -r src/win-arena-container/vm/setup/mm_agents/UFO/ufo src/win-arena-container/client/
⚠️ Python 3.9 兼容性修复
在ufo/llm/openai.py
中,交换@staticmethod
和@functools.lru_cache()
的顺序,以防止由于已知的 Python 3.9 错误导致的问题。
4. 准备 Windows 11 虚拟机
4.1 下载 ISO
- 访问 Microsoft 评估中心
- 接受条款并下载 Windows 11 Enterprise Evaluation (英文,90 天试用版) (~6GB)
- 将文件重命名为
setup.iso
并放置在
WindowsAgentArena/src/win-arena-container/vm/image
4.2 生成黄金镜像快照
准备 Windows 虚拟机快照(一个完全配置的 30GB 镜像)
cd ./scripts
./run-local.sh --mode dev --prepare-image true
⚠️ 准备过程中请勿与虚拟机进行交互。 完成后它将自动关闭。
黄金镜像将保存在
WindowsAgentArena/src/win-arena-container/vm/storage
5. 首次运行 (首次启动设置)
启动环境
./run-local.sh --mode dev --json-name "evaluation_examples_windows/test_custom.json" --agent UFO --agent-settings '{"llm_type": "azure", "llm_endpoint": "https://cloudgpt-openai.azure-api.net/openai/deployments/gpt-4o-20240513/chat/completions?api-version=2024-04-01-preview", "llm_auth": {"type": "api-key", "token": ""}}'
虚拟机启动后
- 请勿输入设备代码 (这会使 WAA 服务器无限期保持活动状态)。
- 访问
https://:8006
并执行以下设置操作 - 禁用 Windows 防火墙
- 打开 Google Chrome 并完成初始设置
- 打开 VLC 并完成初始设置
- 使用 Microsoft 帐户激活 Office 365(Word、Excel、PowerPoint 等)(如果需要,请使用临时帐户)。
设置完成后
- 停止客户端
- 从
storage
文件夹备份黄金镜像
🧪 运行实验
每次实验前
- 将虚拟机镜像替换为您准备好的黄金快照
- 清除任何先前的 UFO 日志
然后运行
./run-local.sh --mode dev --json-name "evaluation_examples_windows/test_full.json" --agent UFO --agent-settings '{"llm_type": "azure", "llm_endpoint": "https://cloudgpt-openai.azure-api.net/openai/deployments/gpt-4o-20240513/chat/completions?api-version=2024-04-01-preview", "llm_auth": {"type": "api-key", "token": ""}}'
注意
test_full.json
:包含所有可使用 UIA 的测试用例。test_all.json
:包含所有测试用例,即使是那些与 UIA 不兼容的。- 如果您不使用 OmniParser,请使用
test_full.json
。