Using GitHub Copilot Background Agents

1 minute read

GitHub Copilot Background Agents

Recently, I had the opportunity to try out GitHub Copilot Coding Agents (Background Agents) on one of my personal projects: the terraform-aws-backup module. This module is designed to help users manage AWS Backup plans using Terraform.

The Problem

A user opened an issue requesting support for multiple backup plans per vault. This required a significant refactor of the module, as it previously only supported a single plan per vault. I decided to assign the issue to Copilot to see how well it could handle a real-world infrastructure-as-code (IaC) refactor.

GitHub Issue Assignment

The Copilot Solution

Copilot Background Agents picked up the issue and proposed a pull request (PR #115) that introduced a new plans variable (a map of maps) to support multiple backup plans. The PR included all necessary code changes, documentation updates, and maintained backward compatibility with the previous single-plan approach.

I interacted with Copilot directly through GitHub, asking questions and requesting changes. For example, I verified backward compatibility and reported an edge case related to Terraform state migration. Copilot responded to my comments, addressed the issues, and updated the PR accordingly.

Copilot PR Conversation

Highlights

  • End-to-end automation: Most of the process happened within GitHub, with minimal human intervention.
  • Speed: The entire refactor and review process took about 35 minutes, with Copilot handling the bulk of the work in just 13 minutes.
  • Device flexibility: I managed the process from my iPad mini using Arc, without needing a local IDE.
  • Iterative feedback: Copilot handled multiple rounds of feedback, including error reports and code adjustments.

Drawbacks

  • Model selection: There was no option to choose which AI model Copilot used for the task.
  • Testing required: As with any automated code generation, manual testing and validation were necessary before merging.
  • Image handling: Copilot could not read images pasted in comments, so error messages had to be provided as text.

Conclusion

GitHub Copilot Background Agents proved to be a valuable tool for unattended, automation-friendly tasks like module refactoring. While it’s important to test and validate the generated code, Copilot can significantly accelerate development workflows, especially for infrastructure code.

References

Leave a Comment