By Sagar Shankaran, Founder of CallSphere
Deploy production-grade Gemini agents on Google Cloud with Vertex AI. Learn managed agent setup, grounding with enterprise data stores, VPC security, IAM controls, and scaling for enterprise workloads.
Key takeaways
Google AI Studio is excellent for prototyping and development. But when you need enterprise-grade security, compliance, data residency, SLAs, and integration with your cloud infrastructure, Vertex AI is the production deployment path.
Vertex AI provides the same Gemini models with additional enterprise features: VPC Service Controls, Customer-Managed Encryption Keys (CMEK), data residency guarantees, IAM-based access control, and managed infrastructure that auto-scales with your workload.
The Vertex AI SDK uses Google Cloud authentication instead of API keys:
flowchart LR
INPUT(["User intent"])
PARSE["Parse plus<br/>classify"]
PLAN["Plan and tool<br/>selection"]
AGENT["Agent loop<br/>LLM plus tools"]
GUARD{"Guardrails<br/>and policy"}
EXEC["Execute and<br/>verify result"]
OBS[("Trace and metrics")]
OUT(["Outcome plus<br/>next action"])
INPUT --> PARSE --> PLAN --> AGENT --> GUARD
GUARD -->|Pass| EXEC --> OUT
GUARD -->|Fail| AGENT
AGENT --> OBS
style AGENT fill:#4f46e5,stroke:#4338ca,color:#fff
style GUARD fill:#f59e0b,stroke:#d97706,color:#1f2937
style OBS fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
style OUT fill:#059669,stroke:#047857,color:#fff
# Install the Vertex AI SDK
# pip install google-cloud-aiplatform
import vertexai
from vertexai.generative_models import GenerativeModel
# Initialize with your project and region
vertexai.init(
project="your-gcp-project-id",
location="us-central1",
)
model = GenerativeModel("gemini-2.0-flash")
response = model.generate_content("Explain Vertex AI in three sentences.")
print(response.text)
Authentication uses Application Default Credentials. In production, this is typically a service account:
# Local development — authenticate with your user account
gcloud auth application-default login
# Production — use a service account
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
# On GKE or Cloud Run — workload identity handles auth automatically
The Vertex AI SDK (vertexai) has a different import structure but similar API patterns. Here is a migration reference:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
# AI Studio SDK
import google.generativeai as genai
genai.configure(api_key="...")
model = genai.GenerativeModel("gemini-2.0-flash")
# Vertex AI SDK
import vertexai
from vertexai.generative_models import GenerativeModel
vertexai.init(project="my-project", location="us-central1")
model = GenerativeModel("gemini-2.0-flash")
# The generate_content API is nearly identical
response = model.generate_content("Hello")
print(response.text)
The main differences: Vertex AI uses IAM for auth (no API keys), supports VPC controls, provides model versioning, and offers production monitoring through Cloud Monitoring.
Vertex AI extends Google Search grounding with the ability to ground on your own data. This is the enterprise alternative to building a custom RAG pipeline:
from vertexai.generative_models import GenerativeModel, Tool
from vertexai.preview.generative_models import grounding
# Ground on your own data store (Vertex AI Search)
data_store_tool = Tool.from_retrieval(
retrieval=grounding.Retrieval(
source=grounding.VertexAISearch(
datastore=("projects/your-project/locations/global/"
"collections/default_collection/"
"dataStores/your-datastore-id"),
),
),
)
model = GenerativeModel(
"gemini-2.0-flash",
tools=[data_store_tool],
)
response = model.generate_content(
"What is our company's refund policy for enterprise customers?"
)
print(response.text)
The data store can be populated from Cloud Storage, BigQuery, or website crawls. Vertex AI handles chunking, embedding, indexing, and retrieval automatically.
Vertex AI Agent Builder provides a managed environment for deploying agents without managing infrastructure:
from vertexai.preview import reasoning_engines
# Define your agent as a class
class CustomerSupportAgent:
def __init__(self):
self.model_name = "gemini-2.0-flash"
def set_up(self):
"""Called once when the agent is deployed."""
from vertexai.generative_models import GenerativeModel
self.model = GenerativeModel(
self.model_name,
system_instruction=(
"You are a customer support agent for Acme Corp. "
"Answer questions using the knowledge base. "
"Escalate billing issues to human agents."
),
)
self.chat = self.model.start_chat()
def query(self, user_message: str) -> str:
"""Handle a user query."""
response = self.chat.send_message(user_message)
return response.text
# Deploy to Vertex AI
remote_agent = reasoning_engines.ReasoningEngine.create(
CustomerSupportAgent(),
requirements=["google-cloud-aiplatform"],
display_name="customer-support-agent",
description="Handles customer inquiries with Gemini",
)
# The agent is now running as a managed service
print(f"Agent resource: {remote_agent.resource_name}")
# Query the deployed agent
result = remote_agent.query(user_message="How do I reset my password?")
print(result)
Enterprise deployments require proper IAM, networking, and encryption:
# Least-privilege IAM for agent service accounts
# Required roles:
# - roles/aiplatform.user (invoke models)
# - roles/discoveryengine.viewer (read data stores)
# - roles/logging.logWriter (write logs)
# Example Terraform for service account
"""
resource "google_service_account" "agent_sa" {
account_id = "gemini-agent-sa"
display_name = "Gemini Agent Service Account"
}
resource "google_project_iam_member" "agent_roles" {
for_each = toset([
"roles/aiplatform.user",
"roles/discoveryengine.viewer",
"roles/logging.logWriter",
])
project = var.project_id
role = each.key
member = "serviceAccount:${google_service_account.agent_sa.email}"
}
"""
For VPC Service Controls, configure a perimeter that includes the Vertex AI API:
# VPC-SC ensures model calls never leave your security perimeter
# Configure via gcloud:
# gcloud access-context-manager perimeters create agent-perimeter \
# --resources=projects/YOUR_PROJECT_NUMBER \
# --restricted-services=aiplatform.googleapis.com \
# --policy=YOUR_POLICY_ID
Vertex AI integrates with Cloud Monitoring for production observability:
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
from google.cloud import monitoring_v3
import time
def create_agent_dashboard_alerts(project_id: str):
"""Set up monitoring alerts for agent health."""
client = monitoring_v3.AlertPolicyServiceClient()
# Alert on high latency
latency_policy = monitoring_v3.AlertPolicy(
display_name="Gemini Agent High Latency",
conditions=[
monitoring_v3.AlertPolicy.Condition(
display_name="P95 latency > 10s",
condition_threshold=monitoring_v3.AlertPolicy.Condition.MetricThreshold(
filter='resource.type="aiplatform.googleapis.com/Endpoint"',
comparison=monitoring_v3.ComparisonType.COMPARISON_GT,
threshold_value=10.0,
duration={"seconds": 300},
),
),
],
combiner=monitoring_v3.AlertPolicy.ConditionCombinerType.AND,
)
client.create_alert_policy(
name=f"projects/{project_id}",
alert_policy=latency_policy,
)
Key metrics to monitor for production agents:
Vertex AI handles auto-scaling, but you need to plan for quotas and throughput:
# Check and request quota increases
# gcloud ai quotas list --project=YOUR_PROJECT --region=us-central1
# Key quotas to monitor:
# - Online prediction requests per minute per region
# - Tokens per minute per model
# - Concurrent requests
# For high-throughput agents, use batch prediction
from vertexai.preview.batch_prediction import BatchPredictionJob
job = BatchPredictionJob.submit(
source_model="gemini-2.0-flash",
input_dataset="bq://project.dataset.input_table",
output_uri_prefix="gs://bucket/batch-output/",
)
print(f"Batch job: {job.resource_name}")
Batch prediction is ideal for agents that process large volumes of data offline — email classification, document analysis, or periodic report generation.
Use Vertex AI when you need: enterprise SLAs, VPC Service Controls, CMEK encryption, IAM-based access, data residency guarantees, integration with GCP services (BigQuery, Cloud Storage, GKE), or production monitoring. For prototyping and personal projects, AI Studio is simpler and sufficient.
Vertex AI token pricing is slightly higher than AI Studio (typically 10-25% more). However, enterprise customers often negotiate volume discounts. The additional cost covers managed infrastructure, SLAs, security features, and support.
Mostly yes. The core generate_content API is nearly identical. The main changes are authentication (API key to IAM), imports (google.generativeai to vertexai.generative_models), and initialization. Function calling, streaming, and structured output work the same way.
#VertexAI #GoogleCloud #EnterpriseAI #Gemini #ProductionDeployment #AgenticAI #LearnAI #AIEngineering

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
A three-way comparison of Gemini Enterprise, Anthropic managed agents and OpenAI Frontier Platform after Cloud Next 2026 — strengths, gaps, buyer fit.
ServiceNow Project Arc vs Anthropic Managed Agents — runtime, governance, integration, and use cases. The 2026 enterprise autonomous agent comparison.
A2A unlocks cross-vendor agent coordination, but most enterprise voice/chat workloads still ship faster on a single-vendor stack. Here is how to choose.
Working memory, permanent memory, sandboxes, harnesses, governance — the practical blueprint enterprises are using to ship long-horizon AI agents in 2026.
A no-fluff recap of the 7 biggest enterprise AI moves from Google Cloud Next 2026 — Gemini Enterprise, Agentspace, A2A, Gemini 3.1 Ultra, and more.
Workspace Studio puts a Gemini-powered AI agent builder inside Google Workspace. A walkthrough of what it does, who it is for, and where it fits in 2026.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI