Guide · not normative
The Focus AI Standards
Guide: GDE-004
Status: Current
Relates to: STD-008
W. Schenk
The Focus AI
2026-07-25
Verified 2026-07-25

GCE Gaia runtime

Status of this guide

This is a guide: explanation, walkthrough and reference implementation. It contains no clauses and binds nothing (STD-001 §4). The rules in this area are STD-008; where this document and a standard disagree, the standard is the authority.

When a guide turns out to contain a rule, the rule moves to a standard where it can be cited and checked, and the guide keeps the explanation.

Rules extracted to STD-008; this is the platform walkthrough.

Deployment pattern for the habitats / Umwelten agent runtime plane: a long-lived GCE VM running Docker, Gaia (orchestrator), and sibling habitat containers. Reference: umwelten (deploy/gaia/, .github/workflows/deploy-gaia.yml) and ops notes in umwelten/docs/guide/operating-production.md.

This is not the Cloud Run / App Engine standard. For those see best-practices/GDE-005-gcp-deployment.md. For the habitats SaaS control plane (previews, env sync) see best-practices/GDE-010-vercel-deployment.md.

When to use this pattern

Use GCE + Gaia when the workload needs:

Do not use this for:

Three deploy loops (do not mix them)

LoopWhat changesTriggerBlast radius
1. PlatformGaia, base images, tool sets, deploy/gaia/Push to umwelten main (path-filtered) → self-hosted runner → redeploy.shWhole fleet: rebuilds images, recreates Gaia, cycles running habitats (~10 min)
2. One agentHabitat repo logic (config.json, tools, stimulus)Push to the agent repo → Gaia rebuild <id> (git pull + mise install + pnpm install --prod)That habitat only
3. SaaShabitats.thefocus.ai UI / APIPush to habitats → VercelControl plane only; does not rebuild GCE agents

PR previews exist on loop 3 (Vercel) only. Loops 1–2 have no branch/PR preview environment on GCP today.

Host topology

PieceConvention
ComputeGCE VM (e.g. gaia-host), Debian + Docker Engine + compose
SizeStart ≥ e2-standard-4 / 100 GB disk when hosting multiple habitats; 4 GB swap
SSHIAP only — no public SSH
Ingresscaddy-docker-proxy on gaia-net; Gaia not published raw on the host
DomainsGAIA_HOSTNAME + GAIA_BASE_DOMAIN; DNS *.<base>; habitat default <id>.<base>
NamingGaia container gaia; children gaia-<id>; volumes gaia-<id>-data
gcloudNamed config in umwelten mise.toml (CLOUDSDK_ACTIVE_CONFIG_NAME = "habitats")
SecretsHost deploy/gaia/.env (0600, gitignored); Gaia master vault on disk; child bindings via Gaia API — not Vercel Preview env

Startup hardening: idempotent deploy/gcp/*-startup.sh (swap, Docker, gcplogs, Ops Agent). Logging: Docker gcplogs driver + docker logs on the host. Backups: scheduled disk snapshots covering Gaia data and Docker volumes.

Auto-deploy (platform loop)

How it works

  1. Merge to umwelten main touching packages/**, examples/**, deploy/gaia/**, lockfiles, or the workflow file.
  2. GitHub Actions job runs-on: [self-hosted, gaia] executes on the prod VM.
  3. Workflow sets GAIA_ENV_FILE to the host’s canonical .env (secrets stay on disk).
  4. deploy/gaia/redeploy.sh builds images on the host, recreates Gaia, waits for /health, then stop/start each running habitat via the Gaia API.
  5. Deliberately stopped habitats stay stopped. Named volumes persist.

Manual equivalent: SSH via IAP and run redeploy.sh, or workflow_dispatch.

Hard rules for the self-hosted runner

This CD shape does not transfer to Cloud Run. Cloud Run has no host Docker socket and no “build on the prod box” step. Future Cloud Run / Cloud Build work is a different pipeline (build in Cloud Build → Artifact Registry → pull on host or deploy a service) — document that separately when it ships.

Previews: what exists vs what does not

SurfacePreview?How
habitats SaaSYesVercel Preview env + mise run vercel:sync -- --env preview
Gaia / habitats on GCENoEvery platform merge hits production
Cloud Build PR imagesNot implementedPlanned (umwelten migration Phase 4 / Stage 2)

Until a staging Gaia host or Cloud Build PR pipeline exists, test control-plane UI against Preview Vercel, and treat agent-fleet changes as production deploys with the ~10 minute cycle cost.

Agent (habitat) lifecycle

Repo-backed habitats only going forward:

config.json      # id metadata, toolsDir, stimulusFile, requiredSecrets
STIMULUS.md
tools/<name>/    # TOOL.md + handler.ts
src/
package.json     # runtime deps; boot installs with --prod
mise.toml        # pin node/pnpm
  1. Secrets → Gaia master vault (POST /api/secrets), never into git.
  2. create_habitat with gitUrl + secretBindings; hostname defaults to <id>.<GAIA_BASE_DOMAIN>.
  3. start_habitat → check /health; attach in SaaS with the child API key (never Gaia’s master key).
  4. Later deploys = agent-repo push + Gaia rebuild <id> (loop 2).

Gaia is the only holder of GitHub credentials (GitHub App on an explicit allowlist). See umwelten ADR / operating-production for the App layout.

Secrets and credentials

SecretWhere it lives
Compose / host config (GAIA_API_KEY, hostnames, …)deploy/gaia/.env on the VM
Provider keys, Twitter tokens, per-agent DB URLsGaia master vault → bound into child secrets.json
GitHub App private keyOn gaia-host only
SaaS Clerk / Neon / Blobhabitats Vercel + fnox — separate plane

Do not sync Vercel Preview secrets onto the GCE host. Do not put prod Gaia keys in the SaaS Preview vault.

Anti-patterns

Planned next (not standard yet)

Documented in umwelten migration reports — do not treat as current practice:

  1. Cloud Build → Artifact Registry so the host pulls tags instead of docker build on the pet VM (decouples CD from runner disk/RAM).
  2. Optional staging Gaia host if we need a non-prod runtime plane.
  3. Longer term: GKE / Cloud Run Instances if orchestration requirements change.

When Stage 2 lands, add a short subsection here or a sibling doc; keep this file focused on the live GCE + self-hosted runner pattern.

Checklist (new Gaia host)

DocRole
best-practices/GDE-005-gcp-deployment.mdCloud Run / App Engine / gcloud configs
best-practices/GDE-010-vercel-deployment.mdhabitats SaaS previews and fnox→Vercel sync
umwelten deploy/gaia/README.mdHost runbook
umwelten docs/guide/operating-production.mdDay-to-day fleet ops
umwelten reports/2026-07-10-gaia-on-gcp-deployment-strategy.mdWhy not Cloud Run