Heard of VS Code Agent Mode?
If you’re using Visual Studio Code (VS Code), this feature is about to become your new best friend. Imagine having an AI sidekick that doesn’t just suggest code but actually does the heavy lifting—editing files, running commands, and fixing errors—all while you sip your coffee and nod in approval.
That’s Agent Mode in a nutshell, and today, I’m walking you through how to use it, step-by-step, with a fun, beginner-friendly vibe. Let’s dive into the world of VS Code Agent Mode and see how it can turbocharge your coding game!

What is VS Code Agent Mode? A Quick Intro
So, what’s this VS Code Agent Mode thing all about? Picture GitHub Copilot—VS Code’s AI-powered assistant—going from “helpful suggester” to “autonomous coder.” In Agent Mode, Copilot doesn’t just sit there waiting for you to type; it takes charge. You give it a high-level task—like “Build me a to-do app”—and it figures out the files to tweak, writes the code, runs commands, and even fixes mistakes, all on its own. It’s like pair programming with a robot that never sleeps!

As of April 10th, 2025, Agent Mode is actively being developed and rolled out, packed with goodies like Model Context Protocol (MCP) support, meaning it can tap into external tools and data. Whether you’re a newbie or a pro, this is a game-changer. Ready to try it? Let’s set it up!
Why You’ll Love Using VS Code Agent Mode
Before we get hands-on, let’s chat about why VS Code Agent Mode rocks:
- Hands-Off Coding: Tell it what you want, and it does the work—perfect for multi-step tasks.
- Smart Fixes: It catches errors (like syntax goofs or failed tests) and loops back to fix them.
- Tool Power: It uses built-in tools, MCP servers, and extensions to go beyond basic edits.
- You’re in Control: You approve every change, so no rogue AI disasters.
Think of it as your personal coding assistant who’s always one step ahead. Now, let’s get it running!

How to Set Up VS Code Agent Mode: Step-by-Step
Getting started with VS Code Agent Mode is a breeze. Here’s how to flip the switch and unleash the magic:
Step 1: Update VS Code
First things first—make sure you’re on a recent version of VS Code that supports Agent Mode. Head to code.visualstudio.com, download the Stable version, or use Insiders for bleeding-edge features.

Step 2: Enable Agent Mode
Agent Mode might not be on by default depending on your version and rollout status. Here’s how to potentially turn it on:
Open VS Code.
Hit Ctrl + ,
(or Cmd + ,
on Mac) to open Settings.
Search for chat.agent.enabled
and make sure its ticked.

If you don’t see it, reload VS Code after updating—it might pop up if available in your build. Check for updates via Help > Check for Updates
.

Pro Tip: This step may become unnecessary as Agent Mode rolls out more broadly. For now, this toggle (if present) gets you in early!
Step 3: Sign In to GitHub
VS Code Agent Mode runs on GitHub Copilot, so you’ll need an active subscription.
In VS Code, click the Copilot icon in the sidebar (or use the relevant shortcut, e.g., Ctrl+Shift+I
/ Cmd+Shift+I
for the Copilot pane).
Sign in with your GitHub credentials. If you don't have a Copilot subscription, you may need to sign up via GitHub.
Step 4: Open the Chat View & Select Agent Mode
Now, let’s get to the fun part:
Open the Copilot Chat view (Ctrl+Shift+I
/ Cmd+Shift+I
).
Look for the mode dropdown at the bottom of the Chat input area—it might say “Ask,” “Edit,” or “Agent.”

Select Agent. Boom—you’re in VS Code Agent Mode!

How to Use VS Code Agent Mode: Let’s Build Something!
Alright, setup’s done—time to see Agent Mode in action! Let’s build a simple React to-do app together. Grab a blank VS Code workspace, and follow along.
Step 1: Give It a Task
In the Chat view (with Agent Mode selected), type a clear, high-level task. For example:
>> Create a simple React to-do application. It should have an input field to add tasks and display the list of tasks.
Hit Enter. You don’t need to specify files—Agent Mode figures that out!
Step 2: Watch the Plan Unfold
Copilot will start chatting back, streaming its thought process. It might say:
"Okay, I can help with that. Here's the plan:
- Set up a basic React project structure (if needed).
- Create the main
App.js
component to manage state. - Create a
TodoForm.js
component for the input field. - Create a
TodoList.js
component to display the tasks. I'll start by creating the necessary files..."
It’s like watching a friend code live! It’ll also propose terminal commands—like npm init react-app
if your project’s fresh.

Step 3: Approve the Tools
Agent Mode might need to use tools—like running npm install
or using built-in file operations. You’ll see prompts like:
"Run
npm install react react-dom
#terminal
#filesystem
src/App.js
Click “Continue” to approve (or tweak the command first). You might be able to auto-approve tools for the session via a dropdown—handy but use it wisely!

Step 4: Review the Edits
As Agent Mode works, code streams into your editor with overlays showing changes (diff views). For our to-do app, you might see:
App.js
updated with state management (useState
) for tasks.
A new file src/TodoForm.js
with a form and input element.
A new file src/TodoList.js
rendering the list items.
Navigate edits with the Up/Down arrows in the overlay or diff viewer, then hit “Accept” (or similar button) to keep changes or “Discard” to reject them. The Chat view usually lists changed files, making it easy to track.

Step 5: Iterate and Refine
Not perfect? Tell Agent Mode what to fix or add next:
>> Now, add functionality to mark tasks as complete when clicked and change the font color to black for tasks added to the todo list.

Agent Mode will loop back, analyze the request, propose changes, run tests (if configured in tasks.json
), and update the code. It’ll keep going until it nails it—or you pause it.
Mastering VS Code Agent Mode: Tips and Tricks
Now that you’ve got the basics, let’s level up your VS Code Agent Mode skills!
- Use Specific Prompts: Vague tasks like “Make an app” can be less effective. Try focused goals: “Add a dark mode toggle to my React app using Context API.” or “Refactor this Python script
utils.py
to use classes for better organization.” Clear goals = better results! - Leverage Tools with # (or other syntax): Want Agent Mode to use a specific capability? Use the designated syntax (e.g.,
#
). #terminal
to run commands.#codebase
to search your project for relevant context.#fetch
to pull data from a URL. Check the available tools (often indicated by an icon or command) in the Chat input area.

- Pause or Cancel When Needed: If Agent Mode goes off the rails (e.g., editing the wrong file or getting stuck), hit “Pause” to refine your prompt or “Cancel” to stop the current operation. You can often still accept the useful changes made so far.
- Undo Like a Pro: Made a mistake accepting changes? Use “Undo Last Edit” (or similar command, often found near the chat input/title bar) to roll back. Changed your mind? “Redo Last Edit” might bring it back. It’s like Ctrl+Z/Cmd+Z for AI!

- Tweak Settings (if available): Head to Settings (
Ctrl + ,
) and search for relevant Agent Mode or Copilot Chat settings. You might find options like: chat.agent.maxRequests
: Limit how many steps/iterations it takes.github.copilot.chat.agent.runTasks
: Toggle automatic execution of workspace tasks (like builds/tests defined intasks.json
).

Agent Mode vs. Edit Mode: When to Use What?
Confused about Agent Mode vs. Edit Mode in Copilot Chat? Here’s the scoop:
- Agent Mode: Best for big, multi-step tasks where you want the AI to figure out the plan, manage files, and potentially self-correct (e.g., "Build a feature," "Refactor this module"). It’s more autonomous.
- Edit Mode (or Inline Chat): Perfect for quick, scoped changes within the current file or selection (e.g., "Fix this function," "Rename this variable," "Add error handling here"). You have more direct control over the scope.
If you’re unsure exactly which files need changes or how to approach a larger task, let Agent Mode take the lead. Need precise modifications in a specific spot? Edit is often faster.
Conclusion: Your AI Pair Programmer Has Arrived
VS Code Agent Mode represents a significant step towards AI-assisted development. By delegating complex, multi-step coding tasks to GitHub Copilot, you can focus more on high-level design, problem-solving, and reviewing the generated code. You've seen how to set it up, guide it through building a simple application, and refine the results. While it requires clear instructions and careful review, Agent Mode has the potential to drastically speed up development workflows and tackle coding challenges more efficiently.
Ready to give your new AI pair programmer a try? Fire up VS Code, ensure Copilot is set up, switch to Agent Mode, and give it a real task from your current project. What will you build or refactor first?