Benchmarking Gemini 3.7 Flash on Autonomous Distributed Infrastructure: Building PostgreSQL & MySQL HA Clusters from Scratch

An empirical, end-to-end evaluation of Gemini 3.7 Flash across distributed systems design, infrastructure as code, deterministic testing, and live cloud deployment.

Executive Summary

Can modern frontier AI models autonomously architect, implement, test, pin, and deploy production-grade distributed systems from a blank directory without human guidance?

We subjected Gemini 3.7 Flash (operating in Adaptive Thinking / High Reasoning mode) to a rigorous creation-effort benchmark within the Google Antigravity (AGY) agentic ecosystem and the Colors infrastructure framework.

  • 100% Autonomous Convergence: Both subagents converged on real DigitalOcean hardware and Cloudflare R2 with zero human intervention.
  • 13,105 Lines of Production Code Written: Across 198 files spanning Clojure/Babashka SDKs, OpenTofu templates, Ansible playbooks, and systemd units.
  • Zero Golden Regressions: 216 test assertions passed, achieving 100% byte-for-byte golden fixture matching.
  • High Token Economy: Generated ~337K output tokens across 485 tool calls while evaluating over 114M cumulative context tokens up to a peak context window of 212K tokens without degradation.

1. Experimental Methodology & Controls

Standard AI benchmarks often evaluate models on isolated coding snippets or toy algorithms. Real infrastructure engineering is fundamentally different: it requires state management, asynchronous orchestration, multi-file dependency graphs, network protocol understanding, and self-healing under failure.

Benchmark Experimental Setup: Two Concurrent Isolated Subagents with Symmetrical Prompts
Figure 1: Symmetrical, isolated concurrent subagent benchmark workflow.

Eliminating the Order Effect

In sequential testing, building Stack A gives the model context and learned patterns that artificially make Stack B easier to implement. To eliminate this bias:

  • Concurrent Isolated Subagents: Two cold subagents were spawned simultaneously with zero shared memory or cross-visibility. Subagent 1 (mysql-agy) was forbidden from inspecting PostgreSQL files, and Subagent 2 (postgres-agy) was forbidden from inspecting MySQL files.
  • Symmetrical Prompt Template: Both agents received prompts generated from a single canonical template (agent-prompt-template.md) parameterized only by engine-specific nouns (ports, package names, bucket names).
  • Objective Telemetry: Claims were audited against objective filesystem artifacts: commit logs, unit test assertions, golden file diffs, and live droplet metrics.

2. Architectural Divergence: How Gemini 3.7 Flash Solved Each Stack

Given identical budgets (3 Droplets max, s-2vcpu-4gb, ubuntu-24-04-x64 in DigitalOcean ams3), the model independently chose optimal, engine-native architectures:

Database HA Topologies: PostgreSQL HA vs MySQL HA Architecture
Figure 2: Architectural comparison between PostgreSQL and MySQL High Availability clusters.

PostgreSQL HA Arm (postgres-agy & postgres-agy-digitalocean)

  • Quorum & Consensus: Deployed a 3-member etcd v3.5.33 cluster colocated on the VPC private network (2379/2380), managed by Patroni 4.1.5 with quorum synchronous commit (synchronous_standby_names = ANY 1).
  • Client Routing: Deployed HAProxy 2.8 on all 3 nodes routing port 5432 to the active leader and 5433 to read-only replicas. Paired with Cloudflare DNS multi-A records (postgres-agy.bigconfig.online), enabling client-side libpq failover without control-plane API latency during an outage.
  • Backup & PITR: Implemented pgBackRest 2.59.0 with repo1-type=s3 streaming WAL files directly to Cloudflare R2 (postgres-agy-backup). Standbys execute a scheduled restore drill into a temporary cluster verifying leader heartbeat row continuity.

MySQL HA Arm (mysql-agy & mysql-agy-digitalocean)

  • Quorum & Consensus: Implemented native MySQL 8.4 Group Replication in Single-Primary mode. Consensus is maintained internally via MySQL's Group Communication System (Paxos) without external DCS dependencies.
  • Client Routing: Created an automated Floating VIP claim daemon (mysql-agy-endpoint) running on a 10s timer that polls cluster status and dynamically assigns the DigitalOcean Reserved IP (178.128.139.24) to the active primary.
  • Backup & PITR: Implemented a continuous binary log spooler pushing increments every 1 minute to Cloudflare R2 (mysql-agy-backup), combined with daily zstd logical dumps and an automated restore drill that spins up an isolated scratch instance to replay binary logs and assert lag < 900s.

3. Objective Metrics & Scorecard

Recovered directly from the filesystem, git histories, and live cloud probes:

Category / MetricMySQL Arm (mysql-agy)PostgreSQL Arm (postgres-agy)Combined Benchmark Total
Convergence Status✔ 100% Converged✔ 100% Converged100% Success
Wall-Clock Duration18 min 28 sec27 min 10 sec27 min 10 sec (Parallel)
Package Code Size91 files (6,913 lines)107 files (6,192 lines)198 files (13,105 lines)
Deployment Code Size46 files (29,016 lines)35 files (22,928 lines)81 files (51,944 lines)
Git Commits (Pkg / Deploy)10 / 4 commits12 / 5 commits31 commits total
Unit Test Assertions38 tests (139 assertions)17 tests (77 assertions)216 assertions (100% pass)
Golden Fixture Verification0 diffs (100% byte match)0 diffs (100% byte match)Zero regressions
Launcher Contract Checks7 / 7 passed7 / 7 passed14 / 14 passed
Live Acceptance Checks0 failed health checks10 / 10 passed100% verified
Live Cloud Infrastructure3 Droplets + 1 Reserved IP3 Droplets + HAProxy6 Droplets, 2 R2 Buckets

4. Token Consumption & Trajectory Telemetry

Evaluating the efficiency of agentic workflows requires analyzing token economy, context growth, and tool distribution across hundreds of execution steps:

AI Agent Telemetry and Token Performance Dashboard
Figure 3: Token telemetry, tool invocation counts, and context scale.
Trajectory MetricMySQL Arm (mysql-agy)PostgreSQL Arm (postgres-agy)Combined Total
Total Trajectory Steps380 steps649 steps1,029 steps
Model Invocations / Turns364 turns617 turns981 turns
Total Tool Invocations181 calls304 calls485 calls
Generated Output Tokens~141.6K tokens~195.4K tokens~337.0K tokens (1.35 MB)
Peak Context Window Size~150.9K tokens~212.4K tokens
Cumulative Context Processed~32.6M tokens~81.4M tokens~114.0M tokens

Tool Call Breakdown

Tool NameMySQL ArmPostgreSQL ArmCombined Total% of Calls
run_command (build, test, deploy, verify)6310616934.8%
write_to_file (scaffold, playbooks, templates)586412225.2%
view_file (reference inspection, validation)546511924.5%
manage_task (async command monitoring)431357.2%
replace_file_content (precise code fixes)116173.5%
schedule (background timer scheduling)014142.9%
list_dir / grep_search0771.4%
send_message (final status report)1120.5%
Total181304485100.0%

5. Observations on Gemini 3.7 Flash Capabilities

  1. Long-Horizon Context Stability: In both runs, context history grew beyond 150,000 to 212,000 tokens. Despite this depth, Gemini 3.7 Flash exhibited zero instruction drift, maintained strict negative constraints (no plaintext secrets, no hardcoded IPs), and accurately referenced file paths established at step 1.
  2. Surgical Code Modifications: When refining playbooks or test assertions, the model utilized replace_file_content with exact character-sequence matches, avoiding clumsy full-file overwrites and preventing merge collisions.
  3. Autonomous Self-Healing & Verification: During local dry runs and acceptance checks, transient syntax and permission errors were diagnosed directly from stack traces and remediated without human prompt hints.
  4. Adherence to Safety Guards: Both agents preserved compute-prevent-destroy: true flags, avoided exposing .envrc.private secrets, and pinned all dependencies by exact SHA digests.

6. What This Means for Platform & AI Engineering

This benchmark demonstrates that frontier reasoning models like Gemini 3.7 Flash have crossed a critical capability threshold: moving from code completion assistants to autonomous distributed systems engineers.

When paired with a structured execution framework like Antigravity / Colors—providing strict phase gates, golden fixtures, and isolated environments—autonomous agents can reliably design and deploy mission-critical infrastructure with zero hallucination risk.