Multi-agent Indian Legal AI System for Lawyers, Courts, and Public
LawAI is an advanced AI-powered legal assistant system designed specifically for the Indian legal framework. It leverages IBM watsonx.ai's Granite-13b-chat-v2 model, LangGraph for agent orchestration, and ChromaDB for vector search to provide intelligent legal assistance.
- π RAG Search - Query Indian legal corpus (BNS, BNSS, BSA, Supreme Court judgements)
- π Draft Document - Generate legal drafts (bail applications, petitions, notices)
- π Analyze Document - Extract and analyze uploaded legal documents (PDF/DOCX)
- π¬ Chat - Context-aware legal Q&A with accurate citations
- BNS - Bharatiya Nyaya Sanhita, 2023 (replaces IPC)
- BNSS - Bharatiya Nagarik Suraksha Sanhita, 2023 (replaces CrPC)
- BSA - Bharatiya Sakshya Adhiniyam, 2023 (replaces Evidence Act)
- SC Judgements - Supreme Court rulings under new legal framework
- LLM: IBM watsonx.ai - Granite-13b-chat-v2
- Agent Framework: LangGraph for complex workflows
- Vector DB: ChromaDB (local deployment)
- Backend: FastAPI with async/await and streaming
- Frontend: Next.js 14 with TypeScript and Tailwind CSS
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (Next.js) β
β Chat Interface | Search | Document Gen | Doc Analysis β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend (FastAPI) β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β LangGraph Agent Orchestrator β β
β β (Intent Classification & Tool Routing) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββΌβββββββββββββββββββ β
β βΌ βΌ βΌ β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β RAG β β Draft β β Analyze β β
β β Search β β Document β β Doc β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β β β β
β ββββββββββββββββββββΌβββββββββββββββββββ β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β IBM watsonx.ai (Granite-13b) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β ChromaDB (BNS, BNSS, BSA, SC Judgements) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python 3.10+
- Node.js 18+
- IBM watsonx.ai account and credentials
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment file and configure
cp .env.example .env
# Edit .env with your IBM watsonx.ai credentials
# Run development server
uvicorn main:app --reloadBackend will be available at http://localhost:8000
API documentation at http://localhost:8000/docs
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Copy environment file
cp .env.local.example .env.local
# Run development server
npm run devFrontend will be available at http://localhost:3000
- Complete Implementation Plan
- Agent Guidelines
- Development Rules
- IBM watsonx.ai Setup Guide (Coming in Phase 2)
- Data Collection Guide (Coming in Phase 3)
cd backend
# Run all tests
pytest
# Run with coverage
pytest --cov=backend --cov-report=html
# Run specific test file
pytest tests/test_main.py -vcd frontend
# Run all tests
npm test
# Run with coverage
npm test -- --coverage
# Run in watch mode
npm run test:watchUser: "Client arrested under BNS 103"
System:
β RAG Search (finds relevant BNSS sections 479/482)
β Draft Document (generates bail application)
β Returns downloadable .docx file
User: "SC anticipatory bail rulings last 5 years"
System:
β RAG Search (queries SC judgements collection)
β Synthesizes answer with accurate citations
β Returns formatted response
User: Uploads rental agreement PDF
System:
β Analyze Document (extracts text and clauses)
β Identifies risks (termination clauses, indemnity)
β Returns comprehensive risk summary
Current Phase: Phase 1 - Project Foundation & Setup β
See COMPLETE_IMPLEMENTATION_PLAN.md for detailed roadmap.
- β No PII stored in vector database
- β Input validation and sanitization
- β Rate limiting on all endpoints
- β JWT authentication
- β Legal disclaimers for AI-generated content
- β Audit logging for document generation
This project follows strict development guidelines. Please read:
- RULES.md - Master rulebook for development
- AGENTS.md - Agent-specific guidance
- CONTRIBUTING.md (Coming soon)
- Plan first, build later
- Create feature branch (
feature/your-feature) - Write tests alongside code
- Ensure all tests pass
- Submit pull request
- Code review required
This project is licensed under the MIT License - see the LICENSE file for details.
IMPORTANT: LawAI is an AI-powered legal assistance tool and does NOT replace professional legal advice. All generated content should be reviewed by qualified legal professionals before use. The system is designed to assist, not replace, lawyers and legal experts.
- tosoham - todrsoham@gmail.com
- IBM watsonx.ai for Granite-13b-chat-v2 model
- LangChain and LangGraph for agent framework
- ChromaDB for vector database
- FastAPI and Next.js communities
Built with β€οΈ for the Indian Legal Community