Agent Mode: Autonomous Multi-Step Development
- Describe a multi-step development task using Agent mode and understand how the agent plans and executes it
- Identify what kinds of tasks are best suited to Agent mode versus Edit or Ask mode
- Explain how premium requests, Autopilot, and parallel sessions work in Agent mode
What Makes Agent Mode Different
Agent mode in Copilot Chat is not a smarter version of Edit mode. It is a fundamentally different kind of interaction. Given a high-level goal, Agent mode autonomously determines which files to modify, makes changes across all of them, runs terminal commands (like npm install or pytest), reads the output, and iterates until the task is complete — including fixing its own errors.
This is synchronous but largely hands-off. You describe what you want to build or fix, and the agent works through it step by step in front of you. Risky terminal commands are surfaced for your approval before they run. Safe commands — installing dependencies, running tests — execute automatically. You can interrupt, redirect, or take over at any point.
Starting Agent Mode
Switch to Agent mode from the mode dropdown in the Copilot Chat panel in VS Code. The panel header changes to indicate you are in agent mode. Type your task in natural language — the more context and intent you provide, the better the plan it produces.
Good starting prompts:
- "Add a REST endpoint
/api/users/:id/preferencesthat reads from the preferences table. Follow the same patterns as the existing user endpoints." - "Set up Jest in this project and write tests for all the functions in src/utils. Make sure the test suite runs clean with npm test."
- "Migrate the authentication middleware from JWT to session-based auth. Update all the routes that depend on it."
Notice the pattern: a clear goal, a reference to existing patterns or constraints, and a verifiable outcome (tests pass, endpoint works, routes updated). Vague prompts produce exploratory attempts; specific prompts produce focused execution.
How the Agent Plans and Executes
When you submit a task, the agent produces a plan — a list of steps it intends to take. You can see this in the Chat panel as it runs. The agent then works through the plan:
- Reads relevant files to understand the current state
- Edits files to implement the change
- Runs terminal commands to install dependencies or run tests
- Reads the output of those commands
- Fixes any errors and iterates until the task is done
The agent catches many of its own mistakes. If a test fails after its changes, it reads the error, diagnoses the problem, and makes a correction — without you having to intervene. This loop can run multiple times on a complex task.
Premium Requests and Autopilot
Each step in an agent mode session consumes AI credits from your plan's allotment. For most tasks this is a few cents. Complex multi-file tasks with multiple iterations cost more. You can monitor usage in your GitHub Copilot settings.
Autopilot is a public preview feature that makes agent mode fully hands-off — the agent approves its own safe actions and retries on failures without waiting for you. For experimentation and well-understood tasks, autopilot removes the approval friction entirely. Keep it off for tasks that modify production configuration or sensitive files.
MCP Server Connections
Agent mode can use MCP (Model Context Protocol) servers to access external tools: databases, APIs, internal services. When an MCP server is configured, its tools appear as additional capabilities the agent can call. This is covered in depth in Lesson 9. For now, know that agent mode is the surface where MCP tools are used — Ask and Edit mode do not invoke MCP tools.
Parallel Agent Sessions
VS Code's Agents panel lets you run multiple agent sessions in parallel in isolated workspaces. This is useful when you have two independent tasks — for example, one agent fixing a bug while another writes tests for a different module. Parallel sessions share the codebase but work in separate chat contexts.
Try This
Switch to Agent mode and give Copilot a real task from your current project — something that would take you 15-30 minutes manually: adding a new API endpoint, setting up a testing framework, or migrating a config format. Watch how it plans the work. When it surfaces a terminal command for approval, read the command before approving. After the session, check the changes with git diff to understand everything it modified.
- Agent mode autonomously determines which files to edit, runs terminal commands, and iterates on errors until the task is complete
- Risky terminal commands require your approval before running; safe commands like npm install execute automatically
- Agent mode is the only Chat mode that invokes MCP server tools — Ask and Edit mode do not use MCP tools