The GitHub Blog 前天 03:23
Agent mode 101: All about GitHub Copilot’s powerful mode
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

GitHub Copilot Agent Mode 是一种自主的实时协作工具,它能够根据自然语言提示执行多步骤的编码任务。简单来说,它理解你的意图,构建解决方案,并不断迭代直到达到目标。Agent Mode 可以分析代码库、规划和执行多步骤解决方案、运行命令或测试,并与外部工具交互。它通过自主循环运行和改进工作,包括规划、应用更改、测试和迭代。通过结合 Agent Mode 和模型上下文协议 (MCP),LLM 的知识可以扩展到你的服务和数据源。

✨Agent Mode 是 GitHub Copilot 的一种模式,能够自主迭代代码,识别并自动修复错误。它通过系统提示,不断迭代自身的输出,直到达到最终状态。

🛠️Agent Mode 的核心是作为多种工具和变量的协调者。当用户向 Copilot Agent Mode 发送自然语言提示时,系统会在后台进行增强,包括用户的查询、工作区的摘要结构、机器上下文和工具描述。

🚀Agent Mode 带来了 agentic 工作流,可以对工作流程中的任何数量的任务提供实时的同步帮助。开发者可以选择让 agent 自行完成任务,也可以逐步引导它,Copilot 始终作为辅助。

💡Agent Mode 可以用于重构代码、将项目迁移到另一种编程语言或技术栈、编写测试、现代化遗留代码、自动修复代码生成错误、向应用程序添加新功能、构建新应用程序的原型等。

⚙️Agent Mode 可以与其他 GitHub Copilot 功能结合使用,例如自定义指令。通过自定义指令,可以指定 Copilot 使用特定的测试框架,以及单元测试的指导方针和框架。

Last month, we released agent mode as a step toward building GitHub Copilot into a system that not only works with you, but works for you. When you give it a natural-language prompt, Copilot’s agent mode works to execute it on your behalf, automating processes and workflows that would otherwise take a lot of time and giving you space to focus on higher-level problem solving.​ 

For those who are newer to coding, agent mode can be a useful synchronous tool when it comes to developing an app (whereas our new preview of coding agent in Copilot offers asynchronous task completion capabilities). But it’s equally, if not more so, an incredibly useful tool for more seasoned developers looking to work faster. With agent mode, you can quickly move from prompting Copilot with a higher-level requirement to testing out a prototype. Plus, we’re still seeing new use cases unfold among developers of all levels. 

Let’s take a closer look at what agent mode is, how it works, and how you can use it. 

But first, what is GitHub Copilot agent mode? 

GitHub Copilot agent mode is an autonomous and agentic real-time, synchronous collaborator that performs multi-step coding tasks based on natural-language prompts. More simply, it’s a problem solver that understands your intent, builds a solution, and iterates until it gets it right. 

Agent mode can:

Rather than just responding to requests, agent mode actively works toward your goal. You define the outcome, and it determines the best approach—seeking feedback from you as needed, testing its own solutions, and refining its work in real time. And as it operates, you can see its reasoning, decision-making process, and the tools it uses.

Whether you want Copilot to analyze your code base, propose file edits, or run tests, agent mode allows Copilot to complete all the necessary subtasks on its own. 

On top of that, agent mode enables Copilot to quickly recognize errors and fix them automatically. 

Here’s how agent mode compares to some of our other AI coding tools: 

ToolWhat it is
Agent modeA mode where Copilot is capable of iterating on its own code, recognizing errors, and fixing them automatically
GitHub Copilot coding agentAn autonomous SWE agent that asynchronously works on your behalf to do everything from resolving issues to solving for human feedback 
Code completionA Copilot feature that offers autocomplete-style suggestions in supported IDEs 

How does agent mode in GitHub Copilot work?

At its core, agent mode works as an orchestrator of several different tools and variables (e.g., your prompt and workspace) through a system prompt that tells Copilot to keep iterating on its own output until it reaches a final state. 

When you send a natural-language prompt to Copilot agent mode, it’s augmented by our backend system prompt. This includes your query, a summarized structure of the workspace, machine context, and tool descriptions.

Here’s a breakdown of what happens when you use Copilot agent mode: 

After it runs commands and applies edits, agent mode works to detect syntax errors, terminal output, test results, and build errors. Based on the results, it then determines how to course-correct, whether that’s by making additional edits, terminal commands, or performing tool calls.

The LLM has an ever-expanding set of tools to call, each with capabilities that help Copilot complete the task—and you’re in charge of which tools you want agent mode to use. Each tool, such as read_file, edit_file, and run_in_terminal, gives Copilot detailed instructions on how and when to use it. These tools allow Copilot to search your workspace, read file contents, run terminal commands, get errors from the editor and apply proposed changes, and more.

You’re not limited to just built-in tools. You can extend agent mode’s capabilities by installing more specialized tools from Model Context Protocol (MCP) servers or extensions. MCP is an open standard that enables AI models to interact with external tools and services through a unified interface. We recently announced the GitHub MCP server, which allows you to:

Combining the power of agent mode and MCP means that the LLM’s knowledge expands even further once connected to your services and data sources. ✨

What can I do with GitHub Copilot agent mode? What are some use cases?

Agent mode brings an agentic workflow to GitHub Copilot, offering real-time, synchronous help across any number of tasks in your workflows. 

Whether you let the agent take the idea and run with it, or you lead it each step of the way and control the path, you’re in the driver’s seat with Copilot as your, well, copilot.  

In my personal experience, agent mode has been a game-changer for starting small projects and proof-of-concepts from scratch. When I needed to modernize our open source history visualization scripts, I put agent mode to the test with both GPT-4o and Claude 3.7 models. The results were remarkable—it transformed our basic matplotlib histograms into sophisticated, SVG-based animated line charts with minimal guidance. What truly impressed me was seeing Copilot produce a perfect SVG histogram on its first attempt. This intelligent assistance not only accelerates development but has fundamentally transformed how I approach both prototyping and refactoring.

Zhe-You Liu, Apache Airflow Committer

Here are some ways we’ve seen developers inside and outside GitHub use agent mode:

One important thing to note: Copilot is powered by LLMs, which are nondeterministic, and that means its suggestions may differ even with the same prompt and context.

What are related tools and features that complement the use of agent mode?

Agent mode is powerful, but you can extend its capabilities by combining it with other features in GitHub Copilot. For instance, you can give Copilot custom instructions so all of its responses fit your day-to-day coding practices, tools, and developers workflows. 

At GitHub, we often use custom instructions to give Copilot specific testing frameworks to use, as well as guardrails, frameworks, and instructions for unit testing. This allows you to customize how Copilot codes for you in agent mode, similar to giving instructions to one of your peers. 

You can also use other Copilot Chat modes, like edit mode and ask mode. 

ModeWhat you can do with itA use case
Edit modeEasily make edits across multiple files in your codebase.Apply code edits directly in your project for implementing a new feature, fixing a bug, or refactoring code.
Ask modeAsk Copilot questions for a better understanding of your codebase or technology concepts.Learn how a piece of code works, brainstorm ideas for software, or discover new technologies.
Agent modeStart an agentic, autonomous coding workflow that delivers your desired result with minimal guidance.Implement high-level requirements for a new feature or project through agent mode, which identifies and applies necessary changes automatically.

Take this with you

Like working with any other developer, the more context you give and the more specific you are about your intended outcome, the better results you’ll get from GitHub Copilot—and that’s particularly true with agent mode. It needs the right tools to do the right work, but by feeding agent mode custom instructions to tailor it to your coding preferences or extending its capabilities via MCP integrations, it can fit your specific style of building software. 

As with anything powered by LLMs, agent mode’s suggestions benefit from having you in the pilot’s seat to review code, and make sure things work as expected. But what’s so remarkable about agent mode is that you can use it exactly the way you want. It’s your peer programmer, which means that if you want to use it to build a prototype app, work with an existing codebase, or have it answer questions and automate lower-level parts of your workflow, you can. It’s up to you. Happy building!

Looking to try agent mode? Learn more about GitHub Copilot features or purchase your plan today.

More resources to explore:

The post Agent mode 101: All about GitHub Copilot’s powerful mode appeared first on The GitHub Blog.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

GitHub Copilot Agent Mode AI 编码 自动化 LLM
相关文章