Clarify Requirements
If not already specified by the user, confirm:
- GCP Project & Zone (discover current defaults via
gcloud config list --format="json"andgcloud compute zones list). - Machine Type:
e2-medium(2 vCPU, 4 GB RAM) — recommended default for CLI and lightweight agent tasks.e2-standard-2ore2-standard-4— recommended for heavier builds, containers, or IDE Remote-SSH.
- Service Account: Check if a dedicated least-privilege VM service account (e.g.,
antigravity-vm@<project>.iam.gserviceaccount.com) exists before falling back to the default compute service account.
Provision the GCE Instance
Validate syntax with gcloud help compute instances create if needed, then create an Ubuntu 24.04 LTS instance:
gcloud compute instances create <INSTANCE_NAME> \ --project=<PROJECT_ID> \ --zone=<ZONE> \ --machine-type=e2-medium \ --image-family=ubuntu-2404-lts-amd64 \ --image-project=ubuntu-os-cloud \ --boot-disk-size=20GB \ --scopes=cloud-platform \ --quiet
(If a dedicated service account exists, include --service-account=<SA_EMAIL>.)
Connect via IAP Tunnel & Install agy
scp the local /usr/bin/agy binary (~240 MB) over SSH/IAP, and do not assume port 22 is open to the public internet. Many projects restrict default-allow-ssh to the IAP ingress range (35.235.240.0/20). Always pass --tunnel-through-iap and install agy directly on the VM using the official installer script.
Run the official installer, symlink agy into /usr/local/bin (so non-interactive SSH commands find it on PATH), and enable systemd user lingering so the remote-control daemon survives SSH logouts and reboots:
gcloud compute ssh <INSTANCE_NAME> \ --project=<PROJECT_ID> \ --zone=<ZONE> \ --tunnel-through-iap \ --command="curl -fsSL https://antigravity.google/cli/install.sh | bash && sudo ln -sf \$HOME/.local/bin/agy /usr/local/bin/agy && sudo loginctl enable-linger \$USER && agy --help | head -n 5" \ --quiet
Authenticate & Start the Remote-Control Daemon
Because OAuth login requires interactive browser verification, provide the user with the exact interactive command to authenticate and register the daemon:
Option A: Built-in agy remote-control Daemon
gcloud compute ssh <INSTANCE_NAME> \ --project=<PROJECT_ID> \ --zone=<ZONE> \ --tunnel-through-iap \ -- -t "agy remote-control start --name <INSTANCE_NAME>"
Option B: Auto-Updating Daemon Installer (agy-daemon.sh)
gcloud compute ssh <INSTANCE_NAME> \ --project=<PROJECT_ID> \ --zone=<ZONE> \ --tunnel-through-iap \ -- -t "curl -fsSL https://antigravity.google/cli/agy-daemon.sh | bash -s -- install --name <INSTANCE_NAME>"
Verification Command
gcloud compute ssh <INSTANCE_NAME> \ --project=<PROJECT_ID> \ --zone=<ZONE> \ --tunnel-through-iap \ --command="agy remote-control status"
Spend & Escalation Guardrails
When setting up a shared or autonomous agent VM, recommend attaching a dedicated service account paired with an IAM Deny Policy that blocks serviceusage.googleapis.com/services.enable and serviceusage.googleapis.com/quotas.update so the remote agent cannot enable new billable APIs or request quota increases.