NyayaAI: An AI-Powered Legal Assistant Using Multi-Agent Architecture and Retrieval-Augmented Generation

2026-05-11Computation and Language

Computation and Language
AI summary

The authors created NyayaAI, a smart helper that makes legal information in India easier to understand and use. It uses advanced language models combined with a special method to find relevant legal documents from a large collection of laws and court cases. The system includes different agents working together to research, summarize, find case law, and help draft legal documents, all checked for accuracy before users see them. Their tests show the system is fairly accurate and could help lawyers, students, and regular people access legal info more easily. The authors also shared their code publicly for others to use and improve.

Large Language ModelsRetrieval-Augmented GenerationIndian legal systemCase lawLegal document summarizationMulti-agent systemsMastra TypeScript frameworkLegal workflow automationDomain classificationCompliance module
Authors
Deepanshu, Divi Saxena, Deepali Rana, Ayesha Varshney, Sahinur Rahman Laskar
Abstract
Legal information in India remains largely inaccessible due to the complexity of legal language and the sheer volume of legal documentation involved in research and case analysis. This paper presents NyayaAI, an AI-powered legal assistant that automates and simplifies legal workflows for lawyers, law students, and general users. The system combines Large Language Models with a Retrieval-Augmented Generation pipeline grounded in a curated Indian legal knowledge base comprising constitutional provisions, statutes, case laws, and judicial precedents. A multi-agent architecture orchestrated through the Mastra TypeScript framework coordinates a main agent with specialized sub-agents handling legal research, document summarization, case law retrieval, and drafting assistance. A compliance module validates all responses before delivery. Domain classification achieved 70\% precision across test samples, with RAG retrieval precision at 74\% and overall response accuracy at 72\%, demonstrating that structured multi-agent LLM systems can meaningfully improve legal accessibility and workflow efficiency. The code\footnote{https://github.com/B97784/NyayaAI} is made publicly available for the benefit of the research community.