AI 程式設計教程中文版
官方教程中文版Cloud Agent 與後臺任務

Cloud Agent 總覽

基於 Cursor 官方 Cloud Agents 文件解釋雲端隔離環境、啟動入口、GitHub/GitLab 分支流、MCP、hooks、artifacts、billing 和排障邊界。

Cloud Agents(雲端代理,原 Background Agents 改名而來——官方明示 "Cloud Agents were formerly called Background Agents")使用和本地 Agent 相同的基本模型,但執行在雲端隔離環境裡,不依賴你的本機持續線上。

閱讀目標:讀完本章,你應該能判斷什麼任務適合交給 Cloud Agent,並能解釋它如何訪問 repo、建立分支、執行測試、產出 artifacts 和交接結果。

1. 為什麼用 Cloud Agents

能力本地 AgentCloud Agent
執行位置你的本機或 IDE雲端 isolated VM
並行數量受本機和上下文影響可並行啟動多個 agent
本機線上需要不需要
構建和測試依賴本機環境在獨立 VM 內執行
UI 驗證本機瀏覽器雲端 desktop / browser
交付本地 diff分支、PR、artifacts、日誌

適合 Cloud Agent 的任務通常具備三個特徵:耗時較長、可以非同步驗收、能用分支和 PR 交付。

不適合的任務:需要你即時互動的小修、小範圍只讀問答、依賴本機登入態或私有 GUI 環境的操作。

2. 啟動入口

官方列出的入口包括:

入口用途
Cursor Webcursor.com/agents 管理 agents
Cursor DesktopAgent input 下拉選擇 Cloud
Slack使用 @cursor 啟動 agent
GitHub在 PR 或 issue 評論 @cursor
Linear使用 @cursor 啟動 agent
API透過 API 啟動 agent

移動端可以把 cursor.com/agents 安裝成 PWA。iOS 用 Safari 的 Add to Home Screen;Android 用 Chrome 的 Install App。

3. Repo 工作方式

Cloud Agents 透過 GitHub 或 GitLab 連線 clone repo,在單獨 branch 上工作,然後把 changes push 回 repo 交接。

你需要:

  • 對目標 repo 有 read-write 許可權。
  • 對 dependent repos 或 submodules 有必要許可權。
  • 連線 GitHub 或 GitLab 賬號。

當前官方說明中,Bitbucket 等其他 provider 還不是主要路徑。

flowchart TD
  Start["Start Cloud Agent"] --> Clone["Clone GitHub / GitLab repo"]
  Clone --> Branch["Work on separate branch"]
  Branch --> Build["Build / test / run app in VM"]
  Build --> Artifacts["Screenshots / videos / logs"]
  Artifacts --> Push["Push changes to repo"]
  Push --> Review["Human review and merge decision"]

4. Models 和 billing

Cloud Agents 使用 curated model selection(精選模型組合),並且總是在 Max Mode 下執行——官方說明沒有 Cloud Agents 的 Max Mode off toggle,也就是用量永遠按 Max Mode 速率計費,比本地 default context 燒得快。

計費按所選 model 的 API pricing。第一次使用時會要求設定 spend limit(消費上限,避免長任務無監管燒到天文數字)。

模型、價格和額度是高波動事實,採購或預算相關內容要回到當前 Cursor Models & Pricing 頁面核對。

5. MCP 和 hooks

Cloud Agents 可以使用 team 配置的 MCP servers。透過 cursor.com/agents 的 MCP dropdown 新增和管理。

官方當前說明:

  • 支援 HTTP 和 stdio transports。
  • 支援需要 OAuth 的 MCP servers。
  • HTTP MCP 更適合安全邊界清晰的團隊環境。

Cloud Agents 也會執行 project hooks:.cursor/hooks.json。Enterprise 計劃還會執行 team hooks 和 enterprise-managed hooks。

這意味著本地 formatters、audit scripts、policy checks 可以在雲端繼續生效,前提是環境配置能跑起來。

6. Artifacts 和 remote desktop

Cloud Agents 會生成 artifacts 幫你驗證結果:

  • screenshots
  • videos
  • logs
  • demo references

你也可以接管 agent 的 remote desktop,在雲端 VM 裡直接測試軟體,然後把控制權交還給 agent。

商業級驗收不要只看自然語言總結。至少檢查:

  • PR diff。
  • 測試或 build 日誌。
  • screenshot / video artifact。
  • 關鍵功能是否能在 remote desktop 中復現。

7. 常見排障

Agent runs not starting:

  • 確認已經登入。
  • 確認連線 GitHub 或 GitLab。
  • 確認你有 repo 許可權。
  • 確認在 paid Cursor plan 上。

Secrets 不可用:

  • 到 Cloud Agents dashboard 新增 secrets。
  • 確認 workspace / team scope 正確。
  • 新增 secret 後重啟 Cloud Agent。

找不到 Secrets tab:

  • 檢查賬號和團隊許可權。

Slack integration 不工作:

  • 確認 workspace admin 已安裝 Cursor Slack app。
  • 確認你有觸發許可權。
深讀:Cloud Agent 不是更自由的本地 Agent

Cloud Agent 的優勢是隔離、非同步和並行,不是可以跳過工程邊界。它仍然需要 repo 許可權、環境配置、secrets、網路、測試命令和審查流程。

如果沒有這些,雲端只會把“本地跑不起來”的問題換到另一臺 VM 上。

本章自檢

完成本章後,用這 3 個問題檢查自己是否真正理解:

  1. Cloud Agent 為什麼適合長任務和並行任務?
  2. 它如何把 changes 交回 GitHub 或 GitLab?
  3. 為什麼 artifacts 不能替代 PR diff 和測試日誌?

透過標準:你能為一個真實 repo 寫出 Cloud Agent 任務 spec,包括目標、允許修改範圍、測試命令、secret 邊界和驗收證據。

官方來源

接下來去哪

本頁目錄