with one click
nexus
// Kailash Nexus (Rust) — MANDATORY for API+CLI+MCP unified deployment. Direct axum/tonic BLOCKED.
// Kailash Nexus (Rust) — MANDATORY for API+CLI+MCP unified deployment. Direct axum/tonic BLOCKED.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | nexus |
| description | Kailash Nexus (Rust) — MANDATORY for API+CLI+MCP unified deployment. Direct axum/tonic BLOCKED. |
Nexus is a zero-config multi-channel platform built on Kailash Core SDK that deploys workflows as API + CLI + MCP simultaneously.
Nexus transforms workflows into a complete platform with:
from kailash.nexus import NexusApp, NexusConfig
# Create app with custom port (or use defaults: host=0.0.0.0, port=3000)
app = NexusApp(config=NexusConfig(port=3000))
# Register handler - deployed to all channels at once
@app.handler(name="greet", description="Greet a user")
async def greet(name: str) -> dict:
return {"message": f"Hello, {name}!"}
# Start the server (no arguments - host/port come from NexusConfig)
app.start()
# Now available via:
# - HTTP API: POST http://localhost:3000/api/greet
# - CLI: nexus run greet --name "World"
# - MCP: Connect via MCP client (Claude Desktop, etc.)
@app.handler() decorator for direct function registrationNexus eliminates boilerplate:
Single deployment, three access methods:
Consistent session management:
Production-ready capabilities:
Use Nexus when you need to:
from kailash.nexus import NexusApp, NexusConfig
import kailash
# Initialize DataFlow
df = kailash.DataFlow("postgresql://user:pass@localhost/db")
@db.model
class User:
id: str
name: str
# Create Nexus app and register database-backed handlers
app = NexusApp(config=NexusConfig(port=3000))
@app.handler(name="create_user", description="Create a new user")
async def create_user(name: str) -> dict:
reg = kailash.NodeRegistry()
builder = kailash.WorkflowBuilder()
builder.add_node("CreateUser", "create", {"data": {"name": name}})
rt = kailash.Runtime(reg)
result = rt.execute(builder.build(reg))
return result["results"]["create"]["result"]
app.start()
from kailash.nexus import NexusApp
from kailash.kaizen import BaseAgent
# Deploy agents via all channels using handlers
app = NexusApp()
@app.handler(name="agent_chat", description="Chat with AI agent")
async def agent_chat(message: str) -> dict:
agent = BaseAgent()
result = agent.execute(message)
return {"response": result.get("output", "")}
app.start() # Agents accessible via API, CLI, and MCP
from kailash.nexus import NexusApp, NexusConfig
import kailash
app = NexusApp(config=NexusConfig(port=3000))
# Register workflow execution as handlers
@app.handler(name="process_data", description="Run data processing workflow")
async def process_data(input_text: str) -> dict:
reg = kailash.NodeRegistry()
builder = kailash.WorkflowBuilder()
builder.add_node("EmbeddedPythonNode", "process", {
"code": "result = {'processed': True}",
"output_vars": ["result"]
})
rt = kailash.Runtime(reg)
result = rt.execute(builder.build(reg))
return result["results"]["process"]["outputs"]
app.start()
from kailash.nexus import NexusApp, NexusConfig, Preset
# Complete platform with enterprise preset and custom config
app = NexusApp(
config=NexusConfig(host="0.0.0.0", port=3000),
preset="enterprise", # or Preset.enterprise()
)
# Add middleware
app.add_cors(origins=["https://app.example.com"])
app.add_rate_limit(max_requests=100, window_secs=60)
# Register handlers
@app.handler(name="status", description="Platform status")
async def status() -> dict:
return app.health_check()
app.start() # Host/port configured via NexusConfig
from kailash.nexus import NexusApp
app = NexusApp() # Defaults: host=0.0.0.0, port=3000
@app.handler(name="hello", description="Hello world")
async def hello(name: str = "World") -> dict:
return {"message": f"Hello, {name}!"}
app.start()
from kailash.nexus import NexusApp, NexusConfig
app = NexusApp(
config=NexusConfig(host="0.0.0.0", port=3000),
preset="enterprise",
)
app.add_cors(origins=["https://app.example.com"])
app.add_rate_limit(max_requests=100, window_secs=60)
# Register production handlers...
app.start()
# Deploy multiple Nexus instances behind nginx/traefik
docker-compose up --scale nexus=3
| 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 |
Feature-gated behind dataflow-bridge. Bridges DataFlow model change events to the Nexus EventBus, enabling Nexus subscribers (SSE clients, plugin hooks, monitoring) to react to DataFlow writes without direct coupling.
kailash-nexus = { version = "...", features = ["dataflow-bridge"] }
| Field | Type | Description |
|---|---|---|
event_type | String | DataFlow event type ("model.created", "model.updated", etc.) |
model_name | String | Name of the model that changed |
payload | serde_json::Value | Event payload as JSON |
timestamp | DateTime<Utc> | When the change occurred |
Subscribes to topics: model.created, model.updated, model.deleted, model.upserted, model.bulk_created.
use kailash_nexus::Nexus;
use std::sync::Arc;
// domain_bus is the DomainEventBus from DataFlow
let mut nexus = Nexus::new(config);
nexus.bridge_dataflow(domain_bus);
Nexus::bridge_dataflow(&mut self, domain_bus: Arc<dyn DomainEventBus>) -> &mut Self registers the bridge as a background service. The bridge converts each DomainEvent into a NexusEvent::DataFlowEvent and publishes it on the Nexus EventBus.
Source: crates/kailash-nexus/src/bridge.rs, crates/kailash-nexus/src/events/mod.rs
For Nexus-specific questions, invoke:
nexus-specialist - Nexus implementation and deploymentrelease-specialist - Production deployment patterns skill - When to use Nexus vs other approaches