Skip to main content

关于自定义代理

自定义智能体 可增强 Copilot,并提供根据你的需求量身定制的帮助。

关于 自定义代理

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

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

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

代理简介 格式

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

  •         **名称**:自定义智能体的唯一标识符。
    
  •         **说明**:说明代理的用途和功能。
    
  •         **提示**:定义代理的行为和专业知识的自定义说明。
    
  •         **Tools**(可选):代理可以access的特定工具。 默认情况下,代理可以access所有可用的工具,包括内置工具和 MCP 服务器工具。
    

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

示例 数据变量.copilot.agent_profile %}

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

---
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`,以便更广泛地使用。
    

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

你可以在其中使用 自定义代理

注意

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

创建 自定义代理 后,它们可用于:

  •         **GitHub.com 上的 Copilot编程助理**:智能体选项卡和面板、问题分配和拉取请求
    
  •         **IDE 中的 Copilot编程助理**:Visual Studio Code、JetBrains IDE、Eclipse 和 Xcode
    
  •         **GitHub Copilot 命令行界面 (CLI)**
    

可以直接在 Visual Studio Code、JetBrains IDE、Eclipse 和 Xcode 中使用 代理资料。 某些属性可能以不同的方式运行,或在环境之间被忽略。

有关在 Visual Studio Code 中使用 自定义代理 的详细信息,请参阅 VS Code 中的 自定义智能体

后续步骤

若要创建您自己的 数据变量.copilot.custom_agents_short %},请查看:

  •         [AUTOTITLE](/copilot/how-tos/use-copilot-agents/coding-agent/create-custom-agents)
    
  •         [AUTOTITLE](/copilot/how-tos/copilot-cli/customize-copilot/create-custom-agents-for-cli)
    
  •         [AUTOTITLE](/copilot/reference/customization-cheat-sheet)