Inspiration

Every cloud quietly drifts. A bucket goes public in the console, an account gets over-privileged, a machine sits idle burning money — and none of it ever touched your Terraform. Tools that scan Infrastructure-as-Code only see the code; they're blind to the changes people make directly on the cloud (ClickOps). We wanted an autonomous fleet that watches the live cloud, proves what it finds, and actually fixes it — safely enough to point at production.

What it does

CloudCap is a governed multi-agent fleet on Google Cloud that continuously audits live GCP projects for cost, security, IAM, and compliance risk — catching the drift and ClickOps that code-only scanners miss. For every finding it:

  • Proves it with deterministic evidence (a Cloud Run service at <1% CPU, a bucket granting allUsers right now), narrated by Gemini 3.7 on Vertex AI — explained, never hallucinated.
  • Fixes it by Pull Request — it resolves which Terraform repo owns the resource (from real state in GCS) and opens a PR removing the public binding at the source. Detect on the cloud, fix in the code.
  • Acts across channels — a PR for the fix, a Slack alert for the on-call, a JIRA ticket for the backlog — governed by per-project policy.

It runs unattended on a daily schedule (Cloud Scheduler), is read-only against your cloud (the remediation agent has no cloud write access — it can only propose), and nothing auto-merges. A human approves.

How we built it

Hexagonal (ports & adapters) — agent logic depends only on ports; the one shipped implementation is Google's Gemini Enterprise Agent Platform (GEAP), with every pillar live, not mocked:

Pillar Implementation
Agent Registry Firestore doc + live IAM service-account verification
Runtime (async) Cloud Run + OIDC-authed Cloud Scheduler daily scan
Memory Bank Firestore finding-lifecycle (known issues don't re-nag)
Identity one least-privilege service account per agent
Gateway policy-gated tool calls
Model Armor real cloudcap-guard template (prompt-injection + jailbreak)
Observability OpenTelemetry → Cloud Trace + hash-chained Cloud Logging audit
Ownership cloud resource → owning Terraform repo, resolved from GCS state

Stack: Gemini 3.7-flash on Vertex AI via the GenAI SDK (keyless — IAM identity, no API keys), Cloud Run, Firestore, Model Armor, Cloud Logging, Secret Manager, Cloud Asset Inventory + Recommender for detection, and Terraform for a one-command install.

Demo environment & cost

Everything here — findings, scans, the hash-chained audit log, the remediation PR — is real, produced by the fleet running live against a dedicated GCP test project we seeded with deliberately-flawed cost and security resources. To keep costs near zero during the judging period (per the hackathon's own guidance to switch services off after the demo), that test project has been decommissioned as of 31 Aug 2026, and both the daily Cloud Scheduler scan and interactive scanning are deliberately paused — the unattended daily automation is real (proven in the demo video and the immutable audit log) and resumes with one command. The dashboard, findings, and audit trail remain fully explorable. The full live run against real GCP is captured in the demo video.

Challenges we ran into

  • Cloud-detect → IaC-fix. The hard part was keeping detection 100% cloud-side (so we catch ClickOps) while routing the fix into the owning Terraform repo — resolving ownership from real GCS state, then generating a precise PR that removes just the offending binding.
  • Keyless Gemini on the global endpoint. Gemini 3.5+ isn't served from regional endpoints; we wired the GenAI SDK to Vertex AI's global endpoint with an IAM identity — no API keys.
  • A guardrail that fails closed. Real Model Armor screening of live bucket-object names (a planted tool-poisoning attempt), with a deterministic backstop so the screen fails safe.
  • Autonomous, not chatty. Making it a scheduled background fleet (an OIDC-authed endpoint) rather than a chatbot you prompt.

Accomplishments that we're proud of

  • A real closed loop: a bucket public on the live cloud → resolved to its Terraform → a real GitHub Pull Request removing the allUsers binding. Not a mock.
  • Every GEAP pillar live, verified against real Google Cloud APIs.
  • Model Armor turned a prompt-injection attack into a finding instead of executing it.
  • Governed multi-channel remediation (PR + Slack + JIRA), human-approved, with zero cloud write access.
  • Runs end-to-end on a real GCP backend, reproducible with one terraform apply.

What we learned

  • The live cloud is the source of truth — code scanners miss what humans do in the console; watching the running cloud is what catches real drift.
  • Deterministic evidence + Gemini narration beats LLM-as-detector — Gemini explains findings it can't invent.
  • Governance is a feature: least-privilege per-agent identity, human-in-the-loop, and no standing write access are what make an agent safe enough for production.
  • Failure-tolerance by design — the fleet stays correct when an agent misbehaves: findings ride on deterministic evidence (Gemini narrates, never invents), Model Armor fails closed on prompt-injection and tool-poisoning, and every remediation is human-gated with zero cloud write access — so a looping or hallucinating agent can't push a bad change.

What's next for CloudCap

  • More detectors, more clouds — the hexagonal ports make AWS/Azure adapters additive, with no agent-logic change.
  • Managed GEAP services — swap our Firestore Memory Bank for Vertex AI Memory Bank and Agent Engine runtime.
  • Drift *prevention* — policy-as-code gates in the PR pipeline, not just detection.
  • Deeper autonomy — auto-remediation tiers for low-risk findings, still human-gated for the rest.
  • Event-driven scanning — react to specific cloud events (e.g. a new public IAM binding) on top of today's cost-efficient daily schedule + on-demand scans.

Built With

Share this project:

Updates