Skip to main content

About custom agents

自定义智能体 enhance Copilot with assistance tailored to your needs.

关于 自定义代理

          自定义智能体 是专用版本的 Copilot 代理,可针对独特的工作流、编码约定和用例进行定制。 他们的行为就像定制团队成员一样,遵循你的标准,使用正确的工具,并实施团队特定的做法。 定义这些代理一次,而不是重复提供相同的指令和上下文。

使用名为 自定义代理 的 Markdown 文件进行定义代理资料。 这些文件指定提示、工具和 MCP 服务器。 这样,就可以将约定、框架和所需结果直接编码为 Copilot。

          代理资料定义自定义智能体的行为。 将代理分配到任务或问题时,它会实例化自定义智能体。

          代理简介 格式

          代理概况 是带有 YAML frontmatter 的 Markdown 文件。 在最简单的形式中,它们包括:

* 名称 (可选):用于自定义智能体的显示名称。 如果省略,代理的文件名将用作其标识符和默认显示名称。 * 说明:说明代理的用途和功能。 * 提示:定义代理的行为和专业知识的自定义说明。 * 工具 (可选):代理可以访问的特定工具。 默认情况下,代理可以访问所有可用的工具,包括内置工具和 MCP 服务器工具。

          代理概况 还可以使用 `mcp-servers` 属性包含 MCP 服务器配置。

示例 代理资料

此示例是一个基本的 代理资料,配置了名称、描述和提示。

---
name: readme-creator
description: Agent specializing in creating and improving README files
---

You are a documentation specialist focused on README files. Your scope is limited to README files or other related documentation files only - do not modify or analyze code files.

Focus on the following instructions:
- Create and update README.md files with clear project descriptions
- Structure README sections logically: overview, installation, usage, contributing
- Write scannable content with proper headings and formatting
- Add appropriate badges, links, and navigation elements
- Use relative links (e.g., `docs/CONTRIBUTING.md`) instead of absolute URLs for files within the repository
- Make links descriptive and add alt text to images

可配置 自定义代理

的位置

可以在不同级别定义 代理资料 :

  •         **存储库级别**:在存储库中创建项目特定的代理`.github/agents/CUSTOM-AGENT-NAME.md`。
    
  •         **组织或企业级**:在`/agents/CUSTOM-AGENT-NAME.md`存储库中创建`.github-private`,以实现更广泛的可用性。
    

有关详细信息,请参阅 准备在组织中使用自定义代理准备在企业中使用自定义代理

Where you can use 自定义代理

注意

自定义智能体 位于适用于 JetBrains IDE、Eclipse 和 Xcode 的 公共预览版 中,并且可能会更改。

Once you create 自定义代理, they become available to:

  • Copilot cloud agent on GitHub.com: The agents tab and panel, issue assignment, and pull requests
  • Copilot cloud agent in IDEs: Visual Studio Code, JetBrains IDEs, Eclipse, and Xcode
  • GitHub Copilot CLI

You can use 代理资料 directly in Visual Studio Code, JetBrains IDEs, Eclipse, and Xcode. Some properties may function differently or be ignored between environments.

For more information on using 自定义代理 in Visual Studio Code, see 自定义智能体 in VS Code.

Next steps

To create your own 自定义代理, see: