Hermes Agent Windows 原生安装与桌面控制指南

笔记 2026-06-30 196
预计阅读时间:8 分钟

Hermes Agent Windows 原生安装与桌面控制指南

一、为什么装 Windows 版

当前你在 WSL 跑 Hermes,但 computer_use(桌面控制工具)通过 WSL 调用 Windows 图形栈的桥接方案一直没跑通。Windows 原生安装 Hermes 可以直接调用 Windows 的 UIAutomation + SendInput 操控桌面,不需要任何桥接。

适用场景

  • 操控 Windows 桌面软件(腾讯视频、QQ、微信等)
  • 自动操作 Windows 原生 GUI 程序
  • 截图、点击、输入、拖拽等桌面交互

⚠️ 重要:必须装在当前登录的 Windows 用户下

cua-driver(桌面控制核心)操控的是运行它那个用户的桌面会话。

  • 装到子用户/其他用户里不行 — 子用户可能没登录、没桌面会话,就算登录了也看不到主用户桌面的窗口
  • 装在你日常登录的这个 Windows 用户下 — 谁登录桌面,谁装 Hermes

你当前使用的 Windows 用户是 Lenovo(WSL 也跑在这个用户下),所以 Windows Hermes 也必须装在这个用户里,WSL 侧的 Hermes 才能跟它互通。

不冲突方案

WSL Hermes 继续作为主力(考研、脚本、飞书、云服务),Windows Hermes 专门用于桌面控制。两个实例互不干扰。


二、安装前准备

系统要求

  • Windows 10 或 Windows 11
  • 网络连接正常(需下载安装包)
  • 管理员权限(安装过程需要)

确认当前环境

# 查看 Windows 版本
winver

# 查看 PowerShell 版本
$PSVersionTable.PSVersion

三、安装步骤

步骤 1:安装 Hermes Agent

打开 PowerShell(管理员),执行:

# 先下载到临时文件,再带参数执行(iex 不支持直接传参)
curl.exe -sLo "$env:TEMP\hermes-install.ps1" https://hermes-agent.nousresearch.com/install.ps1
& "$env:TEMP\hermes-install.ps1" -InstallDir "D:\Soft\Hermes"

安装器会自动:

  • 下载 Hermes CLI 到 D:\Soft\Hermes\
  • 配置 PATH 环境变量(指向 D:\Soft\Hermes\bin
  • 安装 Python 依赖

注: 安装目录可以按需修改,但建议装在非系统盘(D盘)避免占用C盘空间。
安装完成后,Hermes 的配置数据(skills、cron、memories)默认仍在 %USERPROFILE%\.hermes\,只有程序文件在安装目录。

步骤 2:验证安装

# 关闭当前 PowerShell,重新打开一个新的
hermes --version

# 如果提示"无法识别",手动刷新环境变量或重启终端

步骤 3:配置模型供应商

Hermes 需要配置一个 LLM 模型才能工作。推荐三种方式:

方式 A:Nous Portal(推荐,一键搞定)

hermes setup --portal

按提示完成 OAuth 登录,Portal 覆盖模型 + 网页搜索 + 图片生成 + TTS + 浏览器。

方式 B:OpenRouter

hermes config set provider openrouter
hermes config set model openrouter/deepseek/deepseek-v4-flash
hermes config set openrouter.api_key "sk-or-xxx"

方式 C:DeepSeek 直连

hermes config set provider deepseek
hermes config set model deepseek-v4-flash
hermes config set deepseek.api_key "sk-xxx"

步骤 4:安装 cua-driver(桌面控制核心)

# 方法一:通过 Hermes 安装(推荐)
hermes computer-use install

# 方法二:直接运行上游安装器
# irm https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.ps1 | iex

安装完成后验证:

cua-driver --version
hermes computer-use status

步骤 5:授权 cua-driver

# 运行健康检查,确认所有检查项通过
hermes computer-use doctor

Windows 不需要额外的权限授权(不像 macOS 需要 Accessibility + Screen Recording),但如果结果中有检查项不通过,按提示修复即可。

步骤 6:启动 Hermes 并启用桌面控制

# 启动会话,带上 computer_use 工具集
hermes -t computer_use chat

进入对话后,你就可以让 Hermes 操作桌面了。


四、验证桌面控制功能

启动后可以测试几个基本操作:

  1. 截图桌面:让 Hermes 执行 computer_use(action='capture'),应该能返回当前屏幕截图
  2. 列出窗口:让 Hermes 列出当前打开的窗口
  3. 打开应用:让 Hermes 启动计算器或记事本

测试示例对话

你:帮我截个屏看看桌面有什么
Hermes:执行 capture → 返回桌面截图

你:帮我打开记事本并输入"Hello World"
Hermes:capture 定位开始菜单 → 搜索"记事本" → 点击 → 输入文字

五、配置建议

将 computer_use 添加到默认工具集

编辑 %USERPROFILE%\.hermes\config.yaml

enabled_toolsets:
  - computer_use
  # 按需添加其他工具集

或者用命令设置:

hermes config set enabled_toolsets computer_use

调整安全级别

# 每次操作都手动确认(最安全)
hermes config set approvals.mode manual

# 仅在敏感操作时确认
hermes config set approvals.mode auto

调整截图压缩(节省 token)

hermes config set compression.threshold 0.35
hermes config set compression.target_ratio 0.15

六、与 WSL Hermes 共享配置

Windows Hermes 和 WSL Hermes 的配置默认是独立的。如果想把 WSL 的配置迁移过来:

迁移技能

# 在 WSL 中查看已安装的技能列表
ls ~/.hermes/skills/

在 Windows PowerShell 中手动重建或复制需要的技能文件到 %USERPROFILE%\.hermes\skills\

迁移定时任务

在 Windows Hermes 中重新创建需要的 cron 任务。

两个实例同时运行

不冲突,各管各的。需要使用桌面控制时切到 Windows 终端即可。


七、常见问题

Q:cua-driver 安装失败

A:确保 PowerShell 以管理员身份运行。如果防火墙拦截,临时关闭后重试。

Q:hermes computer-use doctor 报错 interactive session

A:表示 cua-driver 运行在 Session 0(无桌面环境),需要用 autostart 模式:

cua-driver autostart enable
cua-driver autostart kick
cua-driver status   # 确认 daemon running

Q:桌面操作没有反应

A:确认目标窗口没有被 UIPI(用户界面特权隔离)阻挡。普通进程无法操作管理员权限的窗口。可以尝试用管理员身份启动 Hermes。

Q:截图返回空

A:运行 cua-driver doctor 检查 UIA 树是否可访问。某些 UWP 应用或旧式 WinForms 可能有兼容问题。


八、参考资料

  • Hermes 官方文档:https://hermes-agent.nousresearch.com/docs
  • cua-driver GitHub:https://github.com/trycua/cua
  • cua.ai 文档:https://cua.ai/docs/
  • Computer Use 功能介绍:https://hermes-agent.nousresearch.com/docs/user-guide/features/computer-use
  • Windows SSH 驱动指南:https://cua.ai/docs/how-to-guides/driver/windows-ssh
  • npiperelay(WSL↔Windows 命名管道桥接):https://github.com/jstarks/npiperelay

本文由 admin 原创,转载请注明出处。

相关推荐

暂无评论,来发表第一条评论吧

发表评论

登录 后发表评论