You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/copilot-agent-mode.md
+26-39Lines changed: 26 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: 'Use agent mode (Preview)'
2
+
title: 'Use agent mode'
3
3
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
5
5
ms.topic: get-started
6
6
author: anandmeg
7
7
ms.author: meghaanand
@@ -10,62 +10,49 @@ ms.subservice: ai-tools
10
10
ms.collection: ce-skilling-ai-copilot
11
11
monikerRange: '>= vs-2022'
12
12
---
13
-
# Use Copilot agent mode in Visual Studio (Preview)
13
+
# Use Copilot agent mode
14
14
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.
16
16
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.
21
18
22
19
## Prerequisites
23
20
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.
31
22
32
23
## Use agent mode
33
24
34
25
In agent mode, Copilot operates autonomously and determines the relevant context for your prompt.
35
26
36
27
Follow these steps to get started:
37
28
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**.
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.
47
34
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.
49
36
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":::
51
38
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.
53
40
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":::
55
42
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.
57
44
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.
59
46
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":::
61
48
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.
63
50
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":::
65
52
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":::
67
54
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.
69
56
70
57
## Agent mode tools
71
58
@@ -76,7 +63,7 @@ Agent mode can use the following tools:
76
63
77
64
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.
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.
82
69
@@ -86,31 +73,31 @@ Additional tools added by running MCP servers are not automatically enabled, the
86
73
87
74
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.
88
75
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":::
90
77
91
78
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.
92
79
93
80
You can reset tool confirmation selections in **Tools** > **Options** > **GitHub** > **Copilot** > **Tools**.
94
81
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":::
96
83
97
84
<!-- TODO: Define what "Reset solution setting does -->
98
85
99
86
## Accept or discard edits
100
87
101
88
Copilot lists the files that were edited in the list of **Total Changes** in the Chat window.
102
89
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":::
104
91
105
92
Click on each file to review changes individually, where you can **Keep** or **Undo** edits made to each chunk of code.
106
93
107
94
Alternatively, in the **Total Changes** list, select **Keep** or **Undo** for all edits made since the last time you clicked **Keep** or **Undo**.
108
95
109
96
## Revert edits
110
97
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.
112
99
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":::
114
101
115
102
Currently, Visual Studio Copilot Agent doesn't support stepwise undo/redo.
0 commit comments