Today we are sharing the technical architecture behind Themis: a multi-agent orchestration system designed from the ground up for high-stakes legal work. This is not a wrapper around a single language model. It is a coordinated system of specialist agents, each purpose-built for a distinct aspect of litigation, working together under a central orchestrator that manages workflow execution, dependency resolution, and quality validation.
We built this system because we believe the future of legal AI lies not in making individual models smarter, but in composing multiple agents into workflows that mirror how the best litigation teams actually operate.
The Orchestrator Concept
At the center of Themis is the orchestrator -- a planning and coordination layer that decomposes a legal task into a directed acyclic graph (DAG) of subtasks, assigns each subtask to the appropriate specialist agent, manages the flow of information between agents, and validates the quality of the combined output.
The orchestrator is not itself performing legal reasoning. Its role is to plan, route, and verify. It understands the dependencies between different phases of legal work and constructs an execution plan that respects those dependencies while maximizing parallelism where possible.
When a new matter arrives, the orchestrator evaluates the context -- the type of case, the documents provided, the issues apparent from the factual record -- and builds a task graph that routes work through five phases. Each phase has defined entry conditions, exit signals, and quality gates that must be satisfied before downstream tasks can begin.
The Five-Phase Workflow
Themis processes legal work through a structured five-phase pipeline, each phase mapped to one or more specialist agents:
Phase 1: Intake and Fact Extraction
The Legal Data Analyst (LDA) processes raw case documents -- incident reports, medical records, contracts, correspondence -- and produces a structured factual record. This includes chronological timelines, party identification, damages quantification, and identification of gaps in the evidentiary record. The LDA uses code execution for computational tasks like damages calculations and statistical analysis, producing verified numbers rather than LLM-approximated figures.
Phase 2: Issue Framing
The Doctrinal Expert Agent (DEA) takes the structured factual record and systematically identifies all potential legal issues. This is not a simple keyword-matching exercise. The DEA employs extended thinking to reason through the factual record, identifying primary claims, secondary theories, and potential counterclaims. Each identified issue is tagged with its area of law (tort, contract, constitutional, statutory) and its relationship to the factual record.
Phase 3: Research and Retrieval
For each identified issue, the DEA locates controlling authority -- binding precedent from the relevant jurisdiction -- and persuasive authority where controlling precedent is absent or ambiguous. Critically, the DEA also identifies contrary holdings: cases that cut against the client's position. This adversarial research methodology prevents the confirmation bias that plagues single-model AI systems, which tend to find support for whatever position they are asked to advocate.
Phase 4: Application and Analysis
The DEA and LDA collaborate to apply the identified legal rules to the structured facts, following the IRAC method (Issue, Rule, Application, Conclusion) that is the standard framework for legal analysis. Each conclusion is linked to both its supporting authorities and the factual predicates that trigger the applicable rule. This creates a fully traceable chain from raw document to legal conclusion.
Phase 5: Draft and Review
The Legal Strategy Agent (LSA) assesses the strategic implications of the analysis -- identifying strengths, weaknesses, settlement leverage, and litigation risk. The Document Drafting Agent (DDA) produces formal legal documents in modern legal prose, formatted according to Bluebook citation standards and jurisdictional requirements. The LSA then reviews the drafts for strategic coherence, ensuring that the documents serve the client's objectives as identified during strategic planning.
How Agents Coordinate via DAG
The task graph is a DAG where each node represents a unit of work assigned to a specific agent, and edges represent data dependencies. When the orchestrator constructs a plan, it performs topological sorting to determine execution order and identifies opportunities for parallel execution. Tasks without mutual dependencies can execute concurrently, significantly reducing total processing time for complex matters.
Each task node carries entry and exit signals. Entry signals define what inputs the task requires -- the factual record, identified issues, located authorities -- and are validated before the task begins. Exit signals define what outputs the task produces and are validated after completion. If a task's exit signals do not satisfy the entry signals of its downstream dependents, the orchestrator flags the gap and re-plans the affected portion of the graph.
Signals and Dependency Resolution
The signal system is what makes the orchestrator more than a simple pipeline. Signals carry structured data between phases: the LDA's fact extraction signal includes timeline events, quantified damages, and identified evidentiary gaps. The DEA's issue framing signal includes a structured list of legal issues with their area-of-law classifications. These signals are typed and validated at each boundary, ensuring that downstream agents receive well-structured inputs.
When a signal is incomplete -- when the LDA identifies gaps in the factual record, or when the DEA flags an issue that requires additional factual investigation -- the orchestrator can insert new tasks into the graph. This creates a feedback loop where later phases can trigger earlier phases to fill gaps, producing a more thorough and internally consistent work product.
Reflection and Quality Validation
After the execution graph completes, the orchestrator performs a reflection pass. This is not a simple check for completeness. The reflection phase validates:
- Signal propagation -- Every signal produced by an upstream task was consumed by the expected downstream tasks.
- Cross-agent consistency -- The factual assertions in the LDA's output are consistent with the facts cited in the DEA's legal analysis.
- Issue coverage -- Every identified legal issue has been researched, analyzed, and addressed in the final work product.
- Citation verification -- Every authority cited in the final documents was produced by the research phase, not hallucinated during drafting.
- Prose quality -- Legal writing uses modern, crisp prose rather than archaic legalese.
If any quality check fails, the orchestrator re-plans the relevant portion of the graph and re-executes. This iterative refinement mirrors the review cycles that characterize high-quality legal work in traditional practice.
Performance at Scale
The system is built for production workloads. Themis implements a hybrid state management strategy with in-memory TTL-based caching that achieves 500x faster reads compared to direct database access and 10x higher request throughput. Execution plans and artifacts are persisted to SQLite with write-through caching, ensuring durability without sacrificing speed.
Prompt caching reduces costs by up to 90% for repeated agent executions within a one-hour window -- a significant advantage for batch processing scenarios where a firm needs to process dozens of similar cases. Extended thinking mode, enabled selectively for the DEA and LSA agents, provides deeper reasoning on complex multi-issue analyses while keeping costs controlled for simpler tasks.
The entire system is observable through Prometheus metrics (agent latency, tool invocations, error rates) and structured JSON logging with automatic sensitive-data redaction. For production deployments, a Docker Compose stack includes the Themis API, PostgreSQL, Prometheus, and Grafana dashboards out of the box.
The future of legal AI is not a smarter model. It is a smarter system.
We believe the orchestrated multi-agent approach represents a fundamental shift in how AI can serve the legal profession. By decomposing legal work into its constituent disciplines, coordinating specialist agents through a rigorous task graph, and validating quality through structured reflection, Themis produces work product that meets the standards that high-stakes litigation demands.