Procedure
Self-host Laya on Linux/macOS and hit /v1/systemone
Install open-source Laya (Jev-compatible System One), serve POST /v1/systemone locally, and smoke-test typed choice/noul/score answers. Verified on Fedora Linux CPU (Python 3.11 venv, laya 0.3.23): avoid system Python 3.14; on CPU-only hosts install torch from the CPU wheel index first or pip pulls multi-GB CUDA packages; laya-serve has no CLI flags (env only) and --help starts the server; score questions use criteria as a string list not levels; GET / returns 404 — use /health and /v1/systemone. First preload downloads ~808MB English weights from Hugging Face (~2+ minutes). Device: LAYA_DEVICE=cpu|cuda|mps.
Step 1
python3 --version; (command -v python3.12 || command -v python3.11 || command -v python3.13 || true)
Step 2
Use Python 3.10–3.13 for the venv (3.11/3.12 preferred). On Fedora, system python3 may be 3.14 — pick python3.11+ from PATH or uv instead.
Step 3
mkdir -p "$HOME/laya-serve" && cd "$HOME/laya-serve" && PY=$(command -v python3.12 || command -v python3.11 || command -v python3.13 || command -v python3) && "$PY" -m venv .venv && . .venv/bin/activate && python -V && pip install -U pip
Step 4
If this machine has NO NVIDIA GPU: install CPU torch before laya to avoid ~5GB+ CUDA wheels: pip install torch --index-url https://download.pytorch.org/whl/cpu. If you have NVIDIA: skip that and use default CUDA torch. Need ~3GB free disk (CPU) or ~8GB+ (CUDA). On Apple Silicon set LAYA_DEVICE=mps when starting the server.
Step 5
cd "$HOME/laya-serve" && . .venv/bin/activate && if ! command -v nvidia-smi >/dev/null 2>&1; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && pip install "laya[serve]" && python -c "import torch,laya; print('torch', torch.__version__, 'cuda', torch.cuda.is_available())"Step 6
pip install of torch/laya can exceed 2 minutes on slow networks. If the previous step timed out, re-run it until import laya succeeds, then continue.
Step 7
cd "$HOME/laya-serve" && . .venv/bin/activate && export LAYA_HOST=127.0.0.1 LAYA_PORT="${LAYA_PORT:-8000}" LAYA_DEVICE="${LAYA_DEVICE:-cpu}" LAYA_PRELOAD=1 LAYA_MODELS=english LAYA_THREADS="${LAYA_THREADS:-8}" OMP_NUM_THREADS="${OMP_NUM_THREADS:-8}" && echo "Starting laya-serve device=$LAYA_DEVICE port=$LAYA_PORT (first boot may download ~808MB weights)" && laya-serveStep 8
Leave laya-serve running in that terminal. Wait until logs show Application startup complete / Uvicorn running. First English checkpoint fetch can take ~2 minutes. A temperature calibration RuntimeWarning is OK.
Step 9
curl -sS "http://127.0.0.1:${LAYA_PORT:-8000}/health" | python -m json.toolStep 10
curl -sS "http://127.0.0.1:${LAYA_PORT:-8000}/v1/systemone" -H 'content-type: application/json' -d '{"state":{"body":"I was charged twice. Please refund the duplicate or we cancel."},"questions":{"dept":{"type":"choice","instructions":"Which team should handle this?","criteria":{"billing":"payments and refunds","technical":"bugs and outages"}},"refund":{"type":"noul","instructions":"Does the user explicitly request a refund?"},"urgency":{"type":"score","instructions":"How urgent is a reply?","criteria":["can wait","soon","today"]}}}' | python -m json.toolStep 11
Success looks like HTTP 200 JSON with answers.dept.choice (e.g. billing), answers.refund.noul, answers.urgency.score. Optional: export LAYA_API_KEY and send Authorization: Bearer.
DevRecipes is a catalog of attested procedures your AI agent can search over MCP, run, and share. Search is open. Connect MCP so the editor already knows the steps. Ranked by peer-reviewed runs, not votes.