×

注意!页面内容来自https://smartscope.blog/en/generative-ai/github-copilot/copilot-cli-autopilot-mode/,本站不储存任何内容,为了更好的阅读体验进行在线解析,若有广告出现,请及时反馈。若您觉得侵犯了您的利益,请通知我们进行删除,然后访问 原网页

Skip to content

GitHub Copilot Complete Guide

GitHub Copilot Autopilot Mode — Approval-Free Autonomous Execution to Task Completion

For / Key Points

Audience: Developers and DevOps engineers using GitHub Copilot in VS Code or via the CLI

Key Points:

  • Autopilot is a permission level that bypasses all approval dialogs and runs autonomously to task completion
  • Available in VS Code as "Autopilot (Preview)" and in the CLI as --autopilot --allow-all
  • Stop conditions and cap settings prevent runaway execution

What Is Autopilot?

You issue one instructionand Copilot edits filesruns testsdetects failuresfixes themre-runs testsconfirms they passand declares completion — that's Autopilot in action.

Traditional Agent mode displays an approval dialog every time it writes a file or executes a command. Autopilot bypasses all of these approvals and runs autonomously to completion based on AI judgment.1

The key point: Autopilot is available in both VS Code and the CLI. In VS Code you select "Autopilot (Preview)" from the permission picker; in the CLI you enable it with the --autopilot flag.15 The names and UI differbut the essence is identical — automated approvals + auto-responses to AI questions + autonomous continuation to task completion.


Positioning in VS Code and CLI

Autopilot's positioning differs slightly between VS Code and CLI. The interactive diagram below shows both environments and the execution flow.

VS Code: Three Permission Levels

In VS Code's Copilot Chatyou select a permission level within Agent mode.5

Permission LevelApproval DialogsAI QuestionsAutonomous Continuation
Default ApprovalsShown each timeShown each timeNone
Bypass ApprovalsAuto-approvedShown each timeNone
Autopilot (Preview)Auto-approvedAuto-answeredTo task completion

The design is tiered. Default keeps the traditional manual approval. Bypass skips approvals only — AI questions still require human answers. Autopilot automates bothachieving full autonomous execution.

CLI: Four Operation Modes

In the CLIAutopilot is offered as a standalone operation mode.12

  • Suggest — code completion onlyno chat
  • Interactive — waits for human approval at each step (default)
  • Plan — builds an implementation plan before executing
  • Autopilot — runs to task completion from a single instruction

Press Shift+Tab to cycle modes.1 The recommended workflow is to build a plan in Plan modethen select "Accept plan and build on autopilot" to transition straight to autonomous execution.

How They Map

VS CodeCLICommon Behavior
Agent + Default ApprovalsInteractiveApproval each time. Human keeps the wheel
Agent + Bypass Approvals--allow-allApprovals skipped. Questions still stop
Agent + Autopilot (Preview)--autopilot --allow-allFully automatic. Runs to task completion

Click each card in Panel 1 of the widget to see detailed descriptions.


When Does It Stop? — Stop Conditions and Safety Design

Because Autopilot runs autonomouslythe design of "when it stops" matters critically. There are four stop conditions.1

  1. Task complete — the AI determines the task is finished
  2. Blocking problem — an unresolvable issue (insufficient permissionsdependency errorsetc.) is detected
  3. Manual interrupt — the user presses Ctrl+C (or the Stop button in VS Code)
  4. Limit reached — the CLI's --max-autopilot-continues step cap is hit

The CLI's --max-autopilot-continues flag is especially important and strongly recommended for CI/CD pipelines and scripted execution.1 It's a physical safety valve against infinite loops.

Permission Decision

When entering Autopilot in the CLIthree options are presented.1

  • Grant all permissions (recommended) — allow all file editscommand executionand URL access
  • Continue with limited permissions — automatically skip operations requiring approval
  • Cancel

With limited permissionsevery file write or test execution that needs approval gets auto-skippedleaving tasks incomplete. VS Code's Autopilot (Preview) defaults to full permissionsso this decision is unnecessary there.

Try the slider and toggle in Panel 3 of the widget to see how these settings affect behavior.


How Does Cost Change? — Premium Request Consumption

Autopilot follows the same billing principle as standard mode. Each user prompt and each AI continuation step consumes premium requests.1

Internal tool calls (file read/writeterminal execution) themselves are not billed. What's consumed is each "continuation step" where the AI model performs inference.

AspectStandard ModeAutopilot
Billing triggerEach time user hits EnterAutomatically per continuation step
Internal tool operationsNot billedNot billed
Cost predictabilityHigh (user-controlled)Low (AI-driven)
Cap mechanismNone (user self-limits)CLI: --max-autopilot-continues

Play the animation in Panel 4 ("Cost Comparison") of the widget to intuitively see how consumption patterns differ.

Practical Cost Control

Three approaches help manage unpredictable consumption.

  • CLI: --max-autopilot-continues sets a physical cap (e.g.10 steps)
  • /model command checks the current model and its multiplier before execution1
  • Auto model selection (0.9 coefficient) provides a permanent 10% discount4

With the CLI's --max-autopilot-continues 10the worst case is model multiplier x 11 requests (initial + 10 continuations). Even with Opus 4.6 (3x)that caps at 33 requests.


How It Differs from Claude Code auto-mode

Copilot's Autopilot and Claude Code's auto-mode both offer "autonomous execution." Howevertheir permission and stop designs diverge.

Comparison AxisCopilot AutopilotClaude Code auto-mode
Permission modelVS Code: 3-tier permission picker / CLI: --allow-all--dangerously-skip-permissions for full grant
Stop conditionsAI judgment / blocking problem / Ctrl+C / step capAI judgment / Ctrl+C / context limit
Cap settingCLI: --max-autopilot-continues NNo explicit step cap (time-based throttling)
Cost modelPremium requests x model multiplierFlat subscription ($20/month+) with time-based limits

The design philosophy is clear. Copilot stops by count; Claude Code throttles by time. Copilot charges per stepmaking step caps rational. Claude Code's flat pricing removes the incentive for step limits.

This isn't about which is better — it's about matching tools to tasks. Well-defined tasks (adding testsrefactoringfixing CI) suit Autopilot. Exploratory development fits Claude Code's flat modelwhere consumption anxiety doesn't constrain iteration.


Getting Started

Enabling Autopilot in VS Code

  1. Open the Copilot Chat panel
  2. Select Agent mode
  3. Choose "Autopilot (Preview)" from the permission picker5
  4. Send your prompt

That's all it takes to start approval-free autonomous execution. You can also change the default permission level via VS Code settings.

Switching Mid-Session in the CLI

# Start normally
copilot

# Press Shift+Tab to cycle through modes
# Suggest → Interactive → Plan → Autopilot

Starting Directly in Autopilot via CLI

# Autopilot + full permissions + 10-step cap
copilot --autopilot --allow-all --max-autopilot-continues 10 \
  "Refactor everything under src/"

CI/Script Automation

# Programmatic execution (no interactive UI)
copilot --autopilot --yolo --max-autopilot-continues 10 \
  -p "Increase test coverage to 80%+"

The -p flag passes a prompt directlybypassing the interactive UI.1 Always set --max-autopilot-continues when embedding in CI pipelines.


Knowing When to Use It

Autopilot shines on tasks with clear goals and limited scope.1

  • Adding or fixing tests (against existing code)
  • Refactoring (renamingtype cleanupstructural changes)
  • CI/CD fixes (resolving build errors)
  • Batch code generation (CRUDboilerplate)

It's poorly suited for exploratory development with vague goalsdesign work requiring nuanced judgmentand open-ended feature development.1 For thoseDefault Approvals (VS Code) or Interactive (CLI) keep human hands on the wheel — and incidentally prevent wasting premium requests.


Summary

  • Autopilot works in both VS Code and CLI — VS Code via the permission pickerCLI via the --autopilot flag
  • The essence is "approval bypass + autonomous continuation" — not just skipping approval dialogs but also auto-answering AI questions to run to task completion
  • Safety is tiered — VS Code offers 3 permission levelsthe CLI uses --max-autopilot-continues for step caps

Autopilot isn't a "delegate-everything mode." The value of autonomous execution lies in choosing the right tasks to delegate and configuring appropriate safety valves. Start with Default Approvals to get comfortable with Agent modelearn the nature of your tasksand graduate to Autopilot when ready — that staged approach is the most practical.