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.
696 projects
second-thought
KNambiarDJsc
Measures decision calibration, prioritizes human review, and builds fine-tuning datasets
hd5-antigravity-jev
alpaslan-exe
A workshop teaching developers to build projects with Antigravity and locally run Laya decisions
laya-cuda
adamjen
Benchmarks Laya typed-decision checkpoints with a CUDA backend on NVIDIA GPUs
laya-exp
changtimwu
Experiments comparing an MLX Laya port with Jev and a TypeSafe-compatible Laya client
laya-main
bill9924
Maps patent texts to OpenAlex concepts using TF-IDF retrieval and a Laya decision model
laya-lab
Alevsk
Runs Laya locally with reproducible scenarios that explore its capabilities on Apple Silicon
laya-rn-executorch
ksanjiv05
Exports and runs Laya decision models offline in a React Native app using ExecuTorch
laya-computer-use
koushikvarma37-jpg
Runs a local Windows voice assistant that uses Laya to choose intents and actions
laya-inference-engine
aaditagrawal
Provides a GPU inference engine and performance modes for Laya on NVIDIA Blackwell
laya-adk-toolkit
Ashfaqbs
Google ADK tools expose Laya's typed-decision engine for classification, scoring, and detection
decision-making
tzt-company
A local demo runs Laya for multilingual text decisions and Git commit risk checks
laya-ko-decision-onnx
2nugu
Fine-tunes Laya for Korean decisions and provides PyTorch training and ONNX export scripts
Tern
AmRitJain0442
A model router uses local Laya-MLX inference to select between configurable provider tiers
agent-decision-firewall
chinna250801
Gates AI agent actions with a local Laya decision model and fail-closed rules
reckon
Quietcatalpa
Organizes and reviews Windows files offline using rules and the local Laya decision model
god-llm-decisions
surajvs2710-stack
A decision engine fuses Laya and Jev predictions with confidence weighting and auditable logs
verdict
Manavarya09
Provides calibrated zero-shot and fine-tuned typed decision models as an alternative to Jev
laya-console
biyyl234
Provides a local web console and REST API for Laya inference and intent classification
RayCodes_LayaAI
47thtechcorner
A browser-based Pong game uses Laya to control an AI opponent's paddle
laya-reader
msudars
Ranks new arXiv papers against a reader profile using the local Laya model
laya-sentiment-analyzer
SwatiK425
A local command-line sentiment analyzer using Laya's typed choices and calibrated probabilities
laya-decision-api
bmw8080
An HTTP service wraps local Laya with OpenAPI documentation and Java, TypeScript, and Python SDKs
laya-vs-dijkstra
antonellof
Compares Laya MLX pathfinding decisions with Dijkstra on seeded weighted mazes
katai
Shiawaseu
A browser automation agent uses fine-tuned Laya models to select actions and target elements
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