🗃️ Unboxing Github Copilot Agent mode
We’ll use GitHub Copilot Agent mode to build a developer productivity feature for analysing failing test stack traces and grasp the nuances as we vibe code our way
Github Copilot recently announced the general availability of Agent mode
Agentic AI, Agents, and MCP (Model context protocol) have been buzzwords that have filled much of the Internet and social media chatter in the past few months. Among all the hype about its capabilities, it’s hard to separate noise from signal.
In this blog, I’ll explain these technologies and how we can use them practically in our day-to-day software engineering workflow in simple, non-marketing language for real software engineers.
Let’s dive right in. 🥽
Agent mode for beginners 🤔
The usage aspect of Agent mode is similar to Edits or chat.
You specify a prompt and let the LLM do its thing, but let’s take a deeper look at these different terms, concepts, and capabilities that this new mode brings and try to form a good mental model
What is Agent mode?
And how is this different from GitHub Copilot Edits or Copilot chat?
All perfectly valid questions.
Agent mode can be thought of as a more powerful version of Copilot Edits that:
Can use tools to achieve tasks that require more planning
Understand and reference multiple files in your codebase without having to specify them manually
Create and run tests with your permission
Running commands on the terminal
It does this while putting the developer in control to review and approve different stages, such as which tools to use, accept, or reject changes, etc.
Tools here can be thought of as a function that exposes some capability from an Application, CLI, API, or data source. They can be used to achieve a certain task by leveraging the model context protocol (MCP). A simple example could be reading a file and writing a file in your own codebase.
What is MCP?
A couple of helpful analogies that I find helpful when thinking about MCP
MCP is like the USB-C port for AI applications
It supports a more plug-and-play way of working with AI, wherein you or Agent can add a relevant MCP server to make it easier for your AI model to talk to and leverage its capabilities to complete a certain task
MCP also helps reduce hallucination problems to a certain degree for LLMs (Large language models), as they now provide a more deterministic and efficient way to work with different tools and resources
The community has already picked up this idea and started producing a bunch of MCP servers for different existing applications to support LLM-driven development, along with OpenAI
What does a MCP server look like in practice, and should you care?
For the most part, discovering relevant tools and MCP is something that Agent mode itself may take care however, if you are deeply engrossed in the domain and know that what you are trying to build would require a certain specific MCP server, you could also add those while initiating the session
You can refer to the GitHub MCP server README to understand what GitHub functionality is exposed.
In practice, it looks like a function wherein the parameters are specified with their data type, and whether a field is required/optional
get_issue - Gets the contents of an issue within a repository
owner: Repository owner (string, required)
repo: Repository name (string, required)
issue_number: Issue number (number, required)
get_issue_comments - Get comments for a GitHub issue
owner: Repository owner (string, required)
repo: Repository name (string, required)
issue_number: Issue number (number, required)
We can do a deeper dive in MCP later, but for now, this basic intuition is good enough.
What would a workflow look like with Agent mode as a developer?
Prompt: Come up with an idea and a detailed prompt for what you want to achieve. – It could be an enhancement of an existing feature to add a new capability, add test coverage for a particular area, etc
Server: Add relevant MCP servers that provide said capabilities, or let Agent mode autodiscover it. – For example, if you are building a CI/CD feature, and you want to leverage the underlying CI tool, you can add an MCP server for that tool, like Jenkins, GitHub Actions, etc
Instructions: Add relevant instructions in a custom_instructions.md file to highlight rules, for example. You can say add a changelog of every change that you made to keep track of what the last change made by Agent mode was.
Execution: Let Agent mode go off and execute on your idea, review the suggestions for accuracy, and only merge changes that make sense.
Fine-tuning: Take control back and edit or refactor the code further before shipping it.