Where Artificial Intelligence Meets Justice
π Live Demo β’ π Documentation β’ π₯ Video Demo β’ π Architecture
LegalMind is a groundbreaking multi-agent AI system that transforms legal case documents into immersive, interactive courtroom simulations. Upload a case document, and watch as AI agentsβpowered by Google's Gemini 2.5 Flashβconduct a realistic courtroom debate complete with Judge, Prosecutor, Defense Attorney, and Witnesses. The system generates cinematic verdict videos using Veo 3 and comprehensive PDF case reports.
- π Intelligent Document Processing - Automatically extracts entities, charges, evidence, and timelines from legal documents
- π€ Multi-Agent AI Debate - Realistic courtroom proceedings with 5+ AI agents using Gemini 2.5 Flash
- βοΈ Legal Database Integration - Cites actual IPC sections and U.S. Federal Law from BigQuery
- π¬ Cinematic Video Generation - Creates 720p HD courtroom videos with Veo 3
- π Comprehensive Reports - Professional PDF case summaries with judicial theming
- π΄ Real-Time Streaming - Watch debates unfold live via WebSocket connections
- π Scalable Architecture - Microservices on Google Cloud Run with auto-scaling
The legal system remains opaque and inaccessible. Law students struggle to visualize courtroom dynamics, citizens find legal proceedings confusing, and understanding judicial reasoning requires years of study.
LegalMind democratizes legal education by providing an interactive platform that:
- Simulates realistic courtroom proceedings with AI agents
- Demonstrates legal reasoning with actual law citations
- Generates professional outputs (video + PDF reports)
- Makes judicial processes transparent and comprehensible
graph TB
subgraph "Frontend - Next.js 14"
FE[Web Application<br/>React + TypeScript]
end
subgraph "Backend Services - FastAPI"
AG[API Gateway<br/>:8000]
PS[Parser Service<br/>:8001]
RA[Role Assignment<br/>:8002]
AO[Agent Orchestrator<br/>:8003]
VG[Video Generator<br/>:8004]
RG[Report Generator<br/>:8005]
end
subgraph "AI Models"
GEMINI[Gemini 2.5 Flash<br/>Multi-Agent Debate]
VEO[Veo 3<br/>Video Generation]
end
subgraph "Infrastructure - GCP"
FS[(Firestore)]
BQ[(BigQuery<br/>Legal DB)]
CS[Cloud Storage]
PS_TOPIC[Pub/Sub]
end
FE -->|HTTP| AG
FE -->|WebSocket| AO
AG --> PS
PS --> PS_TOPIC
PS_TOPIC --> RA
RA --> AO
AO --> VG
AO --> RG
PS --> GEMINI
AO --> GEMINI
VG --> VEO
PS --> FS
RA --> FS
AO --> FS
RA --> BQ
VG --> CS
RG --> CS
style FE fill:#E8F5E9
style GEMINI fill:#4A90E2,color:#fff
style VEO fill:#9B59B6,color:#fff
style FS fill:#2ECC71,color:#fff
sequenceDiagram
participant User
participant Frontend
participant Parser
participant RoleAssign
participant Orchestrator
participant VideoGen
participant ReportGen
User->>Frontend: Upload Document
Frontend->>Parser: Process Document
Parser->>Parser: Extract Entities
Parser->>RoleAssign: Trigger Role Assignment
RoleAssign->>RoleAssign: Assign AI Agents
RoleAssign->>Orchestrator: Start Debate
loop Courtroom Debate
Orchestrator->>Frontend: Stream Messages
Frontend->>User: Display Real-time
end
Orchestrator->>Orchestrator: Announce Verdict
par Generate Outputs
Orchestrator->>VideoGen: Create Video
Orchestrator->>ReportGen: Create PDF
end
VideoGen->>Frontend: Video Ready
ReportGen->>Frontend: PDF Ready
Frontend->>User: Display Results
- Node.js 18+
- Python 3.11+
- Google Cloud Project
- Docker (optional)
# Clone the repository
git clone https://github.com/yourusername/legalmind.git
cd legalmind
# Setup Backend
cd backend
pip install -r requirements.txt
# Setup Frontend
cd ../frontend
npm install
# Configure Environment
cp .env.example .env
# Edit .env with your credentials
# Run Services
./start_services.sh# Google Cloud
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
# Firestore
FIRESTORE_DATABASE=legalmind-db
# BigQuery
BIGQUERY_DATASET=legal_database
# Cloud Storage
STORAGE_BUCKET=legalmind-storage
# Frontend
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_WS_URL=ws://localhost:8003- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- WebSocket - Real-time communication
- FastAPI - High-performance Python API framework
- Pydantic - Data validation
- Uvicorn - ASGI server
- Gemini 2.5 Flash - Multi-agent debate generation
- Veo 3 - Cinematic video generation
- Imagen 4 - Character image generation
- Google Cloud Run - Serverless containers
- Firestore - NoSQL real-time database
- BigQuery - Legal database (500+ IPC sections)
- Cloud Storage - Video and PDF storage
- Cloud Pub/Sub - Asynchronous messaging
- π Complete Documentation
- ποΈ Architecture Guide
- π Workflow Diagrams
- π¨ Frontend Docs
- βοΈ Backend Docs
- π Deployment Guide
- Upload Document - User uploads a legal case document (PDF/DOC/DOCX)
- Parse & Extract - AI extracts entities, charges, evidence (30s)
- Assign Roles - System assigns AI agents to courtroom roles (10s)
- Live Debate - Watch real-time courtroom proceedings (3-5 min)
- Generate Outputs - Create video and PDF report (2-3 min)
- View Results - Watch video and download comprehensive report
Total Time: 6-10 minutes per case
- Fixed Core Agents: Judge, Prosecutor, Defense, Accused, Investigator
- Dynamic Agent Pool: 2-3 flexible agents for case-specific roles
- Intelligent Role Assignment: Gemini 2.5 analyzes case and assigns roles
- 500+ IPC Sections stored in BigQuery
- U.S. Federal Law provisions
- Real-time Citation: Agents cite actual legal codes during debate
- Veo 3 Integration: State-of-the-art video generation
- 720p HD Quality: Professional courtroom scenes
- 8-Second Clips: Optimized for API quota and speed
- WebSocket Architecture: Sub-100ms latency
- Live Updates: Watch debates unfold naturally
- Stage Progression: Visual indicators of debate phases
| Metric | Value |
|---|---|
| Document Parsing | 30 seconds |
| Role Assignment | 10 seconds |
| Courtroom Debate | 3-5 minutes |
| Video Generation | 90 seconds |
| PDF Generation | 60 seconds |
| Total End-to-End | 6-10 minutes |
| WebSocket Latency | <100ms |
| Concurrent Sessions | 100+ (auto-scaling) |
- Visualize courtroom dynamics
- Learn legal argumentation
- Understand judicial reasoning
- Analyze case strategies
- Test evidence strength
- Prepare for trials
- Interactive teaching tool
- Demonstrate legal concepts
- Facilitate discussions
- Understand legal proceedings
- Learn about rights
- Demystify justice system
- β Encryption at Rest & Transit - AES-256 + TLS 1.3
- β PII Redaction - Automatic removal of sensitive data
- β IAM Authentication - Service account-based access
- β Audit Logging - Complete access trail
- β Session Isolation - No data leakage between cases
# Build all services
docker-compose build
# Start services
docker-compose up -d
# View logs
docker-compose logs -f# Deploy all services
./deploy_services.sh
# Or deploy individually
gcloud run deploy parser-service --source ./backend/parser-service
gcloud run deploy agent-orchestrator --source ./backend/agent-orchestrator
# ... etcWe welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Cloud Platform - Infrastructure and AI models
- Gemini 2.5 Flash - Multi-agent debate generation
- Veo 3 - Cinematic video generation
- FastAPI - High-performance backend framework
- Next.js - Modern React framework
- Email: [email protected]
- Documentation: docs.legalmind.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ by the LegalMind Team
βοΈ LegalMind - Democratizing Legal Education Through AI