Installation guide

NandhaKishorM/laya installation guide

Apache-2.0 multilingual decision-model toolkit that provides Python and TypeScript SDKs, local CLI and HTTP serving, ONNX runtimes, framework integrations, evaluation harnesses, and an optional MCP server for fast typed choice, ordinal-score, and yes/no decisions; no native Claude Code plugin, hook, skill, or Claude-specific installation path is evidenced.

Install Laya on macOS Tahoe with Apple silicon

What this repository is

Laya is a Python decision-model library and command-line tool. It evaluates typed questions—closed choices, ordinal scores, and yes/no probabilities—against text or JSON-like input. Its router can choose among English, multilingual, and typed-decision checkpoints. Model inference runs through PyTorch, and the project documents automatic device selection in the order CUDA → Apple Metal Performance Shaders (MPS) → CPU. On an Apple-silicon Mac, that means Laya can select MPS when it is available.

Relationship to Claude Code: **unclassified**

The supplied first-party files do not document a Claude Code plugin, skill, hook, command, settings entry, or Claude-specific installation procedure. Laya does offer an optional MCP extra, but no supplied file explains how to connect that server to Claude Code. Therefore, its Claude Code mechanism cannot be classified reliably. Treat Laya as an independent Python library/CLI—not as a documented Claude Code extension.

Before you begin

You need:

The repository documents macOS generally, but it does not provide a Tahoe-specific compatibility matrix. The procedure below therefore uses its documented macOS virtual-environment commands without claiming separate Tahoe validation.

Open **Terminal** from **Applications → Utilities**. Use Finder to create or select a folder for your Laya work. In Terminal, type `cd ` with a trailing space, drag that folder from Finder into the Terminal window, and press Return. This avoids having to type its path.

Recommended installation: isolated Python environment

A virtual environment keeps Laya and its dependencies separate from other Python projects. Run these three commands from your chosen folder:

python3 -m venv .venv
.venv/bin/python -m pip install laya
.venv/bin/python -I -c "import laya; print(laya.__version__)"

What they do:

  1. `python3 -m venv .venv` creates a private Python environment in a hidden `.venv` folder.
  2. `.venv/bin/python -m pip install laya` installs the published Laya package from PyPI into that environment.
  3. The final command imports Laya and prints its installed version.

The verification command uses Python’s isolated mode, `-I`. The repository explains that this prevents a local source directory from masking a missing installation. It verifies the package without loading or downloading a model checkpoint.

If the first command reports that your Python is too old, stop and install Python 3.10 or newer before continuing. The repository does not prescribe a macOS Python installer, so this guide does not provide an undocumented package-manager command.

Activate the environment for convenient CLI use

The explicit `.venv/bin/python` path is the safest way to ensure you use the right interpreter. For the installed `laya` command, activate the environment in your current Terminal window:

source .venv/bin/activate

Activation applies only to that Terminal session. If you open another Terminal window later, return to the same project folder and activate the environment there before using the bare `laya` command.

First test: routing without a model download

Run the repository’s documented routing-only example:

laya "I was charged twice, please refund"

This performs a routing decision only. According to the README, routing works offline and does not download a checkpoint. It should return quickly and confirms that the command-line entry point is available.

You can also start the documented interactive mode by running:

laya

Use the routing-only test first because it separates installation problems from model-download or inference problems.

First full prediction

Next, run a prediction that actually loads a model:

laya "Refactor this service" --predict

The first full prediction downloads the selected public checkpoint from Hugging Face. That initial run can therefore take substantially longer than the routing-only test. The examples documentation also notes that the first MPS call may spend additional time compiling Metal kernels. Later calls can reuse downloaded files from the Hugging Face cache.

For a ready-made support-triage question set, use the documented preset example:

laya "My payment failed twice" --preset triage

For multilingual input, the router can detect a non-English language and select the multilingual checkpoint. The documented German example is:

laya "Mein Konto wurde zweimal belastet" --lang de

Laya’s router is intended to select between its checkpoints, but the repository also warns that short Latin-script text may not contain enough information for reliable automatic language detection. Supplying a language explicitly, as above, avoids that ambiguity.

What to expect on Apple silicon

The examples state that leaving the device unspecified lets Laya choose CUDA, then MPS, then CPU. Since Apple silicon does not use CUDA, the relevant paths are MPS and CPU. No extra Apple GPU installation command is documented for the normal PyPI setup.

Do not install the optional `laya[fast]` extra for this Mac expecting its advertised fast path: the README describes that path as CUDA-based and says it falls back to the stock implementation on MPS or CPU.

Checkpoint loading requires memory, disk space, and a one-time network download. The three published checkpoints are large neural models, with the README listing hundreds of millions of parameters each. Start with one ordinary `--predict` request rather than preloading all three models.

Alternative: install the development branch from GitHub

The PyPI release is the simpler choice for most people. If you specifically need the current development version from the repository’s default branch, create the same virtual environment but replace the PyPI installation command with the repository’s documented GitHub command:

.venv/bin/python -m pip install "git+https://github.com/NandhaKishorM/laya.git"

Then run the same verification check:

.venv/bin/python -I -c "import laya; print(laya.__version__)"

This route requires Git to be installed. The README warns that the GitHub version follows the default branch and may differ from the published release. Do not run both installation methods unless you intentionally want the later command to replace the earlier installation.

Alternative: use `uv`

If `uv` is already installed, the repository provides these cross-platform commands:

uv venv --python 3.12
uv pip install laya

`uv` creates `.venv` in the current directory and can download a matching Python if needed. Verify the result with the same macOS command:

.venv/bin/python -I -c "import laya; print(laya.__version__)"

If this is already a `uv` project, the documented project commands are:

uv add laya
uv run python -I -c "import laya; print(laya.__version__)"

Choose either the standard `venv` procedure or the `uv` procedure; you do not need both.

Troubleshooting

`ModuleNotFoundError: No module named 'laya'`

Run installation, verification, and your own programs with the same environment. Re-run:

.venv/bin/python -I -c "import laya; print(laya.__version__)"

If you use an editor, select the Python interpreter inside `.venv`.

The version check works, but `laya` is not found

Activate the environment in that Terminal window:

source .venv/bin/activate

Then retry the documented routing test:

laya "I was charged twice, please refund"

A prediction cannot download its checkpoint

The routing-only command can work without a model, while `--predict` needs access to Hugging Face on first use. Confirm that the Mac has network access and retry. The README says the CLI should report a checkpoint download failure rather than crash.

Error about `rl_agent_config.json`

Do not create this file manually. The repository says it belongs beside `model.safetensors` in a Laya checkpoint. This issue matters mainly when loading a custom local model directory.

Installation complete

Your setup is complete when the isolated version check prints a Laya version, the routing-only command runs, and a full `--predict` request finishes after any first-use checkpoint download. No Claude Code configuration is required or documented for this installation.