Problem: Your Copilot Only Suggests Code, Doesn't Execute It
You're using GitHub Copilot for autocomplete but still manually running tests, fixing errors, and editing multiple files yourself. Agent mode changes that—it autonomously plans, edits, tests, and iterates until your task is complete.
You'll learn:
- How to enable agent mode in VS Code (1.99+)
- The difference between Ask, Edit, and Agent modes
- When to use agent mode vs traditional Copilot
- How to control autonomous tool execution
Time: 5 min | Level: Beginner
Why This Matters
GitHub Copilot launched agent mode in February 2025, shifting from code suggestions to autonomous execution. As of January 2026, there are 4.7 million paid Copilot users, with agent mode becoming the default workflow for complex tasks.
What agent mode does:
- Creates multi-step plans before coding
- Edits files across your entire workspace
- Runs Terminal commands (build, test, lint)
- Monitors output and self-corrects errors
- Iterates until the task succeeds
Common symptoms without agent mode:
- Manually applying suggested code changes
- Copy-pasting fixes across multiple files
- Running tests yourself after each edit
- Context-switching between editor and terminal
Prerequisites
Before enabling agent mode:
Required:
- VS Code version 1.99 or later
- Active GitHub Copilot subscription (Free, Pro, Pro+, Business, or Enterprise)
- GitHub Copilot extension installed
Check your version:
code --version
Expected: 1.99.0 or higher
If you're on an older version:
# Update VS Code
# macOS: Code > Check for Updates
# Windows/Linux: Help > Check for Updates
Solution
Step 1: Verify Copilot Extension
Open VS Code and check that GitHub Copilot is active.
# Open Command Palette
Cmd+Shift+P (macOS)
Ctrl+Shift+P (Windows/Linux)
# Type: GitHub Copilot: Sign In
Expected: "Signed in as [your-github-username]" in the status bar
If it fails:
- Not installed: Go to Extensions (Cmd+Shift+X), search "GitHub Copilot", install
- Not signed in: Run the sign-in command again and authenticate via browser
Step 2: Enable Agent Mode
Agent mode is controlled via VS Code settings.
Method 1: Settings UI
- Open Settings (Cmd+, on macOS, Ctrl+, on Windows/Linux)
- Search for
chat.agent.enabled - Check the box to enable
Method 2: Settings JSON
{
"chat.agent.enabled": true,
"github.copilot.chat.agent.runTasks": true,
"github.copilot.chat.agent.autoFix": true
}
Why these settings:
chat.agent.enabled- Activates agent mode in the chat pickerrunTasks- Allows agent to run workspace tasks (build/test)autoFix- Enables automatic error detection and correction
Expected: Agent mode now appears as an option in Copilot Chat
Step 3: Access Agent Mode
Open the Copilot Chat view and select Agent mode.
# Open Copilot Chat
Ctrl+Cmd+I (macOS)
Ctrl+Alt+I (Windows/Linux)
# Click the mode dropdown (top of chat panel)
# Select "Agent" (options: Ask, Edit, Agent)
Mode differences:
- Ask: Conversational Q&A, no code edits
- Edit: Single-file inline changes with preview
- Agent: Autonomous multi-file execution
Step 4: Test Agent Mode
Run a simple multi-file task to verify agent mode works.
Prompt:
Create a new TypeScript utility function called formatDate in src/utils/date.ts,
then write a test file for it in src/utils/__tests__/date.test.ts,
and run the tests to verify it works.
What the agent does:
- Creates a plan with 4-5 steps
- Asks for confirmation before executing
- Creates
src/utils/date.tswith the function - Creates
src/utils/__tests__/date.test.tswith tests - Runs
npm test(or your test command) - Monitors test output
- Fixes failures if any occur
Expected output:
✓ Plan created (3 steps)
1. Create date utility file
2. Create test file
3. Run tests
✓ Created src/utils/date.ts
✓ Created src/utils/__tests__/date.test.ts
Running tests...
✓ Tests passed (1 suite, 3 tests)
Task complete.
If it fails:
- "Agent mode not available": Verify
chat.agent.enabled: truein settings - No terminal execution: Enable
runTaskssetting - Agent asks for manual approval: This is normal—review the plan before accepting
Step 5: Configure Tool Permissions
Agent mode requests permission before running tools. Configure this based on your trust level.
Permission options:
- Always ask (default) - Manual approval for each tool
- Allow for this session - Auto-approve until VS Code restarts
- Allow for this solution - Auto-approve for current workspace
- Remember my choice - Auto-approve forever
Recommended for beginners: Keep "Always ask" enabled until you're comfortable
To reset permissions:
// settings.json
{
"github.copilot.chat.agent.requireConfirmation": true
}
Verification
Test agent mode with a realistic scenario:
Prompt:
Refactor the UserService class to use async/await instead of promises,
update all tests, and verify they still pass.
You should see:
- Agent analyzes
UserService.ts - Creates a refactoring plan
- Applies changes to the class
- Updates test files automatically
- Runs tests
- Reports success or iterates on failures
Success indicators:
- Multiple files edited without your intervention
- Terminal commands executed automatically
- Agent recovers from build/test failures
- Final state: all tests passing
Advanced Configuration
Enable MCP Servers
Agent mode supports Model Context Protocol (MCP) for external tools.
{
"github.copilot.chat.agent.enableMCP": true
}
Available MCP servers:
- GitHub MCP (default): Repository search, issue management
- Database MCP: Query databases from chat
- Cloud MCP: AWS/GCP/Azure integrations
To add an MCP server:
- Install MCP extension from VS Code marketplace
- Configure in
.copilot/mcp.json - Restart VS Code
Customize Models
Agent mode works with multiple LLM providers.
Change model:
# In chat, type:
/model
# Select from:
# - Claude Sonnet 4.5 (best for complex tasks)
# - GPT-4o (balanced performance)
# - Gemini 2.0 Flash (fastest)
Note: Claude Sonnet 4.5 achieves 56% on SWE-bench Verified—best for autonomous coding tasks
Limit Agent Actions
Prevent agent from editing specific files.
Create .copilot/ignore:
# Exclude from agent edits
*.config.js
package.json
.env
Or use workspace settings:
{
"github.copilot.chat.agent.excludeFiles": [
"**/*.config.js",
"**/package.json"
]
}
What You Learned
- Agent mode enables autonomous multi-file coding with self-healing
- Enable via
chat.agent.enabled: truein VS Code settings - Agent creates plans, edits code, runs tests, and iterates on failures
- Use Ask mode for questions, Edit for single files, Agent for complex tasks
Limitations:
- Agent mode consumes premium requests (300/month on Pro, 1,000 on Enterprise)
- Best on smaller repos (<10k files); large codebases may timeout
- Requires manual review—don't blindly accept all changes
- MCP servers not available on Copilot Free plan
When NOT to use agent mode:
- Simple one-line code completions (use autocomplete)
- Refactoring core architecture without human oversight
- Tasks requiring deep domain knowledge agent can't infer
- Projects with complex build systems agent struggles to understand
Troubleshooting
Agent Mode Not Appearing
Issue: Agent option missing from mode dropdown
Solution:
- Verify VS Code version >= 1.99
- Check
chat.agent.enabled: truein settings - Restart VS Code
- Update GitHub Copilot extension to latest version
Agent Stops Mid-Task
Issue: Agent creates plan but doesn't execute
Causes:
- Tool permissions denied
- Workspace folder not set
- Terminal profile misconfigured
Fix:
{
"chat.tools.terminal.terminalProfile.osx": "zsh",
"chat.tools.terminal.terminalProfile.windows": "PowerShell",
"chat.tools.terminal.terminalProfile.linux": "bash"
}
Enterprise Policy Blocking
Issue: Agent mode grayed out in organization
Solution:
- Contact your GitHub admin to enable agent mode in organization policies
- Go to
github.com/organizations/[org]/settings/copilot/policies - Enable "Agent mode" under Copilot features
- May require Copilot Business or Enterprise plan
Tested on VS Code 1.99.4, GitHub Copilot v0.24+, macOS Sonoma & Windows 11