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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
docs(pipeline-controller): say plainly that this controller is not deployed today
nirholasff620a8c26ac
diff --git a/workers/avatar-pipeline-controller/README.md b/workers/avatar-pipeline-controller/README.mdindex 7236c2964..c8e985ed6 100644--- a/workers/avatar-pipeline-controller/README.md+++ b/workers/avatar-pipeline-controller/README.md@@ -5,22 +5,32 @@ selfie photos into one rigged, animation-ready GLB by fanning out to the GPUmodel + rigging workers and surfacing the whole thing as a single job the sitecan poll.-The site talks **only** to this controller. It never calls the mesh or rigging-GPU services directly — the controller picks a mesh backend, runs the raw mesh-through UniRig, uploads the final GLB to Cloud Storage, and reports status. It-holds no model weights and runs no inference; all GPU work happens in the-services it calls. It keeps the same external contract the original-`avatar-reconstruction` service exposed, so the backend provider-([`api/_providers/gcp.js`](../../api/_providers/gcp.js), env-`GCP_RECONSTRUCTION_URL`) needed no changes when the pipeline was split into-per-model services.+When it is the wired reconstruct backend, the site talks **only** to this+controller: it never calls the mesh or rigging GPU services directly. The+controller picks a mesh backend, runs the raw mesh through the rig worker,+uploads the final GLB to Cloud Storage, and reports status. It holds no model+weights and runs no inference; all GPU work happens in the services it calls. It+keeps the same external contract the `avatar-reconstruction` service exposes, so+the backend provider ([`api/_providers/gcp.js`](../../api/_providers/gcp.js),+env `GCP_RECONSTRUCTION_URL`) needs no changes to swap between them.++> **Not deployed today.** No `avatar-pipeline-controller` Cloud Run service+> exists in `us-central1`, and `GCP_RECONSTRUCTION_URL` on `three-ws-api` points+> at the single-service [`avatar-reconstruction`](../avatar-reconstruction/)+> worker (`face_texture_transfer_v2`), which serves `/scan` today. This+> controller is the multi-backend replacement lane: it builds and runs, and+> [`workers/deploy/deploy-all.sh`](../deploy/deploy-all.sh) provisions it+> together with the GPU workers it fans out to. Standing it up is one+> `deploy-all.sh` run plus repointing `GCP_RECONSTRUCTION_URL`; both are+> owner-gated production changes. Verify with `gcloud run services list` before+> trusting any deployment claim here.```/scan (browser)└─ POST /api/avatars/reconstruct (three-ws-api on Cloud Run)└─ controller POST /reconstruct (this service, Cloud Run, CPU)├─ mesh model POST /infer (Cloud Run, L4 GPU) Hunyuan3D / TRELLIS / TripoSR / TripoSG- └─ UniRig POST /rig (Cloud Run, L4 GPU) skeleton + skinning + blendshapes+ └─ model-rig POST /rig (Cloud Run, L4 GPU) skeleton + skinning + blendshapes└─ rigged GLB → GCS → GET /jobs/:id returns glb_url```@@ -37,23 +47,29 @@ For each job the controller (`main.py`, `_run_pipeline`):3. **Auto-rigs** — if `UNIRIG_URL` is set and `SKIP_RIGGING` is off, `POST{UNIRIG_URL}/rig` with the mesh URL (`template: "wolf3d_neutral"`,`blendshapes: true`), polls to completion (3 s cadence, 180 s timeout). If- UniRig rejects the job, the pipeline falls back to the unrigged mesh rather+ the rig worker rejects the job, the pipeline falls back to the unrigged mesh ratherthan failing.4. **Finalizes** — copies the resulting GLB into the output bucket under`avatars/{job_id}.glb` (skipped if it is already there) and writes the final- `status: "done"` + `glb_url` + timing to Firestore.+ `status: "done"` + `glb_url` + timing to Firestore. The download is streamed+ with a 512 MiB ceiling (`MAX_GLB_BYTES`), so a runaway mesh fails the job+ instead of the instance.Job state lives in the Firestore collection `avatar_pipeline_jobs`, so a job-survives an instance restart and any instance can answer a poll. All+survives an instance restart and any instance can answer a poll. The pipeline+itself runs as a FastAPI background task, so a job whose instance dies mid-run+stays at its last written stage; the platform-side backstop for that is+[`api/cron/reconstruct-sweep.js`](../../api/cron/reconstruct-sweep.js), which+re-polls quiet reconstruct jobs and finalizes them. Allinter-service calls carry the shared bearer secret; failures are recorded as`status: "failed"` with an opaque, correlation-id-tagged error (`safe_error` in`worker_security.py`).-> This service exposes **no** `/rig` endpoint of its own — it *calls* UniRig's+> This service exposes **no** `/rig` endpoint of its own; it *calls* the rig worker's> `/rig`. `api/_providers/gcp.js` falls back to `GCP_RECONSTRUCTION_URL` for> `rerig` jobs only when `GCP_UNIRIG_URL` is unset; in that fallback the rig> submit hits this controller's non-existent `/rig` and 404s. Set-> `GCP_UNIRIG_URL` so `rerig` reaches the real UniRig worker.+> `GCP_UNIRIG_URL` so `rerig` reaches the real `model-rig` worker.## API@@ -151,9 +167,9 @@ downstream services for liveness.| `MODEL_TRELLIS_URL` | one+ | — | Cloud Run URL of the TRELLIS mesh worker. || `MODEL_TRIPOSR_URL` | one+ | — | Cloud Run URL of the TripoSR mesh worker. || `MODEL_TRIPOSG_URL` | one+ | — | Cloud Run URL of the TripoSG mesh worker. |-| `UNIRIG_URL` | no | — | Cloud Run URL of the [unirig](../unirig/) worker. Unset (or `SKIP_RIGGING=true`) returns the unrigged mesh. |+| `UNIRIG_URL` | no | (none) | Cloud Run URL of the [rig](../rig/) worker, deployed as `model-rig`. The env name predates the engine swap that retired the old `unirig` worker. Unset (or `SKIP_RIGGING=true`) returns the unrigged mesh. || `MODEL_WEIGHTS` | no | equal | JSON routing weights, e.g. `{"hunyuan3d":0.6,"trellis":0.4}`; normalized to the configured backends. |-| `SKIP_RIGGING` | no | `false` | `true` skips the UniRig stage (testing). |+| `SKIP_RIGGING` | no | `false` | `true` skips the rigging stage (testing). |At least one `MODEL_*_URL` must be set — with zero backends, `/reconstruct`returns `503 no model backends configured`.@@ -174,7 +190,7 @@ API_KEY=dev-secret \GCS_BUCKET=three-ws-avatar-reconstructions \FIRESTORE_PROJECT=your-gcp-project \MODEL_TRELLIS_URL=https://model-trellis-…run.app \-UNIRIG_URL=https://unirig-…run.app \+UNIRIG_URL=https://model-rig-…run.app \uvicorn main:app --host 0.0.0.0 --port 8080```@@ -182,16 +198,42 @@ Firestore and Cloud Storage need Application Default Credentials(`gcloud auth application-default login`). The downstream model services must bereachable, or `/reconstruct` jobs will fail.+### Tests++`test_pipeline.py` drives the real app end to end (submit → mesh → rig →+finalize → poll) against a threaded stdlib HTTP server speaking the workers'+task contract, with in-process stand-ins for Firestore and Cloud Storage. No+GPU, no GCP credentials, no network:++```bash+cd workers/avatar-pipeline-controller+pip install -r requirements.txt+python3 test_pipeline.py # → "all controller pipeline checks passed"+```++It covers the happy path, the copy-into-bucket and oversize-rejection branches+of finalize, degradation when the rig worker rejects a job, an opaque failure+when a mesh backend fails, bearer auth on every route, and model routing.++### Container++```bash+docker build -t avatar-pipeline-controller workers/avatar-pipeline-controller+```+### Production-Ships as the **`avatar-pipeline-controller`** Cloud Run service in+When provisioned, it deploys as the **`avatar-pipeline-controller`** Cloud Run service in**`us-central1`**, CPU-only (2 vCPU / 2 GiB, `--min-instances 1`,-`--max-instances 4`, 600 s timeout, no GPU — orchestration only). Built and-deployed by Cloud Build from `cloudbuild.yaml`:+`--max-instances 4`, 600 s timeout, no GPU, orchestration only), from+`cloudbuild.yaml`. Its build step is `dir: workers/avatar-pipeline-controller`,+so the submit **must** run from the repo root with `.` as the source, and a+manual submit must supply `SHORT_SHA` (only build triggers set it):```bashgcloud builds submit --config workers/avatar-pipeline-controller/cloudbuild.yaml \- workers/avatar-pipeline-controller+ --region us-central1 --project aerial-vehicle-466722-p5 \+ --substitutions=SHORT_SHA=manual$(date +%s) .```That build sets `GCS_BUCKET`, `FIRESTORE_PROJECT`, and `SKIP_RIGGING=false` and@@ -200,7 +242,7 @@ know the backend URLs (they don't exist until the GPU services deploy). The fullpipeline provisioner wires those in afterward and prints the controller URL:```bash-PROJECT_ID=<gcp-project> SERVICES="hunyuan3d trellis triposr unirig" \+PROJECT_ID=<gcp-project> SERVICES="hunyuan3d trellis triposr rig" \workers/deploy/deploy-all.sh```