Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

3.0 KB
Raw Blame
# Build + deploy the auto-rig worker (Make-It-Animatable engine).
# Manual submit (SHORT_SHA is only auto-set by triggers):
#   gcloud builds submit --config workers/rig/cloudbuild.yaml \
#     --substitutions=SHORT_SHA=manual$(date +%s) .
serviceAccount: projects/aerial-vehicle-466722-p5/serviceAccounts/[email protected]

substitutions:
  _REGION: us-central1
  _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com
  _SERVICE: model-rig
  _REPO: model-rig
  _GCS_BUCKET: three-ws-avatar-reconstructions
  _WEIGHTS_BUCKET: three-ws-model-weights
  # Task state lives in this service's memory, so min MUST equal max: with a
  # second instance, Cloud Run can route GET /tasks/:id to the instance that
  # does not own the task and 404 a job that is running fine on the other one.
  # MAX_CONCURRENT=1 already serializes rigging, so the second instance bought
  # no throughput anyway. main.py and the README both document this invariant.
  _MIN_INSTANCES: "1"
  _MAX_INSTANCES: "1"

steps:
  - id: build
    name: gcr.io/cloud-builders/docker
    dir: workers/rig
    args:
      - build
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
      - --cache-from
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
      - .

  - id: push
    name: gcr.io/cloud-builders/docker
    args:
      - push
      - --all-tags
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server

  - id: deploy
    name: gcr.io/google.com/cloudsdktool/cloud-sdk:slim
    entrypoint: gcloud
    args:
      - run
      - deploy
      - ${_SERVICE}
      - --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
      - --region=${_REGION}
      - --service-account=${_RUN_SA}
      - --platform=managed
      - --port=8080
      - --gpu=1
      - --gpu-type=nvidia-l4
      - --no-gpu-zonal-redundancy
      - --no-cpu-throttling
      - --cpu=4
      - --memory=16Gi
      - --min-instances=${_MIN_INSTANCES}
      - --max-instances=${_MAX_INSTANCES}
      - --timeout=900
      # Model init (bpy kinematic trees + ~2.4 GB of checkpoints) takes a few
      # minutes; the default 4-minute startup window killed healthy instances.
      - --startup-probe=tcpSocket.port=8080,initialDelaySeconds=0,periodSeconds=60,timeoutSeconds=60,failureThreshold=15
      - --cpu-boost
      - --allow-unauthenticated
      - --add-volume=name=weights,type=cloud-storage,bucket=${_WEIGHTS_BUCKET}
      - --add-volume-mount=volume=weights,mount-path=/weights
      - --set-env-vars=GCS_BUCKET=${_GCS_BUCKET},MAX_CONCURRENT=1,TASK_TIMEOUT_S=420
      - --set-secrets=API_KEY=avatar-reconstruction-key:latest

images:
  - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
  - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest

options:
  machineType: E2_HIGHCPU_32
  logging: CLOUD_LOGGING_ONLY

timeout: 3600s