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.0 KB
Raw Blame
# Cloud Build → Cloud Run for the market-maker engine (workers/agent-mm).
#
# Background daemon deployed as a SERVICE: it runs the sweep timer continuously
# and binds a tiny liveness endpoint on $PORT (index.js) so the Cloud Run startup
# probe passes. Deployed with --no-cpu-throttling and --min-instances=1 so the
# timer keeps ticking between probes. Build context is the REPO ROOT (the
# Dockerfile copies api/, src/, and compiles the agent-payments-sdk workspace).
#
# Ships in MM_MODE=simulate (real quotes + full decision logic, no broadcast).
# Flip MM_MODE=live only after the RPC secret is set and agent wallets are funded.
#
# ── ONE-TIME SECRET SETUP (never commit these) ────────────────────────────────
#   printf '%s' "$DATABASE_URL"    | gcloud secrets create agent-mm-database-url --data-file=-
#   printf '%s' "$JWT_SECRET"      | gcloud secrets create agent-mm-jwt-secret   --data-file=-
#   printf '%s' "$WALLET_ENCRYPTION_KEY" | gcloud secrets create wallet-encryption-key --data-file=-  # or reuse existing
#   printf '%s' "$SOLANA_RPC_URL"  | gcloud secrets create agent-mm-solana-rpc-url --data-file=-      # live only
#   printf '%s' "$UPSTASH_REDIS_REST_URL"   | gcloud secrets create upstash-redis-rest-url   --data-file=-
#   printf '%s' "$UPSTASH_REDIS_REST_TOKEN" | gcloud secrets create upstash-redis-rest-token --data-file=-
#   for s in agent-mm-database-url agent-mm-jwt-secret wallet-encryption-key \
#            agent-mm-solana-rpc-url upstash-redis-rest-url upstash-redis-rest-token; do \
#     gcloud secrets add-iam-policy-binding "$s" \
#       --member=serviceAccount:three-ws@$PROJECT_ID.iam.gserviceaccount.com \
#       --role=roles/secretmanager.secretAccessor; done
#
#   gcloud builds submit --config workers/agent-mm/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]

substitutions:
  _REGION: us-central1
  _SERVICE: agent-mm
  _REPO: workers
  _MIN_INSTANCES: "1"
  _MAX_INSTANCES: "1"
  _MM_MODE: simulate

steps:
  - id: build
    name: gcr.io/cloud-builders/docker
    args:
      - build
      - --file
      - workers/agent-mm/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: 1200s

  - 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
      - --set-env-vars=NODE_ENV=production,MM_MODE=${_MM_MODE},MM_NETWORK=mainnet,MM_GLOBAL_KILL=0,MM_HEARTBEAT_MS=30000
      - --set-secrets=DATABASE_URL=agent-mm-database-url:latest,JWT_SECRET=agent-mm-jwt-secret:latest,WALLET_ENCRYPTION_KEY=wallet-encryption-key:latest,SOLANA_RPC_URL=agent-mm-solana-rpc-url:latest,UPSTASH_REDIS_REST_URL=upstash-redis-rest-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