返回市场
控制台应用程序

控制台应用程序

作者:trycua11333 星标更新:2025-11-24

项目介绍

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" alt="Cua logo" height="150" srcset="img/logo_white.png"> <source media="(prefers-color-scheme: light)" alt="Cua logo" height="150" srcset="img/logo_black.png"> <img alt="Cua logo" height="150" src="img/logo_black.png"> </picture>

Python Discord <br> <a href="https://trendshift.io/repositories/13685" target="_blank"><img src="https://trendshift.io/api/badge/repositories/113685" alt="trycua%2Fcua | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>

</div>

Cua ("koo-ah") 是一个开源框架,用于计算机使用代理(Computer-Use Agents)——使AI系统能够通过视觉理解和动作执行自主操作计算机。它被用于研究、评估以及桌面、浏览器和移动自动化代理的生产部署。

计算机使用代理是什么?

计算机使用代理(CUAs)是能够通过视觉理解和动作执行自主与计算机界面交互的AI系统。与依赖脆弱选择器或API的传统自动化工具不同,CUAs使用视觉语言模型来感知屏幕内容并推理界面交互,使其能够适应UI变化并处理跨应用的复杂多步骤工作流。

<div align="center"> <video src="https://github.com/user-attachments/assets/c619b4ea-bb8e-4382-860e-f3757e36af20" width="600" controls></video> </div>

使用 计算机SDK,你可以:

使用 代理SDK,你可以:

  • 使用一致的模式运行计算机使用模型
  • 使用HUD在一行代码中对OSWorld-Verified(369任务)、SheetBench-V2和ScreenSpot进行基准测试 - 查看 基准测试结果 (笔记本)
  • 使用 组合代理 将UI定位模型与任何LLM结合
  • 使用来自下方模型动物园的新UI代理模型和UI定位模型,只需一个模型字符串(例如,ComputerAgent(model="openai/computer-use-preview")
  • 通过更改前缀(例如,openai/openrouter/ollama/huggingface-local/mlx/)使用API或本地推理

模块

<table> <tr> <td width="25%" align="center" valign="top">

代理<br /> 用于自动化的AI代理框架

</td> <td width="25%" align="center" valign="top">

计算机<br /> 控制Cua环境的TypeScript/Python SDK

</td> <td width="25%" align="center" valign="top">

MCP服务器<br /> 用于使用Cua代理和计算机的MCP服务器

</td> <td width="25%" align="center" valign="top">

计算机服务器<br /> 运行于Cua环境中的服务器组件

</td> </tr> </table> <table> <tr> <td width="25%" align="center" valign="top">

Lume<br /> macOS虚拟机管理

</td> <td width="25%" align="center" valign="top">

Lumier<br /> macOS/Linux虚拟机的Docker接口

</td> <td width="25%" align="center" valign="top">

SOM<br /> 代理的Mark集合库

</td> <td width="25%" align="center" valign="top">

核心<br /> Cua的核心实用程序

</td> </tr> </table>

快速开始

代理SDK

安装代理SDK:

pip install cua-agent[all]

使用 模型配置字符串计算机实例 初始化一个计算机代理:

from agent import ComputerAgent

# ComputerAgent 可以与使用 Computer SDK 初始化的任何计算机一起工作

agent = ComputerAgent(
    model="anthropic/claude-sonnet-4-5-20250929",
    tools=[computer],
    max_trajectory_budget=5.0
)

messages = [{"role": "user", "content": "截屏并告诉我你看到了什么"}]

async for result in agent.run(messages):
    for item in result["output"]:
        if item["type"] == "message":
            print(item["content"][0]["text"])

输出格式

Cua 使用 OpenAI 代理响应格式。

<details> <summary>示例</summary>
{
  "output": [
    {
      "role": "user",
      "content": "去 GitHub 上找 trycua"
    },
    {
      "summary": [
        {
          "text": "在 Firefox 中搜索 Trycua GitHub",
          "type": "summary_text"
        }
      ],
      "type": "reasoning"
    },
    {
      "action": {
        "text": "Trycua GitHub",
        "type": "type"
      },
      "call_id": "call_QI6OsYkXxl6Ww1KvyJc4LKKq",
      "status": "completed",
      "type": "computer_call"
    },
    {
      "type": "computer_call_output",
      "call_id": "call_QI6OsYkXxl6Ww1KvyJc4LKKq",
      "output": {
        "type": "input_image",
        "image_url": "data:image/png;base64,..."
      }
    },
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "text": "成功!已打开 Trycua GitHub 页面。",
          "type": "output_text"
        }
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 150,
    "completion_tokens": 75,
    "total_tokens": 225,
    "response_cost": 0.01
  }
}
</details>

模型配置

这些是 ComputerAgent(model="...") 的有效模型配置:

配置描述
{computer-use-model}执行所有计算机使用任务的单一模型
{grounding-model}+{any-vlm-with-tools}组合 使用 VLM 进行描述和定位 LLM 进行元素检测
moondream3+{any-llm-with-tools}组合 使用 Moondream3 进行描述和UI元素检测
human/human代替模型的 人机循环

模型能力

下表显示了每个模型支持的能力:

模型计算机使用定位工具视觉语言
Claude Sonnet/Haiku🖥️🎯🛠️👁️
OpenAI CU Preview🖥️🎯👁️
Qwen3 VL🖥️🎯🛠️👁️
GLM-V🖥️🎯🛠️👁️
Gemini CU Preview🖥️🎯👁️
InternVL🖥️🎯🛠️👁️
UI-TARS🖥️🎯🛠️👁️
UI-TARS-2🖥️🎯🛠️👁️
OpenCUA🎯
GTA🎯
Holo🎯
Moondream🎯
OmniParser🎯

图例:

  • 🖥️ 计算机使用:完整的代理循环,包括规划和执行
  • 🎯 定位:UI元素检测和点击坐标预测
  • 🛠️ 工具:支持超出屏幕交互的功能调用
  • 👁️ 视觉语言:视觉语言理解

组合示例:

更多组合示例,请参阅我们的 组合文档

# 使用OpenAI的GPT-5进行规划,结合专门的定位
agent = ComputerAgent(model="huggingface-local/HelloKKMe/GTA1-7B+openai/gpt-5")

# 通过OmniParser进行组合
agent = ComputerAgent(model="omniparser+openai/gpt-4o")

# 结合最先进的定位和强大的推理
agent = ComputerAgent(model="huggingface-local/HelloKKMe/GTA1-7B+anthropic/claude-sonnet-4-5-20250929")

# 结合两种不同的视觉模型以增强功能
agent = ComputerAgent(model="huggingface-local/ByteDance-Seed/UI-TARS-1.5-7B+openai/gpt-4o")

# 使用内置的Moondream3定位与任何规划模式。
agent = ComputerAgent(model="moondream3+openai/gpt-4o")

模型ID

<details> <summary>有效模型ID示例</summary>
模型模型ID
Claude Sonnet/Haikuanthropic/claude-sonnet-4-5, anthropic/claude-haiku-4-5
OpenAI CU Previewopenai/computer-use-preview
GLM-Vopenrouter/z-ai/glm-4.5v, huggingface-local/zai-org/GLM-4.5V
Qwen3 VLopenrouter/qwen/qwen3-vl-235b-a22b-instruct
Gemini CU Previewgemini-2.5-computer-use-preview
InternVLhuggingface-local/OpenGVLab/InternVL3_5-{1B,2B,4B,8B,...}
UI-TARShuggingface-local/ByteDance-Seed/UI-TARS-1.5-7B
UI-TARS-2cua/bytedance/ui-tars-2
OpenCUAhuggingface-local/xlangai/OpenCUA-{7B,32B}
GTAhuggingface-local/HelloKKMe/GTA1-{7B,32B,72B}
Holohuggingface-local/Hcompany/Holo1.5-{3B,7B,72B}
Moondreammoondream3
OmniParseromniparser
</details>

缺少某个模型?创建一个 功能请求贡献

了解更多,请参阅 代理SDK文档

计算机SDK

安装计算机SDK:

pip install cua-computer

初始化一台计算机:

from computer import Computer

computer = Computer(
    os_type="linux",  # 或 "macos", "windows"
    provider_type="cloud",  # 或 "lume", "docker", "windows_sandbox"
    name="your-sandbox-name",
    api_key="your-api-key"  # 仅适用于云
    # 或 use_host_computer_server=True 用于主机桌面
)

try:
    await computer.run()

    # 截屏
    screenshot = await computer.interface.screenshot()

    # 点击并输入文本
    await computer.interface.left_click(100, 100)
    await computer.interface.type_text("你好!")
finally:
    await computer.close()

了解更多,请参阅 计算机SDK文档

MCP服务器

安装MCP服务器:

pip install cua-mcp-server

了解更多,请参阅 MCP服务器文档

计算机服务器

安装计算机服务器:

pip install cua-computer-server
python -m computer_server

了解更多,请参阅 计算机服务器文档

Lume

安装Lume:

curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh | bash

了解更多,请参阅 Lume文档

Lumier

安装Lumier:

docker pull trycua/lumier:latest

了解更多,请参阅 Lumier文档

SOM

安装SOM:

pip install cua-som

了解更多,请参阅 SOM文档

最近更新

2025

2025年9月

  • Hack the North竞赛:首个基于基准驱动的黑客马拉松赛道,保证YC面试奖品。获胜者在OSWorld