How to use agent mode for multi-step tasks on GitHub Copilot
Agent mode in GitHub Copilot allows you to break down complex tasks into multiple steps with autonomous execution. Access it through the Chat panel using @workspace or specific agent commands to handle multi-file operations, refactoring, and project-wide changes.
Prerequisites
- GitHub Copilot subscription
- Visual Studio Code or supported IDE
- Basic understanding of coding workflows
- GitHub Copilot extension installed
Step-by-Step Instructions
Open GitHub Copilot Chat Panel
Activate Agent Mode with Workspace Context
@workspace followed by your multi-step task description. For example: @workspace refactor this authentication system to use JWT tokens, update all related files, and add proper error handling. The @workspace agent has access to your entire project structure.Review the Proposed Plan
- File modifications and creations
- Code refactoring sequences
- Testing recommendations
- Documentation updates
Monitor Step-by-Step Execution
Step 1/5: Creating authentication middleware...
Step 2/5: Updating user model...
Each completed step will show a green checkmark with a summary of changes made.
Review and Approve Individual Changes
Handle Inter-step Dependencies
- Suggest alternative approaches
- Skip dependent steps and continue with independent ones
- Pause execution for your input
Verify Final Results and Test
@workspace /tests to generate appropriate tests for the modifications. Check the Source Control panel to review all file changes before committing.Common Issues & Troubleshooting
Agent mode is not available or @workspace command not recognized
Ensure you have the latest GitHub Copilot extension version and an active subscription. Update VS Code and restart the application. Check that GitHub Copilot Chat is enabled in settings.
Multi-step execution stops or fails midway
Check the Output panel for error details. Ensure all files are saved and not locked by other processes. Try breaking down the task into smaller, more specific requests using @workspace.
Agent makes unwanted changes to unrelated files
Use more specific file or folder targeting in your request like @workspace /src/auth only modify authentication related files. Review the proposed plan carefully before approving execution.
Steps complete but code has syntax errors or conflicts
Use Ctrl+Shift+P and run Developer: Reload Window to refresh IntelliSense. Check the Problems panel and use @workspace fix syntax errors to resolve issues automatically.