Introduction
Você pode usar subagents para delegar tarefas a um agente isolado com sua própria janela de contexto em sua sessão de chat. O subagent opera de forma independente, sem pausar para receber feedback do usuário, e retorna o resultado final para a sessão de bate-papo principal.
Subagents são mais adequados para situações em que:
- Você deseja delegar tarefas complexas e de várias etapas, como pesquisa ou análise, sem interromper sua sessão principal.
- Você precisa processar grandes quantidades de informações ou vários documentos que desorganizam sua janela de contexto principal.
- Você deseja explorar diferentes abordagens ou perspectivas de forma independente sem misturar contextos.
Subagents usam as mesmas ferramentas e o mesmo modelo de IA da sessão principal, mas não podem criar outros subagents.
Subagents are available in Visual Studio Code, JetBrains IDEs, Xcode, and Eclipse. They are not currently available in Visual Studio. The steps to enable and invoke them differ by editor, so click the tabs above for instructions for your IDE.
For the agent session that subagents are delegated from, see Using agent mode in your IDE.
Enabling subagents
- In the Copilot Chat window, click the tools icon.
- Enable the
runSubagenttool.
If you use custom prompt files or custom agents, ensure you specify the runSubagent tool in the tools frontmatter property. See Criando agentes personalizados para Copilot cloud agent, and Use prompt files in VS Code in the Visual Studio Code documentation.
Invoking subagents
Subagents podem ser invocados de maneiras diferentes:
-
Delegação automática. Copilot analisará a descrição da sua solicitação, o campo de descrição dos seus custom agents, o contexto atual, e as ferramentas disponíveis para escolher automaticamente um subagent. Por exemplo, esse prompt delegaria automaticamente a tarefa a um especialista em refatoração custom agent:
Suggest ways to refactor this legacy code. -
Invocação direta. Você pode chamar diretamente o subagent em seu prompt:
Use the testing subagent to write unit tests for the authentication module. -
Calling the #runSubagent tool.
Evaluate the #file:databaseSchema using #runSubagent and generate an optimized data-migration plan.
When the subagent completes its task, its results appear back in the main chat session, ready for follow-up questions or next steps.
Further reading
To use subagents, you must have custom agents configured in your environment. See Using custom agents in your IDE.
Enabling subagents
- Click Tools in the menu bar, then click GitHub Copilot, then Edit Settings.
- In the popup menu, click Chat, then click the Enable Subagent checkbox.
Invoking subagents
Subagents podem ser invocados de maneiras diferentes:
-
Delegação automática. Copilot analisará a descrição da sua solicitação, o campo de descrição dos seus custom agents, o contexto atual, e as ferramentas disponíveis para escolher automaticamente um subagent. Por exemplo, esse prompt delegaria automaticamente a tarefa a um especialista em refatoração custom agent:
Suggest ways to refactor this legacy code. -
Invocação direta. Você pode chamar diretamente o subagent em seu prompt:
Use the testing subagent to write unit tests for the authentication module.
When the subagent completes its task, its results appear back in the main chat session, ready for follow-up questions or next steps.
Further reading
To use subagents, you must have custom agents configured in your environment. See Using custom agents in your IDE.
Enabling subagents
- Click Editor in the menu bar, then click GitHub Copilot then Open GitHub Copilot for Xcode Settings.
- Click Advanced in the chat panel, then under Chat Settings click the Enable Subagents toggle.
Invoking subagents
Subagents podem ser invocados de maneiras diferentes:
-
Delegação automática. Copilot analisará a descrição da sua solicitação, o campo de descrição dos seus custom agents, o contexto atual, e as ferramentas disponíveis para escolher automaticamente um subagent. Por exemplo, esse prompt delegaria automaticamente a tarefa a um especialista em refatoração custom agent:
Suggest ways to refactor this legacy code. -
Invocação direta. Você pode chamar diretamente o subagent em seu prompt:
Use the testing subagent to write unit tests for the authentication module.
When the subagent completes its task, its results appear back in the main chat session, ready for follow-up questions or next steps.
Further reading
To use subagents, you must have custom agents configured in your environment. See Using custom agents in your IDE.
Enabling subagents
- Click the icon in the status bar.
- In the popup menu, click Edit Preferences.
- Under Chat, click the Enable sub-agent check box.
Invoking subagents
Subagents podem ser invocados de maneiras diferentes:
-
Delegação automática. Copilot analisará a descrição da sua solicitação, o campo de descrição dos seus custom agents, o contexto atual, e as ferramentas disponíveis para escolher automaticamente um subagent. Por exemplo, esse prompt delegaria automaticamente a tarefa a um especialista em refatoração custom agent:
Suggest ways to refactor this legacy code. -
Invocação direta. Você pode chamar diretamente o subagent em seu prompt:
Use the testing subagent to write unit tests for the authentication module.
When the subagent completes its task, its results appear back in the main chat session, ready for follow-up questions or next steps.