Algerian Legal Multi-Agent RAG
# ⚖️ Algerian Legal Multi-Agent RAG — API Reference
A **Multi-Agent RAG (Retrieval-Augmented Generation)** REST API built with Agno and **FastAPI**.
Answers legal questions about Algerian law and performs structured contract analysis.
---
## 🏗️ Architecture
| Component | Description |
|---|---|
| **11 Domain Specialist Agents** | One per legal domain (Civil, Pénal, Fiscal, etc.) |
| **Team Coordinator Agent** | Routes queries to the right specialist(s) and synthesizes answers |
| **Privacy Redaction Agent** | Strips sensitive PII from contracts before analysis |
| **Master Contract Analyst Agent** | Produces a structured 8-section legal report |
| **LanceDB** | Local vector database (no server required) |
| **Embeddings** | `paraphrase-multilingual-MiniLM-L12-v2` — supports French, Arabic, Darija |
| **OCR** | `pymupdf` (PDF) + `easyocr` (images) |
---
## 🚀 Quick Start
```bash
# 1. Install dependencies
pip install -r requirements.txt
# 2. Configure your LLM (edit .env)
cp .env.example .env
# 3. Build vector knowledge bases
python -m src.knowledge_builder
# 4. Start the API server
uvicorn src.app:app --host 0.0.0.0 --port 8000 --reload
```
Interactive Swagger UI: 👉 **
localhost
### `.env` Configuration
```env
MODEL_ID=gemini-3.5-flash-thinking
MODEL_BASE_URL=
localhost
MODEL_API_KEY=sk-your-key
```
---
## 📋 Legal Domains Available
| Domain | Coverage |
|---|---|
| ⚖️ Civil | Code civil, maritime, route, aviation, notaire, forêts |
| 🔒 Pénal | Code pénal, procédure pénale, anti-terrorisme, stupéfiants |
| 💼 Commercial | Code de commerce, marchés publics, brevets, investissement |
| 👪 Famille | Code de la famille, nationalité, pension alimentaire |
| 💰 Fiscal | Impôts directs/indirects, douanes |
| 👷 Travail | Code du travail, syndicats |
| 🏛️ Administratif | Commune, wilaya, fonction publique, état civil |
| 🏦 Banque | Réglementations de la Banque d'Algérie |
| 🌍 Foncier | Eaux, hydrocarbures, mines, environnement |
| 🏥 …