{"meta":{"title":"从 GitHub CLI 使用 Copilot 云代理","intro":"从Copilot cloud agent启动并跟踪GitHub CLI会话。","product":"GitHub Copilot","breadcrumbs":[{"href":"/zh/copilot","title":"GitHub Copilot"},{"href":"/zh/copilot/how-tos","title":"操作方法"},{"href":"/zh/copilot/how-tos/use-copilot-agents","title":"使用Copilot代理"},{"href":"/zh/copilot/how-tos/use-copilot-agents/cloud-agent","title":"Cloud agent"},{"href":"/zh/copilot/how-tos/use-copilot-agents/cloud-agent/use-cloud-agent-from-cli","title":"从 GitHub CLI 使用云代理"}],"documentType":"article"},"body":"# 从 GitHub CLI 使用 Copilot 云代理\n\n从Copilot cloud agent启动并跟踪GitHub CLI会话。\n\n> \\[!NOTE]\n> `agent-task` 命令集仅在 GitHub CLI 的 v2.80.0 或更高版本中可用。 此命令集是一个 公开预览 且可能会更改。\n\n## 启动会话\n\n您可以使用 `gh agent-task create` 命令启动新的 Copilot cloud agent 会话。\n\n在没有任何参数的情况下运行命令时，系统会要求输入提示。\nCopilot cloud agent 对提示进行操作，并在当前存储库中打开拉取请求。\n\n可使用命令行选项执行以下操作：\n\n* 提供提示 (`gh agent-task create \"Example prompt\"`)\n* 选择一个基础分支，而不是使用该仓库的默认分支 (`--base`)\n* 选择一个仓库，而非以当前仓库 (`--repo`) 为目标\n* 实时跟踪会话日志 (`--follow`)\n\n要查看所有可用选项，请运行 `gh agent-task create --help`。\n\n## 会话跟踪\n\n您可以使用 `gh agent-task list` 命令查看正在运行和过往的代理会话列表。 输出将显示近期会话列表。\n\n要查看有关特定会话的详细信息，请使用 `gh agent-task view` 命令。 例如，要查看与 `monalisa/bookstore` 仓库中编号为 #123 的拉取请求相关联的会话信息，请运行 `gh agent-task view --repo monalisa/bookstore 123` 命令。\n\n要查看会话日志，请添加 `--log` 选项。 也可使用 `--follow` 选项在智能体工作时流式传输实时日志。\n\n要查看所有可用选项，请运行 `gh agent-task list --help` 或 `gh agent-task view --help`。\n\n## 延伸阅读\n\n* [管理智能体会话](/zh/copilot/how-tos/copilot-on-github/use-copilot-agents/manage-and-track-agents)\n* [使用GitHub Copilot处理任务的最佳做法](/zh/copilot/tutorials/cloud-agent/get-the-best-results)"}