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

1·GitHub repo

hd5-antigravity-jev

alpaslan-exe

A workshop teaching developers to build projects with Antigravity and locally run Laya decisions

1·GitHub repo

laya-cuda

adamjen

Benchmarks Laya typed-decision checkpoints with a CUDA backend on NVIDIA GPUs

1·GitHub repo

laya-exp

changtimwu

Experiments comparing an MLX Laya port with Jev and a TypeSafe-compatible Laya client

1·GitHub repo

laya-main

bill9924

Maps patent texts to OpenAlex concepts using TF-IDF retrieval and a Laya decision model

1·GitHub repo

laya-lab

Alevsk

Runs Laya locally with reproducible scenarios that explore its capabilities on Apple Silicon

1·GitHub repo

laya-rn-executorch

ksanjiv05

Exports and runs Laya decision models offline in a React Native app using ExecuTorch

1·GitHub repo

laya-computer-use

koushikvarma37-jpg

Runs a local Windows voice assistant that uses Laya to choose intents and actions

1·GitHub repo

laya-inference-engine

aaditagrawal

Provides a GPU inference engine and performance modes for Laya on NVIDIA Blackwell

1·GitHub repo

laya-adk-toolkit

Ashfaqbs

Google ADK tools expose Laya's typed-decision engine for classification, scoring, and detection

1·GitHub repo

decision-making

tzt-company

A local demo runs Laya for multilingual text decisions and Git commit risk checks

1·GitHub repo

laya-ko-decision-onnx

2nugu

Fine-tunes Laya for Korean decisions and provides PyTorch training and ONNX export scripts

1·GitHub repo

Tern

AmRitJain0442

A model router uses local Laya-MLX inference to select between configurable provider tiers

1·GitHub repo

agent-decision-firewall

chinna250801

Gates AI agent actions with a local Laya decision model and fail-closed rules

1·GitHub repo

reckon

Quietcatalpa

Organizes and reviews Windows files offline using rules and the local Laya decision model

1·GitHub repo

god-llm-decisions

surajvs2710-stack

A decision engine fuses Laya and Jev predictions with confidence weighting and auditable logs

1·GitHub repo

verdict

Manavarya09

Provides calibrated zero-shot and fine-tuned typed decision models as an alternative to Jev

1·GitHub repo

laya-console

biyyl234

Provides a local web console and REST API for Laya inference and intent classification

1·GitHub repo

RayCodes_LayaAI

47thtechcorner

A browser-based Pong game uses Laya to control an AI opponent's paddle

1·GitHub repo

laya-reader

msudars

Ranks new arXiv papers against a reader profile using the local Laya model

1·GitHub repo

laya-sentiment-analyzer

SwatiK425

A local command-line sentiment analyzer using Laya's typed choices and calibrated probabilities

1·GitHub repo

laya-decision-api

bmw8080

An HTTP service wraps local Laya with OpenAPI documentation and Java, TypeScript, and Python SDKs

1·GitHub repo

laya-vs-dijkstra

antonellof

Compares Laya MLX pathfinding decisions with Dijkstra on seeded weighted mazes

1·GitHub repo

katai

Shiawaseu

A browser automation agent uses fine-tuned Laya models to select actions and target elements

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