Skip to main content
This lesson explains GitHub Copilot “agents” — the @-mention scoped assistants inside Copilot Chat — and shows how to control context in your prompts. You’ll learn how to invoke agents, which contexts they can access, and see practical examples (including a small Pygame demo and a Flask scaffold) that illustrate typical agent workflows. What are Copilot agents?
  • Agents are addressable by @ mentions in the Copilot chat (similar to tagging a person).
  • Each agent is configured with specialized knowledge and access to specific contexts (for example: workspace files, open editor, or terminal output).
  • When invoked, an agent inspects the contexts it can access and uses natural language processing to produce contextually appropriate responses.
How to invoke an agent
  • Type @ in the Copilot chat prompt.
  • Select the agent by name (for example, @workspace).
  • Frame your question for the agent’s domain to get the best results (e.g., ask @terminal shell- or environment-specific questions, and @vscode questions about Visual Studio Code settings).
  • Agents limit their reasoning to the contexts they can access, so tailored prompts lead to more useful answers.
Agents can access the data sources you permit (workspace files, open editor, terminal). Do not share secrets or sensitive data in prompts and review agent-suggested edits before applying them.
Common mention examples
A dark presentation slide titled "Usage" with a highlighted "Accessing and Invoking Agents" banner. Below are three blue rounded boxes explaining: type "@" to see available agents, select one by typing its "@name", and then frame your question for that agent.
Common agents and scopes
  • @workspace — understands project structure, dependencies, and code relationships.
  • @terminal — helps with command-line operations, shell commands, and terminal tools.
  • @vscode — specializes in Visual Studio Code features and settings.
  • @azure — preview agent for Azure services, deployments, and configs.
  • @github — GitHub-specific Copilot skills and platform integrations.
A slide titled "Common Agents and Their Purposes" shows five agent cards: @workspace, @terminal, @vscode, @azure, and @github. Each card gives a short role summary (project structure/dependencies, terminal commands, VS Code features, Azure deployments/config, and GitHub Copilot integrations).
Agents in action — walkthroughs and code Below are consolidated, corrected examples pulled from a demo project (a minimal Pygame simulation of a 4-way traffic intersection) and typical workflows you might use with Copilot agents. These examples are arranged so workspace/terminal/vscode agents can reference the same small set of functions and constants.
  1. Pygame simulation — relevant portions
This concise excerpt contains the constants and functions referenced by the agents. Use it as a minimal context sample so agents can reason about your project.
Traffic light drawing helper
Example deterministic light-state function
Minimal main loop skeleton
  1. VS Code Copilot Chat experimental setting
If you want Copilot Chat to open in a dedicated chat view in VS Code, this example setting places the “Ask Chat” command into the chat view:
  1. Terminal and virtual environment workflow
Typical terminal commands an agent might suggest for setting up a Python virtual environment and installing Pygame:
When launching a Pygame program, you may see a startup message like:
  1. Agent mode (experimental) — example Flask flow
Some Copilot experiences include an “agent mode” that can autonomously propose multiple edits, create files, or run terminal commands. Below is a minimal Flask app an agent might scaffold:
Commands an agent might run to scaffold and run the Flask app:
Typical Flask dev-server output:
Agent mode is currently experimental in some VS Code previews. It can perform file edits and run terminal commands on your behalf — review suggested changes before accepting them.
Notes on scope and exam relevance
  • GitHub Copilot scoped agents (@workspace, @terminal, @vscode, etc.) operate within defined contexts and are useful for targeted assistance related to those contexts.
  • “Agent mode” is a higher-level, more autonomous experience (can create files and run commands). It is typically separate from the per-domain agents and may be in preview; confirm whether it is covered in exam or course materials.
  • When preparing for assessments, focus on the behavior and limits of the per-domain agents unless the exam explicitly includes experimental agent mode capabilities.
Best practices for prompting agents
  • Mention the agent explicitly: start a prompt with @workspace or @terminal to route the question.
  • Provide minimal, relevant context in your prompt (file path, function name, error output).
  • Ask for step-by-step actions when requesting changes that affect multiple files or commands.
  • Review and test any code or terminal commands that an agent suggests before accepting them.
Summary table — common agent tasks Links and references That covers the core concepts, invocation patterns, and practical examples for using GitHub Copilot agents and the experimental agent-mode experience. Use the examples above as a template for agent-assisted development workflows and adapt prompts to the specific contexts your agents can access.

Watch Video