Skip to content
>_MyGearHut

Vertex AI Agents Guide

Deploy production AI agents on Google Vertex AI — LangGraph setup, Agent Engine runtime, checkpoints, observability, and Claude/Gemini model routing.

What Vertex AI Agent Engine is

Google Vertex AI Agent Engine (part of the Gemini Enterprise Agent Platform) is a managed runtime for AI agents. You build with LangGraph, ADK, or Crew.ai; Agent Engine handles scaling, sessions, memory, tracing, and deployment — without rebuilding your agent when you leave the notebook.

Use this guide when a prototype agent needs production uptime, persistent state, and enterprise controls.

Architecture at a glance

Your agent (LangGraph / ADK)
        ↓
Vertex AI Agent Engine (managed runtime)
        ↓
├── Sessions (conversation state)
├── Memory Bank (long-term context)
├── Example Store + Evaluation (quality loop)
├── Cloud Trace (observability)
└── Tool execution (Code Execution, APIs, MCP)

Models: Gemini by default; Anthropic Claude and others supported via Model Garden routing.

Prerequisites

  • Google Cloud project with billing enabled
  • APIs enabled: Vertex AI, Agent Engine
  • gcloud CLI authenticated
  • Python 3.10+ with google-cloud-aiplatform SDK
  • LangGraph / LangChain installed for LangGraph path
gcloud config set project YOUR_PROJECT_ID
gcloud services enable aiplatform.googleapis.com
pip install google-cloud-aiplatform langgraph langchain-google-vertexai

Step 1 — Build a LangGraph agent locally

Minimal tool-calling agent:

from langchain_google_vertexai import ChatVertexAI
from langgraph.prebuilt import create_react_agent

llm = ChatVertexAI(model_name="gemini-2.5-flash", temperature=0)
tools = [your_tool_functions]  # define with @tool decorator

agent = create_react_agent(llm, tools)
result = agent.invoke({"messages": [("user", "What's the exchange rate EUR/USD?")]})

Validate locally before touching Agent Engine. Fix tool schemas and error handling here — production magnifies sloppy tools.

Step 2 — Add persistent checkpoints

Do not use InMemorySaver in production. It loses state on restart.

Pick a checkpointer:

BackendUse when
Cloud SpannerGoogle-native, high scale
PostgresExisting Postgres ops
FirestoreSimple document state

Define a builder function:

def checkpointer_builder():
    from langgraph.checkpoint.postgres import PostgresSaver
    return PostgresSaver.from_conn_string(os.environ["CHECKPOINT_DB_URL"])

Pass to LanggraphAgent at deploy time (Step 3).

Step 3 — Deploy with LanggraphAgent

import vertexai
from vertexai.preview import reasoning_engines

vertexai.init(project="YOUR_PROJECT", location="us-central1")

agent_engine = reasoning_engines.LanggraphAgent(
    model="gemini-2.5-pro",
    tools=[your_tools],
    model_kwargs={"temperature": 0.2},
    checkpointer_builder=checkpointer_builder,
    enable_tracing=True,
)

remote = agent_engine.deploy(
    display_name="my-production-agent",
    description="Customer support agent v1",
)

Note the deployed resource ID — you will query it via SDK or REST.

Step 4 — Sessions, memory, and observability

Pass a consistent thread_id per user so conversation state persists. Wire Memory Bank for long-term facts (preferences, account context). Enable tracing; weekly, sample 20 queries through Evaluation Service and track p95 latency plus tool error rate.

Production checklist

  • Persistent checkpointer (Postgres or Spanner — not in-memory)
  • Consistent thread_id per user session
  • Secrets in Secret Manager; IAM least privilege
  • Tool timeouts; human escalation for high-stakes actions
  • Tracing enabled; weekly eval on 20 sampled queries
  • Rollback: previous agent revision tagged before deploy

Route by task: Gemini Flash for triage, Gemini Pro or Claude for deep reasoning — log which model answered.

Migration path (4 weeks)

Local LangGraph → staging deploy with checkpointer → shadow traffic + eval → prod cutover.

Docs: LangGraph on Agent Engine · Create LangGraph agent

Agent Engine is the runtime. Tools, checkpoints, and eval loop make it production-grade.

Want more gear like this?

The guide above is yours free — subscribe for weekly drops, templates, and tool updates.

One practical AI email a week. Unsubscribe anytime.