Laya for Python
The reference implementation of Laya is the `laya` package on PyPI, maintained by Convai Innovations under Apache 2.0. It ships three checkpoints, a Router that picks one per request by script and language, a CLI, an HTTP server and an optional MCP server.
768 projects
laya-example
lim6112j
Demonstrates typed-question routing with Laya checkpoints and startup optimizations
laya-dino
JakkNaj
A fine-tuned Laya model plays Chrome Dino using a Python backend and TypeScript frontend
laya-serve
ouijan
Serves Laya decisions over HTTP with a typed TypeScript client
laya-duum
Hadlock
Uses the Laya Core ML decision model to play the Duum game from semantic state
laya-api
yrodrigez
A FastAPI service loads the Laya model and serves typed-decision predictions
laya-demo
clonekim
Provides a local server and browser interface for classifying text with Laya
laya-server
r2d-ai
Serves Laya's multilingual checkpoint through CUDA-backed REST and MCP interfaces
laya-service
xiaobai1017
Exposes Laya through a FastAPI service with a Jev-compatible System One API
oido-laya
Djancyp
Wraps the Laya decision model in a Dockerized HTTP API for typed predictions
laya-memory
ganeshdipdumbare
A local Laya classifier selects relevant durable memories for coding agents across sessions
agentify-laya
hongyaok
Serves local Laya classifications through an OpenAI-shaped HTTP API and usage dashboard
laya-snapdragon
piffie
Runs Laya typed decisions on Snapdragon X NPUs through ONNX Runtime and Qualcomm QNN
laya-adblock
Samuel-Ku
Uses a local MLX Laya model to identify and remove likely ads from web pages
laya-agents
lesterppo
Integrates local Laya typed-decision tools into Hermes Agent and Muse for classification and routing
laya-kit
FrancyJGLisboa
Provides a local Python interface for Laya typed judgements and confidence calibration
laya-quiz
Aryamanironman
Uses Laya to adapt trivia categories and difficulty to each player's performance
laya-tetris
kuchris
Runs Laya as a Tetris placement decision-maker with a heuristic safety guard
laya-torch
Shivay00001
Ports the Laya typed-decision model to PyTorch for CPU and GPU inference
laya-jv
TimTan1234
Packages a self-hosted Laya decision model as a Docker HTTP service for Luna
laya-server
noahbclarkson
Runs Laya behind a local TypeSafe System One API for compatible clients
Laya_TESTSUITE
sirwari
Provides Laya tests, demos, routing examples, and MLX setup guidance
Laya_Demo
zhangfanxp
Uses the local Laya model to choose maze branches and trace a route to the exit
laya-server
MrLYC
Provides an authenticated CPU-based HTTP service and decision console for Laya models
Laya_Playground
jonas050210
Runs local Laya decision demos, games, and a raw playground through a browser interface
Install
Python 3.10 or newer, per the core README:
python -m pip install laya
Optional extras: laya[serve] (HTTP server), laya[mcp] (MCP server), laya[langchain], laya[onnx] (ONNX Runtime) and laya[fast] (TileLang GPU fast path).
First decision
from laya import Router
router = Router() # downloads a checkpoint on first use
state = "Hi, we were billed twice for March. Please refund the duplicate today or we will cancel our plan."
questions = {
"department": {"type": "choice", "instructions": "Which department should handle this?",
"criteria": {"billing": "invoices, payments, refunds",
"technical": "bugs, outages, system errors",
"other": "everything else"}},
"urgency": {"type": "score", "instructions": "How urgent is this?",
"criteria": ["not urgent", "soon", "blocking"]},
"churn_risk": {"type": "noul", "instructions": "Does the user threaten to cancel or leave?"},
}
result = router.predict(state, questions)
print(result["answers"]["department"]["choice"]) # billing
print(result["routing"]["model"]) # english
The package also installs a laya command, for example laya "My payment failed twice" --preset triage.
Checkpoints
| checkpoint | encoder | params | context |
|---|---|---|---|
laya |
ModernBERT-large | 421M | 512 |
laya-multilingual |
mmBERT-base | 322M | 1024 (up to 8,192) |
laya-typed-decisions |
ModernBERT-large | 421M | 1024 |
The README reports 32.8 ms for one question with laya-multilingual on a Tesla T4, and 193 to 464 ms per request on CPU with checkpoints preloaded.
Other Python projects
laya-mlx and laya-coreml for Apple Silicon, laya-openvino for Intel CPUs, edgejev for INT8 ONNX on CPU, and laya-mcp for agent tools.
Caveats
The README is direct about limits: the base checkpoints score near chance on its typed-decisions benchmark (0.362 and 0.352), and the 0.766 figure comes from the fine-tuned checkpoint. Temperatures should be refit on your own data before you trust the probabilities. The English checkpoint collapses on non-Latin scripts, which is why the Router exists.
More ways to use Laya