Back to paths

Deploying agents: Agent Runtime, Cloud Run or GKE

Agent Runtime, Cloud Run and GKE can all run your agent. Choose the one with the least you must operate that still meets the requirements, keep sessions out of instance memory, and set scaling for latency and cost.

intermediate~25 min#agentic-ai#agents#deployment#cloud-run#gke
Chapter 5Evaluate and deployLesson 3 of 5Show

Prerequisites: What makes something an agent


Three places to run the same agent

Once an agent works on your machine, it needs to run somewhere users can reach. On Google Cloud an agent built with ADK (Google's open-source agent framework) can run in three main places, and the agent's code barely changes between them:

  • (formerly Agent Engine) is a managed runtime built for agents. You deploy the agent code, and it runs on infrastructure Google manages, next to agent services such as managed sessions, Memory Bank, evaluation and observability. A is the record of one conversation (its messages and state), and a session service is where the agent stores them. Memory Bank keeps long-term memory across sessions.
  • Cloud Run runs any container on serverless infrastructure that scales with requests, down to zero. You package the agent behind an HTTP server (ADK provides one) and deploy it like any other service.
  • GKE (Google Kubernetes Engine) runs your containers on Kubernetes clusters. It gives you the most control, over nodes, accelerators and networking, and leaves you the most to operate.

These are substitutes: each can host the same agent. The question is not which is best but which gives you what you need with the least you must run yourself. That is the decision this lesson teaches.

The three runtimes trade control for operating burden. Start from the left and move right only when a requirement forces you to.

What each one gives you, and what you bring

Agent Runtime is the most opinionated. With ADK you deploy with adk deploy agent_engine (the command still uses the old name), and the service provides the server that answers queries. The agent can use the managed Sessions service for conversation history and Memory Bank for long-term memory, and the runtime connects to Google Cloud's agent evaluation, observability and identity features. You are not limited to ADK: Agent Runtime also deploys from a Dockerfile or your own container image, as long as the container follows its runtime contract (it listens on port 8080 and serves the runtime's query endpoints). What you give up is control of the infrastructure under the container: the nodes, the network around them and how instances are managed. Choose it when you want an agent in production quickly and have no reason to run the platform yourself.

Cloud Run gives you a container you control: the server, the dependencies, the billing mode and the scaling settings, with no cluster to run. It fits when the agent sits beside other Cloud Run services, needs a custom HTTP API, or your team already deploys everything this way. The ADK command is adk deploy cloud_run.

GKE gives you Kubernetes: you choose node types and accelerators, set Kubernetes network policy and can audit the nodes yourself. Cloud Run can also attach a GPU (an NVIDIA L4, or an RTX PRO 6000 in full or as half a GPU) and run sidecar containers next to the agent, so one GPU or a sidecar alone is no reason to move to GKE. ADK's documentation points to GKE when you need more control and for serving open models. It fits a platform team that already runs GKE, strict compliance rules about the nodes and network, or open-weights models served on your own accelerators next to the agent. GKE Autopilot hands node management to Google, but you still operate a cluster.

That last point means the choice is not all or nothing. A common hybrid runs the agent on Cloud Run, where the team's other services live, and uses Agent Runtime's managed Sessions and Memory Bank for state.

An agent moved from local testing to Cloud Run. Users report that it forgets the conversation partway through, at random. What is the likely cause?

Three scenarios

  • A fast managed launch. A small team with no platform engineers needs an agent live this month, with conversation history and memory. Agent Runtime: the state services are managed, and there is no server or cluster to run.
  • One more service on an existing platform. A company already ships every API to Cloud Run through one pipeline. Cloud Run: the agent reuses the pipeline, networking and dashboards, with a persistent session service.
  • Control the platform must keep. A regulated firm has to configure and audit its own nodes and serve an open-weights model on its own GPUs. GKE: no managed runtime gives it that control.

Scaling: three settings

All three runtimes scale out by adding instances. On Cloud Run and Agent Runtime you set three settings directly; on GKE the same ideas map to a HorizontalPodAutoscaler's minimum and maximum replicas (you configure autoscaling yourself), and concurrency is whatever your server allows.

  • keep instances warm. With zero, the first request after a quiet spell waits for a cold start (a new instance starting the container and loading the agent). A minimum of one or more avoids that, and you pay for those instances while they wait.
  • Maximum instances cap how far the service scales out. That protects your budget and the systems behind the agent from a burst.
  • is how many requests one instance handles at once. Agents spend most of each request waiting on the model and tools, so an instance can usually serve several at a time; too many, and a memory-hungry agent runs out of memory.

With ADK on Cloud Run you pass these through to gcloud: flags after -- go to gcloud run deploy, and --no-allow-unauthenticated keeps the service private. Concurrency is left at Cloud Run's default here.

adk deploy cloud_run --project=my-project --region=us-central1 ./my_agent \
  -- --no-allow-unauthenticated --min-instances=1 --max-instances=20

How you set them depends on the load. For spiky or sporadic traffic, keep the minimum at zero (or one, if cold starts hurt users), size the maximum to what your budget and back-end systems can take, and leave concurrency moderate. For steady traffic, a warm floor of instances costs little extra because they are busy anyway, and instance-based billing may be cheaper.

Agent Runtime exposes the same three settings on a deployed agent (in Preview at the time of writing), with its own defaults and limits. Check the current values in the Agent Runtime documentation before you rely on them.

What does container concurrency set, and why can agents usually take more than one request per instance?

What drives the bill

A deployed agent has four cost levers:

  • Model calls. Often the largest running cost, because every turn of the loop sends the conversation and tool results to the model. For a low-traffic agent with warm instances, compute can cost more. Fewer turns, shorter context and a smaller model where it is good enough all lower token spend.
  • Instance settings. Minimum instances you pay for while idle, the size of each instance, and a maximum that bounds the worst case.
  • Billing mode. On Cloud Run, request-based billing charges only while an instance handles requests, starts or shuts down, which suits spiky traffic. Instance-based billing charges for the whole life of each instance, which can cost less under steady load.
  • What you operate. GKE's node prices can look low, but the cluster, its upgrades and the engineers who run it are part of the cost. A managed runtime folds that into its price.

So "GKE is always cheapest" and "managed is always most expensive" are both wrong. The cheapest runtime is the one whose total cost, including the work you take on, is lowest for this agent's load.

An internal agent gets bursts of traffic a few times a day and nothing in between. Which Cloud Run billing mode fits?

Recap

  • Agent Runtime, Cloud Run and GKE are substitutes. Pick the one with the least you must operate that still meets the requirements.
  • Agent Runtime gives you managed agent services; on Cloud Run and GKE you configure the session and memory services yourself, or use Agent Runtime's.
  • Minimum instances trade idle cost for no cold starts; maximum instances cap scale-out and spend; concurrency sets requests per instance.
  • Model calls are often the largest cost, though warm idle compute can be for a quiet agent. Count the cost of operating a platform too.

Sources

Show 10 sourcesHide sources
SourcePublisherWhat it supports
Deploying your agent (opens in a new tab)github.comGoogle, Agent Development Kit documentationretrieved 2026-11-17: Agent Runtime is a fully managed auto-scaling service designed for agents; Cloud Run runs the agent as a container; GKE is a good option for more control and for running open models
Deploy to Agent Runtime (opens in a new tab)and deploy.mdgithub.comGoogle, Agent Development Kit documentationretrieved 2026-11-17: Agent Runtime is a set of modular services to scale and govern agents; the deployment payload; adk deploy agent_engine; Agent Runtime is a paid service
Deploy to Cloud Run (opens in a new tab)github.comGoogle, Agent Development Kit documentationretrieved 2026-11-17: without session and artifact service URIs, sessions and artifacts are lost whenever an instance is recycled; agentengine:// managed sessions; passing gcloud flags after --, including --min-instances
Memory (opens in a new tab)github.comGoogle, Agent Development Kit documentationretrieved 2026-11-17: you do not need to deploy your agent to Agent Runtime to use Memory Bank
Set minimum instances (opens in a new tab)"About concurrency", docs.cloud.google.com/run/docs/about-concurrency (opens in a new tab) (higher concurrency suits I/O-bound work; lower concurrency where each request uses most of an instance's CPU or memory); "Billing settings", docs.cloud.google.com/run/docs/configuring/billing-settings (opens in a new tab)docs.cloud.google.comGoogle Cloud, Cloud Run documentationlast updated 2026-11-12, 2026-11-10 and 2026-11-12: minimum instances avoid slow starts; concurrency; request-based vs instance-based billing
Deploy an agent (opens in a new tab)docs.cloud.google.comGoogle Cloudlast updated 2026-11-12: Agent Runtime's minimum and maximum instances, container concurrency and resource limits, marked Preview
Gemini Enterprise Agent Platform runtime contract (opens in a new tab)(retrieved 2026-12-02: an agent deployed with a custom container or a Dockerfile must follow the runtime contract; the container listens for HTTP requests on 0.0.0.0:8080; /api/reasoning_engine and /api/stream_reasoning_engine serve queries). "Deploy an agent" (same date) lists deploying from an execution object, local source files, a Dockerfile, a container image in Artifact Registry or a Git repositorydocs.cloud.google.comGoogle Cloud
Configure GPU for Cloud Run services (opens in a new tab)and "Deploy multiple containers to a service (sidecars)", docs.cloud.google.com/run/docs/deploying (opens in a new tab)docs.cloud.google.comGoogle Cloud, Cloud Run documentationretrieved 2026-12-02: NVIDIA RTX PRO 6000 Blackwell with 96 GB, or 48 GB as a fractional 0.5 GPU, and NVIDIA L4 with 24 GB; one ingress container plus one or more sidecar containers
Set up Memory Bank (opens in a new tab)docs.cloud.google.comGoogle Cloudretrieved 2026-12-02: standalone Memory Bank instances without a deployed runtime
Agent Runtime (opens in a new tab)docs.cloud.google.comGoogle Cloudlast updated 2026-11-12: "Because the name of Agent Runtime changed over time", its API resource is still ReasoningEngine

Suggested videos

Show 3 videosHide videos

Review

Flashcards1 / 5

What does each of Agent Runtime, Cloud Run and GKE give an agent?

Check yourself

Quick exam1 / 7 · 0 correct

A small team built an ADK agent and needs it in production this month with conversation history and long-term memory. They have no platform engineers. Where should it run?

Go deeper

Your notes on this lesson