Skip to content

GitHub Copilot Agent Mode

Local, synchronous agentic execution that reads files, runs code, checks output, and iterates to fix errors.

How it works

Agent mode turns Copilot from a suggestion engine into an autonomous executor. When you submit a prompt, Copilot iterates across files and works through changes autonomously. It proposes changes across multiple files, runs terminal commands, checks output, finds errors, and loops back to fix them. It installs packages, runs tests, and migrates code without waiting for your approval at each step.

Agent mode runs in VS Code and is generally available in JetBrains, Eclipse, and Xcode.

Planning mode

For complex tasks, Copilot generates a plan that lists all steps before it makes changes. The plan supports structured reasoning and progress tracking.

Multi-file editing

Copilot Edits lets you name a set of files and describe changes in plain language. Copilot then proposes inline edits across those files, one round at a time.

Vision

Feed Copilot a screenshot, mockup, or image and it generates the UI code and implementation details.

Why it works

Per GitHub's agent mode overview, the loop works because the language model reasons about the next step and issues tool calls to gather information or act — reading files, editing, running terminal commands. After each edit or command, agent mode inspects syntax errors, terminal output, test results, and build failures to decide how to course-correct. Deterministic feedback signals from the compiler, linter, and tests anchor the loop. The more structured the signals, the faster it converges.

When this backfires

Agent mode degrades when the feedback loop is weak or the task exceeds its context window:

Example

This example shows agent mode's edit-run-fix loop. Open a project in VS Code with Copilot, switch to agent mode in the Copilot Chat panel, and submit a prompt like:

Migrate the user authentication module from express-session to JWT. Update all routes, add token refresh logic, and fix any test failures.

Copilot responds by reading the affected files, proposing changes across the codebase, running the test suite, and looping back on failures — without asking for step-by-step confirmation. A representative trace looks like:

[agent] Reading src/auth/session.ts, src/routes/user.ts, tests/auth.test.ts
[agent] Proposing changes to 4 files
[agent] Running: npm test
[agent] 2 tests failed — fixing token expiry handling in src/auth/jwt.ts
[agent] Running: npm test
[agent] All tests passing

For complex migrations, enable planning mode first — Copilot shows the full plan before touching any files. In VS Code, this is available via the #plan directive in the prompt:

#plan Migrate express-session to JWT across the auth module

Review the plan, approve, and then Copilot executes all steps.

Key Takeaways

  • Agent mode is the local, synchronous counterpart to the async coding agent
  • It iterates autonomously: edit, run, check, fix — without step-by-step approval
  • Planning mode adds transparency for complex multi-step tasks
  • Generally available across VS Code, JetBrains, Eclipse, and Xcode
Feedback