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-ultrafast

ShinyDataTech

Ports a browser-use agent to run Laya locally for browser action decisions

0·GitHub repo

laya-windows

mateusgl8

Ports a terminal Snake game to Windows with real-time decisions from the Laya model

0·GitHub repo

Laya-Experiments

alperunlu07

Collects reproducible experiments using Laya, including a Pong controller comparison

0·GitHub repo

laya-trade

LivingG0D

Analyzes crypto markets and manages Toobit positions using a fine-tuned Laya decision model

0·GitHub repo

laya-doom

dylanbstorey

Runs Laya in a real-time control loop to play Doom on Apple Silicon

0·GitHub repo

laya-infra

ulevitsky

Deploys Laya and its playground with Docker Compose or Kubernetes

0·GitHub repo

laya-finetuning

tehtommeh

Runs Laya locally with an API and UI, serving multiple checkpoints through the official SDK

0·GitHub repo

laya-api

hugomes14

Serves a multilingual ticket classification model through an HTTP API

0·GitHub repo

laya-http

shaul1991

Serves local Laya predictions through an authenticated self-hosted HTTP API

0·GitHub repo

laya-dino

that-daniel

Controls Chrome's dinosaur game with Laya through a real-browser decision loop

0·GitHub repo

laya-local

arshadakl

Turns Malayalam and English voice or text commands into safe local actions using Laya

0·GitHub repo

laya-chrome

korbinjoe

Uses local Laya to perform constrained browser tasks in Chrome

0·GitHub repo

laya_mcp

fuleinist

Exposes Laya decision inference as tools for MCP clients

0·GitHub repo

laya-server

cmoro-deusto

Serves Laya System 1 decisions through a Jev-compatible REST API

0·GitHub repo

poc-laya

MayukhCars24

Measures Laya classification latency with a FastAPI backend, web console, and observability tools

0·GitHub repo

chess-laya

Kpaul-create

Combines Minimax, Laya, and Gemini to play chess through parallel consensus

0·GitHub repo

laya-cli

CHENG-LIANG1

Wraps Laya typed decisions in a stable JSON command-line interface

0·GitHub repo

laya_playground

Sathish-30

Provides a local Gradio app for downloading and testing the Laya typed-decision model

0·GitHub repo

laya-service

idCntrue

Exposes the Laya non-autoregressive decision engine through a production HTTP service

0·GitHub repo

migration-laya

ViniCarvalhoDados

Evaluates Laya for triaging legacy SQL queries before database migration

0·GitHub repo

laya-mcp

kodexArg

Provides an MCP server for local Laya choice, score, and binary decisions

0·GitHub repo

laya-turbo

razaowais6112

Proposes bounded browser actions using a Laya-compatible decision endpoint

0·GitHub repo

myLaya

RyanPeng1111

Provides an offline Windows CPU workbench for multilingual Laya decision inference

0·GitHub repo

wireshark-laya

stefanus-ai-tech

Evaluates Laya and rule-based judgments of network traffic features extracted from PCAP files

0·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