الذكاء الاصطناعي والأتمتة (AI / Automation)

Enterprise Multi-Tenant RAG AI System with Contextual Memory and Workflow Automation

Designed and built an intelligent enterprise assistant via Telegram, providing instant technical support based on company-specific PDF documents. The system serves multiple organizations simultaneously (Multi-Tenant) while ensuring complete data isolation. It features an automated n8n workflow for dynamic query routing and LangGraph integration to provide the AI agent with session memory, enabling it to understand context and answer complex follow-up questions naturally. The backend is powered by FastAPI and connected to a Qdrant vector database for precise, source-backed information retrieval. The architecture was developed and strictly tested in a stable, isolated Docker environment to ensure compatibility, making it fully cloud-ready for seamless deployment and operation across any plat

Sami Meqdad

Enterprise Multi-Tenant RAG AI System with Contextual Memory and Workflow Automation

Designed and developed an integrated intelligent corporate assistant operating via Telegram to provide technical support based on company-specific documents (PDFs). The system leverages a Retrieval-Augmented Generation (RAG) architecture to serve multiple organizations simultaneously (Multi-Tenant) while ensuring complete data isolation. Developed and strictly tested within an isolated Docker environment, the system is fully optimized for deployment across external Virtual Private Servers (VPS) or cloud-native platforms.

The Challenge

Organizations faced three primary technical hurdles:

Data Leakage Risks: The inability to provide technical support to multiple companies through a single bot without risking cross-contamination of proprietary data.

Context Loss and Hallucinations: Traditional chatbots lack continuous session memory and often generate unverified answers, degrading the quality of technical support.

Frontend API Restrictions: Frequent Webhook delivery failures from Telegram servers due to strict Markdown parsing errors triggered by standard AI-generated text formatting.

Technical Solution and Architecture

A robust microservices architecture was engineered comprising:

Backend API: Built with FastAPI to process query requests and manage AI workflows.

Vector Database: Utilized Qdrant for embedding and storing enterprise document chunks, strictly associating every payload with a specific company identifier (tenant_id).

Automation and Routing Engine: Deployed n8n as middleware to ingest Telegram webhooks, executing custom JavaScript logic to dynamically route queries to the correct corporate knowledge base based on the user's Telegram ID.

Key Features

Absolute Data Isolation (Multi-Tenancy): The tenant_id is enforced as a strict filter parameter in all Qdrant database queries, eliminating the possibility of cross-tenant data retrieval.

Contextual Memory: Integrated LangGraph to enable persistent session memory (MemorySaver). This allows the AI agent to retain conversational context per user, accurately resolving complex, multi-turn follow-up questions.

Targeted Prompt Engineering: Formatted the Google Gemini model instructions to enforce plain-text outputs strictly devoid of Markdown symbols, permanently resolving Telegram API parsing rejections.

Results

The project delivered an automated, secure, and highly scalable enterprise technical support system. It guarantees precise, source-backed information retrieval while providing a seamless, human-like conversational experience that retains complex context across interactions.

Developed by Engineer Sami Meqdad