π National 2nd Prize Winner β Deloitte Hacksplosion 2026 Selected from 22,000+ applicants
Legal.ai is a multi-agent AI platform for transforming complex legal judgments into structured, traceable, and verifiable case-law intelligence.
The system processes legal PDFs, extracts important case information, analyzes statutory references, retrieves relevant legal knowledge, validates generated results, and produces structured outputs with supporting evidence and confidence signals.
The project is built around a Supervisor-Worker architecture using LangGraph, with dedicated components for document processing, extraction, retrieval, statute verification, validation, and observability.
Core idea: Use AI to accelerate legal document analysis without treating an LLM's output as automatically correct.
National 2nd Prize β Deloitte Hacksplosion 2026
Legal.ai was recognized with the 2nd prize nationally at Deloitte Hacksplosion 2026, competing among 22,000+ applicants.
- π€ Multi-Agent Legal Analysis β Coordinates specialized AI components through a LangGraph workflow.
- π Legal PDF Intelligence β Parses and processes lengthy court judgments and legal documents.
- π§ LLM-Powered Information Extraction β Extracts structured case information from unstructured legal text.
- π Semantic Retrieval β Uses embeddings and Qdrant for vector-based retrieval.
- βοΈ Statute Knowledge Base β Supports ingestion, lookup, mapping, and verification of statutory information.
- π‘οΈ PDF Safety Checks β Screens documents before downstream AI processing.
- β Evidence-Based Validation β Separates extraction from validation to reduce unsupported claims.
- π Confidence Scoring β Combines validation signals to assess the reliability of extracted information.
- π Retry & Validation Workflow β Allows questionable outputs to be re-evaluated within the pipeline.
- ποΈ Structured Outputs β Converts complex judgments into machine-readable legal information.
- π LLM Observability β Integrates Langfuse for tracing and monitoring AI workflows.
- π³ Dockerized Execution β Provides a reproducible environment for document processing and ingestion.
Legal.ai follows a Supervisor-Worker orchestration pattern where a central workflow coordinates specialized processing stages.
graph TD
A[Legal Judgment PDF] --> B[Document Safety Check]
B --> C[Document Parsing & Chunking]
C --> D[Supervisor / LangGraph Workflow]
D --> E[Case Metadata Extraction]
D --> F[Legal Facts & Issues]
D --> G[Arguments & Evidence]
D --> H[Statute Analysis]
E --> I[(Qdrant Vector DB)]
F --> I
G --> I
H --> I
E --> J[(PostgreSQL / Supabase)]
F --> J
G --> J
H --> J
H --> K[Statute Knowledge Base]
K --> H
I --> L[Retrieval & Verification]
J --> L
L --> M[Validation]
M --> N[Confidence Scoring]
N --> O[Structured Legal Report]
Legal PDF
β
βΌ
Safety & Parsing
β
βΌ
Document Chunking
β
βΌ
Supervisor / LangGraph
β
ββββΊ Case Metadata
ββββΊ Facts & Issues
ββββΊ Arguments & Evidence
ββββΊ Statute Analysis
β
βΌ
Retrieval / Knowledge Base
β
βΌ
Validation
β
βΌ
Confidence Scoring
β
βΌ
Structured Legal Output
Instead of sending an entire judgment to one monolithic prompt, Legal.ai divides the workflow into specialized stages.
βββββββββββββββββββ
β Supervisor β
ββββββββββ¬βββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββ
βΌ βΌ βΌ
Metadata Agent Evidence Agent Statute Agent
β β β
ββββββββββββββββββββΌβββββββββββββββββββ
βΌ
Validation
β
βΌ
Final Structured
Output
This makes the pipeline easier to extend, test, observe, and validate.
Legal.ai combines LLM reasoning with vector retrieval rather than relying solely on model memory.
Legal Text
β
βΌ
Embeddings
β
βΌ
Qdrant
β
βΌ
Relevant Context
β
βΌ
LLM / Agent
β
βΌ
Validated Result
This architecture helps ground generated information in retrieved document or knowledge-base context.
The dedicated statute_kb/ layer supports legal statute handling through:
- Act registration
- Statute ingestion
- Legal text parsing
- Statute lookup
- Legal mappings
- Citation verification
The goal is to distinguish between what an LLM claims a statute says and what can be verified against the project's legal knowledge source.
Legal.ai is designed so that extracted information can be associated with supporting source context.
A simplified reliability flow is:
Extraction
β
βΌ
Source Evidence
β
βΌ
Validation
β
βΌ
Consistency Checks
β
βΌ
Confidence Score
This provides a more useful signal than simply returning an LLM response.
Legal documents are treated as untrusted input.
Before AI processing, the pipeline includes document safety checks intended to reduce risks from malicious or adversarial document content.
PDF
β
βΌ
Safety Check
β
βββ Unsafe β Reject
β
βββ Safe
β
βΌ
AI Pipeline
| Technology | Role |
|---|---|
| Python 3.12+ | Core application |
| LangGraph | Agent/workflow orchestration |
| LangChain | LLM application framework |
| OpenAI | LLM-powered processing |
| Docling | PDF/document parsing |
| Qdrant | Vector database and semantic retrieval |
| PostgreSQL / Supabase | Persistent application data |
| SQLAlchemy | Database access |
| Sentence Transformers | Embeddings |
| FlagEmbedding | Embedding and retrieval models |
| Pydantic | Structured data validation |
| Langfuse | LLM observability and tracing |
| Docker | Reproducible execution environment |
Legal.ai/
β
βββ data/ # Data and supporting resources
βββ db/ # Database schema and utilities
β
βββ docs/
β βββ architecture/ # Architecture documentation
β
βββ observability/ # LLM tracing and observability
β
βββ pipeline/
β βββ agents/ # Specialized processing agents
β βββ chunking.py # Document chunking
β βββ embeddings.py # Embedding generation
β βββ graph.py # LangGraph workflow
β βββ validation.py # Output validation
β βββ confidence.py # Confidence scoring
β βββ pdf_safety.py # PDF safety checks
β βββ statute_verification.py
β βββ run.py # Pipeline entry point
β
βββ schemas/ # Pydantic schemas
βββ scripts/ # Utility/setup scripts
β
βββ statute_kb/
β βββ acts.py # Legal acts registry
β βββ ingest.py # Knowledge-base ingestion
β βββ lookup.py # Statute retrieval
β βββ mappings.py # Legal mappings
β βββ parser.py # Statute parsing
β
βββ Dockerfile
βββ docker-compose.yml
βββ pyproject.toml
βββ README.md
A court judgment PDF is supplied to the pipeline.
The document is checked before it enters the AI workflow.
Docling extracts usable text and document structure.
Long documents are divided into retrieval-friendly sections.
Specialized workflow stages identify information such as:
- Case metadata
- Facts
- Legal issues
- Arguments
- Evidence
- Statutory references
Relevant information is retrieved from the vector store and statute knowledge base.
The extracted information is checked against available source context and validation rules.
The pipeline produces confidence signals for the resulting information.
The final result is returned in a structured, machine-readable format.
A processed judgment can be represented in a structure similar to:
{
"case_metadata": {
"case_name": "...",
"court": "...",
"date": "...",
"case_number": "..."
},
"facts": [
"...",
"..."
],
"issues": [
"..."
],
"arguments": {
"petitioner": [],
"respondent": []
},
"statutes": [
{
"act": "...",
"section": "...",
"verified": true
}
],
"evidence": [
{
"claim": "...",
"source": "..."
}
],
"confidence": 0.0
}The exact schema and fields depend on the document and pipeline configuration.
- Python 3.12+
- Docker
- Docker Compose
- PostgreSQL / Supabase
- Required LLM/API credentials
git clone https://github.com/vineeethh/Legal.ai.git
cd Legal.aiCreate your environment file:
cp .env.example .envAdd the required API and database credentials to .env.
Never commit API keys or other secrets to GitHub.
docker compose up -d qdrantQdrant is exposed on:
http://localhost:6333
docker compose builddocker compose run --rm app python -m db.apply_schemaProcess a legal judgment with:
docker compose run --rm app python -m pipeline.run path/to/judgment.pdfThe supported Docker workflow keeps document-processing dependencies and model caches inside the containerized environment.
Legal.ai integrates Langfuse to provide visibility into LLM workflows.
Observability can help with:
- Prompt/response tracing
- Workflow debugging
- Agent execution analysis
- Latency monitoring
- Token/cost analysis
- Identifying failure points
This is particularly important when developing multi-stage LLM systems where failures can occur at different points in the pipeline.
Legal.ai can serve as a foundation for:
- βοΈ Legal research assistants
- π Case-law analysis
- π Legal information retrieval
- π Judgment summarization
- π§ββοΈ Legal practitioner research tools
- ποΈ Legal document structuring
- ποΈ Compliance and regulatory analysis
- π€ RAG-based legal applications
- π Legal analytics platforms
This project combines:
Generative AI Γ Agentic AI Γ RAG Γ NLP Γ Document Intelligence Γ Legal Technology
Key areas explored:
- Large Language Models
- Multi-Agent Systems
- LangGraph
- Retrieval-Augmented Generation
- Semantic Search
- Vector Databases
- Information Extraction
- Document Intelligence
- Knowledge Bases
- LLM Evaluation
- AI Safety
- Observability
- Explainable AI
- Web-based legal analysis interface
- Interactive source-to-claim navigation
- Expanded Indian statute knowledge base
- Case-law citation graph
- Human-in-the-loop review interface
- Automated evaluation benchmarks
- Regression test suite for legal documents
- Production-ready API layer
- Multilingual Indian legal document support
- Advanced legal precedent retrieval
Legal.ai is an AI research and engineering project and is not a substitute for professional legal advice.
AI-generated or extracted information should always be verified against the original judgment and authoritative legal sources before being used for legal, compliance, or judicial decisions.
Contributions, suggestions, and bug reports are welcome.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature- Commit your changes:
git commit -m "Add your feature"- Push the branch:
git push origin feature/your-feature- Open a Pull Request.
If you find Legal.ai useful or interesting, consider giving the repository a β.
Vineeth Vuppala
AI/ML β’ Generative AI β’ RAG β’ NLP β’ Legal AI