Rohana
Multi-Tenant Conversational AI Engine for SMEs
Project Overview
Rohana is the multi-tenant engine and Clojure core that hosts isolated conversational AI personas, commercially packaged by the company Daelaam. Each persona has its own knowledge base, and messages flow through an event bus (NATS JetStream) before a response is generated. Personas (such as Sofia, designed for dental clinic operations) are configured dynamically using EDN files, requiring zero code changes to add a tenant. Built on this foundation are three subsystems: the Agent (WhatsApp/Telegram conversational runtime per tenant, performing RAG over client documents), the Probe (a lead scraper via OpenStreetMap → qualified using 5 distinct signals → Telegram alerts, yielding 88 validated leads in Niteroi at zero API cost), and the Observer (a planned operations cockpit and analytics layer). The system was designed from day one to comply with LGPD guidelines, featuring two-tier audit logs and physical database isolation per tenant.
Architecture & Implementation
Sequential Message Flow
- Ingress (Webhook): Each incoming message enters through
POST /webhook/:canal/:tenant, is normalized into a standard envelope, and published to the NATS JetStream event bus (port4223— isolated from port4222used for Nexus Quant on the same VPS). - Graph Processing (Pathom 3): The subscriber consumes the queue and executes
p.eql/processover the Rohana Pathom 3 graph, resolving only the necessary steps dynamically:- Tenant Identification → Intent Classification → Guardrail Check (tenant business hours) → RAG Context → Function Calling → LLM Inference → Final Response.
- Egress Event: The resulting response is published back to NATS JetStream for delivery to the respective chat channel.
Decoupled RAG Pipeline
- Retrieval tasks are offloaded to an independent Python (FastAPI) microservice via
POST /query. - Implements Hybrid Search (Dense Vector + BM25 + Reciprocal Rank Fusion) combined with Cross-Encoder re-ranking and grounded generation. This allows scaling and updating RAG pipelines without redeploying the Clojure core.
Physical Multi-Tenant Isolation & Zero-Deploy Provisioning
- Data Isolation: Multi-tenancy is physically enforced at the database level: each tenant has its own collection in Qdrant, derived strictly by a single chokepoint function (
"tenant_" + id). Collection queries never cross tenant boundaries. - Security: Real-time operational audit logs are streamed to NATS in isolated channels.
- Provisioning: Registering a new tenant simply involves adding a
.ednconfiguration file and indexing their documents — requiring zero code modifications and zero deployments.
Diagramas
Pipeline de Mensagem
Isolamento Multi-Tenant
Live Demo
Access the online demo or project page.