MacOS 的 AI Agent 新星,本地沙盒驱动,解锁 macOS 操作新体验!

随着 AI Agent 在 2025 年的爆发式发展,macOS 用户也迎来了一个令人振奋的开源项目:Cua

这款由 trycua 团队打造的计算机使用代理框架,不仅能在 macOS 上开启虚拟机,还能让 AI 在其中操作系统及应用,如浏览器和 VS Code。它支持 OpenAI 和 Anthropic 的 CUA 模型,未来还将兼容 Ollama 本地模型。

Cua 是一个专为 macOS 设计的开源 AI Agent 框架,它基于 Apple 的 Virtualization.Framework,结合高性能虚拟化与 AI 代理能力,允许用户在 Apple Silicon 上创建并运行 macOS 和 Linux 虚拟机。

它的核心在于其"计算机使用接口"(CUI)和代理支持,让 AI 能在隔离环境中操作桌面应用。

无论是浏览网页、编写代码,还是执行复杂任务,Cua 都能让 AI 在 macOS 上如鱼得水。

核心功能
  • 高性能虚拟化:在 Apple Silicon 上运行 macOS/Linux 虚拟机,性能接近原生(90%)。

  • AI 代理操作:支持 AI 在虚拟机中操作 macOS 系统及应用(如浏览器、VS Code)。

  • 安全隔离:所有操作在沙盒化的虚拟环境中运行,保护主机系统。

  • 多应用支持:AI 可操控虚拟机内的多种程序,实现复杂工作流。

  • 兼容多种大模型:目前支持 OpenAI、Anthropic CUA 模型,未来还将支持 Ollama 等本地大模型。

安装与使用

Cua 的安装和使用过程简单,专为 macOS 用户优化。以下是详细步骤:

1、安装 Lume(Cua 的虚拟化基础)

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

2、安装cua相关的Python库

复制代码
pip install cua-computer cua-agent

3、使用调用示例

复制代码
import logging
from pathlib import Path
from agent import ComputerAgent, LLM, AgentLoop

computer = Computer(verbosity=logging.INFO)

# Create agent with Anthropic loop and provider
agent = ComputerAgent(
        computer=computer,
        loop=AgentLoop.OMNI,
        model=LLM(provider=LLMProvider.ANTHROPIC, name="claude-3-7-sonnet-20250219"),
        # model=LLM(provider=LLMProvider.OPENAI, name="gpt-4.5-preview"),
        save_trajectory=True,
        trajectory_dir=str(Path("trajectories")),
        only_n_most_recent_images=3,
        verbosity=logging.INFO
    )

tasks = [
    "Look for a repository named trycua/cua on GitHub.",
    "Check the open issues, open the most recent one and read it.",
    "Clone the repository in users/lume/projects if it doesn't exist yet.",
    "Open the repository with an app named Cursor (on the dock, black background and white cube icon).",
    "From Cursor, open Composer if not already open.",
    "Focus on the Composer text area, then write and submit a task to help resolve the GitHub issue.",
]

for i, task in enumerate(tasks):
    print(f"\nExecuting task {i}/{len(tasks)}: {task}")
    async for result in agent.run(task):
        # print(result)
        pass

    print(f"\n✅ Task {i+1}/{len(tasks)} completed: {task}")

启动虚拟机命令:

复制代码
lume run macos-sequoia-vanilla:latest

更多用法和 Notebook 示例见 GitHub 文档,几分钟即可体验 AI 操作 macOS 的乐趣。

写在最后

Cua 让 AI 不再只是"聊天机器人",而是能直接动手操作你的 Mac!具备本地虚拟机隔离、性能卓越、模型灵活配置等优点,无论是开发、自动化办公、智能助手,都能极大提升效率。

相关推荐
Francek Chen16 小时前
【自然语言处理】预训练05:全局向量的词嵌入(GloVe)
人工智能·pytorch·深度学习·自然语言处理·glove
这张生成的图像能检测吗16 小时前
(论文速读)LyT-Net:基于YUV变压器的轻量级微光图像增强网络
图像处理·人工智能·计算机视觉·低照度
witton16 小时前
克隆整个macOS系统到新磁盘
macos·asr·克隆·复制·迁移·恢复·restore
许泽宇的技术分享16 小时前
AI黑客来袭:Strix如何用大模型重新定义渗透测试游戏规则
人工智能
Oxo Security16 小时前
【AI安全】检索增强生成(RAG)
人工智能·安全·网络安全·ai
少林码僧16 小时前
2.3 Transformer 变体与扩展:BERT、GPT 与多模态模型
人工智能·gpt·ai·大模型·bert·transformer·1024程序员节
shayudiandian16 小时前
如何使用 DeepSeek 帮助自己的工作
人工智能
程序猿追17 小时前
轻量级云原生体验:在OpenEuler 25.09上快速部署单节点K3s
人工智能·科技·机器学习·unity·游戏引擎
@小码农17 小时前
2025年北京海淀区中小学生信息学竞赛第一赛段试题(附答案)
人工智能·python·算法·蓝桥杯
csdn_aspnet17 小时前
如何在 Mac、Ubuntu、CentOS、Windows 上安装 MySQL 客户端
linux·windows·mysql·macos·centos