Inspiration
Every engineering team has a CI/CD bill they don't fully understand. We've seen pipelines where 30% of compute is "dark spend": oversized runners for 10-second jobs, test suites running on every push regardless of what changed, and :latest image tags pulling fresh layers every time. The problem isn't that teams don't care, it's that there's no visibility. We wanted an agent that turns pipeline telemetry into dollars and opens MRs with concrete fixes, not just reports.
What it does
Fedha (Swahili for "money") is a 3-stage ambient flow that analyzes your CI/CD pipeline costs and automatically opens merge requests to reduce waste. It:
- Fetches recent pipeline runs and calculates per-job costs using GitLab SaaS runner pricing
- Checks for 5 optimization types: runner downsizing, missing interruptible: true, missing rules:changes, unoptimized images, and missing cache configuration
- Validates the optimized YAML with ci_linter, commits it to a new branch, and opens an MR with a cost-impact summary
Every MR includes a Cost-Impact: -$X.XX/mo label so teams can see the dollar value of merging the change.
How we built it
Fedha is a custom flow on the GitLab Duo Agent Platform using the flow registry v1 spec. It chains three AgentComponents (Scout, Optimizer, and Executor), each with a focused system prompt and specific tools:
- Scout: Uses gitlab_api_get, get_project, and get_repository_file to gather pipeline metrics and calculate costs
- Optimizer: Analyzes the CI config against the metrics and generates specific YAML changes with dollar savings for each
- Executor: Uses ci_linter to validate changes, create_commit to push them, and create_merge_request to open the MR
No API keys, no external services. Everything runs natively on the Duo Agent Platform.
Challenges we ran into
- Understanding the difference between the flow registry v1 spec and the ai-catalog-sync component format took time. The flow definition needs to be nested under a definition: key with name, description, and public at the top level
- Getting the agent to produce accurate cost calculations required careful prompt engineering with the exact runner pricing table
- The hackathon project's CI config is inherited from the group level, so there was no .gitlab-ci.yml in the repo. Fedha handled this gracefully by creating one from scratch
Accomplishments that we're proud of
- Fedha successfully analyzed a live project, identified 5 optimization opportunities, validated the YAML, and opened a real MR, fully autonomously with no human intervention after the trigger
- The cost analysis is genuinely useful. It correctly identified that the project was already on the cheapest runner and skipped the downsize recommendation instead of suggesting a pointless change
- The flow detected a non-obvious waste pattern (duplicate pipelines on both main and master branches) that accounted for 50% of the spend
What we learned
- The GitLab Duo Agent Platform is surprisingly capable for multi-step autonomous workflows. Chaining agents with context passing works well
- Prompt engineering matters more than code when building on the Agent Platform. The quality of the system prompt directly determines the quality of the analysis
- FinOps for CI/CD is an underserved space. Most teams have no idea what their pipelines actually cost per job
What's next for Fedha
- Scheduled analysis: Run Fedha weekly and track cost trends over time
- Pipeline event triggers: Automatically analyze when monthly spend exceeds a threshold
- Multi-project support: Scan all projects in a group and generate a FinOps dashboard
- Artifact optimization: Detect oversized artifacts and suggest retention policies
- Custom pricing: Support self-hosted runner cost models, not just GitLab SaaS pricing
Built With
- agent
- claude
- duo
- gitlab-ci/cd
- gitlab-duo-agent-platform
- gitlab-flow-registry-v1
Log in or sign up for Devpost to join the conversation.