Arquibot
Intelligent assistant with Langgraph and RAG for construction management

In the construction and architecture industry, information management is critical. From checking updated material prices to coordinating on-site logistics, professionals lose hours searching for scattered data. ArquiBot is born as a solution to this problem: an intelligent conversational agent capable of assisting architects and construction companies in real time through WhatsApp. It’s not just a simple chatbot; it’s an agentic system capable of querying internal databases, calculating labor costs, and even managing purchase orders with human supervision.
What Does ArquiBot Do?
ArquiBot acts as a virtual site manager available 24/7. Its main capabilities include:
-
Technical and Price Queries (RAG): The bot has access to a document library (PDFs, Excel, Word) containing regulations, material prices, and labor agreements.
-
Labor Cost Calculations: It estimates costs based on worker type and hours, applying predefined rates.
-
Logistics and Weather: It queries external APIs to verify whether weather conditions allow work (OpenWeather) and calculates delivery times for materials.
-
Purchase Management (Human-in-the-Loop): It generates formal purchase orders and sends emails to suppliers, always requesting human approval before executing critical actions.
Technical Architecture
The project is built on a modern Python stack, using LangGraph for agent orchestration, enabling a cyclical flow with memory—unlike traditional linear chains.
Knowledge Ingestion (Multi-format RAG)
The system does not hallucinate information; it relies on real data. I implemented an ingestion system (ingest.py) that scans knowledge directories.
-
Technologies: LangChain, PyPDFLoader, Docx2txtLoader, CSVLoader.
-
Vector Store: Documents are chunked and converted into vectors (embeddings) using the all-MiniLM-L6-v2 model. These vectors are stored in PostgreSQL via the PGVector extension, enabling fast semantic search.
The Brain: LangGraph and Google Gemini
The core of ArquiBot is a state graph (StateGraph).
-
LLM Model: I use Google Gemini 2.5 Flash for its efficiency and context window.
-
Orchestration: The graph defines nodes for the Agent and the Tools. The flow dynamically decides whether to reply to the user or invoke an external tool (Function Calling).
-
Persistence: Thanks to PostgresSaver, the bot has long-term memory (“Memory Persistence”). If you restart the server, the bot remembers the conversation with each user.
Human-in-the-Loop (HITL)
One of the most advanced features is safe interruption. When the agent decides to generate a purchase order, the flow stops thanks to the interrupt_before configuration in LangGraph. The system waits for the user (the architect) to type “APPROVE ORDER”. Only then does the graph resume execution, generate the order, and fire the email-sending tool. This prevents accidental or hallucinated purchases.
Interface and Deployment (FastAPI + Twilio)
To make it accessible on-site, the interface is WhatsApp.
-
API Gateway: A FastAPI server handles incoming webhooks from Twilio (WhatsApp) and Telegram.
-
Thread Handling: Each phone number becomes a unique thread_id in the database, maintaining independent sessions for each user.
-
Communication: The Twilio API is used to receive and send messages, connecting the user’s input directly to the LangGraph state machine.


