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.

1712 projects

hermes-skill-router

cdepuy

Routes tasks to relevant Hermes skills using a local Laya model or SemIf

1·GitHub repo

ultra_laya

roadius2

A fork of Laya adds multilingual decision routing and checkpoint selection

1·GitHub repo

omp-laya

KiidxAtlas

Adds local Laya decision policies and verification controls to Oh My Pi

1·GitHub repo

laya-go

lengoman

Provides Go types, routing, batching, and transports for using local Laya checkpoints

1·GitHub repo

laya-plays-doom

shantanugoel

Trains Laya with reinforcement learning to play Doom through ViZDoom

1·GitHub repo

pastewhat

mizorewww

A native macOS clipboard companion recommends entries using a local Laya model or optional Jev backend

1·GitHub repo

jev-codex-workbench

qualixar

Adds Jev decisions and optional local Laya-MLX routing to a Codex plugin and MCP server

1·GitHub repo

jev-vs-open-decision-models

elcronos

Benchmarks Jev against Laya and PrismNLI on zero-shot text classification tasks

1·GitHub repo

laya

givespace-asia

A Claude Code plugin uses Laya to guard shell commands and code patches

1·GitHub repo

laya

xosi

Runs Laya typed-decision inference locally on Apple Silicon with MLX

1·GitHub repo

fastlaya

emtay-com

Serves English and multilingual Laya decision models through a FastAPI service

1·GitHub repo

laya-server

pambrose

Implements a Jev-compatible API server backed by local Laya checkpoints

1·GitHub repo

laya-mcp

PerryLink

An MCP server for Laya typed decisions with preflight checks and persisted calibration

1·GitHub repo

laya-mlx-ddz

smile-magic

A browser-based 斗地主 game lets two local AI seats play using Laya on Apple Silicon

1·GitHub repo

laya-plays-mario

DavidDevGt

Fine-tunes Laya as a control policy for playing Super Mario Bros

1·GitHub repo

laya-mac-serve

chrisns

Serves Laya from a macOS menu bar app through an OpenAI-compatible HTTP endpoint

1·GitHub repo

chinese-workflow-decision-bench

Adkid-Zephyr

Benchmarks Jev and Laya on synthetic Feishu message classification scenarios

1·GitHub repo

decide

gopaljigaur

Provides a Python client that chains Laya with hosted and other decision-model backends

1·GitHub repo

system-one

asynq-io

Offers a provider-neutral SDK for typed decisions through hosted and local backends

1·GitHub repo

laya

ganeshdipdumbare

Serves Laya typed-decision predictions over HTTP in a self-hosted Docker deployment

1·GitHub repo

laya

DilwoarH

Wraps the Laya Router agent in a Flask API for typed-decision predictions

1·GitHub repo

SmartMom

clydechen0228

Uses Laya for edge classification and training within a smart-factory operations platform

1·GitHub repo

laya_dashboard

ghozifadilah

A REST API and web studio serve Laya decisions and manage workflows

1·GitHub repo

laya-micro

osamabinIaggin

Prunes and quantizes Laya for low-memory single-board computer deployment

1·GitHub repo

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