Hybrid ecosystem for automating sales and support

Most ready-made chat widgets on the market either function as simple autoresponders with rigid rules or require complex manual setup of scenarios for each language version of a website. Meanwhile, operators often cannot see what the client is typing in real time, and AI models may freeze or produce errors during peak loads.

The AI-Robot Studio team developed AI-Robot Chat — a fault-tolerant enterprise AI consulting platform. It is a fully ready-made software suite with an open architecture that deploys on your servers, guarantees complete independence from third-party subscription services, and ensures instant interface response.

Technical architecture and the 'guts' of the AI-Robot Chat system

1. Dynamic Content Bridge (Dynamic Decoupled Knowledge Base)

The main architectural feature of AI-Robot Chat is the complete separation of the bot’s knowledge from the backend code. The bot operates as an 'empty shell', while all knowledge about your services, prices, and rules is dynamically loaded from external JSON files (e.g., ru.json, es.json) on a remote server.

  • At launch and upon request, the kb_service.py service downloads the knowledge files, cleans them of HTML tags, and converts structured blocks into flat text context.
  • The system takes an instruction template (System Prompt), dynamically inserts the cleaned knowledge into the context marker, and adds a strict language instruction at the very end, preventing confusion in multilingual dialogues.

2. Fast and adaptive frontend (Svelte 5 Chat Widget)

The chat interface is built on the Svelte 5 framework, ensuring minimal bundle size and instant widget performance without slowing down your main website.

  • Automatic language detection: The widget reads the lang attribute of the html tag. If your website (React/Svelte SPA) changes language without reloading the page, the built-in MutationObserver instantly detects this, clears the chat window, and requests a greeting in the new language.
  • Hybrid communication: REST API is used for quick loading of message history and settings, while asynchronous WebSockets provide instant two-way message exchange and real-time display of the 'Typing...' status.
  • Rich Content: The chat supports Markdown rendering (lists, bold/italic text), displaying attached screenshots, and file uploads.

3. High-performance asynchronous core (FastAPI)

The server side of AI-Robot Chat is built on FastAPI using Python. For working with databases (Firebase) and spreadsheets (Google Sheets), we use asynchronous thread distribution via asyncio.to_thread. While one thread waits for log writing or data submission to Google Sheets, the main FastAPI core continues to instantly serve hundreds of active WebSocket connections from other users without delays.

A special connection manager (ws_manager.py) tracks user status in real time. If a client opens the website tab, the operator sees a green presence indicator; if they close it, the indicator instantly disappears, saving the manager’s time.

4. Fault-tolerant AI engine: 'Waterfall' architecture (Waterfall AI Engine)

The system’s brain (the ai_service.py module) is protected from AI provider failures. We implemented a cascading request model: if the priority model (e.g., OpenAI) returns an error or does not respond within 20 seconds, the bot automatically redirects the request to Gemini, and in case of another failure, to xAI or Mistral. The client receives uninterrupted responses, even if one of the AI services is globally unavailable.

5. Intelligent lead generation (Function Calling)

The AI does not just simulate conversation. Using Function Calling technology, the bot semantically recognises when a user leaves their contact details (phone, email, messenger nickname). At this point, the system instantly calls the technical function save_lead, captures the contacts, and sends an instant notification to the business owner via Telegram.

6. Professional operator panel (NiceGUI & AG Grid)

The interface for managers is built on NiceGUI and provides a full-fledged workspace:

  • Instant takeover (Human Mode): The manager sees the client’s conversation with the AI in real time and can take over control from the bot with a single click, switching the chat to manual mode. Activity indicators show if any colleagues are also viewing the chat, preventing confusion.
  • Analytics dashboard: Displays key business KPIs in real time (number of unique sessions, active dialogues, lead conversion).
  • Intelligent database management via AG Grid: The table allows filtering thousands of sessions by country, UTM tags, visit dates, entry pages, and bulk archiving or deletion. The table remembers column settings individually for each manager.

Key advantages of AI-Robot Chat for your business

  • Fully autonomous knowledge base: The bot is trained on your JSON files, eliminating the need for reprogramming when price lists or service terms change.
  • Maximum response speed: The asynchronous backend architecture and WebSockets eliminate any delays in message delivery.
  • Absolute transparency: You see the entire customer journey — from the UTM tag of the ad campaign, IP address, and city to the page where the user opened the chat.

AI-Robot Chat is a ready-for-high-load enterprise-class tool that automates up to 90% of customer service and turns your website visitors into sales-ready leads. Contact the AI-Robot Studio specialists to discuss implementing AI-Robot Chat on your website or customising the platform for your business processes.