An advanced agentic Retrieval-Augmented Generation (RAG) chatbot system with modular backend and frontend architecture.
This system integrates vector storage, session tracking, UI components, and multi-stage agent orchestration to generate intelligent, context-aware responses from external dataset sources.
agentic-chatbot/ β βββ backend/ β βββ main.py # FastAPI backend entry point β βββ agent.py # Agent orchestration, tools, retrieval and reasoning logic β βββ config.py # Backend configuration, environment variables, paths β βββ vectorstore.py # Vector DB handling: embeddings, retrieval, storage β βββ pycache/ # Compiled python cache files β βββ ... # Additional backend utilities (if added later) β βββ frontend/ β βββ app.py # Frontend UI application launcher β βββ backend_api.py # Functions to communicate with backend FastAPI API β βββ config.py # Frontend settings, constants, URLs β βββ session_manager.py # Conversation/session state handling β βββ ui_components.py # UI layout, rendering and interaction components β βββ requirements.txt # Dependencies for frontend environment β βββ pycache/ # Cached python files β βββ .env # Environment variables (keys, config) βββ .gitignore # Files/folders ignored by Git βββ .python-version # Python version lockfile βββ pyproject.toml # Project metadata and configurations βββ requirements.txt # Global requirements (if used) βββ README.md # Documentation
yaml Copy code
This project implements an intelligent, multi-agent RAG chatbot system where:
- The backend handles embeddings, storage, retrieval, and reasoning.
- The frontend provides an interactive UI with session-awareness and streamlined communication.
- A structured agent pipeline enhances accuracy, reliability, and contextual depth.
Key capabilities:
- Document ingestion and vector storage
- Retrieval-Augmented Generation (RAG)
- Multi-agent orchestration (retrieve β evaluate β generate)
- Persistent sessions and context flow
- Clean frontend-backend separation
The backend uses FastAPI to expose endpoints for querying, extraction, and agent-driven reasoning.
| File | Description |
|---|---|
main.py |
Defines API routes, runs FastAPI server, orchestrates request handling. |
agent.py |
Core agent logic: retrieval, reasoning, chain-of-actions, tool usage. |
vectorstore.py |
Handles embeddings, similarity search, persistent Chroma/other vector DB logic. |
config.py |
Stores backend constants, environment variables, paths, model references. |
The frontend provides a Python-based UI layer (Streamlit or custom UI via app.py).
| File | Description |
|---|---|
app.py |
Entry point to run the frontend UI interface. |
backend_api.py |
Wrapper for backend API calls (query, ingest, retrieval). |
session_manager.py |
Stores and updates user sessions, chat history, context flow. |
ui_components.py |
Contains UI building blocks, rendering logic, interaction elements. |
config.py |
Frontend-specific configuration (API URL, constants). |
requirements.txt |
Dependencies required to run frontend. |
git clone https://github.com/your-username/agentic-chatbot.git
cd agentic-chatbot
β
Backend Setup
bash
Copy code
cd backend
python -m venv venv
source venv/bin/activate # For Linux/Mac
venv\Scripts\activate # For Windows
pip install -r ../requirements.txt
Start backend:
bash
Copy code
uvicorn main:app --reload --port 8000
β
Frontend Setup
bash
Copy code
cd frontend
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
pip install -r requirements.txt
Launch the frontend UI:
bash
Copy code
python app.py
π§© How the System Works
pgsql
Copy code
User Input β Frontend UI β backend_api.py β FastAPI Backend
β
Backend Agent (agent.py)
β
Vectorstore Retrieval
β
LLM Response Generation
β
Back to Frontend UI
Steps summary:
User types a query.
Frontend sends query to backend using backend_api.
Backend agent calls vectorstore for relevant chunks.
Agent synthesizes retrieved context.
Final answer generated and sent back.
UI displays formatted output.
β¨ Features
β
Retrieval-Augmented Generation
β
Multi-agent reasoning pipeline
β
Persistent vector database
β
Session-aware conversations
β
Modular architecture
β
Extensible design for adding new tools/agents
π Future Enhancements
Docker deployment (backend + frontend)
UI improvements
Adding multiple data ingestion formats
Authentication and user management
Streaming responses
π¨βπ» Author
Krishiv Arora
GitHub: https://github.com/Krishiv1611