Inspiration:

Legal contracts silently destroy small businesses every day. Watching startup peers sign vendor agreements without understanding unlimited liability clauses, IP traps, and one-sided termination terms inspired us to build an autonomous AI system that gives every MSME founder the same legal protection that Fortune 500 companies take for granted.

What it does:

LexaGuard AI ingests any contract in PDF, DOCX, or TXT format and runs it through ten specialised AI agents. It segments every clause, scores risk as HIGH, MEDIUM, or LOW, compares against 50+ standard templates via RAG, generates plain-English summaries, safer rewrites, and exports full reports in under three minutes.

How we built it:

Built on Python with a LangGraph state machine orchestrating ten agents. Used Gemini LLM for reasoning, ChromaDB with hybrid BM25 + semantic retrieval for RAG, PyMuPDF and pdfplumber for parsing, ReportLab for PDF export, and Streamlit Cloud for zero-infrastructure deployment with a single API key.

Challenges we ran into:

The hardest challenge was making Agent 4 (Key Info Extractor) reliably extract parties, dates, and contract values across wildly different contract formats. Gemini occasionally returned "Unknown" wrapped in valid JSON. We solved this by building a parallel regex-based keyword extraction fallback that runs independently and merges results with the LLM output.

Accomplishments that we're proud of:

We built and deployed a fully functional ten-agent autonomous pipeline with a seven-page Streamlit dashboard, PDF/DOCX/JSON export, and a contract-aware chat assistant — all working end-to-end on real contracts across PDF, DOCX, and TXT formats. The system correctly identifies HIGH-risk clauses like unlimited liability and one-sided IP ownership with legal reasoning and redlines attached.

What we learned:

Multi-agent systems require extremely disciplined shared state design. Every agent must be stateless and idempotent — early bugs came from agents mutating shared state unpredictably. We also learned that hybrid retrieval (BM25 + dense embeddings) dramatically outperforms pure semantic search for legal clause matching, where exact legal terminology matters as much as semantic meaning.

What's next for LEXAGUARD AI:

Multilingual contract analysis in Hindi, Tamil, and Telugu for regional Indian MSMEs. Jurisdiction-specific rule sets for Indian, US, and EU law.

Built With

Share this project:

Updates