Laya
Set up the optional local Laya worker, select it in Relay, and troubleshoot request classification.
Laya is an optional System One model for classifying request intent and identifying coding tasks. It runs as a separate worker; it does not generate the response to your application. Community Relay includes the integration, while AnchorShell Classifier Basic remains the default.
Self-hosted setup
Start from the Relay Community repository. You need Python 3.11–3.13, uv, and enough memory and disk for the model and its Python runtime. The locked dependencies must support your operating system; the current macOS runtime requires macOS 14 or later.
From the repository root, prepare the dependencies and pinned model:
make laya-setupFirst-time setup downloads Python dependencies and the model.
Then start the worker in a separate terminal and leave it running:
make laya-startIt loads and warms the cached model once, then listens on 127.0.0.1:11731. CPU is the default. Serving does not download models; complete setup first.
Add the following to Relay's own .env, then restart the Relay backend:
RELAY_LAYA_URL=http://127.0.0.1:11731
RELAY_LAYA_TIMEOUT=2sThe timeout is an example, not a performance guarantee. Measure on your hardware and choose a positive timeout of at most 30 seconds. In Settings → Request Characterization, select Laya and save. Changing the selected engine does not require another restart once the worker connection is configured.
Existing Python environment
To use an existing virtual environment with compatible dependencies already installed:
LAYA_PYTHON=/path/to/venv/bin/python LAYA_DEVICE=cpu make laya-startThis only selects the worker interpreter; it does not install dependencies into that environment. Keep model preparation aligned with services/laya/model.json. To prepare the pinned model from an already complete local Hugging Face cache without downloading:
/path/to/venv/bin/python services/laya/setup_model.py --cached-onlyCached-only setup fails if required artifacts are missing. Run ordinary setup when a download is needed. Do not sync dependencies into a separate working environment whose versions you need to preserve.
Keep the worker private
Applications call Relay, not Laya. Keep the worker on loopback. For worker authentication, set the same private value as RELAY_LAYA_TOKEN in Relay and LAYA_SERVICE_TOKEN in the worker's environment. Never put these values in browser configuration or source control.
Classification processes request-derived text even when payload storage is off. Saving request and response bodies is a separate setting; see Logs and Settings.
Routing and full characterization
Automatic Laya classification uses the worker's POST /classify-routing endpoint. It evaluates the primary action and whether the request needs coding specialization in one prediction call. Hosted Smart Groups can use that result for model selection. Community classification does not unlock hosted Smart Groups.
The separate POST /classify endpoint is for explicit richer characterization. Relay does not automatically call it after the routing result. It shares the worker and can delay routing classification; avoid full evaluations on a busy routing worker. These are worker interfaces, not public application endpoints.
Troubleshooting
- Unavailable in Settings: confirm the worker terminal is still running, model setup completed, and Relay restarted after its URL changed. The worker's
GET /health/readyreturns HTTP 200 when ready and 503 while unavailable. - Authentication failure: check that the two service-token values match; do not paste them into logs or support messages.
- Missing model or integrity error: rerun setup using the matching repository version. Do not bypass artifact checks.
- Slow classification or timeouts: check CPU load, memory pressure, and competing requests. Warm latency varies with hardware and input; there is no universal millisecond target.
If Laya is unavailable or its result cannot be used, Relay falls back to AnchorShell classification for that request without changing your saved selection. Ordinary requests can finish before background classification; their characterization appears when the bounded work completes. Smart Groups need a routing decision before selecting their model list.
Hosted Relay
Hosted users select an available engine in Settings; they do not install a worker on their laptop. Availability depends on the hosted deployment. See AnchorShell characterization for engine choices and log interpretation.
Exact model pins and third-party licensing are recorded in the public repository's services/laya/model.json and services/laya/NOTICE.md.