Challenge 2: Contain Your Excitement

Previous Challenge Next Challenge

Introduction

Running agents locally is fine for development but enterprise workloads require high availability, auto-scaling, low latency, and robust runtime isolation.

Agent Runtime (part of Gemini Platform) provides a managed, serverless execution environment specifically built for AI agents. While Agent Runtime can deploy from source, enterprise platforms often require the Bring Your Own Container (BYOC) pattern to maintain full control over base images, security vulnerability scanning, system packages, and language runtime versions.

In this challenge, you will package the agent into a container image and deploy it to Agent Runtime.

Description

The sample agent already contains the necessary files to build a container image. Build the container image using Google Cloud Build (or Docker) and push it to the Artifact Registry repository agent-images that’s in your project.

Once the image is on Artifact Registry, deploy the containerized agent to Agent Runtime using the BYOC option. Make sure to use the following parameters:

  • CPU: 1 vCPU
  • Memory: 4 GiB
  • Min instances: 1
  • Max instances: 5
  • Concurrency: 4 requests per instance

 Note
You can do the deployment using various methods, Python SDK, REST APIs, Terraform etc. For this, and the remaining challenges, we suggest that you use agents-cli as that’s the easiest method to deploy/update the agent. Make sure that its version is >= 1.13 as that’s when the BYOC support was introduced.

Success Criteria

  • Custom container image is built and stored in Artifact Registry.
  • An Agent Runtime resource, using the custom container image from the Artifact Registry, is successfully created and in ready state.
  • Sizing configuration (CPU, Memory, Concurrency, Min/Max instances) is correctly applied.
  • The deployed agent successfully processes remote queries and returns streaming responses using its tools

    You can ignore any permission denied errors when the tools access the Firestore database, we’ll address that in the next challenge.

  • No code was modified.

Learning Resources

Tips

  • The agents-cli documentation for the deployment parameters is quite concise, use the --help parameter to find out all of the supported parameters.
  • You can use Agent Runtime Playground or the REST APIs to test your agent.
  • If the deployment fails the very first time with code 13, retry it as this is a known issue

Previous Challenge Next Challenge