# Stop Your AI Agents from Burning $100K Overnight

DevFeed: [Stop Your AI Agents from Burning $100K Overnight](<https://devfeed.tech/articles/stop-your-ai-agents-from-burning-100k-overnight-90786.md>)

Original publisher: [Read original article](<https://blog.devops.dev/stop-your-ai-agents-from-burning-100k-overnight-8ab7f3fd0045?source=rss----33f8b2d9a328---4>)

Author: Mohamed Rasvi

Published: 2026-10-20T13:26:04Z

Content type: tutorial

Language: en

Sources: [DevOps.dev](<https://devfeed.tech/sources/devops-dev.md>)

Topics: [LLM security](<https://devfeed.tech/topics/llm-security.md>), [cloud cost management](<https://devfeed.tech/topics/cloud-cost-management.md>), [Multi-step AI processes](<https://devfeed.tech/topics/multi-step-ai-processes.md>), [context window](<https://devfeed.tech/topics/context-window.md>), [google-adk](<https://devfeed.tech/topics/google-adk.md>)

Tags: [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [alert](<https://devfeed.tech/tags/alert.md>), [alerts](<https://devfeed.tech/tags/alerts.md>), [api](<https://devfeed.tech/tags/api.md>), [api-key](<https://devfeed.tech/tags/api-key.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [autonomous](<https://devfeed.tech/tags/autonomous.md>), [bill](<https://devfeed.tech/tags/bill.md>), [billing](<https://devfeed.tech/tags/billing.md>), [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [context-window](<https://devfeed.tech/tags/context-window.md>), [devops](<https://devfeed.tech/tags/devops.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [gemini-pro](<https://devfeed.tech/tags/gemini-pro.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [google-cloud-platform](<https://devfeed.tech/tags/google-cloud-platform.md>), [guardrails](<https://devfeed.tech/tags/guardrails.md>), [infinite](<https://devfeed.tech/tags/infinite.md>), [mlops](<https://devfeed.tech/tags/mlops.md>), [retries](<https://devfeed.tech/tags/retries.md>), [security](<https://devfeed.tech/tags/security.md>), [spending](<https://devfeed.tech/tags/spending.md>)

## AI overview

The excerpt recommends layered controls to limit runaway Gemini and Vertex AI costs. Its primary measure is an opted-in Google Cloud spend cap scoped to one project and service: it pauses new requests at the threshold and resets next billing period, but enforcement can lag, in-flight calls may cause overages, and GPU VMs are not covered. It also describes organization policies to disable service-account keys, restrict models and API use, least-privilege agent accounts, lower request and token quotas, and VPC Service Controls. An optional Pub/Sub-triggered function can revoke agent access or detach project billing, though detaching billing stops all paid services in that project. Runtime iteration, token, retry, and timeout limits provide another layer. The excerpt advises separating development and production, setting caps below the absolute financial ceiling, and testing VPC-SC in dry-run mode. These are the article's stated recommendations; the excerpt notes its code may contain bugs.

## Source excerpt

Hard Spending Caps & Security Guardrails for the Gemini Agent Platform (formerly Vertex AI) Every month a new story surfaces on Reddit or Hacker News: someone deployed an autonomous agent on Vertex AI, went to sleep, and woke up to a $100K+ bill. A recursive tool-calling loop. A leaked API key scraped from a public repo. A "budget alert" that sent an email nobody read at 3am while the meter kept running. The default Google Cloud budget is alerts-only. It sends you a polite notification when spending crosses a threshold. It does not stop your workloads. Your agent keeps calling Gemini Pro at $3.50/million tokens while you sleep. This post is the practical playbook, not theory, not a checklist, working guardrails. The Threat Model Before we lock things down, understand what actually causes six-figure AI bills: | Threat Vector | What Happens | Why It's Expensive | |---------------|--------------|--------------------| | Agent infinite loop | A multi-step agent hits an error, retries indefinitely, each iteration growing the context window | Context grows per turn -- each call costs more than the last | | Leaked API key | A key committed to GitHub gets scraped; attacker blasts inference requests | Thousands of Gemini Pro calls per minute | | Budget alert ≠ budget cap | Team sets a $5K budget, gets an email at $5K, service keeps running | 4-12 hour billing data lag means $50K+ overshoot | | Overprivileged service account | SA has `roles/aiplatform.admin` across the org | One compromised agent can spin up GPU instances and call any model | | No model restriction | Developer tests with Gemini Ultra when Flash would suffice | 10-50x cost difference per request | The Architecture We Are Building ┌─────────────────────────────────────────────────────────────────────┐ │ Google Cloud Organization │ │ │ │ ┌───────────────────────────────────────────────────────────────┐ │ │ │ Org-Level Guardrails │ │ │ │ │ │ │ │ - iam.disableServiceAccountKeyCreation = ENFORCED │ │ │ │ - vertexai.a