Skip to content

Commit 93e43b7

Browse files
Merge pull request #10839 from MicrosoftDocs/main638857800263059619sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents d815578 + 5bf7aef commit 93e43b7

23 files changed

+96
-87
lines changed

docs/ide/copilot-agent-mode.md

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: 'Use agent mode (Preview)'
2+
title: 'Use agent mode'
33
description: Use GitHub Copilot Agent to iterate on code in Visual Studio by making code edits, running commands, and reading error/build context.
4-
ms.date: 5/13/2025
4+
ms.date: 6/17/2025
55
ms.topic: get-started
66
author: anandmeg
77
ms.author: meghaanand
@@ -10,62 +10,49 @@ ms.subservice: ai-tools
1010
ms.collection: ce-skilling-ai-copilot
1111
monikerRange: '>= vs-2022'
1212
---
13-
# Use Copilot agent mode in Visual Studio (Preview)
13+
# Use Copilot agent mode
1414

15-
With GitHub Copilot's agent mode in Visual Studio, you can use natural language to specify a high-level task. AI will then autonomously reason through the request, plan the work needed, and apply the changes to your codebase. Agent mode combines code editing and tool invocation to accomplish the task you specified. As it processes your request, it monitors the outcome of edits and tools, and iterates to resolve any issues that arise.
15+
With GitHub Copilot's agent mode in Visual Studio, you can use natural language to specify a high-level task. AI will create a plan, make code edits, run terminal commands, invoke tools, and apply changes across your codebase. It monitors outcomes, such as build results, unit test failures, or tool outputs, and iterates as needed.
1616

17-
The key difference from Copilot Chat is that agent mode can:
18-
19-
* Run commands and builds to interpret the environment or execute a task (for example, database migrations, dotnet restore, etc.).
20-
* Iterate on errors, failed builds, or unit test results until it either requires additional input or considers the task complete.
17+
Unlike *ask mode*, *agent mode* doesn't stop after a single response. It continues executing and refining steps until the goal in your prompt is reached or additional input is required.
2118

2219
## Prerequisites
2320

24-
+ [Visual Studio 2022 version 17.14](/visualstudio/releases/2022/release-history) or later.
25-
+ [Sign in to Visual Studio using a GitHub account](work-with-github-accounts.md) with [Copilot access](https://docs.github.com/en/copilot/about-github-copilot/what-is-github-copilot#getting-access-to-copilot). <br/>
26-
+ You can use [GitHub Copilot for Free](copilot-free-plan.md). Sign up and leverage AI to code faster and more efficiently.
27-
28-
## Get started with agent mode
29-
30-
To get started with Copilot agent mode in Visual Studio, enable the feature in **Tools** > **Options** > **GitHub** > **Copilot** > **Copilot Chat** > **Enable agent mode in the chat pane**.
21+
[Visual Studio 2022 version 17.14](/visualstudio/releases/2022/release-history) or later.
3122

3223
## Use agent mode
3324

3425
In agent mode, Copilot operates autonomously and determines the relevant context for your prompt.
3526

3627
Follow these steps to get started:
3728

38-
1. Ensure agent mode is enabled by selecting **Enable agent mode in the chat pane** in **Tools** > **Options** > **GitHub** > **Copilot** > **Copilot Chat**.
39-
40-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-setting-updated.png" alt-text="Screenshot that shows the enable agent mode setting in Options." lightbox="media/vs-2022/copilot-agent/copilot-agent-setting-updated.png":::
41-
42-
2. Open the Copilot Chat window, select **Ask** to expand the mode dropdown, and then select **Agent**.
29+
1. Open the Copilot Chat window, select **Ask** to expand the mode dropdown, and then select **Agent**.
4330

44-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-dropdown.png" alt-text="Screenshot that shows Copilot agent mode selector." lightbox="media/vs-2022/copilot-agent/copilot-agent-dropdown.png":::
31+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-dropdown.png" alt-text="Screenshot that shows Copilot agent mode selector." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-dropdown.png":::
4532

46-
3. Enter your prompt for making edits in the chat input field and select **Send** or press **Enter** to submit it. You can specify a high-level requirement, and you don't have to specify which files to work on. In agent mode, Copilot determines the relevant context and the files to edit autonomously.
33+
1. Enter your prompt, and then select **Send** or press **Enter** to submit it. You can specify a high-level requirement, and you don't have to specify which files to work on.
4734

48-
4. Agent mode might invoke multiple tools to accomplish different tasks. Optionally, select the **Tools** icon to configure which additional tools can be used for responding to your request.
35+
1. Agent mode might invoke multiple tools to accomplish different tasks. Optionally, select the **Tools** icon to configure which additional tools can be used for responding to your request.
4936

50-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-tools.png" alt-text="Screenshot that shows additional tools used by agent mode." lightbox="media/vs-2022/copilot-agent/copilot-agent-tools.png":::
37+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-tools-list.png" alt-text="Screenshot that shows additional tools used by agent mode." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-tools-list.png":::
5138

52-
5. Confirm tool invocations and terminal commands. Before running a terminal command or a non-builtin tool, Copilot requests confirmation to continue. This is because tools might run locally on your machine and perform actions that modify files or data.
39+
1. Copilot requests confirmation before running a terminal command or using a non-builtin tool.
5340

54-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-command-approval.png" alt-text="Screenshot that shows agent command approval." lightbox="media/vs-2022/copilot-agent/copilot-agent-command-approval.png":::
41+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-command-approval.png" alt-text="Screenshot that shows agent command approval." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-command-approval.png":::
5542

56-
6. Copilot detects issues and problems in code edits and terminal commands, and then iterates and performs additional actions to resolve them. For example, agent mode might run unit tests as a result of a code edit. If the tests fail, it uses the test outcome to resolve the issue. Copilot agent mode iterates multiple times to resolve issues and problems.
43+
1. Copilot automatically detects issues in code edits or terminal commands, and then takes additional actions to resolve them. The process repeats until the issue is resolved.
5744

58-
7. As Copilot processes your request, notice that Copilot streams the suggested code edits directly in the editor. Review the suggested edits and either keep or discard the suggested edits as a whole in **Total Changes** in the chat window, or individually by clicking on a file and reviewing the code diffs presented in the editor.
45+
1. As Copilot processes your request, it streams the suggested code edits directly in the editor. Review the suggested edits and either keep or discard the suggested edits as a whole in **Total Changes** in the chat window, or review individual file diffs and apply them selectively.
5946

60-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-keep-undo.png" alt-text="Screenshot that shows the list of suggested edits." lightbox="media/vs-2022/copilot-agent/copilot-agent-keep-undo.png":::
47+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png" alt-text="Screenshot that shows the list of suggested edits." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png":::
6148

62-
8. If you want to review individual code changes made by the agent, you can either review the specific change made at each step, or review the cumulative changes from the last time changes were kept or undone.
49+
1. If you want to review individual code changes made by the agent, you can either review the specific change made at each step, or review the cumulative changes from the last time changes were kept or undone.
6350

64-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-stepwise-edits.png" alt-text="Screenshot that shows accessing individual edit diffs with Copilot agent." lightbox="media/vs-2022/copilot-agent/copilot-agent-stepwise-edits.png":::
51+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-stepwise-edits.png" alt-text="Screenshot that shows accessing individual edit diffs with Copilot agent." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-stepwise-edits.png":::
6552

66-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-cumulative-edits.png" alt-text="Screenshot that shows accessing cumulative edit diffs with Copilot agent." lightbox="media/vs-2022/copilot-agent/copilot-agent-cumulative-edits.png":::
53+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-cumulative-edits.png" alt-text="Screenshot that shows accessing cumulative edit diffs with Copilot agent." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-cumulative-edits.png":::
6754

68-
9. Continue to iterate on the code changes to refine the edits or implement additional features.
55+
1. Continue to iterate on the code changes to refine the edits or implement additional features.
6956

7057
## Agent mode tools
7158

@@ -76,7 +63,7 @@ Agent mode can use the following tools:
7663

7764
You can view and manage the tools that can be used for responding to a request. Select the **Tools** icon in the chat window to view and manage the tools that are available in agent mode.
7865

79-
:::image type="content" source="media/vs-2022/copilot-agent-mcp/copilot-agent-partial-tools.png" alt-text="Screenshot that shows Copilot agent tool selector." lightbox="media/vs-2022/copilot-agent-mcp/copilot-agent-partial-tools.png":::
66+
:::image type="content" source="media/vs-2022/mcp-servers/copilot-agent-partial-tools.png" alt-text="Screenshot that shows Copilot agent tool selector." lightbox="media/vs-2022/mcp-servers/copilot-agent-partial-tools.png":::
8067

8168
Based on the outcome of a tool, Copilot might invoke other tools to accomplish the overall request. For example, if a code edit results in syntax errors in the file, Copilot might explore another approach and suggest different code changes.
8269

@@ -86,31 +73,31 @@ Additional tools added by running MCP servers are not automatically enabled, the
8673

8774
When a tool is invoked, Copilot requests confirmation to run the tool. This is because tools might run locally on your machine and perform actions that modify files or data.
8875

89-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-command-approval.png" alt-text="Screenshot that shows tool confirmation request." lightbox="media/vs-2022/copilot-agent/copilot-agent-command-approval.png":::
76+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-command-approval.png" alt-text="Screenshot that shows tool confirmation request." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-command-approval.png":::
9077

9178
In the chat window, after a tool invocation, use the **Allow** dropdown options to automatically confirm the specific tool for the current session, solution, or all future invocations.
9279

9380
You can reset tool confirmation selections in **Tools** > **Options** > **GitHub** > **Copilot** > **Tools**.
9481

95-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-tool-config.png" alt-text="Screenshot that shows tool confirmation options." lightbox="media/vs-2022/copilot-agent/copilot-agent-tool-config.png":::
82+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-tool-config.png" alt-text="Screenshot that shows tool confirmation options." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-tool-config.png":::
9683

9784
<!-- TODO: Define what "Reset solution setting does -->
9885

9986
## Accept or discard edits
10087

10188
Copilot lists the files that were edited in the list of **Total Changes** in the Chat window.
10289

103-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-keep-undo.png" alt-text="Screenshot that shows the Total Changes list." lightbox="media/vs-2022/copilot-agent/copilot-agent-keep-undo.png":::
90+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png" alt-text="Screenshot that shows the Total Changes list." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png":::
10491

10592
Click on each file to review changes individually, where you can **Keep** or **Undo** edits made to each chunk of code.
10693

10794
Alternatively, in the **Total Changes** list, select **Keep** or **Undo** for all edits made since the last time you clicked **Keep** or **Undo**.
10895

10996
## Revert edits
11097

111-
As you're sending requests to make edits to your code, you might want to roll back some of these changes, for example, when you want to use another implementation strategy or if Copilot starts walking down the wrong path when generating edits. To do so, select **Restore** next to the checkpoint prior to the prompt that included changes you didn't want.
98+
As you request code edits, you may want to undo some changes. To revert, select **Restore** next to the checkpoint prior to the prompt that included changes you didn't want.
11299

113-
:::image type="content" source="media/vs-2022/copilot-agent/copilot-agent-checkpoint.png" alt-text="Screenshot that shows reverting edits." lightbox="media/vs-2022/copilot-agent/copilot-agent-checkpoint.png":::
100+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-checkpoint.png" alt-text="Screenshot that shows reverting edits." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-checkpoint.png":::
114101

115102
Currently, Visual Studio Copilot Agent doesn't support stepwise undo/redo.
116103

docs/ide/copilot-chat-context.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'Tips & Tricks for GitHub Copilot Chat in Visual Studio'
33
description: Use slash commands, references, and threads to form better questions and get better answers with scoped context in GitHub Copilot Chat.
4-
ms.date: 2/26/2025
4+
ms.date: 6/16/2025
55
ms.topic: how-to
66
author: anandmeg
77
ms.author: meghaanand
@@ -15,12 +15,12 @@ monikerRange: '>= vs-2022'
1515
---
1616
# Get better answers by setting the context for GitHub Copilot Chat in Visual Studio
1717

18-
You can use [**GitHub Copilot Chat**](visual-studio-github-copilot-chat.md) in Visual Studio to get coding information and support, such as syntax, programming concepts, context-specific code help, test cases, debugging, and more, without leaving the IDE. Copilot Chat is integrated into Visual Studio, which means it can understand what you're working on by gathering useful clues from what you have in the IDE.
18+
You can ask [**GitHub Copilot Chat**](visual-studio-github-copilot-chat.md) to give you code suggestions, explain code, generate unit tests, and suggest code fixes. In addition to your prompt, Copilot uses additional context, like the code in your current file and the chat history, to generate a response.
1919

20-
In addition to your prompt, Copilot uses additional context, like the code in your current file and the chat history, to generate a response. In this article, you learn how to get better answers by providing more information to Copilot Chat including:
20+
In this article, you learn how to get better answers by providing more information to Copilot Chat:
2121
+ Use [slash commands](#slash-commands) to quickly specify common tasks like `/explain` to get code explanations.
22-
+ Use the [guided chat experience](#prompting-guidance) and [custom instructions](#enable-custom-instructions) to refine context in Visual Studio 17.12 or later.
23-
+ [Attach images](#attach-images) to your prompt to provide additional context and better illustrate your ideas in Visual Studio 17.14 Preview 1 or later.
22+
+ Use the [guided chat experience](#prompting-guidance) and [custom instructions](#enable-custom-instructions) to refine context.
23+
+ [Attach images](#attach-images) to your prompt to provide additional context and better illustrate your ideas.
2424
+ Scope the chat to specific files using [references](#reference).
2525
+ Review the [source used](#find-context) by Copilot to generate the answer.
2626
+ Use different [threads](#threads) for each of your Copilot chats so you can maintain different contexts in each.
@@ -30,11 +30,9 @@ Learn more about [AI-assisted development in Visual Studio](../ide/ai-assisted-d
3030
## Prerequisites
3131

3232
To get started using GitHub Copilot Chat in Visual Studio, you need:
33-
+ Visual Studio 2022 [version 17.8](/visualstudio/releases/2022/release-history) or later
33+
+ Visual Studio 2022 [version 17.10](/visualstudio/releases/2022/release-history) or later
3434
+ [Sign in to Visual Studio using a GitHub account](work-with-github-accounts.md) with [Copilot access](https://docs.github.com/en/copilot/about-github-copilot/what-is-github-copilot#getting-access-to-copilot) <br/>
35-
<sup>**</sup> You can use [GitHub Copilot for Free](copilot-free-plan.md). Sign up and leverage AI to code faster and more efficiently.
36-
+ [GitHub Copilot](visual-studio-github-copilot-install-and-states.md) in Visual Studio
37-
+ [GitHub Copilot Chat](visual-studio-github-copilot-chat.md#get-github-copilot-chat-for-visual-studio) in Visual Studio
35+
<sup>**</sup> You can use [GitHub Copilot for Free](copilot-free-plan.md).
3836

3937
Support for GitHub Copilot Chat will be provided by GitHub and can be reached at https://support.github.com.
4038

@@ -54,6 +52,20 @@ To configure custom instructions:
5452

5553
Custom instructions are not visible in the Chat view or inline chat. However, when used by Copilot, the`.github/copilot-instructions.md` file is listed in the References list of a response.
5654

55+
## Use prompt files
56+
57+
You can now create reusable prompt files in your repository to run or share your frequently used prompts.
58+
59+
To create a prompt file:
60+
1. Write your prompts as you normally would in the prompt box, using `#` references to include specific information from your solution, such as methods, classes, and files. You can even reference other prompt files for shared instructions.
61+
1. Copy the prompt into a markdown file, and save it with the `.prompt.md` extension in the `.github/prompts` folder at the root of your repository.
62+
63+
To use a prompt file:
64+
1. Type `#prompt:` in chat input to reference any prompt files from your `.github/prompts` folder, or click the ➕ icon in the chat input to add it as context.
65+
1. Add any extra details, or simply enter the prompt as is.
66+
67+
:::image type="content" source="media/vs-2022/copilot-chat-context/prompt-files.png" alt-text="Screenshot of using prompt files in GitHub Copilot Chat.":::
68+
5769
## <a name="slash-commands"></a>Use slash commands in Copilot Chat for common tasks
5870

5971
Slash commands in Copilot Chat help you set the intent quickly for common development tasks. By using specific slash commands to form your question, you can get better answers without having to write out long questions.
@@ -112,6 +124,19 @@ With Visual Studio 2022 version 17.11, [GitHub Copilot Enterprise](https://docs.
112124

113125
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-context-at-github.png" alt-text="Screenshot of using GitHub skills in Copilot Chat.":::
114126

127+
### Reference output window
128+
129+
You can now use the output window as context in chat to ask questions and get help with output logs. Supported output windows include Build, Debug, Tests, Source Control, Package Manager, or any other active output window pane.
130+
131+
Reference output logs in chat in one of the following ways:
132+
133+
- Use *#output* to reference it directly in chat.
134+
- Select the ➕ icon in the chat input and add `Output logs` as context.
135+
- Ask Copilot directly, for example, *Check my output logs and help me fix this error*.
136+
- Right-click in the **Output Window** and select **Explain with Copilot** to attach it.
137+
138+
:::image type="content" source="media/vs-2022/copilot-chat-context/copilot-chat-context-output-window.png" alt-text="Screenshot of output window as context in Copilot Chat.":::
139+
115140
### Usage examples
116141
Here are some examples of using references for context control:
117142

0 commit comments

Comments
 (0)