Sub topic 8
Choose between Ask, Edit, and Agent modes
This chapter assumes you have installed the Copilot extension, signed in, and opened the Chat view. You should also know how to attach context to a chat request. Copilot Chat has three modes. Each one gives Copilot a different level of control over your project, so choosing the right one saves time and avoids unwanted changes.
The working model
A mode decides two things: what Copilot can read, and what it can change. You pick the mode from a dropdown in the Chat view's input area. The mode applies to the next request you send, and you can switch at any time.
| Mode | What it does | Changes files? | Runs commands? |
|---|---|---|---|
| Ask | Answers questions and explains code. | No | No |
| Edit | Proposes changes to files you choose. | Yes, in the files you name | No |
| Agent | Plans a task, finds the files it needs, edits them, and runs tools. | Yes, in any file it decides is relevant | Yes, after you approve |
The mode names and the exact controls can change between VS Code releases. If your menu looks different, look for the same three levels of autonomy.
Ask mode
Use Ask when you want understanding, not edits. Typical requests are explaining a function, comparing two approaches, or asking how an error arises.
Explain what #file:utils.ts does and suggest one way to simplify it.Ask may show code in its answer, but it does not write that code into your files. You copy it or apply it yourself. This makes Ask the safest mode, so it is a good default when you are exploring an unfamiliar codebase.
Edit mode
Use Edit when you already know which files need to change. You add those files to the working set, describe the change, and Copilot proposes edits across them. The changes appear in the editor as a diff, and you accept or discard each one.
A good Edit request is specific:
Rename the parameter `cb` to `callback` in #file:utils.ts and update the JSDoc to match.Edit mode stays inside the files you gave it. That limit is its main benefit. You get multi-file changes without Copilot wandering through the rest of the project.
Agent mode
Use Agent when the task is larger or you do not know where the change belongs. Agent mode works in a loop. It reads files, edits them, runs tools such as terminal commands or tests, looks at the results, and corrects itself until it believes the task is done.
An example request:
Add a --verbose flag to the CLI, update the help text, and run the tests.Agent mode asks for your approval before it runs terminal commands. Read each command before you allow it. Agent can touch more files than you expected, so review the full set of changes before you keep them.
Common errors
- Asking Ask mode to "fix it" and wondering why no file changed. Ask only answers. Switch to Edit or Agent.
- Using Edit without adding the relevant files. Copilot can only change files in its working set, so the result is incomplete or missing.
- Using Agent for a one-line change. The loop of searching, planning, and running tools costs more time than a direct edit.
- Approving terminal commands without reading them. Agent mode can run anything your terminal can.
- Keeping all of Agent's edits because the tests pass. Passing tests do not prove the change matches your intent, so review the diff.
Exercise
You want to change the error message format in three files you have already identified, and you do not want Copilot to touch anything else. Which mode fits, and why?
Show answer
Edit mode. It limits changes to the files you add to the working set, and you review each proposed change as a diff. Agent could modify other files or run commands, and Ask would not change any file.
Exercise
A request in Ask mode returns a correct code snippet, but your file is unchanged. Is this a bug?
Show answer
No. Ask mode only answers and never writes to files. Copy the snippet yourself, or resend the request in Edit or Agent mode so Copilot applies it.