📚 Module: Understanding the ADLC Multi-Tenant Bot System Architecture Target Audience: Beginner Engineers, AI builders, and Community Learners Estimated Reading Time: 8–10 minutes Goal: Understand how an automated, AI-powered multi-tenant chatbot works from the moment a user types a message to running real-world tools and creating GitHub PRs. 🎯 High-Level Overview: What is this system? Imagine you run an automated AI developer/assistant named ADLC Bot. - "Multi-Tenant" means many different teams or channels ("tenants") can use the exact same server instance, each having their own custom rules, memory, and settings without interfering with each other. - Whenever a user talks to the bot in Google Chat, the bot wakes up, verifies who you are, loads your specific channel's rules, thinks using an LLM (Large Language Model), browses the web if needed, and can even automatically push code fixes to GitHub! 🗺️ The Architecture at a Glance (The 4 Main Zones) Looking at the diagram, the architecture is divided into 4 distinct color-coded zones: 1. 🟩 Google Chat (The Frontend / User Interface): Where users interact with the bot. 2. 🟦 Fly.io Machine + Volume (The Core Engine): The lightweight server where the routing, security, database, and browser automation live. 3. ⬛ LLM & Peer Agents (The Brains & Network): The AI models (Gemini / Claude / DeepSeek) and other bots communicating agent-to-agent. 4. 🟧 GitHub Org (The Code Factory): Where the bot creates repositories, tests code, and submits pull requests. 🔄 Step-by-Step Walkthrough: What Happens When You Send a Message? Step 1: The Trigger (Google Chat 🟩) - Action: A user in a Google Chat space types @bot help me fix this bug. - Webhook: Google Chat packages this event into an HTTP POST request and shoots it over to the bot server at /api/chat-event. Step 2: The Gateway & Security Check (Fly.io 🟦) Before doing anything expensive or dangerous, the server performs a two-step security check: