Welcome to Agent mode in Visual Studio which aims to deliver a development workflow where your AI assistant takes on complex coding tasks from start to finish—all from a single prompt.
Now available in public preview with Visual Studio 17.14, Agent mode supercharges GitHub Copilot by allowing it to autonomously plan, edit, iterate, and even invoke tools across your codebase, fundamentally changing how developers interact with their IDE.
What Sets Agent Mode Apart?
Unlike Copilot Chat or Edits, Agent mode doesn’t stop at suggesting code snippets or making one-off changes. Instead, it works iteratively, continuously analyzing your code, running builds and tests, and making further changes until your task is complete.
This autonomous approach means Copilot can handle everything from multi-file refactoring to implementing new features and fixing bugs, all while keeping you in control.
- Context Awareness: Agent mode determines which files are relevant and edits them as needed.
- Terminal Integration: It suggests terminal commands for you to approve and execute.
- Iterative Problem Solving: Copilot checks for errors, runs tests, and validates results until the task is done.
- Tool Invocation: It leverages trusted tools in your environment via MCP servers, including linters and test runners.
Getting Started with Agent Mode
To enable Agent mode, you’ll need Visual Studio 17.14 or later. Simply use the Feature Search (Ctrl + Q), look for “agent,” and enable “Copilot Chat: Agent Enabled.” Switch to the “Agent” tab in the Copilot Chat window to start leveraging high-level prompts. This new mode is set as the default for code changes, making it the next step in Copilot’s evolution.
Agent Mode in Action
Agent mode is ideal for scenarios that require more than simple code edits. Whether you’re building an app from scratch, refactoring across multiple files, writing and running tests, integrating new libraries, or automating terminal-heavy tasks, Agent mode orchestrates the workflow efficiently. It’s particularly powerful for:
- Autonomous Edit Scope: Agent mode searches and edits the codebase with minimal guidance.
- Complex Tasks: Great for intricate, multi-step processes that require tool invocations or terminal commands.
- Multi-Step Iteration: Agent mode evaluates outcomes and iterates until all issues are resolved.
- Handling Multiple Requests: Complex prompts may trigger several backend actions for a robust solution.
Example Prompts to Try
- Add error handling to this API
- Convert this project to use environment variables
- Write tests for this class and fix anything that fails
- Add structured logging with Serilog
- Replace HttpClient with IHttpClientFactory
Optimizing Agent Mode with Custom Instructions
For best results, provide Copilot with detailed context about your coding standards, team preferences, or preferred libraries using the custom instructions feature. This ensures more accurate, tailored responses to your requests. You can configure these instructions directly within Visual Studio, following the official documentation.
Expanding Capabilities with Model Context Protocol (MCP) Servers
The latest release introduces support for MCP servers, which act as universal adaptors connecting Copilot to external tools and data sources without custom integrations. With MCP servers, Agent mode can:
- Interact with your cloud environment, such as querying Azure Storage or Cosmos DB
- Manage and analyze databases directly from your IDE
- Search and manage GitHub repositories, batch-create issues, or update files
- Automate end-to-end testing and connect with custom tools via available SDKs
Continuous Improvement and Community Engagement
Microsoft is shifting to a monthly release cycle for Copilot updates, ensuring developers always have access to the latest features. Developers can access the latest Copilot updates by continuing to update Visual Studio to the latest version.
Agent Mode in Visual Studio: The Next Leap for Autonomous Coding Assistants