About Copilot 扩展
Copilot 扩展 are integrations that expand the functionality of Copilot Chat, allowing developers to bring external tools, services, and custom behaviors into the Chat experience. You can use Copilot 扩展 to extend the capabilities of Copilot Chat in a variety of ways, including:
- Querying documentation: A Copilot 扩展 can allow Copilot Chat to query a third-party documentation service to find information about a specific topic.
- AI-assisted coding: A Copilot 扩展 can use a third-party AI model to provide code suggestions.
- Data retrieval: A Copilot 扩展 can allow Copilot Chat to query a third-party data service to retrieve information about a specific topic.
- Action execution: A Copilot 扩展 can allow Copilot Chat to execute a specific action, such as posting to a message board or updating a tracking item in an external system.
GitHub Copilot 扩展 are built with GitHub Apps. They are best suited for developers who want cross-platform compatibility and app management and support from GitHub.
Supported clients and IDEs
客户端和 IDE | GitHub Copilot 扩展 支持 |
---|---|
Visual Studio Code | |
Visual Studio | |
GitHub.com | |
GitHub Mobile | |
JetBrains IDE | |
GitHub Codespaces | |
Vim/Neovim | |
Copilot(CLI 版) | |
Xcode |
Visibility of GitHub Copilot 扩展
GitHub Copilot 扩展 can be private, public and shareable, or public and listed on the GitHub Marketplace. Which visibility option you choose will depend on your use case and the audience you are targeting.
- Private extensions are often preferred by large enterprises or companies that:
- Want more customization and controls over data access
- Need to integrate with a large volume of internal documents and databases
- Have strict security policies making it difficult to authorize permissions for third-parties
- Public extensions are suitable for:
- Open-source projects
- Collaborative development and use across organizations within an enterprise
- Sharing your tool and getting feedback before publishing to the GitHub Marketplace
- GitHub Marketplace extensions are ideal for third-parties that want to:
- Offer their service to a broader audience
- Integrate their tool into the developer workflow on GitHub and the IDE
- Leverage the GitHub ecosystem to raise awareness for their product
GitHub Copilot 扩展 permissions
Permissions vary by extension, depending on the level of authorization that the extension requires in order to respond to your query. You can view the required permissions on the extension’s installation page, located after the billing information step and before the install and authorize step.
For extension users: At a minimum, the Copilot Chat permissions must be set to "Read-only". Additional permissions may include executing write actions on other surfaces and authorizing read access to repository and organization level data in GitHub.
For extension creators: In addition to the above, you may also request local context from a user’s editor to further tailor responses. To do so, the Copilot Editor Context permissions must be set to "Read-only". Users will be notified to provide the required authorization.
For more information on GitHub App permissions, see 为 GitHub Apps 选择权限.
Granting permissions to access organization resources
Users with an individual Copilot subscription can install and use Copilot 扩展. Users with a Copilot Business or Copilot Enterprise subscription need an organization administrator to enable this feature.
Only organization administrators can grant permissions for Copilot 扩展 to access organization resources.
To grant organization members access, the organization administrator must:
- Install the extension
- Grant the extension permission to access specific repositories
- Authorize access for all, or specific repositories
Controlling access at the enterprise level
If you are an enterprise administrator, you can disable Copilot 扩展 across your enterprise by setting the Copilot 扩展 policy to "Disabled". The "No Policy" setting allows organization administrators to set their own policy.
No, there is no allowlist or blocklist at the enterprise level.
Sharing data with Copilot 扩展
The following data is shared when you interact with Copilot 扩展:
- Data attached to your account and Copilot Chat usage, such as GitHub user ID, and timestamps of messages.
- Past messages within the chat thread where you are invoking an extension. Only one extension can be used per thread, preventing data sharing across extensions. The data retention period for thread context is 30 days.
- Any additional organization and repository data that is authorized for the extension by your organization administrator. Administrators installing extensions must approve access to the required permissions prior to completing installation.
- For GitHub 中的 Copilot Chat, if your administrator has approved the extension to access repository or organization metadata, that data will be shared as well.
About skillsets and agents
技能集和代理是通过 Copilot 扩展性平台 扩展 Copilot 的功能和上下文的两种方式。 它们支持将外部服务和 API 集成到 Copilot Chat 中,但每一种都适用于不同的用例,并提供不同程度的控制和复杂度:
- 技能集轻巧且精简,是为那些需要使用 Copilot 执行特定任务(例如,数据检索或简单操作)且希望以最少的设置来完成的开发人员而设计的。**** 它们会自动处理路由、提示构建、函数评估以及响应生成,这使得它们非常适合进行快速且直接的集成。 For more information about skillsets, see About skillsets for Copilot Extensions.
- 代理适用于那些需要完全控制请求处理方式以及响应生成方式的复杂集成****。 它们支持实现自定义逻辑,与其他 LLM 和/或 Copilot API 集成,管理对话上下文,并处理用户交互的各个方面。 虽然代理需要更多的工程和维护工作,但它们为复杂的工作流提供了最大的灵活性。 有关代理的详细信息,请参阅“About agents for Copilot Extensions”。
About context passing
You can allow your Copilot 扩展 to receive context from the editor, such as the currently opened file, by enabling the Read-only access level for the "Copilot Editor Context" permission in your GitHub App settings. See step 10 of Configuring your GitHub App.
The GitHub Copilot 扩展性平台 automatically handles messaging when implicit and explicit context is unavailable or unauthorized. To enable context passing, you are required to request permissions from users. To enable context passing, you are required to:
- Update your APIs to handle new reference types.
- Request permissions from users. When requesting permissions, follow these best practices:
- Clearly communicate what context you need and what you need it for.
- Implement appropriate error handling for unavailable context that your own application logic and API calls.
- If context is unavailable, provide value where possible without this data.
- Request only the minimum required permissions for your extension.
Context passing respects content exclusions, which refers to any files listed in your context exclusion settings, including files that begin with .
.
For more information about context passing, see Context passing for your agent.
Using APIs in GitHub Copilot 扩展
Building GitHub Copilot 扩展 requires using the GitHub API. Optionally, the Copilot API can be used for additional capabilities. For details on request and response formatting, see the OpenAI API documentation.
注意
The Copilot API is available for Copilot 扩展 builders, but only GitHub Apps and VS Code Chat extensions can be used to access these endpoints.
Resources for building GitHub Copilot 扩展
GitHub provides a comprehensive toolkit for extension builders, with code samples, a CLI debugging tool, quickstart SDKs, and a user feedback repository. For more information, see the copilot-extensions organization on GitHub.
Before creating your own GitHub Copilot 扩展 from scratch, you may want to explore an existing Copilot 代理, then integrate it with a GitHub App to see how it works. GitHub provides a few example Copilot 代理 that you can clone and use as the basis for your own GitHub Copilot 扩展:
-
Blackbeard: A simple Copilot 代理 that responds to requests like a pirate, using Copilot's LLM API and special system prompts. It is a good starting point for learning how to build a GitHub Copilot 扩展. For more information, see the Blackbeard Copilot 扩展.
-
GitHub Models: A more complex Copilot 代理 that lets you ask about and interact with various LLMs listed on the GitHub Marketplace from within Copilot Chat. For more information, see the GitHub Models Copilot 扩展.
注意
GitHub Models are in 公共预览版 and subject to change.
-
Function calling: an example agent written in Go that demonstrates function calling and confirmation dialogues. For more information, see the Function calling extension.
-
RAG extension: an example agent written in Go that demonstrates a simple implementation of retrieval augmented generation. For more information, see the RAG extension.
-
Preview SDK: An SDK that simplifies the process of building GitHub Copilot 扩展 by handling request verification, response formatting, and API interactions. It allows builders to focus on their extension's core functionality rather than boilerplate, by streamlining the integration of tools, APIs, and data sources into Copilot Chat. For more information, see the Preview SDK.
About building Copilot-enabled VS Code chat participants
注意
The GitHub documentation focuses on building GitHub Copilot 扩展, not Copilot-enabled VS Code chat participants.
You can build a Copilot 扩展 that is exclusive and native to Visual Studio Code, called a Copilot-enabled VS Code chat participant.
GitHub Copilot 扩展 and Copilot-enabled VS Code chat participants use the same backend platform to route requests to extensions. Both provide similar end-user experiences, integrate with Copilot Chat, and can leverage the Copilot API or other LLMs.
While they share similarities, below are several key differences:
- GitHub Copilot 扩展 can be used in any editor where extensions are supported, while Copilot-enabled VS Code chat participants are only available in Visual Studio Code.
- GitHub Copilot 扩展 are server-side extensions, requiring server infrastructure to build. These extensions provide a built-in connection to your GitHub workspaces, as set by your organization administrator.
- Copilot-enabled VS Code chat participants are client-side extensions that have more access to VS Code's features and APIs, allowing more editor-specific interactions like accessing local workspace data, manipulating Visual Studio Code's interface, and read/write access to local files. They do not require server infrastructure.
- Because Copilot-enabled VS Code chat participants are local to the user's machine, they cannot be controlled by the Copilot policies of an organization or enterprise on GitHub.com.
- Copilot-enabled VS Code chat participants are published to the VS Code Marketplace, not the GitHub Marketplace.
Copilot-enabled VS Code chat participants are best suited for developers who want to build extensions that use VS Code-specific APIs and functionality, or extend existing VS Code extensions.
For more information on Copilot-enabled VS Code chat participants, see Chat extensions in the Visual Studio Code documentation.
Indemnity for Copilot 扩展
Copilot 扩展 are not covered by GitHub Copilot’s indemnity policy. However, this exclusion applies only to issues that arise within extension chat threads.
Installing and using extensions does not affect indemnity coverage for any issues that occur while using other Copilot features such as code completion and chat.