How leonadavinci/laya-system-one works
Laya is a multilingual, non-autoregressive typed-decision engine. The main workflow accepts a state and typed questions, routes the request to a suitable checkpoint, runs inference, and returns typed answers with routing information. Python is the sampled primary runtime; the README also documents batching, email cleaning, presets, HTTP/MCP and framework integrations, plus a TypeScript runtime. Some subsystem details are documented but unsampled, so the graph shows those capabilities without guessing internal call chains.
Main entry points: agent.py Decision agent · __init__.py Python package API · router.py Checkpoint router · router.ts TypeScript router
Components 24
Decision runtime
- Python package API
laya/__init__.py - Checkpoint router
laya/router.py - Decision agent
laya/agent.py - Question preparation
laya/common.py
Language and tasks
- Language detection
laya/lang.py - Decision presets
laya/presets.py - Email cleaning
laya/email.py
Product interfaces
- Command-line interface
laya/cli.py - HTTP inference server
laya/serve.py - MCP server
laya/mcp/server.py - MCP decision tools
laya/mcp/tools.py - LangChain integration
laya/integrations/langchain.py
Inference options
- ONNX inference
laya/onnx_agent.py - GPU fast path
laya/fast.py
TypeScript runtime
- TypeScript package API
laya-ts/src/index.ts - TypeScript router
laya-ts/src/router.ts - TypeScript language detection
laya-ts/src/lang.ts - TypeScript decision agent
laya-ts/src/agent.ts - Model providers
laya-ts/src/providers.ts
Other components
- Application caller
- Checkpoint repository
- HTTP API client
- MCP client
- LangChain application
Connections 29
- Application caller → Python package API: submits request
- Python package API → Checkpoint router: routes request
- Checkpoint router → Language detection: detects language
- Checkpoint router → Decision agent: loads and dispatches
- Decision agent → Checkpoint repository: downloads checkpoint
- Decision agent → Question preparation: prepares questions
- Question preparation → Decision agent: supplies encoded inputs
- Decision agent → Python package API: returns typed answers
- Application caller → Command-line interface: runs local test
- Command-line interface → Python package API: calls runtime
- HTTP API client → HTTP inference server: sends request
- HTTP inference server → Checkpoint router: serves inference
- MCP client → MCP server: calls tools
- MCP server → MCP decision tools: dispatches tools
- MCP decision tools → Checkpoint router: routes or predicts
- MCP decision tools → Decision presets: uses presets
- LangChain application → LangChain integration: evaluates state
- LangChain integration → Checkpoint router: uses local runtime
- LangChain integration → HTTP inference server: uses remote runtime
- Python package API → Decision presets: exposes presets
- Python package API → Email cleaning: exposes email cleaning
- Decision agent → GPU fast path: optionally accelerates
- ONNX inference → Checkpoint repository: loads exported model
- Application caller → TypeScript package API: uses package
- TypeScript package API → TypeScript router: routes request
- TypeScript router → TypeScript language detection: analyses language
- TypeScript router → TypeScript decision agent: dispatches inference
- TypeScript decision agent → Model providers: loads model bundle
- TypeScript router → TypeScript decision agent: returns routed result