Skip to main content
In this guide, we explore GitHub Copilot Agents and demonstrate how to control context in your prompts for more precise AI assistance.

What Are Copilot Agents?

GitHub Copilot Agents are domain-specific assistants you can summon in the chat interface by typing @ followed by their names. Each agent is optimized to access relevant contexts—such as your workspace files, terminal history, or editor settings—to deliver tailored suggestions and code snippets. These agents use advanced natural language processing (NLP) to understand your requests and generate contextually accurate responses.
The image explains how Copilot agents operate, detailing their functionality and features, including triggering by "@" mentions, specialized knowledge, information analysis, and natural language processing. It also shows a list of commands in a chat interface.
Each agent has unique training data and access scopes—choose the right one for your task to get the best results.

Accessing and Invoking Agents

To view all available agents, type @ in the Copilot chat prompt. A dropdown menu will list every agent you can interact with. Simply select an agent by typing @agent-name. For example:
For optimal responses, frame your query according to the agent’s expertise.
The image is a guide on accessing and invoking agents, detailing steps to type "@" in the chat prompt, select an agent, and frame a question for the agent's expertise.

Common Agents and Their Domains

The image lists common agents and their purposes, including @workspace, @terminal, @vscode, @azure, and @github, each with a brief description of their functions.

Agents in Action: Mention-Based Workflow

Below is a step-by-step example of how to use mention-based agents in Visual Studio Code:
  1. Open Copilot Chat (Ctrl+Shift+P → Copilot: Open Chat)
  2. Type @workspace and ask a question:
    The agent will scan your entire project and highlight relevant functions. For instance:
  3. Switch to the Terminal agent to install and run the app:
    If you encounter an indentation error:
    Correct the indentation and rerun to launch the Pygame traffic light simulator.
  4. For editor-specific queries, use the VS Code agent:
    It will direct you to Settings > Editor > Copilot.
  5. Generate tests across your codebase with Workspace:
    This produces comprehensive unit tests rather than file-scoped ones.

Experimental Agent Mode

GitHub Copilot’s experimental Agent Mode lets Copilot autonomously suggest code, edit files, and run terminal commands. This mode can significantly accelerate repetitive tasks.
The image shows a GitHub Copilot interface in a code editor, with options for chatting about code and editing with Copilot in experimental agent mode.
To enable Agent Mode:
  1. Click the Agent Mode toggle in the lower-right corner of VS Code.
  2. Request a new project scaffold:
    The agent will generate a virtual environment, install Flask, and produce app.py:
    And run:
Agent Mode is experimental. Review all changes before committing to avoid unintended edits.
From here, you can ask the agent to add a database layer:
The agent will update your Flask app and execute the necessary commands automatically.

Summary

  • Mention-based Copilot Agents (@workspace, @terminal, @vscode, etc.) scan specific contexts to deliver targeted assistance.
  • Experimental Agent Mode enables Copilot to autonomously generate code, run commands, and modify files.
Leverage GitHub Copilot Agents to streamline your development workflow and boost productivity.

Watch Video