| name | nexus |
| description | Kailash Nexus (Ruby) — MANDATORY for API+CLI+MCP. Direct Rack/Sinatra BLOCKED. |
Kailash Nexus - Multi-Channel Platform Framework (Ruby)
Nexus is a zero-config multi-channel platform built on Kailash Core SDK that deploys workflows as API + CLI + MCP simultaneously. The Ruby gem wraps the Rust Nexus engine via native extensions and provides Rack middleware integration.
Features
- Zero Configuration: Deploy workflows instantly without boilerplate
- Multi-Channel Access: API, CLI, and MCP from a single deployment
- Unified Sessions: Consistent session management across all channels
- Enterprise Features: Health monitoring, plugins, event system, logging
- DataFlow Integration: Automatic CRUD API generation from database models
- Rack Integration: Mount Nexus as Rack middleware alongside Rails/Sinatra
- Handler DSL: Register Ruby blocks as handlers deployed to all channels
Install
gem install kailash-nexus
Or in Gemfile:
gem "kailash-nexus"
Quick Start
require "kailash/nexus"
workflow = create_my_workflow
nexus = Kailash::Nexus.new(workflow)
nexus.run(port: 8000)
Handler Registration
require "kailash/nexus"
app = Kailash::Nexus::App.new(port: 3000)
app.handler("greet", description: "Greet a user") do |params|
{ message: "Hello, #{params[:name]}!" }
end
app.start
Key Concepts
Zero-Config Platform
Nexus eliminates boilerplate:
- No manual routes - Automatic API generation from workflows
- No CLI arg parsing - Automatic CLI creation
- No MCP server setup - Automatic MCP integration
- Unified deployment - One command for all channels
Multi-Channel Architecture
Single deployment, three access methods:
- HTTP API: RESTful JSON endpoints
- CLI: Command-line interface
- MCP: Model Context Protocol server
Unified Sessions
Consistent session management:
- Cross-channel session tracking
- Session state persistence
- Session-scoped workflows
- Concurrent session support
Enterprise Features
Production-ready capabilities:
- Health monitoring endpoints
- Plugin system for extensibility
- Event system for integrations
- Comprehensive logging and metrics
Integration Patterns
With DataFlow (Database-Backed Handlers)
require "kailash/nexus"
require "kailash/dataflow"
db = Kailash::DataFlow.new do |config|
config.database_url = ENV["DATABASE_URL"]
end
db.model "User" do |m|
m.string :name
m.string :email
end
nexus = Kailash::Nexus.new(db.workflows)
nexus.run(port: 8000)
With Kaizen (Agent Platform)
require "kailash/nexus"
require "kailash/kaizen"
app = Kailash::Nexus::App.new(port: 3000)
app.handler("agent_chat", description: "Chat with AI agent") do |params|
delegate = Kailash::Kaizen::Delegate.new(model: ENV["LLM_MODEL"])
result = delegate.run_sync(params[:message])
{ response: result }
end
app.start
With Core SDK (Custom Workflows)
require "kailash"
require "kailash/nexus"
registry = Kailash::Registry.new
builder = Kailash::WorkflowBuilder.new
builder.add_node("NoOpNode", "start", {})
workflow = builder.build(registry)
nexus = Kailash::Nexus.new(workflow)
nexus.run(port: 8000)
With Rack (Middleware)
require "kailash/nexus"
nexus = Kailash::Nexus.new(my_workflows)
use Kailash::Nexus::Middleware, nexus: nexus
run MyRailsApp
Standalone Platform
require "kailash/nexus"
app = Kailash::Nexus::App.new(
host: "0.0.0.0",
port: 3000,
preset: :enterprise
)
app.cors(origins: ["https://app.example.com"])
app.rate_limit(max_requests: 100, window_secs: 60)
app.handler("status", description: "Platform status") do |_params|
app.health_check
end
app.start
Deployment Patterns
Development
nexus = Kailash::Nexus.new(workflows)
nexus.run(port: 8000)
Production (Docker)
app = Kailash::Nexus::App.new(
host: "0.0.0.0",
port: 3000,
preset: :enterprise
)
app.start
With Puma (Multi-Worker)
workers 4
threads 2, 4
port 3000
require "kailash/nexus"
nexus = Kailash::Nexus.new(my_workflows)
use Kailash::Nexus::Middleware, nexus: nexus
run MyApp
With Load Balancer
docker-compose up --scale nexus=3
Critical Rules
- Use Nexus for workflow platforms instead of building raw Rack/Sinatra/Rails API routes
- Register workflows or handlers, not individual routes
- Leverage unified sessions across channels
- Enable health monitoring in production
- Use plugins for custom behavior
- NEVER mix raw Rack routes with Nexus for the same endpoints
- NEVER implement manual API/CLI/MCP servers when Nexus can do it
- NEVER skip health checks in production
Channel Comparison
| Feature | API | CLI | MCP |
|---|
| Access | HTTP | Terminal | MCP Clients |
| Input | JSON | Args/JSON | Structured |
| Output | JSON | Text/JSON | Structured |
| Sessions | yes | yes | yes |
| Auth | yes | yes | yes |
| Streaming | yes | yes | yes |
Related Skills
Support
For Nexus-specific questions, invoke:
nexus-specialist - Nexus implementation and deployment
release-specialist - Production deployment patterns
- ``decide-framework
skill - When to use Nexus vs other approaches