Inspiration
What it does
How I built it💡 Inspiration
The legal system is fundamentally overwhelmed. Lawyers, public defenders, and judges spend countless hours reading thousands of pages of case files, leading to burnout and delayed justice. We asked ourselves: What if we could create an AI that doesn't just "chat" about the law, but actually reasons, debates, and researches like a real legal team?
However, in the legal field, AI hallucinations are unacceptable. A lawyer cannot submit a document with a fake law. This inspired us to build LexIA: a system where multiple agents debate each other and pass through strict deterministic guardrails to ensure absolute precision.
⚙️ How we built it LexIA is a Distributed Multi-Agent Swarm built on top of Google Gemini 3.5 Flash using the google-generativeai SDK. The system orchestrates four specialized autonomous agents using advanced Function Calling:
Investigator Agent: Uses internal tools to query the legal database. Analyst Agent: Synthesizes the facts and drafts an initial defense or legal strategy. Red Team Agent: Acts as an aggressive opposing counsel to attack the Analyst's logic. Verifier Agent: An anti-hallucination firewall that rejects any cited law that doesn't exist in our factual database. To feed the agents, we designed a Dual System Architecture with a Hybrid RAG pipeline. It combines traditional SQL Full-Text Search (FTS5) with Semantic Vector Search, passing the results through a Cross-Encoder Re-ranker. Finally, the entire application is hosted on a Streamlit Tactical Dashboard and deployed seamlessly on Google Cloud.
🚧 Challenges we ran into Our biggest challenge was taming the generative nature of Large Language Models. Initially, the AI would invent convincing but entirely fake legal precedents. To solve this, we had to rethink the architecture. Instead of relying on a single prompt, we engineered the Red Team and Verifier agents. Making these agents disagree constructively and enforcing strict SQL-based verification tools before final output generation required complex state management and prompt engineering. We also faced the challenge of ensuring complete data privacy, leading us to our local-first hybrid architecture approach.
🎓 What we learned Agentic frameworks are the future: Breaking down a complex prompt into multiple specialized agents (Analyst vs. Red Team) yields exponentially better and more logical results than zero-shot generation. Verification over Generation: We learned that deterministic guardrails (like our SQL FTS5 lookup tool) are mandatory when building GenAI for high-stakes industries like Law. Gemini's speed is unmatched: Utilizing Gemini 3.5 Flash allowed our 4 agents to debate and output a final verified Microsoft Word document in seconds, making real-time legal assistance a reality. 🚀 What's next for LexIA We plan to expand our Hybrid RAG database to include full historical jurisprudence across multiple countries. We also aim to implement Vertex AI to scale our semantic search capabilities and introduce a voice-based agent so lawyers can dictate case facts directly from the courtroom.
Log in or sign up for Devpost to join the conversation.