AI-Driven SDLC on Google Cloud: Testing Agents with Harbor

 · 19 mins read

Contents

Six-stage Google Cloud AI-driven SDLC and Harbor FastAPI security hardening results on GKE.
A practical guide to evaluating coding agents on Kubernetes and turning checks into a CI gate

Introduction

Using AI coding agents to build and review backend services is getting easier every month. However, knowing whether a prompt edit, a new SKILL.md guide, or a model upgrade actually makes an agent safer and more reliable is still surprisingly hard. Changing a single sentence in your repository instructions can cause an agent to forget input validation, leave a default password secret behind, or get stuck in a loop.

Traditional unit tests only check one static code diff, so they cannot tell us how an agent performs across multiple end-to-end runs before we merge a change. In software engineering, we rely on continuous integration (CI) to catch regressions early. For coding agents, we need the same habit: isolated, repeatable evaluations that verify behavior without handing real API keys to the sandbox.

In this tutorial, we start with a quick map of the AI-driven software development lifecycle (SDLC) on Google Cloud, and then walk through a practical demonstration using open-source Harbor on Google Kubernetes Engine (GKE). Together, we will test an agent on a realistic task almost every team runs into: hardening a small FastAPI, SQLite, and Docker microservice before production. All of the starter application files, the reusable security SKILL.md, the verifier suite, and the CI configuration are available on my GitHub.

Mapping the Google Cloud AI-driven SDLC

Before installing Harbor, it helps to see where agent evaluation fits into the wider engineering workflow. Figure 1 and the table below divide the Google Cloud and open-source ecosystem into six straightforward stages.

Six-stage matrix mapping the Google Cloud AI-driven SDLC stack from Google AI Studio to production runtimes.
Figure 1: Six-stage Google Cloud AI-driven SDLC stack.
Table: Stage, Google Cloud / OSS tooling, Primary role in the lifecycle (6 rows).

Across these stages, teams often combine the Agent Development Kit (ADK) (adk.dev) for writing custom multi-agent applications with google-agents-cli for modular skill packages, while sharing conventions through AGENTS.md (repository instructions), SKILL.md (reusable task checklists), Model Context Protocol (MCP), and Agent2Agent (A2A).

For the rest of this tutorial, we focus on Stage 04. But first, why not just run agent tests directly on a laptop or inside a standard CI runner?

Why verification needs Harbor

Running agent evaluations in a shared machine or plain CI worker usually hits a few recurring problems:

  • Test tampering: If the grading tests live inside the same folder as the project code, an agent with shell access can inspect the assertions directly or weaken them.
  • Leftover state: Files left behind in /tmp or background processes from one run can quietly affect the next trial.
  • Credential risk: Putting raw API keys inside a test container exposes them to arbitrary generated code.

Harbor (Apache 2.0) solves these issues by separating every evaluation into three clean parts: a Task folder (instructions, container definition, reference solution, and hidden tests), an Agent and Model pair, and an Environment backend (Docker on a laptop, or Kubernetes and GKE at scale). If you want to try public benchmarks too, Harbor Hub ships adapters for datasets such as Terminal-Bench and SWE-Bench.

In Harbor v0.27.0, native GKE support installs right inside the main package via harbor[gke] (working on both self-managed Standard and Google-managed Autopilot clusters). Every sandbox pod (container unit) disables automatic Kubernetes API tokens, while on the host side Harbor builds container images remotely with Cloud Build into Artifact Registry (so you do not need Docker running locally) and isolates each parallel terminal session so concurrent trials do not clash.

With Harbor’s built-in terminus-2 agent, model API calls stay on your trusted host machine using your local Google Cloud login (Application Default Credentials, or ADC), while the sandbox pods only receive shell keystrokes (Figure 2). Harbor’s antigravity-cli agent supports enterprise ADC in a similar way via AGY_ADC_AUTH=true for Gemini 3 Flash and newer models.

Harbor native GKE execution showing trusted host-side ADC, Cloud Build, Artifact Registry, and isolated sandbox pods.
Figure 2: Harbor v0.27.0 trust boundary on GKE with host-side ADC.

Demonstration

We are now ready to build and run a paired evaluation on GKE. Instead of using a tiny toy script, our task audits a small runnable FastAPI Expense Tracker backed by SQLite, complete with user login, CRUD routes, receipt downloads, passing happy-path smoke tests, and a Dockerfile.

Even though the starter app passes its smoke tests, it intentionally includes the kinds of flaws that come up regularly in real code reviews:

  • Database and auth: SQL injection, missing ownership checks allowing one user to edit another user’s expenses (IDOR), unsalted MD5 password hashes, a hardcoded "dev-secret-change-me" fallback secret, and unsigned base64 tokens.
  • API and file handling: a debug endpoint leaking configuration and stack traces, missing input bounds, permissive cross-origin (CORS) settings paired with credentials, and receipt downloads open to ../ path traversal.
  • Container image: a Dockerfile running python:latest as root with --reload, hardcoded APP_SECRET and DEBUG=true, and no health check.

To measure whether repository guidance actually helps, we compare two fair variants that can both legitimately score 1.0 (10 out of 10 checks, based purely on public OWASP and Docker practices):

  • Baseline (fastapi-expenses-baseline): contains only the starter microservice, Dockerfile, and smoke tests.
  • With skill (fastapi-expenses-with-skill): identical code, prompt, and grading suite, plus an AGENTS.md file pointing to a reusable 9-point OWASP FastAPI and Docker SKILL.md (with no leaked test answers).

Replace example-gcp-project with your own Google Cloud project ID in the commands below (or inspect and run the starter app locally with uvicorn app.main:app before spinning up a cluster).

Step 1: Install Harbor and configure GKE

First of all, using uv (a fast Python package manager), let us create a Python 3.12 virtual environment, install harbor[gke] with Google authentication helpers, sign into Application Default Credentials (assuming you already ran gcloud auth login), and set our shared environment variables:

uv venv .harbor-venv --python 3.12
uv pip install --python .harbor-venv/bin/python "harbor[gke]==0.27.0" google-auth certifi
source .harbor-venv/bin/activate

export PROJECT_ID=example-gcp-project
export REGION=europe-west2
export ZONE=europe-west2-a
export CLUSTER_NAME=harbor-eval-demo
export AR_REPO=harbor-eval-repo

gcloud auth application-default login --project="${PROJECT_ID}"
export GOOGLE_CLOUD_PROJECT="${PROJECT_ID}"
export GOOGLE_CLOUD_LOCATION=global
export VERTEXAI_PROJECT="${PROJECT_ID}"
export VERTEXAI_LOCATION=global
export SSL_CERT_FILE="$(python -c 'import certifi; print(certifi.where())')"

Note that VERTEXAI_* and the vertex_ai/gemini-3.8-flash model string below are provider prefixes used by LiteLLM (Harbor’s model client) to route through your local ADC login to Gemini 3.8 Flash on Gemini Enterprise Agent Platform without static API keys.

Next, with the Kubernetes Engine, Artifact Registry, Cloud Build, and aiplatform.googleapis.com APIs enabled, we create a three-node e2-standard-4 GKE cluster (enough headroom to run five parallel trials without waiting), an Artifact Registry repository for task images, image-pull permissions for the VM service account (preventing ImagePullBackOff errors), and an isolated harbor-eval namespace. Creating the cluster takes roughly five minutes:

gcloud container clusters create "${CLUSTER_NAME}" \
  --zone "${ZONE}" --project "${PROJECT_ID}" \
  --machine-type e2-standard-4 --num-nodes 3 \
  --release-channel regular \
  --scopes https://www.googleapis.com/auth/cloud-platform --quiet

# Use your gcloud login instead of ADC when fetching cluster credentials
export CLOUDSDK_CONTAINER_USE_APPLICATION_DEFAULT_CREDENTIALS=false
gcloud container clusters get-credentials "${CLUSTER_NAME}" \
  --zone "${ZONE}" --project "${PROJECT_ID}"

gcloud artifacts repositories create "${AR_REPO}" \
  --repository-format=docker --location="${REGION}" --project="${PROJECT_ID}"

PROJECT_NUMBER="$(gcloud projects describe "${PROJECT_ID}" --format='value(projectNumber)')"
gcloud artifacts repositories add-iam-policy-binding "${AR_REPO}" \
  --location="${REGION}" --project="${PROJECT_ID}" \
  --member="serviceAccount:${PROJECT_NUMBER}-compute@developer.gserviceaccount.com" \
  --role="roles/artifactregistry.reader" --quiet

kubectl create namespace harbor-eval

Step 2: Review the task prompt and verifier

Clone the companion folder from my GitHub and cd into it before running the commands below. Both task folders include the starter FastAPI app, a container Dockerfile, a task.toml config (giving each agent 1 vCPU, 2 GiB memory, and a 480-second timeout so multi-file edits over remote terminal connections do not cut off early), a hardened reference script (solution/solve.sh), and a hidden tests/ folder mounted only during grading.

Both arms receive the exact same instruction.md, phrased clearly without vague lines like “follow conventions if present” (which can send a baseline agent wasting steps looking for nonexistent files):

# Production Security Hardening: FastAPI Expense Tracker API

Prepare the Expense Tracker microservice in `/app` for production deployment.

Perform a thorough security and production-readiness audit of both the application code under `/app/app/` and its container definition at `/app/Dockerfile`. Fix every vulnerability and misconfiguration you find using standard Python/FastAPI and Docker security practices.

Keep these constraints in mind:

1. Preserve all existing API routes, request schemas, and happy-path behavior covered by `/app/tests/test_smoke.py` (except removing or disabling unsafe debug endpoints that should not exist in production).
2. Read `DB_PATH`, `RECEIPTS_DIR`, and `APP_SECRET` from environment variables as configured in the starter code (do not break dynamic test overrides).
3. Use only the Python standard library and packages already installed in the container (see `/app/requirements.txt`).
4. Run `pytest` inside `/app` to verify your changes (and add regression tests if helpful) before finishing.

In the with-skill arm, AGENTS.md points the agent to our reusable SKILL.md checklist:

  • Parameterized SQL queries, strict sort allowlists, and owner-scoped routes.
  • Slow salted password hashing (such as scrypt or pbkdf2_hmac, no MD5), revocable random tokens, and no fallback secret.
  • No debug routes or traceback leaks, strict input and pagination limits, HTTP security headers, path-safe authenticated downloads, and a non-root Dockerfile with a /health check.

Our hidden pytest suite (test_state.py) runs 10 independent checks matching those practices while still verifying happy-path functionality. Then tests/test.sh reads pytest’s standard XML report (JUnit XML) and turns the pass count into a smooth 0.0 to 1.0 reward:

Step 3: Validate sanity bounds and launch the paired trials

Before spending any money on model tokens, it is always worth checking both sanity bounds: leaving the repo untouched (nop) should score 0.0, and running our reference solution (oracle) should score 1.0. You can run those locally with plain Docker first (details in the companion repository), then run them on GKE from inside the companion folder to warm up Cloud Build and Artifact Registry. The --ek flags pass backend environment settings (region expects the regional name europe-west2 for Cloud Build while reusing the cluster connection created earlier):

# Avoids SSL errors behind some corporate proxies
export CLOUDSDK_STORAGE_PARALLEL_COMPOSITE_UPLOAD_ENABLED=False

GKE_FLAGS=(
  --env gke --ek "cluster_name=${CLUSTER_NAME}" --ek "region=${REGION}"
  --ek namespace=harbor-eval --ek "registry_location=${REGION}"
  --ek "registry_name=${AR_REPO}" --ek "project_id=${PROJECT_ID}"
)

harbor run -p ./dataset/fastapi-expenses-baseline -a oracle "${GKE_FLAGS[@]}" \
  --jobs-dir ./harbor_gke_jobs --job-name gke-oracle-baseline
harbor run -p ./dataset/fastapi-expenses-with-skill -a nop "${GKE_FLAGS[@]}" \
  --jobs-dir ./harbor_gke_jobs --job-name gke-nop-with-skill
harbor run -p ./dataset/fastapi-expenses-with-skill -a oracle "${GKE_FLAGS[@]}" \
  --jobs-dir ./harbor_gke_jobs --job-name gke-oracle-with-skill

All three smoke jobs pass cleanly, and Harbor runtime drops from around 95 seconds on a cold image build down to just 18 seconds once the image is cached:

Table: Smoke job, Agent, Reward, Checks, Harbor runtime, Total CLI time, Build / pull note (3 rows).

Now we launch the paired experiment: five parallel trials (-k 5 --n-concurrent 5) for each arm using the exact same model and agent. All five pods run in parallel across our three nodes and get removed automatically once each job finishes:

harbor run -p ./dataset/fastapi-expenses-baseline \
  -a terminus-2 -m vertex_ai/gemini-3.8-flash \
  -k 5 --n-concurrent 5 "${GKE_FLAGS[@]}" \
  --jobs-dir ./harbor_gke_jobs --job-name gke-exp-baseline

harbor run -p ./dataset/fastapi-expenses-with-skill \
  -a terminus-2 -m vertex_ai/gemini-3.8-flash \
  -k 5 --n-concurrent 5 "${GKE_FLAGS[@]}" \
  --jobs-dir ./harbor_gke_jobs --job-name gke-exp-with-skill

The baseline arm finishes in 8m 45s with a mean score of 0.38 (and three AgentTimeoutError exceptions), whereas the with-skill arm finishes slightly faster in 8m 11s with a mean score of 1.00 (5 out of 5 passing all 10 checks, zero exceptions).

Step 4: Inspect trajectories and separate real bugs from verifier policy

A raw headline gap like 0.38 versus 1.00 never tells the whole story on its own, so the most informative step is reading the per-check matrix (Figure 3) and the saved step-by-step JSON logs (trajectory.json, written in Harbor’s Agent Trajectory Interchange Format, ATIF-v1.8).

Per-check matrix comparing nop, oracle, baseline, and with-skill trials across all 10 OWASP and Docker checks.
Figure 3: Per-check outcome matrix across all 10 paired live GKE trials.

The table below collects the full Harbor trial durations, token counts, and costs across all ten rollouts (total durations include container setup and verification, which is why completed runs slightly exceed the 480-second agent-only timer):

Table: Trial, Total time, Steps, Exception, Score, Prompt tokens (cached), Output tokens, Cost (10 rows).

Across all 10 trials, total model spend came to $3.77 ($2.00 for baseline and $1.77 with the skill). Adding SKILL.md pushed the pass rate to 5/5, lowered spend by about 11% ($0.35 vs $0.40 per trial), and cut average trial time by roughly 90 seconds (411.7s vs 501.9s total from unrounded timings, or 371.6s vs 460.7s agent-only) because every with-skill agent read the checklist on step 3 and worked straight through it without wandering.

Sample size note: Five parallel trials per arm (100 check evaluations total) give a much clearer signal than a single run, though this is still one repository and one model. For a production CI gate, combine multiple trials with a small suite of tasks.

Digging into the baseline logs shows three distinct failure patterns:

  • Genuine missed flaws: All four baseline trials that edited code fixed SQL injection in search, IDOR ownership checks, leaked password hashes, /debug/config, and path traversal. However, all four left the hardcoded "dev-secret-change-me" fallback secret in config.py (one left it in auth.py too), kept accepting negative expense amounts, and forgot a Dockerfile health check. Two also missed the X-Content-Type-Options: nosniff header.
  • Strict policy differences: Not every red cell was an active exploit. Those same four baseline runs upgraded new passwords to salted pbkdf2_hmac while keeping an old MD5 fallback branch for backwards compatibility, and three defaulted unknown sort columns back to "id" (HTTP 200) instead of returning HTTP 400 or 422. Even if we give baseline full credit for all seven of those amber policy cells in Figure 3, its mean rises only from 0.38 (19/50) to 0.52 (26/50).
  • One parser stall: Trial aYkoypH (0/10) emitted malformed JSON responses on steps 6, 8, and 10 that failed terminus-2’s parser, burning 50,499 of 61,780 output tokens until the timeout expired without editing a single file (notice its 37% cache rate versus 86% to 89% with the skill). Because Harbor still grades timed-out containers, partial edits on YULiFkf (0.5) and eWFXRYM (0.4) were preserved fairly.

We can also explore completed jobs offline in a browser UI with harbor view ./harbor_gke_jobs --host 127.0.0.1 --port 18081 --jobs. Figure 4 shows all five runs side by side, while Figure 5 highlights one small UI quirk to keep in mind: timed-out rows display a red AgentTimeoutError label instead of their partial score, even though the 0.38 mean includes those partial passes.

Harbor view Jobs overview showing all five completed GKE jobs with scores, durations, errors, and USD costs.
Figure 4: harbor view Jobs overview across all five GKE runs.
Harbor view job detail for gke-exp-baseline showing five rollouts with three displaying AgentTimeoutError.
Figure 5: Job detail view for gke-exp-baseline.

Step 5: Turn Harbor into a Cloud Build CI gate

To run this benchmark automatically whenever a pull request edits SKILL.md or AGENTS.md (still without any static API keys), we can wire it into a short cloudbuild.yaml:

Every build gets its own isolated namespace (harbor-eval-${BUILD_ID}) with a bash cleanup hook (trap ... EXIT) so interrupted runs never leave pods behind or collide with parallel pull requests. We also raise timeout to 1800s so Cloud Build finishes cleanup safely, set CLOUD_LOGGING_ONLY for custom service accounts, and gate merges on both scored trials (at least 4 of 5) and mean reward (at least 0.80).

Once a versioned task suite like this is in place, you can even take the next step toward automated instruction tuning. As shown in Google Cloud’s post on building an agent skill optimizer with AlphaEvolve and Harbor, you can treat editable sections of SKILL.md like code, let an evolutionary loop propose improvements from failing logs, evaluate candidates concurrently in Harbor, and test winners on held-out tasks before reviewing them in a regular pull request.

Cleaning up

Finally, once you finish experimenting, delete the namespace, Artifact Registry repository, and GKE cluster so no billable resources keep running (cleanup takes about five minutes, and you can keep ./harbor_gke_jobs locally for offline browsing in harbor view):

kubectl delete namespace harbor-eval --ignore-not-found
gcloud artifacts repositories delete "${AR_REPO}" --location="${REGION}" --project="${PROJECT_ID}" --quiet
gcloud container clusters delete "${CLUSTER_NAME}" --zone="${ZONE}" --project="${PROJECT_ID}" --quiet

Conclusion

Running Harbor on GKE gives us a clean, repeatable way to test changes to prompts, models, and SKILL.md files before they reach production, without handing API keys to the sandbox. On a realistic FastAPI and Docker hardening task, pairing an agent with a concise OWASP checklist raised the five-trial average from 0.38 to 1.00 while lowering both runtime and total model cost ($1.77 versus $2.00). Looking past the headline number into the trajectories also helps separate real missed vulnerabilities from strict policy preferences. If you are interested in adapting the starter app, checklist, or verifier for your own project, the links below cover the companion repository and official docs.

Get started

Disclaimer: Views and opinions in this post are my own and do not represent Google.

Contacts

If you want to keep updated with my latest articles and projects follow me on Medium and subscribe to my mailing list. These are some of my contacts details:

Buy Me A Coffee

Subscribe to my mailing list to be updated about my new blog posts!

* indicates required