How godswillomondi/laya works
Laya is a multilingual, non-autoregressive engine for typed decisions, exposed through Python and TypeScript APIs and optional serving and framework integrations. The principal flow is a caller submitting state and questions to a Router, which detects language, selects a checkpoint, runs inference, and returns typed answers with routing metadata. Major capabilities also include schema-driven decisions, presets, shortlisting, long-input and batch prediction, hooks, and operational interfaces. The graph reflects README claims and sampled source; unsampled subsystem wiring is shown only where documented.
Main entry points: router.py Checkpoint router · agent.py Model inference · structured.py Schema decisions · cli.py Command-line interface
Components 23
Decision runtime
- Checkpoint router
laya/router.py - Language analysis
laya/lang.py - Model inference
laya/agent.py - Model checkpoints
- Long-input scanning
laya/router.py - Batch prediction
laya/router.py
Decision capabilities
- Schema decisions
laya/structured.py - Decision presets
laya/presets.py - Choice shortlisting
laya/shortlist.py - Prediction hooks
laya/hooks.py - Email processing
laya/email.py
Product interfaces
- Command-line interface
laya/cli.py - HTTP serving
laya/serve.py - MCP server
laya/mcp/server.py - MCP decision tools
laya/mcp/tools.py - TypeScript API
laya-ts/src/index.ts - TypeScript router
laya-ts/src/router.ts
Framework integrations
- LangChain integration
laya/integrations/langchain.py - LlamaIndex integration
laya/integrations/llamaindex.py - CrewAI integration
laya/integrations/crewai.py
Inference backends
- ONNX inference
laya/onnx_agent.py - GPU fast path
laya/fast.py
Other components
- Application caller
Connections 30
- Application caller → Checkpoint router: submits decisions
- Checkpoint router → Language analysis: analyses language
- Checkpoint router → Model inference: routes inference
- Checkpoint router → Model checkpoints: loads checkpoint
- Model inference → Model checkpoints: runs model
- Checkpoint router → Long-input scanning: scans long input
- Checkpoint router → Batch prediction: batches requests
- Application caller → Schema decisions: provides schema
- Schema decisions → Checkpoint router: requests decision
- Application caller → Decision presets: selects preset
- Application caller → Choice shortlisting: shortlists choices
- Checkpoint router → Prediction hooks: dispatches hooks
- Application caller → Email processing: prepares email
- Application caller → Command-line interface: runs command
- Command-line interface → Checkpoint router: requests prediction
- Application caller → HTTP serving: sends request
- HTTP serving → Checkpoint router: requests prediction
- Application caller → MCP server: invokes MCP
- MCP server → MCP decision tools: dispatches tools
- MCP decision tools → Checkpoint router: requests decisions
- Application caller → TypeScript API: imports API
- TypeScript API → TypeScript router: exposes router
- TypeScript router → Language analysis: analyses language
- Application caller → LangChain integration: uses integration
- LangChain integration → Checkpoint router: requests decisions
- Application caller → LlamaIndex integration: uses integration
- LlamaIndex integration → Checkpoint router: requests decisions
- Application caller → CrewAI integration: uses integration
- Model inference → GPU fast path: accelerates forward
- Application caller → ONNX inference: runs ONNX inference