agi.diy

Reference · look things up, do not read through

Self-host.

Run a runner that serves models to api.agi.diy, or the whole stack. The four-minute read is /docs.

Two ways. A: run a runner that serves models to api.agi.diy (ten commands, needs one secret from the operator). B: run the whole stack — Worker, D1, web, runner — under your own domain.

A. Your GPU box as a runner for api.agi.diy

What you need: Linux + CUDA GPU (tested: Jetson Thor, CUDA 13.0, 122 GB unified memory), python 3.10–3.12, ~5 GB disk per model, outbound https. No sudo, no docker. And an INTERNAL_KEY — the operator hands you one (https://github.com/cagataycali); it is the only thing that lets your heartbeat into /v1/internal/*.

# 1. code
git clone https://github.com/cagataycali/api-agi-diy && mkdir -p ~/agi-diy && cp -r api-agi-diy/runtime ~/agi-diy/runtime
# 2. python with LeRobot main (remote inference is not on PyPI lerobot yet) — see runtime/THOR.md for the CUDA-torch variant
cd ~/agi-diy && python3 -m venv --system-site-packages venv
GIT_LFS_SKIP_SMUDGE=1 ./venv/bin/pip install "lerobot[remote,smolvla] @ git+https://github.com/huggingface/lerobot@d3793b7e"
# 3. zenohd 1.10.1 (not 1.9.0) + bore + cloudflared (quick tunnels for traces and the browser wire; any recent release on PATH)
mkdir -p bin && curl -sL -o z.zip https://github.com/eclipse-zenoh/zenoh/releases/download/1.10.1/zenoh-1.10.1-$(uname -m)-unknown-linux-gnu-standalone.zip && unzip -o z.zip zenohd -d bin
curl -sL https://github.com/ekzhang/bore/releases/download/v0.6.0/bore-v0.6.0-$(uname -m)-unknown-linux-musl.tar.gz | tar xz -C bin
# 4. secrets (names in runtime/.env.example)
printf 'INTERNAL_KEY=%s\nAGI_API_URL=https://api.agi.diy\n' '<from the operator>' > ~/agi-diy/broker.env
# 5. pool: edit runtime/pool.yaml (runner name, which deployments/*.yaml, slots) — the defaults serve act/so101 ×2 + smolvla/so101 ×3
# 6. start everything: zenohd · bore (public tcp) · trace server + tunnel · browser wire gateway + tunnel · broker (spawns the policy servers, heartbeats)
#    or one part at a time: start.sh zenohd|bore|trace|wire|broker|tunnel
~/agi-diy/runtime/start.sh all
# 7. watch
tail -f ~/agi-diy/logs/broker.log                 # READY d_… · LEASE · client connected · meter accepted=1 · recycle
cat ~/agi-diy/run/broker-status.json              # slots, sessions, endpoint, last heartbeat
curl -s https://api.agi.diy/v1/models             # your runner's models appear with state ready
# 8. stop (by pidfile only; never touches other processes)
~/agi-diy/runtime/stop.sh all

Public endpoint: start.sh writes the bore relay address (tcp/bore.pub:<port>) to ~/agi-diy/run/public_url; the broker sends it in every heartbeat and the Worker hands it to clients unchanged. For a fixed address, port-forward TCP 7447 or run zenohd on a small VPS, and set PUBLIC_ZENOH_ENDPOINT=tcp/<host>:7447 in broker.env.

Add a model: copy runtime/deployments/act-so101.yaml, point it at a checkpoint, fill features from the dataset's meta/info.json, add {id, yaml, slots} to pool.yaml, restart the broker. Horizon, fps and cameras are read from the server's descriptor; nothing else to configure. Memory and timing per model: runtime/CAPACITY.md.

Docker: runtime/Dockerfile + docker-compose.yml exist and are honest about not having been built yet (a 20–40 min on-device build on Thor's disk budget). The venv path above is what runs in production.

B. The whole stack under your own domain

You need: a Cloudflare account (Workers + D1), a Vercel account, a GitHub OAuth App, a runner (part A).

# Worker + D1
cd worker && npm ci
npx wrangler d1 create api-agi-diy                              # paste database_id into wrangler.toml
# edit wrangler.toml: routes pattern = your host, COOKIE_DOMAIN = your host, WEB_ORIGIN = your Vercel URL
npm run migrate                                                 # applies migrations/*.sql remotely
for s in GITHUB_CLIENT_ID GITHUB_CLIENT_SECRET AUTH_JWT_SECRET INTERNAL_KEY; do npx wrangler secret put $s; done
npm test && npm run deploy

GitHub OAuth App callback: https://<your-host>/auth/github/callback. Leave DEV_LOGIN_SECRET unset in production (D10) — it enables POST /auth/dev, which exists for tests.

# Web (Next.js)
cd web && npm ci && npm run build                               # prebuild syncs docs/ into content/
vercel --prod                                                   # set env API_ORIGIN=https://<your-host> on the project

The Worker proxies every non-API path to WEB_ORIGIN; Vercel overwrites x-forwarded-host, so SSR reads x-agi-origin / API_ORIGIN for absolute URLs.

# Runner → point it at your Worker
printf 'INTERNAL_KEY=%s\nAGI_API_URL=https://<your-host>\n' '<same value as the Worker secret>' > ~/agi-diy/broker.env
~/agi-diy/runtime/start.sh all

Then: log in, create a key, AGI_API_URL=https://<your-host> agi run act/so101 --probe. Price constant and signup credit are two lines in worker/src/util.ts.

What is not there yet

Zenoh TLS/ACL (deployment names are the capability today, D3) · a fixed public endpoint (relay port changes on restart) · a built Docker image · multi-runner scheduling beyond "first ready slot".