Skip to content
agentgateway has joined the Agentic AI FoundationLearn more

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Google Cloud

Page as Markdown

Run agentgateway on Google Cloud and reach Vertex AI with a service account instead of an API key.

Verified Code examples on this page have been automatically tested and verified.

Run agentgateway on Cloud Run or GKE, and reach Vertex AI with the service account that Google Cloud already attaches to the workload. No API key goes into your configuration file.

Authenticate with a service account

On Cloud Run and GKE, Google Cloud supplies credentials to the workload through its service account, which agentgateway reads with Application Default Credentials (ADC). ADC is the default for the vertex provider, so auth.gcp only makes that choice explicit.

Review the following example configuration.
# yaml-language-server: $schema=https://agentgateway.dev/schema/config

llm:
  models:
  - name: gemini-2.5-flash
    provider: vertex
    params:
      model: google/gemini-2.5-flash
      vertexProject: my-project-id
      vertexRegion: us-central1
    auth:
      gcp:
        type: accessToken

Review the following table to understand this configuration.

SettingDescription
nameThe model name to match in incoming requests.
providerThe LLM provider, set to vertex for Vertex AI.
params.modelThe Vertex AI model to send upstream, which does not have to match name.
params.vertexProjectThe Google Cloud project ID.
params.vertexRegionThe Google Cloud region. Defaults to global if not set.
auth.gcp.typeThe token to fetch through ADC. Use accessToken for Vertex AI. Use idToken when the upstream is a Cloud Run service or another endpoint that verifies an identity token.

For the full list of Vertex AI settings, see Vertex AI. For direct Gemini API access with an API key instead, see Google Gemini.

Run on Cloud Run

Run agentgateway as a serverless container. Cloud Run gives the container an identity through its service account and can mount your configuration file from Secret Manager.

Store the configuration file as a secret

gcloud secrets create agentgateway-config --data-file=config.yaml

Deploy the service

gcloud run deploy agentgateway \
  --image cr.agentgateway.dev/agentgateway:latest-dev \
  --port 4000 \
  --service-account [email protected] \
  --set-secrets /config/config.yaml=agentgateway-config:latest \
  --args="-f,/config/config.yaml" \
  --no-allow-unauthenticated

Note the following details.

  • Port 4000 carries LLM traffic. When your configuration file defines no gateway, the implied default gateway serves LLM traffic on port 4000 and MCP traffic on port 3000. Set --port to the port that carries the traffic you route. For more information, see Configuration modes.
  • The service account is the credential. Because auth.gcp uses ADC, --service-account is what lets agentgateway call Vertex AI. No API key is needed in the deploy command or in the configuration file.
  • A secret mount is read-only. Set config.storage.mode to readOnly so that writes from the UI fail with a clear message instead of a filesystem error. For more information, see Configuration storage.

Important

The example uses --no-allow-unauthenticated. A gateway that holds Vertex AI access is a credential of its own, so anyone who can reach it can spend against your project. If you do need public access, put an authentication policy in front of it. For more information, see Authentication and identity.

Run on GKE

GKE is an ordinary Kubernetes distribution as far as agentgateway is concerned. Two options are available.

  • Run standalone agentgateway as a Deployment with the Helm chart. Bind the Kubernetes service account to a Google service account with Workload Identity Federation, and the same auth.gcp configuration applies.
  • Run the Kubernetes control plane, which manages agentgateway proxies from Kubernetes custom resources and the Kubernetes Gateway API.

IAM roles

Create a service account and grant it the roles that agentgateway needs.

# Create the service account
gcloud iam service-accounts create agentgateway \
  --display-name "agentgateway"

# Grant Vertex AI access
gcloud projects add-iam-policy-binding my-project \
  --member "serviceAccount:[email protected]" \
  --role "roles/aiplatform.user"

# Grant access to the configuration secret
gcloud secrets add-iam-policy-binding agentgateway-config \
  --member "serviceAccount:[email protected]" \
  --role "roles/secretmanager.secretAccessor"

Google Cloud services

ServiceHow it is used
Vertex AIGemini and other models, reached with the service account
Google GeminiDirect Gemini API access with an API key
Secret ManagerStorage for the configuration file and for the API keys of non-Google providers
Cloud Load BalancingLoad balancing and TLS termination in front of the gateway port
Cloud MonitoringMetrics collection, through a Prometheus scrape
Cloud TraceTrace collection, through an OpenTelemetry collector

Next steps

Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.