EcoPilot is a GitLab Duo Agent Platform project for sustainable CI/CD, led by a public Duo flow that acts like a green CI teammate. The flow triages CI waste, quantifies runtime/cost/carbon impact, proposes remediation, and adds merge guardrails before a developer merges the optimization.
- It is built around a
GitLab Duo flowand public agents, not just an external AI webhook. - It reacts to merge request events instead of acting like a chat-only assistant.
- It takes action by publishing MR feedback and generating a deterministic fix even when an LLM is unavailable.
- It tells a strong story for
Green Agent,GitLab + Google, andGitLab + Anthropiccategories.
EcoPilot has two layers:
GitLab Duo flow and agentsare the primary product surface.EcoPilot serviceis the backend execution engine that powers real actions.
The backend service does the following:
- Receives a GitLab merge request webhook.
- Reads CI config and recent pipeline history from GitLab.
- Detects CI waste patterns such as missing cache, redundant steps, broad test scope, wasteful retry or timeout settings, and over-serialized pipelines.
- Calculates baseline runtime, estimated savings, runner cost reduction, and carbon reduction.
- Posts a sustainability report back to the merge request with annualized savings.
- Generates a deterministic
.gitlab-ci.ymlfix for common waste patterns, with optional AI refinement when Anthropic is configured. - Opens a remediation merge request so the developer can merge the optimization instead of rewriting CI by hand.
Hackathon demos break when they depend on a single model call. EcoPilot now keeps the workflow alive even without Anthropic by auto-fixing common CI waste patterns itself:
- missing cache for dependency-heavy jobs
- overly broad test execution
- wasteful retry counts and timeouts
That makes the project easier to demo, easier to trust, and more aligned with the idea of an autonomous teammate.
- Show a merge request with an intentionally wasteful
.gitlab-ci.yml. - Trigger EcoPilot through the MR webhook.
- Show the MR comment with baseline metrics, projected savings, and annualized impact.
- Show the remediation MR that EcoPilot created automatically.
- Close with the before/after story: less runner waste, lower cloud spend, lower carbon.
ecopilot/ Python service code
tests/ Automated test suite
fixtures/ Webhook payload fixtures
agents/ Public GitLab Duo agent definition
flows/ Public GitLab Duo flow definition
main.py ASGI entry point
python -m pip install -r requirements.txt
uvicorn ecopilot.main:app --host 0.0.0.0 --port 8080Optional environment variables:
ECOPILOT_GITLAB_BASE_URLECOPILOT_GITLAB_TOKENECOPILOT_WEBHOOK_SECRETECOPILOT_DUO_ANTHROPIC_URLECOPILOT_DUO_ANTHROPIC_TOKENECOPILOT_DUO_ANTHROPIC_MODELECOPILOT_BIGQUERY_TABLE_IDECOPILOT_GCP_BILLING_TABLE_IDECOPILOT_GCP_PROJECT_IDECOPILOT_ENABLE_AUTO_LABELECOPILOT_ENABLE_AUTO_ISSUE
python -m pytest -v- Flow-first entry point:
flows/ecopilot-flow.yml - Orchestrator:
agents/ecopilot-agent.yml - Triage agent:
agents/ecopilot-triage-agent.yml - Impact agent:
agents/ecopilot-impact-agent.yml - Remediation agent:
agents/ecopilot-remediation-agent.yml - Guardrail agent:
agents/ecopilot-guardrail-agent.yml
The public flow is the main product entry and is structured as a four-stage Duo workflow:
triage_agentfinds the largest CI waste patternsimpact_agentquantifies runtime, cost, carbon, and Google Cloud impactremediation_agentproposes merge-ready GitLab CI changesguardrail_agentadds merge confidence and rollback guidance
GitLab Duo flowis the primary user experiencePublic Duo agentsare the reusable stages within that flowEcoPilot serviceis the execution engine that powers webhook handling, analysis, remediation, and persistenceAnthropic through GitLabstrengthens the guardrail and remediation reasoning pathGoogle Cloudstrengthens the cost and sustainability evidence path
More detail: docs/duo-flow-architecture.md
MIT