Agent Mode
The moment Copilot stops being autocomplete and becomes a worker — understand the loop, know when to reach for it, and learn to keep it on a leash.
Agent mode is like giving your helper a to-do list and letting it work through it on its own — try something, check if it worked, fix it, repeat — while you watch and say “yes” before anything risky happens.
What agent mode does
☺ Like you’re 10: Instead of Copilot just finishing your sentence, you give it a whole job — like “build me a LEGO castle” — and it grabs the pieces, tries them, checks if they fit, and fixes mistakes on its own until it’s done.
You give it a task in natural language and it runs an autonomous loop:
Concretely, in one session agent mode will analyze your project structure, decide which files to create or modify, make edits across multiple files at once, run terminal commands (install a dependency, run tests, start a build), read the output, and fix its own errors — looping until the task is done or it gets stuck. People describe it as “a junior developer who never takes coffee breaks”: capable, tireless, and in need of supervision. It’s generally available across VS Code, Visual Studio, JetBrains, Eclipse, and Xcode.
Foxy: I gave it a task and it changed three files at once — did it just guess and hope?
Benny the Beaver: No guessing — I read the whole workspace first, then edit each file the plan needs.
Timmy the Turtle: Then I run the tests. Uh-oh — one fails. Let’s not call it done yet.
Rocky the Raccoon: A failing test is just a clue! I read the error, patch the code, and run it again…
Timmy the Turtle: All green now. That’s the loop — act, observe, fix — until the task truly passes.
A typical session
☺ Like you’re 10: It’s like a board game where Copilot takes its turns by itself, but has to stop and ask “can I roll?” at two special squares — so you get to peek and say yes before it does anything big.
Here’s a scoped task running in agent mode with the leash on — watch where it stops for you:
YOU "Add a DELETE /todos/:id endpoint with a test. Show your plan first."
PLAN 1) add route in routes/todos.js 2) remove from store 3) add a test
pause - waiting for your approval -> you read, approve
ACT edit routes/todos.js OBSERVE saved
ACT run "npm test" pause - approve shell command? (you approve)
OBSERVE FAIL: returns 200 for an unknown id
ACT edit routes/todos.js (404 when the id is missing)
ACT run "npm test" OBSERVE PASS (2 tests)
DONE Added DELETE /todos/:id (404 for unknown ids) + a passing test.The two pauses are the whole point of the leash: you approved the plan and the shell command, but the routine edits and the recovery from the failing test happened on their own. Tighten or loosen those gates as your trust grows.
When to use it (and when not to)
☺ Like you’re 10: A robot vacuum is great for cleaning the whole floor, but silly for picking up one sock — Copilot’s agent mode is the same: use it for big multi-step jobs, not tiny fixes you could do faster yourself.
Use agent mode for: scaffolding a feature across several files, wiring up a new dependency, writing a batch of tests, a mechanical refactor that spans the codebase, or fixing a bug where you’re unsure which file is at fault.
Don’t use it for: a one-line change (just type it, or use Edit mode), something you don’t yet understand well enough to review, or exploratory “what should I even do” questions (use Ask mode first). Agent mode executes; it’s not where you do your thinking.
Keeping it on a leash — the three things that bite beginners
☺ Like you’re 10: Think of Copilot’s agent as an eager puppy that’s fast but doesn’t know the rules yet — a leash lets it run around while you stay in charge, so it can’t chew something it shouldn’t.
1 · Approvals
Agent mode can run terminal commands and edit files. By default it asks before sensitive actions like running shell commands. Keep that confirmation on while you’re learning. Read the plan and the commands before approving. What you intended and what the agent interpreted can differ, and reviewing the plan is how you catch a wrong turn before it wastes a dozen iterations. A good instruction to give it: “Show me your plan and wait for my confirmation before making changes.”
2 · Premium-request budget
Because agent mode iterates, it consumes premium requests per step. Two habits keep your budget healthy: scope tightly (“Add a DELETE /todos/:id endpoint with a test” is a good agent task; “refactor the whole app” is a budget bonfire), and scope in Ask mode first — do the thinking cheaply, then hand the agent a well-defined job.
3 · Source-control discipline
Agents generate a lot of code, and some needs refinement. Commit before you start an agent task so you have a clean rollback point, and keep your history tidy so you can bisect when something breaks later. Treat each agent session as a feature branch.
In a small project, commit your current state. Open Chat, switch to Agent mode, and give it a scoped task: “Add an in-memory rate limiter to the Express app: max 100 requests per IP per minute, return 429 when exceeded, and add a test. Show me your plan first.” Read its plan. Approve step by step. Watch it edit files, run the test, and fix failures. Then review the diff critically before committing — this review habit is the whole game.
(1) Describe the four phases of the agent loop. (2) Why keep terminal-command confirmation on? (3) Name two ways to control premium-request spend in agent mode.
Check your answers
- The four phases: Understand (read the workspace), Plan (break the task into steps), Act (edit files and run terminal commands), and Observe (read the results). The agent repeats this loop, fixing its own errors, until the task passes or it gets stuck.
- Why keep confirmation on: What you intended and what the agent interpreted can differ, so reading the plan and commands before approving lets you catch a wrong turn early — before it wastes a dozen iterations on the wrong thing.
- Two ways to control spend: Scope tightly — give it one well-defined job (like adding a single endpoint with a test) rather than “refactor the whole app.” And do your thinking cheaply in Ask mode first, then hand the agent a clearly-defined task so it iterates less.