Software Architect & Builder MVP · Validated Pipeline

Rohana

Multi-Tenant Conversational AI Engine for SMEs

ClojurePathom 3NATS JetStreamQdrantOllamaFastAPI (RAG)NVIDIA NIMLlama 3.3 70BClaude APIDatahikeOpenStreetMapTelegram BotWhatsApp API

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

  1. 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 (port 4223 — isolated from port 4222 used for Nexus Quant on the same VPS).
  2. Graph Processing (Pathom 3): The subscriber consumes the queue and executes p.eql/process over the Rohana Pathom 3 graph, resolving only the necessary steps dynamically:
    • Tenant IdentificationIntent ClassificationGuardrail Check (tenant business hours) → RAG ContextFunction CallingLLM InferenceFinal Response.
  3. 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 .edn configuration file and indexing their documents — requiring zero code modifications and zero deployments.

Diagramas

Pipeline de Mensagem

PIPELINE DE MENSAGEMUsuárioWhatsAppTelegramWebhookPOST /webhook/:canal/:tenantpublishNATS JetStreammessages.incoming.*:4223subscribePathom 3tenant-configintent-classifyguardrail-checkrag-contextllm-response→ response/finalpublishNATS JetStreammessages.outgoing.*:4223RespostaWhatsAppTelegramaudit LGPD → NATS

Isolamento Multi-Tenant

ISOLAMENTO MULTI-TENANTTenant: saude-oralPathom 3 Graphtenant/id → :saude-oralQdrant Collectiontenant_saude-oral[odontologia, convênios, equipe, preços]audit.operational.saude-oralTenant: caram-advocaciaPathom 3 Graphtenant/id → :caram-advocaciaQdrant Collectiontenant_caram-advocacia[direito trabalhista, previdenciário]audit.operational.caram-advocaciazero cross-accesscollection-name chokepoint: "tenant_" + (name tenant/id)

Live Demo

Access the online demo or project page.

Access Site / Demo