Inspiration
A real courtroom can feel impossible to simulate. The law is messy: justices interrupt, push back on each other, and force counsel to think on their feet. We wanted a tool that reproduced that pressure, teaching students and practitioners how to make arguments that survive real scrutiny, not a chatbot that hands answers to the user. To fill that goal, we created Courtly: a legal training ground that rewards tight reasoning, command of precedent, and clarity under stress.
What it does
Courtly runs a multi-agent simulation of a Supreme Court hearing: you pick a side, draft a brief, and argue before a nine-justice AI panel. The system retrieves and ranks authoritative legal sources, runs adversarial agents (opposing counsel, law clerk, and nine judge personas), streams judge questions, and produces a reasoned ruling with majority opinion, concurrences, and dissents. Everything is evidence-grounded — case data comes from CourtListener and is stored in MongoDB.
How we built it
Backend: Python FastAPI orchestrator with stateless agent functions for retrieval, brief-writing, stress tests, opposing counsel, and nine parameterized judge agents.
Data: CourtListener as the authoritative data source; we upsert cases into a cases collection in MongoDB and never hardcode case facts or citations.
Frontend: Next.js (app router) + Tailwind CSS. The hearing UI is a spatial courtroom (bench + lectern). Judge output streams over SSE for a live “spoken” effect; bench asides and the press mechanic are orchestrated server-side so the frontend just renders structured events.
Auth & infra: Auth0 for identity, local env configuration for dev, and a small seed process to bootstrap popular cases.
Challenges we ran into
UX vs. chatbot mentality: converting a chat-bubble interaction into a courtroom spatial metaphor (bench/lectern) required rethinking UI affordances and user flow.
Streaming and timing: implementing readable, low-latency judge text via SSE, synchronizing the input box animation, and preserving accessibility (reduced-motion, pause-on-hover).
Data fidelity: forcing case data to come from CourtListener and reconciling incomplete or variant metadata while keeping the system resilient.
Agent orchestration: parallelizing independent agents (retriever, clerk, judges) while preserving a deterministic, auditable pipeline of evidence and claims..
Accomplishments that we're proud of
A full nine-judge panel implemented as reusable agent instances, each with a distinct judicial philosophy that affects questions, scoring, and votes.
An adversarial orchestration pipeline (hearing → opposing counsel → rebuttal → conference → sequential ruling) that produces a written majority opinion, concurrences, and dissents.
A courtroom-first frontend UX (bench + lectern) with streaming questions, bench asides, and a clerk panel that surfaces actionable intelligence rather than ghost-writing answers.
Strict data policy: no hardcoded case content; everything is fetched from CourtListener and upserted into MongoDB for reproducibility and grounding.
What we learned
Always keep reasoning stateless and auditable.
Parallelize independent agent workstreams once the API contract is defined to avoid unnecessary sequencing and latency.
Small UX decisions (streaming text, input visibility, interruptions) massively affect perceived realism; UX details are not optional.
Make dev-safe defaults for third-party integrations (Auth0 env placeholders) to avoid confusing dev-only runtime behavior.
What's next for Courtly
Ruling Ceremony: implement sequential vote reveal, swing-justice spotlight, and typed-out opinions for dramatic readability.
Persistence and growth: wire up Auth0-backed judicial records (win/loss, doctrine strength) so users build a persistent reputation and training history.
Head-to-head and spectator modes: two-attorney matches judged by the same panel and a spectator “bench mode” for learners.
Explainability: visual argument graphs linking cited precedents to outcome, and a model brief comparison after each hearing.
Built With
- claude
- courtlistener
- gemini
- github
- law
- mongodb
Log in or sign up for Devpost to join the conversation.