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.
770 projects
laya-reliability-
Charanraj-24
Tests Laya prediction stability by reordering or renaming choices and measuring reliability
layaMOE
vishalmysore
Routes Laya requests to domain-specific expert heads, with a browser demo using ONNX Runtime Web
LayaAssitant
ps1x
Provides a local Home Assistant conversation agent that uses Laya to select approved device actions
LayaFinetuning
hermestwogetherbot
Tests Laya decision scenarios and documents a workflow for fine-tuning it on transcript events
LayaTUI-MCP
guillermojmontenegro-hub
Provides a terminal UI and MCP server for running Laya questions and viewing results
laya-docker
hrodic
Packages the Laya decision model as an offline Docker service using ONNX Runtime
laya-mlx-demo
jerryshao2012
Demonstrates an Apple silicon MLX conversion of Laya for typed decision inference
layastudy
jerin288
Triage customer support emails by intent, mood, urgency, and cancellation risk using Laya
laya-demo
Majczana
Demonstrates Laya decision scoring for emoji selection with choice and yes/no experiments
ask-laya
v3moreno
Routes agent decisions through a local Laya daemon for classification, relevance filtering, and yes/no scoring
Laya_Sandbox
abhishekwoco
Serves Laya typed decisions to MCP-compatible agents over streamable HTTP
laya-ha
artmdv
Integrates Laya as a fast System-1 conversation agent for Home Assistant
laya-tictactoe
amdisrar
Tests Laya's tic-tac-toe decisions against a Minimax reference
laya-refugio
jafs
Provides a Spanish-language terminal interface for making closed-set decisions with Laya
laya-snake
zhenda-hub
Runs Laya in Snake and compares its play with four other strategies
lagos-monopoly
vunderkind
Runs two local Laya agents through a Lagos-themed Monopoly game and creates animated replays
Laya-CookBook
MaheshPulivarthi18
Provides runnable recipes that teach how to use Laya’s typed-decision model
claude_guardrail_laya
pedro-ggomes
Uses Laya to score Bash commands in a Claude Code pre-tool guardrail
Laya-Reopen-Analyser
yousufttp
Classifies incident records with Laya and exports reopen verdicts to an Excel workbook
laya-local-guard
Kamandlou
Classifies content for safety risks locally with Laya-MLX and detects PII and secrets
AutoJev
wuwenbo0626
Automates Laya-based dataset preparation, fine-tuning, calibration, evaluation, and model export
loop.laya.bible
thomasperdana
An autonomous Bible study loop integrates Laya to generate chapter studies and interactive workbooks
laya-plane-battle
wjw1-Evan
A browser-based plane battle game uses a local Laya model to make real-time gameplay decisions
loop.laya.btc
thomasperdana
An autonomous BTC/USD trading system combines Laya decisions with market-making and directional strategies
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