Vertex AI is Google's umbrella for the Gemini model family, and building an agent on it means dealing with three things that don't exist on a bare chat API: the SDK split between the older google-generativeai client and the newer google-genai unified SDK, native grounding via Google Search, and function calling that behaves slightly differently from OpenAI's and Anthropic's depending on whether you're on Gemini 1.5 or 2.x. None of that is exotic once you've seen it once, but the gaps between "the demo works" and "this survives production traffic" are the same gaps every LLM integration has.
Setting up the Vertex client
Use the Vertex AI endpoint (google-genai SDK with vertexai=True) rather than the consumer Gemini API key for anything production-facing — Vertex gives you IAM-scoped service accounts, VPC-SC support, regional endpoint pinning, and quota that's tied to a GCP project rather than a personal key. The trade-off is more setup: a service account, a project ID, and a region have to be configured before the first call, versus a single API key on the consumer endpoint. If you're prototyping, start with the API key; the moment you need audit logging or a data-residency guarantee, move to Vertex proper.
from google import genai
from google.genai import types
client = genai.Client(
vertexai=True,
project="my-gcp-project",
location="us-central1",
)
response = client.models.generate_content(
model="gemini-2.0-flash",
contents="Summarize the open support tickets from the last 24 hours",
config=types.GenerateContentConfig(
tools=[get_tickets_tool],
temperature=0.2,
),
)
Function calling on Gemini
Gemini's function-calling loop is conceptually the same as OpenAI's and Anthropic's — the model returns a structured call instead of text, you execute it, and you send the result back as a follow-up turn — but the response object shape differs enough that a thin adapter layer pays for itself if you're supporting multiple providers. Gemini also supports parallel function calls and, as of the 2.x models, "compositional" calling where the model can chain tool outputs into a second call without a round trip back to your orchestration code for simple cases. Don't rely on that for anything with side effects; keep execute-and-confirm on your side of the loop for writes, and only let the model chain freely for read-only lookups.
Grounding with Google Search
Vertex's built-in Google Search grounding tool is the one capability that's genuinely differentiated from the other major providers — you attach it as a tool and Gemini decides when to issue a search and cites sources in the response, without you standing up your own retrieval pipeline. It's useful for anything time-sensitive (current events, pricing, recent releases) but it is not a substitute for RAG over your own private documents. Use grounding for "what's true on the public internet right now" and your own vector store or search index for "what's true about our data" — mixing the two into one tool call makes it hard to tell which source informed which claim.
Grounded responses come back with source URLs attached, which makes them look more trustworthy than they are. The model can still misattribute a claim to a source that doesn't actually support it. If the output feeds a decision that matters, surface the citations to the end user rather than trusting the summary blindly.
Safety settings and context caching
Vertex exposes per-category safety thresholds (harassment, hate speech, sexually explicit, dangerous content) that block or allow content independently of your own guardrail layer — treat these as a coarse floor, not your actual safety system, since they're tuned for general-purpose harm categories and won't catch domain-specific issues like a customer-support agent giving legal advice it shouldn't. Separately, for agents that reuse a large system prompt or document context across many calls, Vertex's context caching cuts cost meaningfully on Gemini's per-token pricing — cache the static instructions and RAG context, and only send the turn-specific delta on each call.
Wrapping up
Vertex AI gets you IAM-grade access control and a genuinely useful built-in search-grounding tool, at the cost of more setup than a bare API key and an SDK surface that's still catching up to OpenAI's and Anthropic's in ergonomics. Use it when data residency or centralized GCP billing matter, keep your own guardrail and RAG layers regardless of provider, and don't let compositional function calling touch anything with a side effect without a confirmation step.
Independent software engineer in Nairobi specialising in Acumatica customisations, Laravel backends, and tax fiscalisation integrations across East and Southern Africa.