Adding a Brain and an Engine Room to GAS: Vertex AI and Cloud Run
Add classification, summary, and drafts by calling Vertex AI (Gemini) straight from GAS. Hand heavy work that exceeds 6 minutes to Cloud Run. A human-approval gate stays mandatory.
When GAS alone isn’t enough, add two things: a brain (Vertex AI) and an engine room (Cloud Run). Both are separate adoptions and cross the line from “fully free” into “pay for what you use” (zero at idle, with a free allowance). So adopt them only when the trigger is clear.
The three-layer shape
GAS = front desk (Gmail, Sheets, Drive, screens, human approval)
Cloud Run = engine room (heavy or long-running work, latest AI)
Vertex AI = brain (classification, summary, drafts)
Vertex AI first (easy entry)
Call Gemini straight from GAS via the advanced service (no separate server). Adopt when you need “intelligence” inside the app: auto-triaging inquiries, summarizing sheets/docs, drafting a quote from a file.
The standard pattern inserts a human-approval gate, not auto-execution:
Workspace data → GAS → Vertex (Gemini) → structured JSON → validation
→ human approval → Workspace action → audit log
Force structured JSON output + validation, and never let the AI act without human review.
Cloud Run when you hit the wall
A small cloud server you own. Adopt on any one signal:
- A job exceeds the GAS 6-minute limit.
- An account quota conflict actually occurs.
- You need the latest Gemini features faster than the advanced service ships them.
Split roles clearly: GAS = UI, Workspace access, approval cards; Cloud Run = heavy logic, latest AI. Design Secret Manager, logging, and retries alongside adoption.
The honest cost
Both need a Google Cloud project with billing enabled. Cloud Run is scale-to-zero, so it’s free at idle but billed under traffic. Go custom (“build it well while you’re at it”); skip no-code paths, which are weak on quality and differentiation.
One line to keep: intelligence via Vertex inside GAS (approval gate required), heavy work via Cloud Run: only when the trigger is clear.
Frequently asked questions
- Do I need a separate server to call Vertex AI (Gemini) from GAS?
- No. You can call Gemini straight from GAS via the advanced service with no separate server. Adopt it when you need intelligence inside the app, such as auto-triaging inquiries, summarizing sheets, or drafting quotes from files.
- Is it safe to let Vertex AI act automatically without human review?
- The article advises against it. The standard pattern routes output through structured JSON and validation, then requires a human-approval gate before any Workspace action is taken.
- What does Vertex AI or Cloud Run cost to run?
- Both require a Google Cloud project with billing enabled and follow a pay-for-what-you-use model. Cloud Run is scale-to-zero, so there is no charge at idle, but traffic triggers billing.