An end-to-end Enterprise Multi-Agent Retrieval-Augmented Generation (RAG) Platform built with FastAPI, Next.js, FAISS, Sentence Transformers, SQLite, and Ollama.
The platform combines intelligent agent routing, document-based question answering, document analysis, persistent conversation memory, session-isolated vector storage, and a modern web interface.
- Multi-agent AI architecture
- General, RAG, and Analysis agents
- Intelligent query routing
- PDF document question answering
- Multiple PDF support per session
- Session-isolated RAG
- Persistent FAISS vector storage
- Persistent SQLite conversation memory
- Local LLM inference with Ollama and Llama 3.2
- Sentence Transformer embeddings using all-MiniLM-L6-v2
- Next.js and TypeScript frontend
- FastAPI REST backend
- Document listing and clearing
- New Chat and Clear Memory functionality
- Backend health and system status endpoints
User
|
v
Next.js Frontend
|
v
FastAPI Backend
|
v
Router Agent
|
+----------------+----------------+
| | |
v v v
GENERAL RAG ANALYSIS
Agent Agent Agent
| | |
| v v
| Session-Specific FAISS Store
| |
| v
| Retrieved Context
| |
+----------------+----------------+
|
v
Ollama LLM
Llama 3.2
|
v
Answer
Conversation Memory -> SQLite
PDF Embeddings -> Sentence Transformers
Vector Indexes -> Persistent FAISS Storage
Handles general questions that do not require uploaded document context.
Example:
Explain machine learning in simple words.
Retrieves relevant chunks from PDFs uploaded in the current session and generates answers grounded in document context.
Example:
What does the uploaded document say about revenue?
Performs detailed analysis using retrieved information from uploaded documents. It can identify important facts, patterns, trends, risks, comparisons, and document-based insights.
Example:
Analyze the main information in the uploaded document.
Automatically routes each query to one of the following:
GENERAL
RAG
ANALYSIS
Each chat receives a unique session ID. Documents uploaded in one session are isolated from other sessions.
Session A -> PDF A -> FAISS Index A
Session B -> PDF B -> FAISS Index B
This prevents document context from being shared between independent chat sessions.
FAISS indexes and document metadata are persisted to disk:
data/
└── vector_stores/
├── session-a/
│ ├── index.faiss
│ └── documents.pkl
└── session-b/
├── index.faiss
└── documents.pkl
After a backend restart, a session's vector store can be loaded again without re-uploading the PDF.
Generated vector-store data is excluded from Git.
Conversation messages are stored in SQLite and associated with a session ID.
The Clear Memory feature removes conversation history for the current session independently of document storage.
Users can upload multiple PDFs within the same session. The platform loads each PDF, splits it into chunks, generates embeddings, adds them to the session-specific FAISS index, and persists the updated index.
- Python
- FastAPI
- Uvicorn
- Pydantic
- SQLAlchemy
- Ollama
- Llama 3.2
- Sentence Transformers
- all-MiniLM-L6-v2
- FAISS
- Document chunking
- Semantic embeddings
- Vector similarity search
- Context-grounded generation
- SQLite
- Next.js
- React
- TypeScript
- Tailwind CSS
Enterprise-Multi-Agent-RAG-Platform/
├── app/
│ ├── agents/
│ │ ├── analysis_agent.py
│ │ ├── general_agent.py
│ │ ├── memory.py
│ │ ├── rag_agent.py
│ │ └── router_agent.py
│ ├── api/v1/
│ │ ├── chat.py
│ │ ├── routes.py
│ │ └── upload.py
│ ├── config/
│ ├── database/
│ ├── llm/
│ ├── models/
│ ├── rag/
│ │ ├── embeddings.py
│ │ ├── loader.py
│ │ ├── retriever.py
│ │ ├── splitter.py
│ │ └── vectorstore.py
│ └── main.py
├── frontend/
│ ├── app/
│ ├── public/
│ ├── package.json
│ └── tsconfig.json
├── requirements.txt
├── .env.example
├── .gitignore
└── README.md
GET /api/v1/healthGET /api/v1/statusPOST /api/v1/chatExample:
{
"session_id": "web-session-1",
"query": "What does the uploaded document say?"
}POST /api/v1/uploadForm data:
file: document.pdf
session_id: web-session-1
GET /api/v1/documents/{session_id}DELETE /api/v1/documents/{session_id}DELETE /api/v1/chat/memory/{session_id}DELETE /api/v1/chat/session/{session_id}git clone <your-repository-url>
cd Enterprise-Multi-Agent-RAG-PlatformWindows PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1macOS/Linux:
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtInstall Ollama, then pull Llama 3.2:
ollama pull llama3.2Verify:
ollama listCreate a local .env based on .env.example.
Never commit real API keys, credentials, or secrets.
Windows PowerShell:
$env:OPENBLAS_NUM_THREADS="1"
$env:OMP_NUM_THREADS="1"
$env:MKL_NUM_THREADS="1"
python -m uvicorn app.main:app --host 127.0.0.1 --port 8002FastAPI backend:
http://127.0.0.1:8002
API documentation:
http://127.0.0.1:8002/docs
Open another terminal:
cd frontend
npm install
npm run devFrontend:
http://localhost:3000
Start FastAPI
|
Start Next.js
|
Create New Chat
|
Upload PDF(s)
|
Ask Question
|
Router Selects Agent
|
FAISS Retrieves Context (for RAG/Analysis)
|
Ollama Generates Answer
|
Conversation Stored in SQLite
Sensitive and generated files should remain excluded from Git, including:
.env
.venv/
uploads/
*.db
data/vector_stores/
data/chroma_db/
frontend/node_modules/
frontend/.next/
Never commit real API keys, credentials, uploaded private documents, or production secrets.
Session isolation in this portfolio project separates document context by chat session. A production deployment should additionally implement authentication, authorization, access controls, and secure secret management.
- User authentication and authorization
- PostgreSQL
- Redis caching
- Background document processing
- Streaming LLM responses
- Hybrid search
- Reranking
- Metadata filtering
- Individual document deletion
- Docker and Docker Compose
- Cloud deployment
- Automated tests
- CI/CD
- Observability and structured logging
- Role-based access control
- Production-grade vector database
This project demonstrates practical experience with AI engineering, LLM application development, multi-agent systems, Retrieval-Augmented Generation, embeddings, vector search, FAISS, local LLM deployment, FastAPI, Next.js, persistent application state, session isolation, REST API design, and end-to-end AI application architecture.
This project is designed as an AI engineering and portfolio project. Before production use with sensitive enterprise data, additional security, authentication, authorization, testing, monitoring, and deployment controls should be implemented.