cua: 为 AI 智能体提供高性能虚拟环境

GitHubGitHub - trycua/cua: c/ua is the Docker Container for Computer-Use AI Agents.

更多AI开源软件发现分享好用的AI工具、AI开源软件、AI模型、AI变现 - 小众AI

一个专为 AI 智能体设计的高性能操作系统虚拟化与控制框架。它通过轻量级、近乎原生速度的虚拟容器,让 AI Agent 能够在完全隔离的 macOS 或 Linux 环境中自动执行“用电脑”任务,如操作应用、上网、写代码、自动化复杂办公流程等,并内置多种主流 LLM(大模型)接口。

主要功能

  1. 高性能虚拟化:在 Apple Silicon 上运行 macOS/Linux 虚拟机,性能接近原生(90%)。
  2. AI 代理操作:支持 AI 在虚拟机中操作 macOS 系统及应用(如浏览器、VS Code)。
  3. 安全隔离:所有操作在沙盒化的虚拟环境中运行,保护主机系统。
  4. 多应用支持:AI 可操控虚拟机内的多种程序,实现复杂工作流。
  5. 兼容多种大模型:支持 OpenAI、Anthropic 的 CUA 模型,未来还将兼容 Ollama 等本地大模型。

安装和使用

系统要求

  • 配备 Apple Silicon 的 Mac(M1/M2/M3/M4 系列)
  • macOS 15 (Sequoia) 或更高版本
  • Python 3.10+(计算机、代理和 MCP 库需要)。我们建议使用 Conda(或 Anaconda)创建临时 Python 环境。
  • VM 映像的磁盘空间(建议 30GB+)

1:仅限 Lume CLI(VM 管理)

如果您只需要虚拟化功能:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"

(可选)如果您不希望 Lume 作为后台服务运行:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh) --no-background-service"

注意:如果您选择此选项,则需要在需要时通过在终端中运行来手动启动 Lume API 服务。这适用于完成步骤 1 后的选项 2。lume serve​

有关 Lume 使用说明,请参阅 Lume 文档

2:完整的计算机使用代理功能

如果要将 AI 代理与虚拟化环境一起使用:

  1. 安装 Lume CLI:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
    
  2. 拉取最新的 macOS CUA 映像:

    lume pull macos-sequoia-cua:latest
    
  3. 安装 Python 库:

    pip install cua-computer cua-agent[all]
    
  4. 在 Python 代码中使用这些库:

    from computer import Computer
    from agent import ComputerAgent, LLM, AgentLoop, LLMProvider
    
    async with Computer(verbosity=logging.DEBUG) as macos_computer:
      agent = ComputerAgent(
          computer=macos_computer,
          loop=AgentLoop.OPENAI, # or AgentLoop.ANTHROPIC, or AgentLoop.OMNI
          model=LLM(provider=LLMProvider.OPENAI) # or LLM(provider=LLMProvider.ANTHROPIC)
      )
    
      tasks = [
          "Look for a repository named trycua/cua on GitHub.",
      ]
    
      for task in tasks:
        async for result in agent.run(task):
          print(result)
    

    浏览 Agent Notebook 以获取可运行的示例。

  5. 或者,您可以将代理与 Gradio UI 一起使用:

    from utils import load_dotenv_files
    load_dotenv_files()
    
    from agent.ui.gradio.app import create_gradio_ui
    
    app = create_gradio_ui()
    app.launch(share=False)
    

3:从源构建

如果您想为项目做出贡献或需要最新的 nigh

目录

主要功能

安装和使用

系统要求

1:仅限 Lume CLI(VM 管理)

2:完整的计算机使用代理功能

3:从源构建


tly 功能:

# Clone the repository
git clone https://github.com/trycua/cua.git
cd cua

# Open the project in VSCode
code ./.vscode/py.code-workspace

# Build the project
./scripts/build.sh

有关更多信息,请参阅我们的开发人员指南

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值