# Team Pools 与仓库路由

> 使用服务账号启动 Enterprise worker，配置标签、仓库根和 any-repo 克隆。

- 网址：https://funcoding.ai/agents/cursor/cloud/team-pools/
- 核实日期：2026-10-18（命令、配置和价格以官方文档为准）
- 官方来源：[Cursor 官方文档：Team Pools](https://cursor.com/docs/cloud-agent/self-hosted/pool)

---
Pool 是可选择的路由目标，请求排队等待空闲 worker claim。每个 pool worker 同时服务一个 Agent；多个任务并行需要多个 worker。

## 前提与启动

需要 Enterprise、管理员允许 Self-Hosted Machines，以及服务账号 API Key。个人登录和个人/用户 key 不能启动 pool worker。

管理员在 Cloud Agents dashboard 的 Self-Hosted 区设置路由：Allow Self-Hosted Machines 让用户按请求选择，Require Self-Hosted Machines 把 Cloud Agent 运行都交给自托管 worker。开启 Require 之前已在 Cursor 托管机器上启动的 Agent，之后拿不到新的托管机器；后续消息需要新机器时运行失败，提示在自托管 worker 上新建 Agent。受 Require 约束的运行没有指定 pool 或机器、也没有 pool worker 能接时，改在你自己已连接的 [My Machines](https://funcoding.ai/agents/cursor/cloud/my-machines/) 上运行，不会用队友的机器。

```bash
export CURSOR_API_KEY="your-service-account-api-key"
agent worker --pool my-pool --worker-dir /path/to/repo start
```

不提供名称时加入 default。当前专题页使用 `--pool [name]`；旧 `--pool-name` 为弃用别名，`--single-use` 是旧兼容入口。通用 CLI 参数页仍展示旧格式，实际安装版本需用帮助核对。

## 仓库根与标签

--worker-dir 最多重复 20 个已存在目录，首项决定 assignment identity 与 dashboard 主仓库显示；全部根提供给运行时，有 Git remote 的根注册仓库路由。

更多根不自动把更多仓库加入请求。普通 repo-backed pool 请求仍选择一个仓库，其他根的 Git 操作用机器已有凭据。检查 verbose 日志中的 workspacePaths 和 x-repository-urls 确认注册范围。

标签可用 --label key=value 或 --labels-file JSON/TOML，二者互斥。repo 和 pool 为保留标签，分别从 Git remote 和 pool 参数生成，不应手动填写。

## Any-repo 池

无绑定仓库的命名 pool 按 pool 名匹配，默认不克隆。需要自动准备请求仓库时：

```bash
agent worker --pool my-pool --clone-git-repos start
```

此开关只支持非 default、无绑定 repo、无绑定 machine 的 any-repo pool，隐含 --mint-github-token，并需管理员允许 mint、PATH 中有 git。使用 HTTPS GitHub remote；完整 40 字符 SHA 使用 detached checkout。

可复用 worker 目录中干净且 origin 匹配的 checkout；存在未提交修改、本地领先提交、进行中的 Git 操作、submodule 或额外配置等不安全状态时，另克隆目录。复用需 Git 2.26 或以上。claim 结束后删除本次克隆内容，保留复用的 checkout。

## 凭据与分发

--sync-dashboard-secrets 需管理员开启 Secret sync，接收团队/用户 secrets 和 API envVars；any-repo 只接收未限制到仓库的 secrets；加了 --clone-git-repos 时，如果用户能读 worker 克隆的每个仓库、且它们都是私有 GitHub 仓库，该用户的运行还会收到限定到这些仓库的 secrets。环境范围的 secrets 和 Build Secrets 都不发送。

启用克隆、token mint 或 secret sync 的 worker 必须每容器或 OS 用户仅一个，不能同用户共置多个凭据 worker。运行池的扩容与回收见[Controller](https://funcoding.ai/agents/cursor/cloud/worker-controller/)。
