Piloting agents in GitHub Copilot - Christopher Harrison, Microsoft

Housekeeping and Session Overview 00:00

  • The session is at full capacity with another identical lab scheduled for later in the day.
  • Attendees must accept a GitHub organization invitation via their associated email to gain access to GitHub Copilot.
  • The same lab will run at 3:30 PM for those who couldn't join the current session.
  • GitHub Copilot access is required, and participants must ensure their invitations are accepted.
  • Devices should be silenced, and phone calls taken outside the room.
  • The lab will proceed with a mix of presentation and hands-on exercises, aiming to cover as much as possible in the allotted 73 minutes.

Introduction to GitHub Copilot and Context 03:50

  • GitHub Copilot is described as an "AI pair programmer" that collaborates like a human partner, with strengths and weaknesses.
  • The session covers various Copilot modes: agent mode (local), edit mode, ask mode, and the new Copilot coding agent announced at Build.
  • Emphasis on the importance of context when interacting with Copilot: code readability, clear naming, comments, and project structure aid Copilot's understanding.
  • Good context can be provided through clear prompts, detailed comments, structured projects, and instruction files.
  • Clarity and specificity in instructions to Copilot are encouraged, moving beyond terse, command-like prompts.

Copilot Workloads and Modes 10:16

  • Copilot offers several workflows:
    • Code completion: Inline coding assistance for next lines, functions, or blocks.
    • Chat and Edit modes:
      • Chat (Ask) for explanations or file creation.
      • Edit for making changes across multiple files in one shot.
    • Local agent mode: Copilot explores, finds files, builds code, runs tests, and can self-heal failed states.
    • Copilot Coding Agent: Issues can be assigned to Copilot, allowing asynchronous work on repository tasks.
  • Copilot Coding Agent requires either Copilot Pro Plus or Enterprise for issue assignment; the rest can be used with Copilot Free.

Setting Up the Lab and Instructions 15:10

  • Participants follow a GitHub repository README for lab instructions:
    • Environment setup, issue assignment, configuring external services, providing context to Copilot, completing a sitewide update, and reviewing Copilot’s work.
  • Lab uses GitHub Codespaces—no local installation required.
  • Clarified how to create the repository: correct organization (Octo) and using the participant's GitHub handle as the repo name.
  • Attendees start exercises, with instructors available for help, though there are only two facilitators for about 80 participants.

Q&A: Copilot Agent Modes and Alternatives 21:12

  • “Vibe coding” refers to agent-driven modes where Copilot drives the operation.
  • The presenter is not able to compare Copilot to alternatives like Cursor, Windsurf, or Cascade, as he is unfamiliar with their features.

Copilot and External Data Sources, Model Context Protocol (MCP) 23:35

  • Copilot can interact with external resources (like databases) indirectly using MCP (Model Context Protocol).
  • MCP allows Copilot to access data or perform tasks via intermediate servers (examples: GitHub, Azure, Playwright, community servers).
  • Security is critical: use only trusted MCP servers or create your own.
  • To help Copilot write good database queries, provide DDL (data definition language) or database schema in the context/instruction file.

Copilot Coding Agent in Practice 29:50

  • Copilot Coding Agent works asynchronously: assign an issue and Copilot completes the task, using all provided context.
  • Detailed, explicit prompts and instruction files (copilot-instructions.mmd) improve task outcomes.
  • Instruction files contain coding standards, language guidance, project and repository information, and can be reused from existing documentation.
  • The agent uses GitHub Actions to run and is given an environment set up by dedicated workflow files.
  • All actions are visible; Copilot’s PRs and sessions can be reviewed for transparency.

Advanced Instructions and Automation 36:02

  • copilot-instructions files are supported in both chat and coding agent modes.
  • Organization-level instruction files and Copilot Spaces (where repositories or knowledge bases are pointed to by Copilot) support scaling standards and documentation.
  • Task-specific instruction files can be applied conditionally based on file patterns (e.g., React component patterns).
  • Creating thorough instruction files is initially time-consuming but pays off in long-term productivity and code quality.

Security, Permissions, and Workflow Integration 44:44

  • Copilot’s agent runs in GitHub Actions’ ephemeral spaces with limited rights:
    • Read access to repo, write access only to dedicated branches.
    • No external calls unless explicitly allowed (e.g., for package installation).
    • Custom setup steps must be handled in dedicated workflows.
  • PRs generated by Copilot don’t run organization workflows until a human triggers them, maintaining standard DevOps validation processes.

DevOps Practices and AI 50:03

  • Introducing AI doesn’t remove the need for established DevOps fundamentals:
    • Code reviews, automated tests, and security scans remain necessary.
    • Copilot runs some tests locally, but human review and workflow validation are always required.
  • Prompts or instruction files can be used to direct Copilot to run subsets of tests as needed for large codebases.

Integrations and Limitations 52:04

  • Copilot supports remote MCP servers, but requires configuration (firewall rule) to access external services.
  • Currently, task/issue assignment works only with GitHub issues, not other systems like Jira or ADO; users can consider scripting to copy those issues into GitHub as a workaround.

Using Internal Libraries and Customization 55:02

  • To have Copilot use internal or external libraries, provide usage examples in the codebase.
  • Additional context, like APIs or libraries, can be given through instructions files or via an MCP server for broader access.
  • Copilot does not currently support model fine-tuning, as selecting “good” versus “bad” code for training is challenging.
  • MCP servers allow more granular control over what data Copilot can access or use for context.

Wrap-up and Resources 58:44

  • Lab materials are publicly available for participants to explore outside the session.
  • Acknowledgment of technical/network issues and gratitude expressed to attendees.