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.

4.4 KB
Raw Blame
# Cloud Build → Cloud Run for the Agora life engine (workers/agora-citizens).
#
# Background daemon: it runs the daily loop continuously and binds a tiny health
# endpoint on $PORT so the startup probe passes. Deployed with --no-cpu-throttling
# and --min-instances=1 so the loop keeps ticking between probes. Build context is
# the REPO ROOT (the Dockerfile compiles the @three-ws/solana-agent SDK).
#
# Runtime config mirrors three-ws-api: the DATABASE_URL secret (the same Neon
# projection sink the API reads), the shared Redis proxy on the private VPC range
# for the feed:events ticker, and the pinned three-ws@ runtime service account
# (the project's default compute SA was deleted, so an unpinned deploy fails).
# Both secrets referenced below already exist in Secret Manager; a --set-secrets
# entry naming a secret that does NOT exist fails the deploy step, which is why
# AGENC_DEVNET_RPC_URL is not wired here (it is optional and the engine falls back
# to the public devnet endpoint). To use a private devnet RPC, create it once and
# add it to --set-secrets:
#
#   printf '%s' "$AGENC_DEVNET_RPC_URL" | gcloud secrets create agenc-devnet-rpc-url --data-file=-
#   gcloud secrets add-iam-policy-binding agenc-devnet-rpc-url \
#     --member=serviceAccount:three-ws@$PROJECT_ID.iam.gserviceaccount.com \
#     --role=roles/secretmanager.secretAccessor
#
# An unattended fleet also needs a funded devnet wallet to top its signers up from
# (AGORA_DEVNET_FUNDER_SECRET, see README) - without it the public faucet 429s and
# the citizens cannot pay their own stake. Add it the same way once it exists.
#
#   gcloud builds submit --config workers/agora-citizens/cloudbuild.yaml .

# Builds run as the pinned three-ws-build service account: the project's default
# compute service account was deleted, so an unpinned submit fails with
# "Unknown service account".
serviceAccount: projects/aerial-vehicle-466722-p5/serviceAccounts/[email protected]

# _REPO is the SHARED "workers" Artifact Registry repo the other long-lived Node
# workers (agent-mm, agent-orders, okx-chat-bot) publish into. Cloud Build does not
# create an Artifact Registry repo on demand, so a per-worker repo name that has
# never been created fails the push step after a full image build.
substitutions:
  _REGION: us-central1
  _SERVICE: agora-citizens
  _REPO: workers
  _MIN_INSTANCES: "1"
  _MAX_INSTANCES: "1"
  _MAX_CITIZENS: "4"

steps:
  - id: build
    name: gcr.io/cloud-builders/docker
    args:
      - build
      - --file
      - workers/agora-citizens/Dockerfile
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/${_SERVICE}:$SHORT_SHA
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/${_SERVICE}:latest
      - --cache-from
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/${_SERVICE}:latest
      - .
    timeout: 1800s

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

  - 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}/${_SERVICE}:$SHORT_SHA
      - --region=${_REGION}
      - --platform=managed
      - --no-cpu-throttling
      - --cpu=1
      - --memory=1Gi
      - --min-instances=${_MIN_INSTANCES}
      - --max-instances=${_MAX_INSTANCES}
      - --no-allow-unauthenticated
      - --service-account=three-ws@$PROJECT_ID.iam.gserviceaccount.com
      # The feed:events ticker lives on the shared Redis proxy at a private VPC
      # address, so the worker needs the same connector three-ws-api uses. Without
      # it the REST calls simply never reach the proxy and the world loses its
      # live ticker (the projection still lands in Postgres).
      - --vpc-connector=three-ws-vpc
      - --vpc-egress=private-ranges-only
      - --set-env-vars=AGORA_CLUSTER=devnet,AGORA_MAX_CITIZENS=${_MAX_CITIZENS},AGORA_DISPATCH_TASKS=1,UPSTASH_REDIS_REST_URL=http://10.128.15.228
      - --set-secrets=DATABASE_URL=DATABASE_URL:latest,UPSTASH_REDIS_REST_TOKEN=upstash-redis-rest-token:latest

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

options:
  machineType: E2_HIGHCPU_8
  logging: CLOUD_LOGGING_ONLY