GitHub Copilot Workspace and Agent Mode

GitHub Copilot's most advanced capabilities go beyond completing individual functions. Workspace features and Agent Mode let Copilot take multi-step actions across your entire codebase — planning changes, editing multiple files, running commands, and iterating on results. This topic explains how these powerful features work and when to use them.

The Difference Between Suggestions and Agent Mode

STANDARD COPILOT (Suggestions + Chat):
  You: Write a function to hash a password
  Copilot: [writes the function in the current file]
  Result: One function in one location

AGENT MODE:
  You: "Add password hashing to the user registration flow"
  Copilot:
    → Reads your User model, auth controller, and config files
    → Installs the bcrypt package
    → Updates the User model with a pre-save hook
    → Updates the registration controller
    → Updates the login function to use bcrypt.compare
    → Creates a test file for the new behavior
  Result: Multiple files changed, package installed, tests written

What Is Agent Mode

Agent Mode is a setting in Copilot Chat that allows Copilot to perform multi-step actions autonomously. Instead of waiting for you to approve each step, Copilot plans a sequence of actions and executes them, asking for confirmation only at key decision points.

STANDARD CHAT MODE:
  User → Copilot → User (approves) → Copilot → User (approves)
  Each step requires manual review and application

AGENT MODE:
  User describes goal
  ↓
  Copilot plans steps
  ↓
  Copilot executes Step 1 (reads files)
  Copilot executes Step 2 (edits files)
  Copilot executes Step 3 (runs a command)
  Copilot executes Step 4 (checks for errors)
  ↓
  Copilot reports what it did and asks for confirmation
  ↓
  User reviews and approves or rolls back

Enabling Agent Mode in VS Code

STEPS TO ENABLE:
1. Open Copilot Chat (Ctrl+Shift+I)
2. Click the model selector dropdown at the top of Chat
3. Select "Claude Sonnet" or "GPT-4o" (agent-capable models)
4. At the bottom of the Chat input, look for the mode toggle:
   [Ask] [Edit] [Agent]
5. Click [Agent] to switch to Agent Mode

Agent Mode requires a model that supports multi-step reasoning. Make sure your Copilot plan includes access to these models — they are available on Individual, Business, and Enterprise plans.

What Agent Mode Can Do

FILE OPERATIONS:
  ✓ Read multiple files across your project
  ✓ Edit any file in the workspace
  ✓ Create new files and directories
  ✓ Delete files (with confirmation)
  ✓ Rename and move files

TERMINAL OPERATIONS:
  ✓ Run npm install / pip install
  ✓ Execute tests and show results
  ✓ Run build commands
  ✓ Execute git commands
  ✓ Run database migrations

ANALYSIS OPERATIONS:
  ✓ Search the codebase for a pattern
  ✓ Find all files that import a specific module
  ✓ Identify code that needs updating

Example: Using Agent Mode for a Feature

Here is how Agent Mode handles a realistic feature request from start to finish:

YOUR REQUEST:
"Add rate limiting to all API endpoints.
 Limit each IP address to 100 requests per 15 minutes.
 Return a 429 status with a Retry-After header when exceeded."

AGENT MODE EXECUTION PLAN:
─────────────────────────────────────────────────────────
Step 1: Read package.json to check if express-rate-limit
        is already installed

Step 2: Run `npm install express-rate-limit` if not found

Step 3: Read app.js or server.js to find middleware setup

Step 4: Create config/rateLimiter.js with the limiter config:
        const rateLimit = require('express-rate-limit');
        module.exports = rateLimit({
            windowMs: 15 * 60 * 1000,
            max: 100,
            standardHeaders: true,
            legacyHeaders: false,
        });

Step 5: Import and apply the limiter in app.js:
        const limiter = require('./config/rateLimiter');
        app.use('/api', limiter);

Step 6: Create a test that verifies 429 response on limit

Step 7: Report: "I made 4 changes. Review them?"
─────────────────────────────────────────────────────────
RESULT: Rate limiting fully implemented in ~30 seconds

GitHub Copilot Workspace (Browser Feature)

GitHub Copilot Workspace is a separate feature available on github.com that lets you work on entire features directly from a GitHub Issue. You do not need to clone the repository to your computer first.

HOW COPILOT WORKSPACE WORKS:
                        ┌─────────────────────────┐
  GitHub Issue          │  COPILOT WORKSPACE      │
  "Add dark mode" ────→ │                         │
                        │  1. Reads the codebase  │
                        │  2. Creates a plan      │
                        │  3. Lists files to edit │
                        │  4. Shows code changes  │
                        │  5. Creates a PR draft  │
                        └─────────────────────────┘
                                   ↓
                    Pull Request ready for your review

You review the proposed changes, edit anything that needs adjustment, and then open the pull request. Copilot Workspace is designed for planning and scaffolding large changes — you still review and approve every change before it goes into your codebase.

@workspace in Chat

The @workspace reference in Copilot Chat is a lighter version of workspace-level awareness. It gives Copilot access to your entire project folder for context, allowing it to answer questions about files it has not yet opened.

USEFUL @workspace QUERIES:
──────────────────────────────────────────────────────────
@workspace Where do I define API routes?
→ Lists all route files and their paths

@workspace What authentication strategy does this app use?
→ Reads auth files and explains the approach

@workspace Find all TODO comments in the project
→ Searches every file for TODO markers

@workspace Which components depend on the UserContext?
→ Maps component dependencies

@workspace Is there any code that accesses the database directly
           outside the repository layer?
→ Identifies architecture violations
──────────────────────────────────────────────────────────

Safe Use of Agent Mode

Agent Mode is powerful but requires careful oversight. Follow these practices to avoid unwanted changes:

BEFORE USING AGENT MODE:
  ✓ Commit your current work (git commit)
  ✓ Work on a feature branch, not main
  ✓ Read the plan Copilot presents before confirming

DURING AGENT MODE:
  ✓ Watch which files it modifies
  ✓ Use the undo option if it makes wrong changes
  ✓ Run your tests after Agent Mode finishes

NEVER LET AGENT MODE:
  ✗ Run deployment commands without your explicit instruction
  ✗ Push to a remote repository
  ✗ Modify .env files (it should read but not change them)

When Agent Mode Saves the Most Time

Agent Mode is most valuable for tasks that are tedious and mechanical but touch many files:

  • Migrating from one library to another across the entire codebase
  • Adding logging to every API endpoint
  • Converting JavaScript files to TypeScript
  • Updating import paths after a folder restructure
  • Adding input validation to every form handler
  • Implementing a new design pattern consistently across all services

For creative or architectural decisions, Agent Mode is less useful than a focused Chat conversation. Use it for breadth (many files, same change) rather than depth (one file, complex design).

Agent Mode and Workspace features mark a significant shift in how developers interact with AI tools. Rather than generating one piece of code at a time, Copilot can now plan and execute entire workflows. Mastering these features means you can delegate entire categories of implementation work — and spend your time on the decisions that only you can make.

Leave a Comment

Your email address will not be published. Required fields are marked *