Ever find yourself staring at an AI coding assistant, wondering why it’s not quite nailing what you need? Maybe it’s spitting out code that’s close but not quite right, or you’re stuck wrestling with a problem that spans multiple files, wishing it could just get the bigger picture. Often, when developers hit these snags, it’s less about the tool, and more about knowing how to use it.
So here’s the key question you should ask yourself: “Do I need a quick answer or a thoughtful conversation?” That’s the secret to unlocking AI coding tools like GitHub Copilot.
Because different aspects of Copilot serve different needs, and we’re here to help you discern when is the best time for agent mode and when you should be using Copilot Edits instead. Both are powerhouse Copilot features, built to supercharge your coding, but they shine in different scenarios.
Copilot Edits is your go-to for fast, precise tweaks—think refactoring a function, squashing a bug, or applying consistent changes across files without losing your flow.
Agent mode, on the other hand, steps up as your AI collaborator for thornier, multi-file challenges—analyzing your codebase, proposing architectural fixes, and even running terminal commands while you steer the ship and approve each move.
Figuring out which one fits your needs doesn’t just save time, it turns your AI assistant into a seamless extension of your own coding instincts.
Copilot command center: Your chat window
Before learning more about agent mode and Copilot Edits, it’s essential to understand the Copilot chat window in VS Code—your central hub for AI interactions.
This is where you can:
Ask coding questions like “How do I implement JWT authentication in Node.js?”
Use /explain to understand complex code blocks
Debug issues with /fix
Generate tests with /tests
Access both Edits and agent mode features
With the chat window giving you a solid grasp of your code’s context, you’re in the driver’s seat to pick the perfect Copilot tool: Edits or agent mode, for whatever’s next.
Let me take you through a real-world example of how I’ve been using GitHub Copilot to evolve my personal website. It started with a simple idea: create an interactive terminal-style easter egg that showcases my skills in a developer-friendly way.
I began with a basic command processing function that handled a few simple commands:
functionprocessCommand(command) {
try {
if (!command?.trim()) {
return'Please enter a command. Type "more" for available commands.';
}
const sanitizedCommand = command.toLowerCase().trim();
switch (sanitizedCommand) {
case'more':
return commands.more;
case'about':
return commands.about;
case'skills':
return commands.skills;
case'projects':
return commands.projects;
case'contact':
return commands.contact;
default:
return`Command not found: "${command}". Type 'more' for available commands.`;
}
} catch (error) {
console.error('[Terminal] Error processing command:', error);
return'An error occurred while processing the command.';
}
}
Initially, I used Copilot Edits to quickly add new features. For instance, I wanted to add a ‘github’ command to showcase my repositories:
Copilot Edits made targeted changes to the switch statement in the processCommand function and added the new command to the commands object—a perfect example of quick, focused modifications to existing code.
As my terminal interface matured, I wanted to implement several interactive features that would require more comprehensive improvements. To get animation effects, keyboard navigation controls, and an extensible theming system that spanned multiple files to work together seamlessly, I turned to agent mode.
The agent mode advantage
When we designed agent mode, we didn’t want to create a tool that’s a simple AI feature: We wanted to create an AI that could pair with you! Rather than working on specific, limited changes where you might be reinventing the wheel, you’re now providing higher-level direction while the AI tackles the implementation details across multiple files or systems.
That being said, with agent mode, you’re still in control of the process. The AI has more latitude to explore your codebase and suggest comprehensive solutions, but you always review and approve the changes before they’re applied. It’s not about surrendering control, it’s about effectively delegating implementation details while you focus on the bigger picture.
What makes agent mode special:
Codebase search: It searches your codebase to find relevant files without you explicitly specifying them.
Self-iteration: It can iterate on its own output to complete your entire request in one go.
Error identification and repair: It automatically recognizes and fixes errors in suggested code.
Terminal command execution: It suggests and runs terminal commands with your permission.
Build and run capabilities: It can build and run your application to check if changes work correctly.
I reach for agent mode when:
Building complete features: “Add analytics tracking throughout the app”
Navigating unfamiliar codebases: “Help me understand how authentication works in this project”
Writing and verifying tests: “Write tests for the UserService and make sure they pass”
Implementing terminal-heavy tasks: “Set up a new React project with TypeScript, Redux, and styled-components”
Doing complex refactoring: “Refactor our API calls to use the new error handling pattern”
Continuing with my terminal easter egg, let’s say I want to implement a much more extensive upgrade with multiple features, like adding a typing animation effect for responses, command history navigation with up/down arrows, and tab completion for commands. At the same time, I want to create a new TerminalThemes.css file with different color scheme options that users can switch between with a ‘theme’ command.
This is where agent mode truly shines. The task spans multiple files, requires an understanding of the existing codebase, and involves creating entirely new functionality. Here, agent mode would:
Search through the codebase to understand the terminal implementation.
Create the new CSS file for themes.
Add typing animation functionality to terminal responses.
Implement keyboard handlers for history navigation.
Build the tab completion system.
Add the theme command to the switch statement.
Test the implementation to ensure everything works correctly.
This is the beauty of agent mode: it has a complex understanding of patterns and relationships in different parts of the codebase! Agent mode can ensure that the typing animation did not interfere with existing functionality, check that the history navigation was compatible with the current command processing, and confirm that the theme switching properly modified the UI. It is precisely in this multi-file feature implementation with interlinking components that agent mode can shine compared to the more laser-focused Copilot Edits.
In the below episode of GitHub Checkout, you can see agent mode implementing a complete water consumption tracker feature in an iOS app. It not only writes the code but also builds, runs, and tests the app, all from a single prompt, without the developer needing to touch the editor directly.
The secret: use both together!
After many hours with both tools, here’s my takeaway: It’s not about picking one, or one being better than the other. It’s about wielding them together for different purposes. Copilot Edits and agent mode work well together to augment our coding abilities, whether that’s a more prompt-centric style of development with agent mode, or maintaining granular file edit control via Copilot Edits.
Regardless of which tool you are using, you are still the pilot, steering the AI to supercharge your own productivity. The more context you provide in your prompts, the better results you’ll get—and remember, you always have the final say on any suggested changes.
If you’re just jumping into the world of AI, check out our new Getting started with GitHub Copilot tutorial series, where we walk you through everything from initial setup to advanced techniques. It’s perfect for developers at any skill level who want to quickly become productive with AI-assisted coding.
Happy coding, everyone!
How to get started
Want to try these features? Here’s my quick setup guide:
For Copilot Edits:
Open VS Code and look for the Copilot Chat window.
Click the “Edit with Copilot” button to open the Copilot Edits view.
Add your relevant files to the working set. Copilot will only make changes to files in this set (unless it’s creating a new file).
Type your prompt describing what changes you need.
Review the “diff” of all proposed changes before accepting them.
For agent mode:
Make sure you’re using VS Code version 1.99 or higher (as of original publish date, available in VS Code Insiders).
Switch from “Edit” to “Agent” mode.
Type your prompt, describing the complex task or feature you want to implement.
Agent mode will work autonomously, but still require your approval for changes.
For best results, consider using custom instructions to personalize how agent mode works with your codebase.
Andrea is a Senior Developer Advocate at GitHub with over a decade of experience in developer tools. She combines technical depth with a mission to make advanced technologies more accessible. After transitioning from Army service and construction management to software development, she brings a unique perspective to bridging complex engineering concepts with practical implementation. She lives in Florida with her Welsh partner, two sons, and two dogs, where she continues to drive innovation and support open source through GitHub's global initiatives. Find her online @alacolombiadev.
Ever wondered how to create checklists in your GitHub repositories, Issues, and PRs? Make task lists more manageable in your GitHub repositories, issues, and pull requests.