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
+70-58Lines changed: 70 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: 'Use agent mode'
3
-
description: Use GitHub Copilot Agent to iterate on code in Visual Studio by making code edits, running commands, and reading error/build context.
2
+
title: Use Agent Mode
3
+
description: Use the GitHub Copilot agent to iterate on code in Visual Studio by making code edits, running commands, and reading error/build context.
4
4
ms.date: 7/28/2025
5
5
ms.update-cycle: 180-days
6
6
ms.topic: get-started
@@ -11,15 +11,15 @@ ms.subservice: ai-tools
11
11
ms.collection: ce-skilling-ai-copilot
12
12
monikerRange: '>= vs-2022'
13
13
---
14
-
# Use Copilot agent mode
14
+
# Get started with GitHub Copilot agent mode
15
15
16
-
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, unittest failures, or tool outputs, and iterates as needed.
16
+
With the GitHub Copilot agent mode in Visual Studio, you can use natural language to specify a high-level task. AI creates a plan, makes code edits, runs terminal commands, invokes tools, and applies changes across your codebase. It monitors outcomes, such as build results, unit-test failures, or tool outputs, and iterates as needed.
17
17
18
-
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.
18
+
Unlike *ask mode*, agent mode doesn't stop after a single response. It continues running and refining steps until you reach the goal in your prompt or more input is required.
19
19
20
20
## Prerequisites
21
21
22
-
[Visual Studio 2022 version 17.14](/visualstudio/releases/2022/release-history) or later.
22
+
You need [Visual Studio 2022 version 17.14](/visualstudio/releases/2022/release-history) or later.
23
23
24
24
## Use agent mode
25
25
@@ -29,119 +29,131 @@ Follow these steps to get started:
29
29
30
30
1. Open the Copilot Chat window, select **Ask** to expand the mode dropdown, and then select **Agent**.
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-dropdown.png" alt-text="Screenshot that shows the Copilot agent mode selector." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-dropdown.png":::
33
33
34
-
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.
34
+
1. Enter your prompt, and then select **Send** or select the <kbd>Enter</kbd> key to submit it. You can specify a high-level requirement, and you don't have to specify which files to work on.
35
35
36
-
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.
36
+
1. Agent mode might invoke multiple tools to accomplish different tasks. Optionally, select the **Tools** icon to configure which additional tools the agent can use for responding to your request.
37
37
38
-
:::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":::
38
+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-tools-list.png" alt-text="Screenshot that shows additional tools that agent mode uses." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-tools-list.png":::
39
39
40
-
1. Copilot requests confirmation before running a terminal command or using a non-builtin tool.
40
+
1. Copilot requests confirmation before running a terminal command or using a tool that isn't built in.
41
41
42
42
:::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":::
43
43
44
-
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.
44
+
1. Copilot automatically detects issues in code edits or terminal commands, and then takes action. The process repeats until the issues are resolved.
45
45
46
-
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.
46
+
1. As Copilot processes your request, it streams the suggested code edits directly in the editor. Review the suggested edits and either:
47
47
48
-
:::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":::
48
+
- Keep or discard the suggested edits as a whole in **Total changes** in the chat window.
49
49
50
-
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.
50
+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png" alt-text="Screenshot that shows a list of suggested edits." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png":::
51
51
52
-
:::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":::
52
+
- Review individual file diffs and apply them selectively.
53
53
54
-
:::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":::
54
+
1. If you want to review individual code changes that the agent made, you can either:
55
55
56
-
1. Continue to iterate on the code changes to refine the edits or implement additional features.
56
+
- Review the specific change at each step.
57
57
58
-
## Agent mode tools
58
+
:::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 the Copilot agent." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-stepwise-edits.png":::
59
59
60
-
Agent mode can use the following tools:
60
+
- Review the cumulative changes from the last time that changes were kept or undone.
61
61
62
-
* Built-in tools
63
-
*[MCP tools](mcp-servers.md)
62
+
:::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 the Copilot agent." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-cumulative-edits.png":::
64
63
65
-
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.
64
+
1. Continue to iterate on the code changes to refine the edits or implement more features.
To view and manage the tools that are available in agent mode, select the **Tools** icon in the chat window.
74
+
75
+
:::image type="content" source="media/vs-2022/mcp-servers/copilot-agent-partial-tools.png" alt-text="Screenshot that shows the tool selector for the Copilot agent." lightbox="media/vs-2022/mcp-servers/copilot-agent-partial-tools.png":::
68
76
69
77
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.
70
78
71
-
Additional tools added by running MCP servers are not automatically enabled, they are unchecked by default and must be checked to be activated.
79
+
Additional tools that you add by running MCP servers are not automatically enabled. Their checkboxes are cleared by default, and you must select them to activate the tools.
72
80
73
81
## Manage tool approvals
74
82
75
-
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.
83
+
When Copilot invokes a tool, it requests confirmation to run the tool. The reason is that tools might run locally on your machine and perform actions that modify files or data.
76
84
77
-
:::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":::
85
+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-command-approval.png" alt-text="Screenshot that shows a tool confirmation request." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-command-approval.png":::
78
86
79
-
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.
87
+
In the chat window, after a tool invocation, use the **Allow** dropdown options to automatically confirm the specific tool for the current session or solution, or all future invocations.
80
88
81
89
You can reset tool confirmation selections in **Tools** > **Options** > **GitHub** > **Copilot** > **Tools**.
82
90
83
91
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-tool-config-options.png" alt-text="Screenshot that shows tool confirmation options." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-tool-config-options.png":::
84
92
85
-
<!-- TODO: Define what "Reset solution setting does -->
86
-
87
93
## Accept or discard edits
88
94
89
-
Copilot lists the files that were edited in the list of **Total Changes** in the Chat window.
95
+
Copilot lists the edited files in the **Total changes**list in the chat window.
90
96
91
-
:::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":::
97
+
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png" alt-text="Screenshot that shows a list of edited files." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-keep-undo.png":::
92
98
93
-
Click on each file to review changes individually, where you can **Keep** or **Undo** edits made to each chunk of code.
99
+
Select each file to review changes individually. You can keep or undo edits made to each chunk of code.
94
100
95
-
Alternatively, in the **Total Changes** list, select **Keep** or **Undo** for all edits made since the last time you clicked**Keep** or **Undo**.
101
+
Alternatively, in the **Total changes** list, select **Keep** or **Undo** for all edits made since the last time that you selected**Keep** or **Undo**.
96
102
97
103
## Revert edits
98
104
99
-
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.
105
+
As you request code edits, you might want to revert some changes. To revert, select **Restore** next to the checkpoint before the prompt that includes changes you don't want.
100
106
101
107
:::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":::
102
108
103
-
Currently, Visual Studio Copilot Agent doesn't support stepwise undo/redo.
109
+
Currently, the Visual Studio Copilot agent doesn't support stepwise undo or redo.
104
110
105
111
## Interrupt an agent mode request
106
112
107
-
To interrupt an ongoing request, you can cancel it.
108
-
This stops all running tools and terminal commands.
113
+
To interrupt an ongoing request, you can cancel it. Canceling a request stops all running tools and terminal commands.
109
114
110
-
To stop a build, select **Build**in the top toolbar, and then select **Cancel** or use the **Ctrl + Break** keyboard shortcut.
115
+
To stop a build, select **Build**on the top toolbar, and then select **Cancel**. Or use the <kbd>Ctrl+Break</kbd> keyboard shortcut.
111
116
112
117
## Frequently asked questions
113
118
114
-
#### What visibility does Agent mode have into my files?
115
-
Agent mode can only manipulate local files that are part of the solution, or are located in the open solution directory or its subdirectories.
119
+
### What visibility does agent mode have into my files?
120
+
121
+
Agent mode can manipulate only:
116
122
117
-
Files and directories excluded by file exclusion are not visible to agent mode.
123
+
- Local files that are part of the solution.
124
+
- Local files that are in the open solution directory or its subdirectories.
118
125
119
-
When running terminal commands, Agent mode has the same permissions as the running Visual Studio process and is not limited to the restrictions above. Carefully review proposed terminal commands before running them.
126
+
Agent mode can't access files and directories excluded through file exclusion.
120
127
121
-
#### I don't see Ask and Agent mode in the GitHub Copilot Chat window.
128
+
For terminal commands, agent mode has the same permissions as the running Visual Studio process and isn't limited to the preceding restrictions. Carefully review proposed terminal commands before you run them.
122
129
123
-
Take the following troubleshooting steps in the order specified:
124
-
- Make sure you're using Visual Studio 17.14 or later: check the version at **Help** > **About Visual Studio**. If you're not using version 17.14 or later, launch the Visual Studio Installer and update your build.
125
-
- Make sure you've selected the **Enable agent mode in the chat pane** setting in **Tools** > **Options** > **GitHub** > **Copilot Chat**.
126
-
- Try restarting Visual Studio.
130
+
### I don't see ask mode and agent mode in the Copilot Chat window
127
131
128
-
#### When should I use Ask mode vs. Agent mode?
132
+
Take the following troubleshooting steps in the specified order:
133
+
134
+
1. Make sure you're using Visual Studio 17.14 or later. Check the version at **Help** > **About Visual Studio**. If you're not using version 17.14 or later, open the Visual Studio Installer and update your build.
135
+
136
+
1. Make sure that you selected the **Enable agent mode in the chat pane** setting in **Tools** > **Options** > **GitHub** > **Copilot Chat**.
137
+
138
+
1. Try restarting Visual Studio.
139
+
140
+
### When should I use ask mode vs. agent mode?
129
141
130
142
- Ask mode is excellent when you want 100% confidence that no code edits are made unless you explicitly select **Apply** or copy and paste the code yourself.
131
-
- Agent mode can handle the same conceptual questions, generate code examples without applying them, along with its agent capabilities of editing code.
132
-
- If you are looking to use MCP capabilities, you must have agent mode selected.
143
+
- Agent mode can handle the same conceptual questions and generate code examples without applying them, along with its agent capabilities of editing code.
144
+
- If you want to use MCP capabilities, you must have agent mode selected.
145
+
146
+
### What happened to Copilot Edits in Visual Studio?
133
147
134
-
#### What happened to Copilot Edits in Visual Studio?
148
+
Agent mode is an evolution of Copilot Edits, with a greater ability to iterate on errors, use tools, and automatically apply code changes.
135
149
136
-
- We perceive agent mode to be an evolution of Edits, with greater ability to iterate on errors, use tools, and automatically apply code changes.
137
-
- For the initial releases of Visual Studio 2022 version 17.14, Edits mode is still available if you uncheck the **Enable agent mode in the chat pane** setting in **Tools** > **Options** > **GitHub** > **Copilot** > **Copilot Chat**.
150
+
For the initial release of Visual Studio 2022 version 17.14, Copilot Edits is still available if you clear the **Enable agent mode in the chat pane** setting in **Tools** > **Options** > **GitHub** > **Copilot** > **Copilot Chat**.
138
151
139
-
####As an administrator, how do I control use of agent mode for Visual Studio users?
152
+
### As an administrator, how do I control the use of agent mode for Visual Studio users?
140
153
141
-
Agent mode in Visual Studio is governed by the **Editor preview features** flag in the GitHub Copilot dashboard for administrators.
142
-
If the administrator turns off this setting, users under that subscription won’t be able to use agent mode in Visual Studio.
154
+
Agent mode in Visual Studio is governed by the **Editor preview features** flag on the GitHub Copilot dashboard for administrators. If the administrator turns off this setting, users under that subscription can't use agent mode in Visual Studio.
143
155
144
-
For more information, see [managing policies and features for copilot in your enterprise](https://docs.github.com/en/enterprise-cloud@latest/copilot/managing-copilot/managing-copilot-for-your-enterprise/managing-policies-and-features-for-copilot-in-your-enterprise#editor-preview-features).
156
+
For more information, see [Managing policies and features for GitHub Copilot in your enterprise](https://docs.github.com/en/enterprise-cloud@latest/copilot/managing-copilot/managing-copilot-for-your-enterprise/managing-policies-and-features-for-copilot-in-your-enterprise#editor-preview-features).
0 commit comments