← Back to Projects
Multi-Tenant RAG Platform (AI Chatbot as a Service)RAGMulti-Tenant SaaSChat Widget

Agentech Assistant

Custom AI Chatbot as a Service — your data, answered with citations.

Agentech Assistant — Multi-Tenant RAG Platform (AI Chatbot as a Service)

Overview

Designed and built Agentech Assistant, a production-grade multi-tenant RAG platform that lets any business deploy an AI assistant grounded strictly in its own proprietary data. Clients upload documents (PDF, Word, PowerPoint, CSV, Excel, JSON), live URLs, images, or audio through a private dashboard; the platform automatically extracts, chunks, embeds, and vectorizes the content, then serves answers with citations via an embeddable chat widget or per-tenant API keys. The backend is a Spring Boot 4.0 + Spring Modulith modular monolith with an async Postgres-backed ingestion queue and streaming chat. Strict tenant isolation is enforced in layers: application-level tenant/account context, PostgreSQL Row-Level Security on every tenant- and account-scoped table, and vector-level isolation in Qdrant via payload filtering — so one client's data can never leak into another's. A prepaid, token-metered billing model (message credits billed per token under the hood) protects margin while keeping usage simple for customers.

Responsibilities

  • Architected and built a multi-tenant RAG platform end-to-end (backend, dashboard, and embeddable widget)
  • Built a Spring Boot 4.0 modular monolith using Spring Modulith with per-module domain/persistence/application/web/api/mapper layering over a shared kernel
  • Implemented the ingestion pipeline: document extraction, chunking, embedding, and vectorization via an async Postgres-backed job queue
  • Built retrieval-augmented streaming chat with source citations to reduce hallucinations
  • Enforced strict tenant isolation via PostgreSQL Row-Level Security plus Qdrant payload-filtered vector isolation
  • Implemented global identity: accounts + workspace memberships, email-only login, account-scoped RLS, multi-workspace switching, and two-phase OTP registration
  • Built per-tenant API keys, rate limiting, and usage quotas for the public widget
  • Designed a prepaid, token-metered billing/credit model with per-message usage display billed per token internally
  • Added media ingestion (image + audio transcription via vision and Whisper) and observability/hardening
  • Migrated the production vector store from self-hosted Qdrant to managed Qdrant Cloud with zero data loss and near-zero downtime
  • Built the Next.js dashboard and a vanilla-JS web-component chat widget
  • Extended the assistant to social channels (Messenger, WhatsApp, Instagram, Telegram) via a shared ChannelAdapter feeding the existing chat/RAG pipeline
  • Implemented per-tenant assistant persona and conversation opener
  • Built a platform super-admin back-office for cross-tenant operations

Technical Challenges

Problem

Preventing cross-tenant data leakage in a shared-schema multi-tenant platform.

Solution

Layered isolation: application-level TenantContext/AccountContext derived only from the authenticated principal, PostgreSQL Row-Level Security (deny-by-default) on every tenant- and account-scoped table, and Qdrant payload filtering per tenant.

Result

A single client's documents and vectors can never surface in another tenant's answers.

Problem

Reducing AI hallucination so answers are company-specific and trustworthy.

Solution

Strict Retrieval-Augmented Generation — the model answers only from retrieved tenant documents and returns citations to the source chunks.

Result

Factual, grounded answers instead of generic or invented statements.

Problem

Heavy, slow document ingestion blocking the request path.

Solution

Moved extraction, chunking, embedding, and vectorization into an async Postgres-backed job queue supporting docs, structured data, live URLs, images, and audio.

Result

Zero-coding, near-instant setup for clients while ingestion runs in the background.

Problem

Protecting margin on a variable OpenAI cost base without confusing customers.

Solution

Prepaid message-credit model shown per message but billed per token internally (1 credit = 3,500 tokens), with a deliberately tight free tier and hard caps on image/audio ingestion.

Result

Predictable, abuse-resistant pricing (~3–5x cost) with simple per-message UX.

Problem

Resolving the correct tenant on unauthenticated inbound social webhooks before RLS context exists.

Solution

Signature-verified webhook per channel resolves (channel, external_id) → tenant via a SECURITY DEFINER function (bypasses RLS for the lookup), sets app.current_tenant, then processes the message async on the existing queue.

Result

Messenger/WhatsApp/Instagram/Telegram plug into the same RAG pipeline with tenant isolation intact and fast webhook acks.

Problem

Moving the production vector store off a self-hosted container onto managed Qdrant Cloud without losing vectors or taking the assistant offline.

Solution

Streamed the live collection with Qdrant's official migration tool in resumable batches while the app kept serving reads, verified the source and target point counts matched along with the tenant_id payload index, then cut over by repointing env and doing a single rolling redeploy — after adding an explicit gRPC use-tls flag that the Cloud endpoint requires. The old container and its volume stayed untouched as a rollback path until decommission.

Result

Zero data loss, downtime limited to one redeploy, and a managed cluster in production while dev and staging stay on self-hosted Docker.

Results & Impact

80%
Tier-1 tickets deflected
24/7
Automated, grounded answers
6+
Source types ingested
100%
Cited, tenant-isolated replies

Tech Stack

Java 21Spring Boot 4.0Spring ModulithSpring AISpring SecurityPostgreSQL 16Row-Level Security (RLS)Qdrant CloudRedisOpenAI (gpt-4o-mini, text-embedding-3-small, Whisper)FlywayMapStructLombokNext.js 16React 19TypeScriptVanilla JS Web ComponentMeta Graph APIWhatsApp Cloud APITelegram Bot APIWebhooksDocker

Gallery

Agentech Assistant screenshotAgentech Assistant screenshotAgentech Assistant screenshotAgentech Assistant screenshot

Key Features

  • Zero-coding setup: upload data and get a ready AI assistant in minutes
  • Omnichannel ingestion: PDF, Word, PowerPoint, TXT, CSV, Excel, JSON, live URLs, images, and audio
  • Retrieval-Augmented answers with citations to reduce hallucination
  • Multi-channel deployment: embeddable web widget, per-tenant API keys, plus Facebook Messenger, WhatsApp, Instagram, and Telegram via a shared adapter
  • Customizable per-tenant assistant persona and conversation opener
  • Strict multi-tenant isolation (PostgreSQL RLS + Qdrant vector isolation)
  • Global identity with multi-workspace switching and OTP registration
  • Rate limiting, usage quotas, and prepaid token-metered billing
  • Streaming chat responses for real-time interaction
  • Platform super-admin back-office for cross-tenant operations