Inspiration
CI/CD pipelines are invisible carbon emitters. A typical organization running thousands of pipelines daily generates significant CO2 emissions, yet developers have zero visibility into this environmental impact. The rise of AI-augmented development adds hidden LLM energy costs on top. We realized that the GitLab Duo Agent Platform, combined with real-time carbon data, could turn this blind spot into an opportunity.
What it does
EcoGuardian is a 4-agent multi-agent flow that automatically analyzes any pipeline or merge request for sustainability impact:
- Pipeline Analyzer reads
.gitlab-ci.ymland job logs, extracting energy metrics and inefficiencies (missing caches, oversized images, redundant jobs) - Carbon Forecaster queries real-time grid carbon intensity via a custom MCP server connected to the Electricity Maps API, covering 230+ global zones and 21 GCP regions
- Green Optimizer generates prioritized, copy-pasteable recommendations: region switching (up to 99% carbon reduction), dependency caching, conditional execution, image optimization
- Sustainability Reporter posts a comprehensive carbon footprint report as an MR comment and auto-creates an optimization MR with improved CI configuration when savings exceed 10%
The result: quantifiable carbon savings with zero manual effort. Just mention @ai-ecoguardian on any MR.
How we built it
- GitLab Duo Agent Platform: 4-agent flow using Flows YAML v1 schema with specialized system prompts for each agent
- Custom MCP Server: Node.js server wrapping the Electricity Maps API v3, mapping 21 GCP regions to electricity grid zones with real-time and static fallback data
- SCI Scoring: Carbon calculations using the ISO/IEC 21031:2024 Software Carbon Intensity formula
- Eco-CI Integration: Pipeline energy estimation using CPU utilization and SPECpower methodology
- GCP Region Carbon Data: Carbon-Free Energy percentages and grid intensity from Google Cloud sustainability reports
Challenges we ran into
- Mapping GCP compute regions to Electricity Maps grid zones required manual research across 21 regions
- Designing agent prompts that produce consistent, structured output across different pipeline configurations
- Balancing real-time API data with static fallback for reliability when the Electricity Maps free tier has limitations
- Ensuring the SCI formula calculations correctly account for shared runner power profiles
Accomplishments that we're proud of
- 24/24 MCP server tests passing with full coverage of all 5 tools
- A single region switch recommendation can reduce pipeline carbon by 99.5% (Mumbai to Stockholm)
- The system pays for its own carbon cost: the LLM tokens used for analysis are offset within 2 optimized pipeline runs
- Clean, production-ready flow that follows the actual Duo Agent Platform v1 schema
What we learned
- The carbon intensity gap between GCP regions is enormous: 3 gCO2/kWh (Stockholm) vs 679 gCO2/kWh (Mumbai), a 226x difference
- Most CI/CD pipelines have easy wins: dependency caching alone typically saves 40% of energy
- The Model Context Protocol (MCP) is powerful for giving AI agents access to real-time external data
- Multi-agent flows on GitLab Duo enable sophisticated analysis that a single agent prompt cannot achieve
What's next for EcoGuardian
- Organization-wide carbon budgets with per-team allocation
- Automatic green scheduling: defer non-urgent pipelines to clean energy windows based on 24h forecasts
- Carbon leaderboard across projects
- Integration with GCP Carbon Footprint Service for actual cloud resource emissions
- CI/CD carbon badges for repositories
- Slack/Teams notifications for carbon spikes
Built With
- anthropic-claude
- eco-ci
- electricity-maps-api
- gitlab-duo-agent
- google-cloud
- model-context-protocol
- node.js
Log in or sign up for Devpost to join the conversation.