# 在您的组织或企业中测试和发布custom agents

在向公司发布前，确保 custom agents 性能良好且合规。

> \[!NOTE]
> Copilot custom agents 位于 公开预览 中，并可能会更改。

## 介绍

在组织或企业中发布或更新 custom agent 代理之前，可以私下测试代理，以确保它符合你的标准。 一旦您感到满意，您便可以轻松更改agent profile的位置，使其在整个公司内可用。

## 先决条件

在测试 custom agent 前，需要为 custom agents 设置你的组织或企业。 请参阅“[准备在组织中使用自定义代理](/zh/copilot/how-tos/administer-copilot/manage-for-organization/prepare-for-custom-agents)”或“[准备在企业中使用自定义代理](/zh/copilot/how-tos/administer-copilot/manage-for-enterprise/manage-agents/prepare-for-custom-agents)”。

## 1.创建测试 custom agent

1. 在组织或企业的 `.github-private` 存储库中，创建名为 `.github/agents` 的新目录。 存储在此目录中的代理仅适用于有权访问 `.github-private` 存储库的组织或企业的成员，并且只能在他们启动该存储库中的任务时使用。
2. 在你的`.github/agents`目录中，为测试代理创建agent profile。 可以创建一个 net-new 配置文件或复制现有配置文件，以测试潜在的更新。 有关配置 agent profile的信息，请参阅 [为Copilot cloud agent创建自定义代理](/zh/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/create-custom-agents#configuring-an-agent-profile)。
3. 将测试 agent profile 合并到存储库的默认分支中。

## 2. 测试 custom agent

1. 转到[https://github.com/copilot/agents](https://github.com/copilot/agents?ref_product=copilot\&ref_type=engagement\&ref_style=text)的“代理”选项卡。
2. 使用提示框中的下拉菜单，选择 `.github-private` 存储库。
3. 选择 <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-copilot" aria-label="Select a custom agent" role="img"><path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.769.693-2.484.579-.733 1.494-1.124 2.724-1.261 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095v1.872c0 .766-3.351 3.795-8.002 3.795Zm0-1.485c2.28 0 4.584-1.11 5.002-1.433V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-1.146 0-2.059-.327-2.71-.991A3.222 3.222 0 0 1 8 6.303a3.24 3.24 0 0 1-.544.743c-.65.664-1.563.991-2.71.991-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433ZM6.762 2.83c-.193-.206-.637-.413-1.682-.297-1.019.113-1.479.404-1.713.7-.247.312-.369.789-.369 1.554 0 .793.129 1.171.308 1.371.162.181.519.379 1.442.379.853 0 1.339-.235 1.638-.54.315-.322.527-.827.617-1.553.117-.935-.037-1.395-.241-1.614Zm4.155-.297c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Z"></path><path d="M6.25 9.037a.75.75 0 0 1 .75.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 .75-.75Zm4.25.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 1.5 0Z"></path></svg>，然后单击测试代理。
4. 若要测试你的 custom agent，请向 Copilot 发送一个提示。
5. 在“最近会话”部分中，单击会话以查看有关结果的详细信息。
6. 继续根据需要进行更改和测试 custom agent ，直到满足其性能。

## 3. 释放 custom agent

1. 在您的`.github-private`存储库中，将agent profile目录中的`.github/agents`移动到`agents`目录中。
2. 将更改合并到默认分支中。 现在，你的 custom agent 已在你的组织或企业中对所有用户开放使用。

## 后续步骤

若要监视组织中 custom agents 的使用情况，请按 `actor:Copilot` 筛选组织的审核日志。 请参阅“[查看贵组织的审核日志](/zh/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization)”。

若要监视企业中 custom agents 的使用情况，请参阅 [监视企业中的代理人活动](/zh/copilot/how-tos/administer-copilot/manage-for-enterprise/manage-agents/monitor-agentic-activity)。