AI tools are rapidly becoming essential for developers. GitHub Copilot, once just a code-suggestion engine, has evolved into a much smarter assistant — now offering Ask Mode and Agent Mode, especially valuable for .NET developers.
In this article, we’ll break down what each mode does, how they differ, when to use them, and how to enable these features inside Visual Studio or VS Code.
🧠 What is GitHub Copilot?
GitHub Copilot is an AI pair programmer powered by OpenAI, deeply integrated into modern IDEs like Visual Studio and VS Code. In its latest versions, Copilot goes beyond autocomplete and offers more intelligent experiences:
- 🔹 Ask Mode — a conversational help assistant
- 🔹 Agent Mode — a task-based smart code executor
🆚 Ask Mode vs Agent Mode
🔹 Ask Mode
Think of Ask Mode as a built-in chatbot — similar to ChatGPT — ready to answer your coding questions.
✅ Key Features:
- Manually ask questions
- Get code examples
- Understand concepts
- Debug issues with suggestions only
📌 Example Prompt:
How do I build a minimal Web API controller in ASP.NET Core?
Use this mode when you’re exploring ideas or looking for help writing new code.
🔹 Agent Mode
Agent Mode takes things a step further. It understands your project’s structure and can perform multi-step tasks directly in your codebase.
✅ Key Features:
- Works contextually with your actual code
- Performs tasks like:
- Refactoring
- Writing unit tests
- Adding logging
- Cleaning up legacy code
- Can execute multiple actions in one command
📌 Example Prompt:
Refactor this service class and generate unit tests.
🧭 When to Use Each Mode?
Situation | Recommended Mode |
---|---|
Learning new concepts | Ask Mode |
Writing code from scratch | Ask Mode |
Refactoring existing code | Agent Mode |
Generating unit tests | Agent Mode |
Automating complex coding tasks | Agent Mode |
⚙️ How to Enable Ask Mode & Agent Mode
▶ For Visual Studio 2022+:
- Install Visual Studio 2022 (v17.10 or later).
- Make sure GitHub Copilot and GitHub Copilot Chat extensions are installed.
- From the top menu, go to:
View > GitHub Copilot Chat - Select some code and use natural language prompts like:
-
Add null checks
-
Refactor this method
Explain what this code does
-
Copilot will detect context and switch between Ask or Agent mode automatically.
▶ For VS Code:
- Install the following extensions:
- GitHub Copilot
- GitHub Copilot Chat
- Open the Copilot Chat sidebar.
- Use prompts directly, or select code and run contextual instructions.
🧱 Requirements
- GitHub account with Copilot subscription
- Visual Studio 2022+ or latest VS Code
- Internet connection
- Logged in with GitHub in your IDE
✅ Summary
With Ask Mode and Agent Mode, Copilot becomes far more than a code completion tool for .NET developers:
- Ask Mode = Q&A assistant (ideal for learning & guidance)
- Agent Mode = Smart agent that acts on your code (ideal for productivity)
Used wisely, these modes can significantly speed up your workflow, reduce cognitive load, and help you focus on building better software.
I’m Morteza Jangjoo and “Explaining things I wish someone had explained to me”
✍️ Originally published on my Hashnode blog