Inspiration

1.3 billion Indians. Less than 1 lawyer per 1,000 people outside major cities. Legal fees that routinely cost more than the dispute itself. A system so complex that navigating it requires the very expertise most people cannot afford. When a landlord refuses to return a deposit, when an employer withholds wages for months, when a government office ignores an RTI application — most Indians have no idea what their rights are, let alone how to enforce them. The legal system was designed for people who already understand it. We wanted to build something that levels that playing field completely. Not a chatbot that answers legal questions — a case worker that actually fights alongside you.

What It Does

Describe your legal problem in plain language. CasePilot's 7 AI agents immediately go to work. The Intake Agent classifies your dispute and identifies the applicable jurisdiction. The Law Research Agent searches 3,310 sections across 11 Indian acts via MongoDB Atlas Vector Search — finding the exact statutes that apply to your situation. The Evidence Agent analyses any documents you upload, extracts key facts, and produces a Justice Score showing your case strength, evidence completeness, and exactly what's missing before filing. The Strategy Agent maps your optimal legal path — notice, consumer forum, civil court, or police complaint. The Drafting Agent generates court-ready documents pre-filled with your case facts. The Citation Agent attaches verified statute references grounded in Atlas cosine similarity scores — no hallucination, ever. And the Memory Agent saves your complete case to MongoDB Atlas so you can resume anytime with your Case ID. The result: a formal legal notice, consumer complaint, or RTI appeal — generated in minutes, for free, by someone who had no legal knowledge when they started.

How We Built It

The entire pipeline runs on Google ADK as the agent runtime. Seven specialized agents are orchestrated in sequence — each with a specific role, specific tools, and specific output schema. MongoDB Atlas is the operational backbone. Three data layers run simultaneously: an operational layer storing cases, documents, and timelines; a vector search layer on the law corpus (3,310 chunks, 3,072 dimensions via gemini-embedding-2); and a per-user evidence vector layer where uploaded documents are embedded and stored for semantic analysis. The Law Research Agent and Memory Agent connect to MongoDB Atlas via the official MongoDB MCP Server — giving agents native database access through the Model Context Protocol rather than raw queries. Every law retrieval and case persistence operation goes through MCP. The Justice Score is calculated deterministically — case_strength derived from violation severity found by law retrieval, evidence_completeness from the ratio of required evidence present. No LLM estimation. Citation confidence scores are raw Atlas cosine similarity values — if Atlas returns it, we surface it; if it doesn't, we don't claim it. The frontend is a single HTML file with a dark luxury theme, served directly from Cloud Run alongside the Python API.

Challenges We Ran Into

Getting the Citation Agent to produce grounded references without hallucination required significant iteration. The temptation for the LLM is always to fill gaps with plausible-sounding section numbers. The solution was strict output schemas and tying confidence directly to Atlas similarity scores — if the vector search doesn't find it, the citation doesn't appear. The document generation pipeline was more complex than expected. Different dispute types require completely different document structures — an RTI First Appeal looks nothing like a Consumer Complaint. Building document templates that are specific enough to be legally useful but flexible enough to accept any case's facts took multiple iterations. The MongoDB MCP Server integration inside a Cloud Run container required Node.js to be installed alongside Python in the Docker image — something that wasn't immediately obvious and added complexity to the deployment pipeline.

Accomplishments That We're Proud Of

The end-to-end pipeline works on real Indian legal scenarios with real law sections. A landlord deposit case returns the Transfer of Property Act Section 108(q) and Consumer Protection Act Section 2(47) — the actual applicable sections, not generic legal advice. The Justice Score is genuinely useful. When a user uploads a rental agreement, the evidence_completeness jumps because the agent actually reads the document and finds the deposit amount and lease date. When they don't upload anything, it flags exactly what's missing. The Resume Case feature closes the loop — MongoDB Atlas becomes a persistent legal case file, not just a database. Users can return days later and pick up exactly where they left off.

What We Learned

Legal information and legal advice are fundamentally different — and that line matters enormously. CasePilot provides the former: what the law says, what your evidence shows, what your options are. The temptation to cross into advice ("you will win this case") had to be resisted at every step. The disclaimer isn't just legal cover — it's a design principle. We also learned that deterministic scoring beats LLM estimation for trust. When a judge or a user sees "case_strength: 82" they need to know where that number came from. Tying it to measurable inputs — number of violations found, evidence items present — makes it defensible.

What's Next for CasePilot

WhatsApp Bot — describe your case via voice message in Hindi or English, no app needed. Regional language support — Hindi, Tamil, Telugu, and Bengali so legal help reaches every corner of India. eCourts Integration — direct e-filing with India's eCourts portal so generated documents go straight to the right court. Aadhaar Verification — verified user profiles for stronger legal standing in filings. Lawyer Marketplace — for cases that need a human advocate, CasePilot connects users to verified lawyers with full case context already assembled. Offline Mode — a compressed law corpus for rural areas with poor connectivity, so the 500 million Indians outside reliable internet coverage aren't left out. MSME Platform — multi-tenant legal support for small businesses managing disputes across employment, contracts, and consumer law simultaneously.

Built With

  • gemini
  • gemini-embedding-2
  • google-adk
  • google-cloud-run
  • mongodb-atlas
  • mongodb-mcp-server
  • python
  • vector-search
Share this project:

Updates