Skip to content

Legal / contract intelligence

Contract intelligence pipeline

Pulls contract PDFs from Drive and bulk uploads, unpacks nested archives and attachments, then walks each document through a chain of explicit LLM stages — citation extraction, deal typing, vendor identification, overlap and amendment detection, redaction checks.

Pipeline

  1. extracting text
  2. citation
  3. deal type
  4. vendor
  5. deal data
  6. summary
  7. overlap check
  8. amendment check
  9. redaction
  10. human QA gate
  11. import

01The brief

What made this hard.

The problem

Analysts were reading thousands of sponsorship contracts by hand. Naive automation was not an option: a wrong extraction propagates into downstream reporting, and a job that dies late in the chain cannot afford to re-burn every prior stage of tokens.

The approach

Each document is a work unit with an explicit status enum and one background job per stage. A stage only enqueues the next on success, and every job is idempotent, so a failure resumes exactly where it broke. All model calls route through a provider gateway with bounded retries, a hard timeout and typed handling for read and connect timeouts. Before anything reaches reporting, the pipeline writes a QA record listing the model's disagreements and open issues and halts at a review gate — only that item blocks; the queue keeps draining.

02In production

What it actually does, day to day.

  • Resumable pipeline with one idempotent job per stage
  • Bounded retries + 180s timeout + provider failover on every model call
  • Human review gate blocks the item, never the queue
  • Live and unattended for over a year

Stack

Ruby on Rails 7.2HotwireSidekiqPortkeyOpenAIGoogle Drive APIMySQL

04Start here

Tell us what you are building. We will tell you what it takes.

Four short steps, then a real conversation with the engineer who would build it. No sales call, no discovery deck.

ContextScopeShapeYou
What sector are you in?
Where is the project today?

Rather just talk?

Grab 45 minutes. You will be on with an engineer, not a salesperson.

  • No NDA needed to have the first conversation
  • You keep the architecture note either way
  • We will tell you if we are the wrong fit