Skip to main content

About building GitHub Copilot Extensions

Learn about developing Extensões do Copilot.

Quem pode usar esse recurso?

Qualquer pessoa com um plano do Copilot Pro, do Copilot Pro+ ou do Copilot Free pode usar o Extensões do Copilot.

Para organizações ou empresas com um plano do Copilot Business ou do Copilot Enterprise, proprietários de organização e administradores de empresa podem conceder acesso a Extensões do Copilot.

O Extensões do Copilot não está disponível para o GitHub Enterprise Server.

About building Extensões do Copilot

Extensões do 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 Extensões do Copilot to extend the capabilities of Copilot Chat in a variety of ways, including:

  • Querying documentation: A Extensão do Copilot can allow Copilot Chat to query a third-party documentation service to find information about a specific topic.
  • AI-assisted coding: A Extensão do Copilot can use a third-party AI model to provide code suggestions.
  • Data retrieval: A Extensão do Copilot can allow Copilot Chat to query a third-party data service to retrieve information about a specific topic.
  • Action execution: A Extensão do 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.

Extensões do 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.

About skillsets and agents

Conjuntos de habilidades e agentes são as duas maneiras de estender as funcionalidades e o contexto do Copilotpor meio do Plataforma de Extensibilidade do Copilot. Eles permitem que você integre serviços externos e APIs ao Copilot Chat, mas cada um deles atende a diferentes casos de uso e oferece diferentes níveis de controle e complexidade:

  • Conjuntos de habilidades são leves e simplificados, projetados para desenvolvedores que precisam do Copilot para executar tarefas específicas (por exemplo, recuperação de dados ou operações simples) com configuração mínima. Eles lidam com roteamento, criação de prompts, avaliação de função e geração de resposta automaticamente, tornando-os ideais para integrações rápidas e simples. For more information about skillsets, see Sobre conjuntos de habilidades para extensões do GitHub Copilot.
  • Agentes são para integrações complexas que precisam de controle total sobre como as solicitações são processadas e as respostas são geradas. Eles permitem que você implemente a lógica personalizada, integre-se a outras LLMs e/ou à API do Copilot, gerencie o contexto da conversa e lide com todos os aspectos da interação do usuário. Embora os Agentes exijam mais engenharia e manutenção, eles oferecem flexibilidade máxima para fluxos de trabalho sofisticados. Para saber mais sobre agentes, confira Sobre agentes para extensões do GitHub Copilot.

About context passing

You can allow your Extensão do 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 Plataforma de extensibilidade do 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 Passagem de contexto para seu agente.

Using APIs in Extensões do GitHub Copilot

Building Extensões do 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.

Observação

The Copilot API is available for Extensão do Copilot builders, but only GitHub Apps and VS Code Chat extensions can be used to access these endpoints.

Resources for building Extensões do 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 Extensão do GitHub Copilot from scratch, you may want to explore an existing Agente do Copilot, then integrate it with a GitHub App to see how it works. GitHub provides a few example Agentes do Copilot that you can clone and use as the basis for your own Extensão do GitHub Copilot:

  • Blackbeard: A simple Agente do 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 Extensão do GitHub Copilot. For more information, see the Blackbeard Extensão do Copilot.

  • GitHub Models: A more complex Agente do 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 Extensão do Copilot.

    Observação

    GitHub Models are in versão prévia pública 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 Extensões do 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 Participantes de chat do VS Code habilitados para Copilot

Observação

The GitHub documentation focuses on building Extensões do GitHub Copilot, not Participantes de chat do VS Code habilitados para Copilot.

You can build a Extensão do Copilot that is exclusive and native to Visual Studio Code, called a Participante de chat do VS Code habilitado para Copilot.

Extensões do GitHub Copilot and Participantes de chat do VS Code habilitados para Copilot 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:

  • Extensões do GitHub Copilot can be used in any editor where extensions are supported, while Participantes de chat do VS Code habilitados para Copilot are only available in Visual Studio Code.
  • Extensões do 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.
  • Participantes de chat do VS Code habilitados para Copilot 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 Participantes de chat do VS Code habilitados para Copilot are local to the user's machine, they cannot be controlled by the Copilot policies of an organization or enterprise on GitHub.com.
  • Participantes de chat do VS Code habilitados para Copilot are published to the VS Code Marketplace, not the GitHub Marketplace.

Participantes de chat do VS Code habilitados para Copilot 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 Participantes de chat do VS Code habilitados para Copilot, see Chat extensions in the Visual Studio Code documentation.

Indemnity for Extensões do Copilot

Extensões do 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.

Further reading