Inspiration

Modern CI/CD pipelines power software delivery, but they often run inefficiently. Many pipelines repeatedly install dependencies, rebuild containers unnecessarily, or execute jobs sequentially when they could run in parallel. These inefficiencies waste compute resources, increase energy consumption, and slow down developer feedback loops.

We were inspired by the idea that AI agents should not only detect problems but also take action to fix them. GreenGuardian was created to help teams understand the environmental impact of their CI pipelines and automatically improve them. By combining AI analysis with automated fixes, we wanted to make sustainable software development effortless for developers.

What it does

GreenGuardian is an autonomous AI agent built on the GitLab Duo Agent Platform that analyzes CI pipelines and automatically improves their efficiency.

When triggered from a Merge Request, GreenGuardian:

  1. Reads the project’s .gitlab-ci.yml pipeline configuration
  2. Detects inefficiencies such as missing caching, redundant jobs, or sequential execution
  3. Calculates a CI Carbon Score that estimates the environmental efficiency of the pipeline
  4. Generates an optimized CI configuration that reduces compute waste
  5. Posts a detailed sustainability report back to the Merge Request

By detecting and auto-fixing inefficient pipelines, GreenGuardian helps developers ship faster while reducing their infrastructure and environmental impact.

How we built it

GreenGuardian was built using the GitLab Duo Agent Platform with Anthropic models available in the hackathon sandbox.

We implemented:

AI Agents

  • A CI analysis agent that reads and evaluates .gitlab-ci.yml
  • A sustainability scoring mechanism that calculates a CI Carbon Score
  • A pipeline optimization step that generates an improved CI configuration

GitLab Integration

  • The agent is triggered directly from a Merge Request by mentioning the flow
  • It automatically reads repository files using GitLab tools
  • It posts a structured sustainability report as a Merge Request comment

Agent Flow

  • Triggered from a Merge Request comment
  • Reads CI configuration
  • Analyzes inefficiencies
  • Calculates sustainability score
  • Generates optimized pipeline configuration
  • Posts the report back to the Merge Request

This architecture demonstrates how AI agents can become active participants in the software development lifecycle.

Challenges we ran into

One of the main challenges was working within the GitLab Duo Agent Platform sandbox environment. The platform requires a strict flow and agent schema, and debugging flow behavior required careful alignment with the expected configuration.

Another challenge was designing a meaningful sustainability scoring model that could estimate CI efficiency in a practical way without direct energy measurements. We solved this by defining heuristic penalties for common inefficiencies such as missing caching or redundant pipeline stages.

Finally, ensuring that the agent produced clear, actionable feedback for developers required refining prompts and output structure so the results were easy to understand and apply.

Accomplishments that we're proud of

We are proud that GreenGuardian goes beyond simple analysis and actually suggests improvements that developers can apply immediately.

Key accomplishments include:

  • Building a working AI agent integrated with GitLab workflows
  • Designing a CI Carbon Score to quantify pipeline sustainability
  • Creating an agent that automatically analyzes real CI pipelines
  • Generating optimized pipeline configurations to reduce compute waste

Most importantly, GreenGuardian demonstrates how AI agents can actively improve developer workflows rather than just providing suggestions.

What we learned

Through this project we learned how powerful AI agents can be when they are embedded directly inside developer workflows.

We also learned that many CI pipelines contain small inefficiencies that accumulate into significant compute waste. Even simple optimizations like caching dependencies or parallelizing jobs can dramatically reduce pipeline runtime and resource consumption.

Finally, we learned how the GitLab Duo Agent Platform enables developers to build workflow-aware AI systems that can react to events, analyze code, and take meaningful actions inside the development lifecycle.

What's next for GreenGuardian

GreenGuardian has the potential to evolve into a full CI sustainability platform.

Future improvements could include:

  • Automatically creating fix pull requests with optimized CI configurations
  • Tracking CI sustainability trends across repositories and teams
  • Building a dashboard for CI energy and carbon metrics
  • Integrating with cloud telemetry to estimate real energy consumption
  • Recommending cost and energy optimized pipeline architectures

Our vision is to make GreenGuardian a continuous sustainability assistant for software teams, helping developers build faster while reducing the environmental impact of modern software infrastructure.

Built With

  • agent
  • flow
  • gitlab
  • gitlabci
Share this project:

Updates