Blog

GitHub Copilot: Custom Agents

The Hidden Cost of Serverless Sprawl

A single AWS Lambda function is trivial to manage. But when you scale a serverless application across dozens of developers, a massive hidden cost emerges: codebase sprawl. Left unchecked, developers naturally bring their own personal styles, folder structures, and dependency management preferences.

When you are evaluating or maintaining a massive serverless footprint, inconsistency is a liability. You need an automated way to enforce enterprise guardrails—without slowing developers down.

To solve this, I designed a custom GitHub Copilot Agent to evaluate source code locally against our strict organizational standards before a commit is ever made.

Encoding Enterprise Standards into AI

In this specific enterprise environment, each Python Lambda function lives in a dedicated Git repository with its own distinct CI/CD workflows and Infrastructure as Code (IaC). The goal for the Copilot Agent was straightforward: aggressively enforce a uniform baseline across every single repo.

The agent is instructed to audit against four non-negotiable standards:

  • Dependency & Project Management: Standardized pyproject.toml using uv.
  • Testing Requirements: A hard minimum of 80% unit test coverage.
  • Code Quality: A strict pylint score of 8.0 or higher.
  • Directory Structure: A heavily enforced, identical folder layout across all repositories.

The Bare-Metal Lesson for Modern Serverless

This strict standardization is a lesson I carry from my early sysadmin days managing hundreds of bare-metal physical servers. Back then, every server was jumpstarted with an identical baseline configuration. When a system broke at 2 AM, troubleshooting was significantly faster because you knew exactly where every log, config, and script lived.

The exact same principle applies to modern serverless codebases. When a Sev-1 incident occurs, your engineers should not have to waste cognitive energy deciphering a bespoke folder structure.

Global Distribution and “Shift-Left” Governance

After iteratively prompting the agent with our repository guidelines, the results were highly deterministic. When a developer runs the agent against an out-of-standard repository in their IDE, it immediately identifies the architectural gaps and provides tailored code remediations.

To distribute this governance across the enterprise, the agent was deployed globally by placing the .agent.md file in a central .github-private repository (specifically under .github-private/agents/). This allows any Python developer across any team to instantly access the organization’s standard.

The Unit Economics of Shift-Left AI

It is true that evaluating code locally via Copilot consumes API tokens, and at enterprise scale, those tokens add up. However, an architect must look at the unit economics of the entire pipeline. Trading fractions of a cent in LLM tokens to prevent spinning up expensive enterprise GitHub runners for doomed builds yields immediate ROI. More importantly, it eliminates the most expensive waste in the engineering lifecycle: highly paid developers sitting idle waiting for a pipeline to fail on a linting error.

The Bottom Line: Stop Using CI as a Spellchecker

While your CI/CD pipelines must always serve as the definitive quality gate for static analysis and coverage, relying on GitHub Actions to catch basic linting or structural errors is an expensive anti-pattern.

Pushing this evaluation into the IDE via a centralized GitHub Copilot Agent saves thousands of hours of developer wait time, prevents context-switching, and drastically reduces unnecessary compute costs on your enterprise GitHub runners.



With over two decades of systems experience, I’m passionate about designing Internal Developer Platforms (IDPs) that build enterprise guardrails right into the developer workflow and accelerate time-to-market. I’m always looking to connect with other engineering leaders navigating these same scaling bottlenecks. If your team is trying to optimize CI/CD pipelines, integrate AI governance, or reduce developer friction, feel free to reach out—I’m always happy to talk shop and swap architectural strategies.