The Agent Awakens: Collaborative Development with Copilot - Christopher Harrison, GitHub

Introduction & Lab Setup 00:00

  • Christopher Harrison and John Peek, enterprise advocates at GitHub, are conducting a hands-on lab focused on developer experience with GitHub Copilot.
  • Participants are instructed to send their GitHub handle via email to gain access to the lab.
  • Due to potential Wi-Fi challenges, participants will have a couple of days to complete the lab on their own time if they cannot finish during the session.

GitHub Copilot: The AI Pair Programmer 03:10

  • GitHub Copilot is best thought of as an "AI pair programmer," where context is crucial, similar to human interaction.
  • Beyond prompt crafting, Copilot reads your code, making good function names, variable names, and well-structured code important for its understanding.
  • Comments, even if seemingly superfluous, help make code more readable for Copilot.
  • A well-navigable project structure also aids Copilot in understanding the codebase.
  • The overall takeaway is that "good code 101" practices significantly enhance Copilot's effectiveness.

Guiding Copilot for Better Results 07:17

  • To help Copilot, developers should provide clear intent and be specific in their requests, avoiding terse prompts often used with older chatbots.
  • It's important to explicitly tell Copilot any crucial information it needs to consider, rather than expecting it to infer.

Copilot Workloads and Modes 08:29

  • Code Completions: The original mode, where Copilot suggests the next line, function, or class, aiding developers "in the zone."
  • Chat: Originally single-shot questions and answers, like generating a single file.
  • Edits: Allows Copilot to edit across multiple files, addressing the need for multi-file updates (e.g., HTML, JavaScript, CSS for a webpage).
  • Agent Mode (IDE-based): Enables Copilot within the IDE to navigate projects, determine tasks, build code iteratively, run external tasks (like unit tests), and self-heal errors.
  • Coding Agent (github.com-based): A newer mode where a GitHub issue can be assigned to the coding agent, which then works in the background to figure out what needs to be done, runs scripts, self-heals, and eventually creates a pull request for review.

Hands-On Lab Instructions 11:02

  • Participants are directed to a specific GitHub URL (github.com/octo/hol-hands-on-lab) to accept an invitation to the lab.
  • After accepting, they need to navigate to gh.io/agent-sdlc-lab to start the exercises.
  • When creating their repository, the owner should be "Octo" and the repository name should be their GitHub handle.
  • The lab begins with exercises zero and one, focusing on setting up the environment and working through the initial steps.

GitHub Copilot Coding Agent & Security 30:38

  • The coding agent's goal is to act as an AI pair programmer, taking a GitHub issue and beginning work on it.
  • Providing detailed context in the issue description (requirements, potential workflows) is crucial for the coding agent.
  • The agent works within a specific environment defined by a "copilot setup steps" workflow, which installs necessary services and packages.
  • Security is a major focus:
    • By default, the coding agent is firewalled and does not have internet access, including for installing frameworks or libraries, unless explicitly opened.
    • It runs in an ephemeral GitHub Actions space, limiting its access to other resources.
    • It does not have write access to the main repository; it can only modify the branch it creates.
    • Pull requests created by the agent are in draft form and require manual approval to run workflows (like security checks, unit tests).
    • By design, the person who assigns an issue to the coding agent is not allowed to review its work; a different person must perform the review.

Q&A: Iteration and Customization 35:49

  • Copilot can iterate on its work: adding a comment to an issue (e.g., "also add an endpoint to search for games by name") will trigger a new session where Copilot builds upon its previous work.
  • The coding agent currently does not work with self-hosted runners.
  • Copilot cannot be leveraged to perform actions on another company's codebase via a GitHub application; it needs to operate on a repository that the user owns.

Q&A: Improving AI Output with Context 40:13

  • If Copilot produces incorrect or unexpected output, several approaches can be taken:
    • Add a clarifying comment to the issue to provide more context or specific instructions.
    • If the output is completely wrong, unassign Copilot, modify the issue, and then reassign Copilot to start from scratch.
    • Analyze why it got it wrong, often due to insufficient context about the request or the working environment.
  • copilot-instructions.mmd files provide additional context to coding agent and chat requests, outlining app introduction, code standards, required pre-commit checks, global language guidance, and repository structure.
  • Model Context Protocol (MCP) servers allow Copilot to access external data and perform operations on the user's behalf, extending beyond its training set.

Q&A: DevOps Flow and Advanced MCP Usage 52:21

  • AI does not change the fundamental DevOps flow; manual code reviews, linters, security scans, and unit tests are still essential safeguards for code quality and security.
  • While Copilot may work on specific files, there's no guarantee it will only modify that file in agent mode; for precise, single-file changes, edit mode or ask mode in the IDE might be more suitable.
  • Code generated by Copilot is probabilistic, meaning it might not always be exactly as desired, but the generated branch can be manually edited or further refined by Copilot with new comments.
  • MCP servers can access remote servers and act on behalf of the user, with connection credentials (e.g., tokens) allowing for expiration settings.
  • MCP servers do not automatically act; the user must indicate intent, and a prompt to approve workflow runs appears. Vetting MCP servers is crucial.
  • copilot-instructions.mmd files can reference other instructions files and apply to specific folders or file patterns (e.g., .jsx, .tsx, .svelte), providing consistent guidance for code generation.
  • Instructions files should be treated as artifacts of the repository, updated as needed to maintain productivity and ensure generated code aligns with desired patterns.
  • Consistency in instructions and context provided to Copilot is vital to avoid "mixed messages" and ensure predictable behavior.
  • MCP server configurations can be set at the organization or repository level, with variables for centralization, but users still need to set up their own credentials.
  • When using MCP servers with agent mode, it's beneficial to specify which MCP server to use in the instructions file if a specific scenario requires it.