Home / Work / Case study 001
AI Agents Document Processing Live in production

Teaching software to read 40 hours of legal documents a week.

A mid-size litigation firm was drowning in discovery documents. We built a pipeline of specialized AI agents that classifies, extracts, and cross-checks — and routes only the uncertain 12% to humans. Eight weeks from kickoff to production.

Client
Commercial litigation firm, 45 attorneys (name withheld under NDA)
Engagement
8 weeks, fixed scope + support retainer
Team
2 senior engineers, 1 designer
Shipped
Q1 2026 — in production since
96.4%
Field-level extraction accuracy
9s
Per document — was ~3 minutes
~$238K
Annual review cost absorbed
12%
Of documents ever touch a human
/01

The problem

Every commercial dispute the firm takes on arrives with a mountain of discovery: contracts, invoices, email exports, deposition transcripts, corporate filings. Before any attorney can build an argument, someone has to answer basic questions about each document — what is it, who are the parties, what dates and amounts matter, which case issues does it touch.

That someone was a team of four paralegals spending a combined ~40 hours per week on first-pass review. At roughly 3 minutes per document, a single 5,000-document production took most of a month to triage. Two things made it worse:

  • Deadlines don't negotiate. Discovery responses are court-scheduled. When productions arrived late (they always do), the firm paid overtime or outsourced review at $45–60/hour.
  • Fatigue errors compound. A misclassified document doesn't just waste time — a missed date or party name can surface mid-deposition. The firm had two near-misses in the year before they called us.

The brief came down to one sentence: get the firm's best people off work a careful intern could do — without accepting an intern's error rate.

Constraint that shaped everything

Client-matter confidentiality meant no document could leave infrastructure the firm controlled. That ruled out consumer AI tools and shaped the architecture: a private VPC deployment with zero-retention API agreements for model calls.

/02

The approach

The instinct with projects like this is to build one giant “do everything” prompt. We didn't, for a simple reason: you can't measure — or fix — a monolith. Instead we decomposed first-pass review into four narrow jobs and gave each to a specialized agent:

  1. Classifier — assigns each document one of 14 types the firm's workflow already used (contract, invoice, correspondence, filing…). Narrow job, near-perfect accuracy.
  2. Extractor — pulls typed fields per document class: parties, effective dates, amounts, governing law, signature blocks. Every field carries a confidence score.
  3. Cross-checker — validates extractions against each other and against the case record. If an invoice references a contract number, does that contract exist in the production? Dates in impossible orders get flagged.
  4. Summarizer — writes the two-sentence summary and issue tags that populate the review interface, so attorneys scan instead of open.

The exception queue is the real product

The single most important design decision wasn't a model choice. It was accepting that the system would be wrong sometimes and building for it. Any document where classification confidence, a required field, or a cross-check fell below threshold went to a human review queue — a purpose-built UI where a paralegal confirms or corrects in seconds, with the suspect field highlighted in the source document.

Two effects. First, the paralegals stopped being replaced and started being editors — which is why adoption took days, not months. Second, every correction became labeled training data: the thresholds and few-shot examples were tuned from real corrections during the pilot, which is how accuracy climbed from 89% at week four to 96.4% at handoff.

Stack notes

Pipeline in TypeScript on a private VPC; queue-based orchestration so a 5,000-document production just means a longer queue, not a different system. PostgreSQL with pgvector for the case record and similarity lookups. Model calls through a gateway with zero-retention agreements; classification runs on a small fast model, extraction and cross-checking on a frontier model — that split alone cut inference cost ~70% versus running everything on the large model.

/03

The rollout

We shipped in phases, each one earning the next. The firm saw working software at the end of every week — our standard practice, but it mattered more than usual here because trust was the whole game.

Weeks 1–2

Shadow mode on a closed case

The pipeline processed 3,100 documents from a settled matter where the “right answers” were known. This gave us a ground-truth benchmark before a single live document was touched — and gave the partners a number they could interrogate.

Weeks 3–4

Pilot: one live matter, everything double-checked

Paralegals reviewed 100% of output while the exception thresholds were tuned from their corrections. Accuracy rose from 89% to 94% in these two weeks; more importantly, the team started trusting the confidence scores because they could see them being wrong in predictable ways.

Weeks 5–6

Exception-only review

Human review dropped to flagged documents only. Weekly audits of a random 5% sample confirmed straight-through accuracy held. This is the operating mode the firm runs today.

Weeks 7–8

Hardening + handoff

Monitoring dashboards, audit logging (every extraction traceable to source page and model version — their malpractice insurer asked), runbooks, and training. We remain on a light support retainer; the audit sample runs automatically.

/04

The results

Measured over the first 90 days in production, against the firm's own baseline from the prior year:

MeasureBeforeAfterDelta
First-pass review time per document~3 min (manual)9 s (automated)−95%
Paralegal hours on first-pass review~40 h / week~5 h / week (exceptions + audit)−87%
Field-level extraction accuracy~97% (human, fresh) — degrading with fatigue96.4%, constantat parity
5,000-document production turnaround~4 weeks~3 days incl. exception review−89%
Annual review cost (staff time + overflow outsourcing)~$276K~$38K (review + inference + hosting)−$238K

The number the firm cares about most isn't in the table: the four paralegals now spend their week on privilege review and deposition preparation — higher-value work the firm previously turned away for capacity reasons.

What we'd tell you if you're considering something similar

The model is maybe 30% of this project. The other 70% is the exception queue, the confidence routing, the audit trail, and the rollout sequence that let a skeptical team verify the system instead of being asked to believe in it. Budget accordingly.

Built with
TypeScriptNode.jsClaudePostgreSQLpgvectorRedisReactAWS (private VPC)Docker
Your turn

Drowning in documents, tickets, or copy-paste?

Tell us where the hours go. We'll tell you honestly whether an agent can absorb them — and what it would take.