Custom agents allow you to tailor Copilot's expertise for specific tasks. For a conceptual overview of custom agents, see 关于自定义代理.
注意
Custom agents 位于适用于 JetBrains IDE、Eclipse 和 Xcode 的 公开预览 中,并且可能会更改。
Creating a custom agent profile
- Open GitHub Copilot Chat in Visual Studio Code.
- From the agents dropdown at the bottom of the chat view, click Configure Custom Agents..., then click Create new custom agent.
- Choose the location where the agent profile should be created:
- Workspace: Create the custom agent profile in the
.github/agentsfolder of your workspace to only use it within that workspace. - User profile: Create the custom agent profile in the current user profile folder to use it across all your workspaces.
- Workspace: Create the custom agent profile in the
- Enter a file name for the custom agent. This is the default name that appears in the agents dropdown.
- Configure the agent profile in the newly created
.agent.mdfile, including the description, tools, and prompts. For more information on what the agent profile can include, see Configuring an agent profile.- You can use the Configure Tools... button within the editor to open the "Configure Tools" dialog, where you can view and select available tools, including built-in tools and tools from MCP servers. Click OK to add selected tools to the agent profile.
- To set which AI model the agent uses, add a
model:property and select your preferred model from the autocomplete dropdown.
To update an agent profile, select Configure Custom Agents from the agents dropdown, and then click on an agent from the list to modify it. For more information on custom agents in VS Code, see Custom agents in VS Code.
Creating a custom agent profile
- Open the GitHub Copilot Chat window in your JetBrains IDE.
- From the agents dropdown at the bottom of the chat view, click Configure Agents..., then in the settings window, under "Chat Agents", click Workspace.
- Enter a file name for the custom agent. This is the default name that appears in the agents dropdown.
- Configure the agent profile in the newly created
.agent.mdfile in the.github/agentsdirectory, including the description, tools, and prompts. For more information on what the agent profile can include, see Configuring an agent profile.- You can use the Configure Tools... button within the editor to open the tools dialog, where you can view and select available tools, including built-in tools and tools from MCP servers. Click Apply to add selected tools to the agent profile.
- To set which AI model the agent uses, add a
model:property and select your preferred model from the autocomplete dropdown.
To update an agent profile, select Configure Custom Agents from the agents dropdown, and then click next to the agent you want to modify.
Creating a custom agent profile
- Open the GitHub Copilot Chat window in Eclipse.
- From the agents dropdown at the bottom of the chat view, click Configure Agents..., then click Add....
- Enter a file name for the custom agent. This is the default name that appears in the agents dropdown.
- Configure the agent profile in the newly created
.agent.mdfile in the.github/agentsdirectory, including the description, tools, and prompts. For more information on what the agent profile can include, see Configuring an agent profile.- You can use the Configure Tools... button within the editor to open the "Configure Tools" dialog, where you can view and select available tools, including built-in tools and tools from MCP servers. Click Apply to add selected tools to the agent profile.
- To set which AI model the agent uses, add a
model:property and select your preferred model from the autocomplete dropdown.
To update an agent profile, select Configure Agents... from the agents dropdown, and then select the agent you want to modify and click Edit.
Creating a custom agent profile
- Open the GitHub Copilot Chat window in Xcode.
- From the agents dropdown at the bottom of the chat view, click Create an agent.
- Enter a file name for the custom agent. This is the default name that appears in the agents dropdown.
- Configure the agent profile in the newly created
.agent.mdfile in the.github/agentsdirectory, including the description, tools, and prompts. For more information on what the agent profile can include, see Configuring an agent profile.- You can use the Customize Agent button within the file editor to open a dialog, where you can select the AI model for the agent to use, select available tools (including built-in and MCP server tools), and configure the
handoffsproperty for transitioning between custom agents. Click Apply to add selected options to the agent profile.
- You can use the Customize Agent button within the file editor to open a dialog, where you can select the AI model for the agent to use, select available tools (including built-in and MCP server tools), and configure the
To update an agent profile, from the agents dropdown, click the pencil icon next to the agent you want to modify.
Configuring an agent profile
agent profile是一个带有 YAML frontmatter 的 Markdown 文件,custom agent用于指定名称、说明、可用工具和 MCP 服务器配置。 配置涉及 agent profile 定义代理的标识、功能、工具访问和行为说明。
有关 YAML 属性、工具、MCP 服务器设置、工具别名以及如何 custom agents 处理的详细配置信息,请参阅 自定义代理配置。
若要配置agent profile:
- 可选择为你的
name编写一个 custom agent。 如果未设置,则名称将默认为文件名(不含.md或.agent.md后缀)。 - 编写简短
description的(必需)描述代理的作用以及其特定功能或领域专业知识。 - 在属性中
tools,定义代理可以使用哪些工具。 这是一个工具名称或别名的列表,包括在存储库设置或agent profile中配置的MCP服务器工具(例如,tools: ["read", "edit", "search", "some-mcp-server/tool-1"])。 如果省略此属性,代理将有权访问所有可用的工具。 请参阅 自定义代理配置 中的“工具”。 - (可选)在属性中
mcp-servers,可以配置仅可用于此代理的 MCP 服务器以扩展其功能。 请参阅 自定义代理配置 中的“MCP 服务器配置详细信息”。 - 如果要创建和使用 agent profile In VS Code、JetBrains IDE、Eclipse 或 Xcode,还可以使用该
model属性来控制代理应使用的 AI 模型。 - (可选)将
target属性设置为vscode或github-copilot,以便仅在特定环境中使用该代理。 如果省略属性,则代理将在两个环境中都可用。 - 编写代理的指令。 在 YAML frontmatter 下方的 Markdown 内容中定义代理的行为、专业知识和说明。 提示最多可以包含 30,000 个字符。
Example agent profiles
以下示例演示 agent profile 在进行编写测试或规划项目实施这些常见任务时可能呈现的样子。 有关其他灵感,请参阅自定义库中 的 Custom agents 示例。 还可以在 awesome-copilot 社区集合中找到更具体的示例。
测试专家
此示例通过省略 tools 属性来启用所有工具。
--- name: test-specialist description: Focuses on test coverage, quality, and testing best practices without modifying production code --- You are a testing specialist focused on improving code quality through comprehensive testing. Your responsibilities: - Analyze existing tests and identify coverage gaps - Write unit tests, integration tests, and end-to-end tests following best practices - Review test quality and suggest improvements for maintainability - Ensure tests are isolated, deterministic, and well-documented - Focus only on test files and avoid modifying production code unless specifically requested Always include clear test descriptions and use appropriate testing patterns for the language and framework.
---
name: test-specialist
description: Focuses on test coverage, quality, and testing best practices without modifying production code
---
You are a testing specialist focused on improving code quality through comprehensive testing. Your responsibilities:
- Analyze existing tests and identify coverage gaps
- Write unit tests, integration tests, and end-to-end tests following best practices
- Review test quality and suggest improvements for maintainability
- Ensure tests are isolated, deterministic, and well-documented
- Focus only on test files and avoid modifying production code unless specifically requested
Always include clear test descriptions and use appropriate testing patterns for the language and framework.
实现规划器
此示例仅启用一部分工具。
--- name: implementation-planner description: Creates detailed implementation plans and technical specifications in markdown format tools: ["read", "search", "edit"] --- You are a technical planning specialist focused on creating comprehensive implementation plans. Your responsibilities: - Analyze requirements and break them down into actionable tasks - Create detailed technical specifications and architecture documentation - Generate implementation plans with clear steps, dependencies, and timelines - Document API designs, data models, and system interactions - Create markdown files with structured plans that development teams can follow Always structure your plans with clear headings, task breakdowns, and acceptance criteria. Include considerations for testing, deployment, and potential risks. Focus on creating thorough documentation rather than implementing code.
---
name: implementation-planner
description: Creates detailed implementation plans and technical specifications in markdown format
tools: ["read", "search", "edit"]
---
You are a technical planning specialist focused on creating comprehensive implementation plans. Your responsibilities:
- Analyze requirements and break them down into actionable tasks
- Create detailed technical specifications and architecture documentation
- Generate implementation plans with clear steps, dependencies, and timelines
- Document API designs, data models, and system interactions
- Create markdown files with structured plans that development teams can follow
Always structure your plans with clear headings, task breakdowns, and acceptance criteria. Include considerations for testing, deployment, and potential risks. Focus on creating thorough documentation rather than implementing code.
Using custom agents
创建一个 custom agent 后,可以在 Copilot cloud agent 可用的位置使用它。
- 当在 Copilot cloud agent 上提示 GitHub.com 任务时,使用智能体面板或智能体选项卡中的下拉菜单选择你的 custom agent,而不是默认的 cloud agent。
- 在为问题分配 Copilot cloud agent 时,您可以从下拉菜单中选择您的 custom agent 以使用您的专用配置处理该问题。
- 使用 GitHub Copilot CLI 时,可以通过使用 custom agent 斜杠命令或在提示中引用智能体或通过命令行参数来选择使用特定的
/agent。 有关详细信息,请参阅“使用 GitHub Copilot CLI”。
当Copilot打开拉取请求时,它将在拉取请求描述中注明使用了哪一个custom agent来完成该工作。
有关使用 Copilot cloud agent 的详细信息,请参阅“启动GitHub Copilot会话”。
Using custom agents in your IDE
You can also use your custom agent profiles directly in supported IDEs. You can switch between custom agents using the agent dropdown in the Chat window, allowing you to access specialized configurations for different tasks like planning, code editing, or research.
Some properties may function differently between the GitHub.com and IDE environments. For more information on supported properties, see 自定义代理配置.
For more information on custom agents in VS Code specifically, see Custom agents in VS Code in the VS Code documentation.
Next steps
- 请参阅custom agent,了解创建您的第一个的动手教程。
- 有关详细的配置信息,请参阅 自定义代理配置。
- 有关使用云代理(包括你 custom agents)启动 Copilot 会话的信息,请参阅 启动GitHub Copilot会话。