# Cost Management Rules — propane-will-491900-m5 ## Hard rules 1. **Billing budget alert** must be created BEFORE any resource deployment. Alert thresholds: 50% / 75% / 90% / 100% of monthly budget. Start with 5 USD (~55 NOK) for dev/test phases. 2. **Agent Runtimes** cost money when deployed — always undeploy via `03-teardown.sh` at end of workday. 3. **Vertex AI Endpoints** — same rule as above. 4. **Staging bucket lifecycle**: auto-delete objects older than 7 days. 5. **Colab Enterprise runtimes** — terminate when not actively developing. 6. GCP does NOT enforce a hard spend cap. Budget alerts are email-only by default. ## Agent Runtime pricing (May 2026) | Resource | Free Tier/month | Paid rate | |---|---|---| | vCPU | 180,000 vCPU-seconds | ~$0.0864/vCPU-hour | | RAM | 360,000 GiB-seconds | ~$0.0090/GiB-hour | Agent Runtime does NOT bill for idle/non-running agents (pay-per-use). Always delete at end of session. ## NEW billing lines (effective Jan 28, 2026) These were previously free/in preview and are now METERED: - **Sessions** — agent interaction contexts - **Memory Bank** — long-term memory storage - **Code Execution** — sandboxed code runs → Trim session histories. Only persist high-value facts to Memory Bank. Disable Code Execution on agents that don't need it. ## Cloud Run cost profile - `--min-instances=0` → scales to zero — no idle cost (use for dev/test) - `--min-instances=1` → keeps one warm instance — eliminates cold-start (~$4–8/month) - Cleanup: `gcloud run services delete SERVICE_NAME --region=us-central1 --quiet` ## Lifecycle JSON for staging bucket ```json { "rule": [ { "action": { "type": "Delete" }, "condition": { "age": 7 } } ] } ``` ```bash gcloud storage buckets update gs://propane-will-491900-m5-agent-staging \ --lifecycle-file=lifecycle.json ``` ## RAG Engine cost warning - If RAG Engine uses a managed Spanner instance as vector DB → billed 24/7. - For dev/test: prefer `us-east1` or `us-east4` until us-central1 allowlist is granted. - Contact: `vertex-ai-rag-engine-support@google.com` for us-central1 allowlist access. ## Artifact Registry cleanup ```bash gcloud artifacts docker images list \ us-central1-docker.pkg.dev/propane-will-491900-m5/oavauco-docker \ --format="value(IMAGE,DIGEST)" | tail -n +2 | \ while read -r image digest; do gcloud artifacts docker images delete "${image}@${digest}" --quiet done ``` ## Pub/Sub hard-stop billing automation (optional) Consider: Pub/Sub → Cloud Run Function to auto-disable billing if budget alert fires. Template: https://cloud.google.com/billing/docs/how-to/notify#cap_disable_billing_to_stop_usage