Design an Orchestrator for Long-Running Multi-Step Legal Workflows

Last updated: November 29, 2026

Quick Overview

Design the backend that runs multi-step AI workflows (for example, review 5,000 contracts against a checklist, extract fields, then draft a summary memo) that can take minutes to hours, fan out across documents, survive failures, and report progress.

Harvey
System Design
Software Engineer
Harvey
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design the backend that runs multi-step AI workflows (for example, review 5,000 contracts against a checklist, extract fields, then draft a summary memo) that can take minutes to hours, fan out across documents, survive failures, and report progress.

Harvey's Workflows product turns legal tasks into multi-step agentic pipelines that run over large document sets. The interviewer wants durable execution, fan-out and fan-in, idempotent steps calling flaky and rate-limited models, cancellation, and a clear progress model a lawyer can trust.

What the Interviewer Expects
  • Model a workflow as a DAG of steps with typed inputs and outputs
  • Use durable state so runs survive worker crashes and deploys
  • Fan out per document with bounded concurrency and fan in results
  • Make steps idempotent with retry, backoff, and dead lettering
  • Integrate with model rate limits and tenant fairness
  • Support progress, cancel, pause, and partial results
Key Topics to Cover
durable execution
job queues
DAG scheduling
idempotency
backpressure
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you version a workflow definition while runs of the old version are in flight?
  • How would you let a human approve an intermediate step before continuing?
  • How do you avoid paying twice for model calls on retry?
  • How would you estimate time remaining for a run?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: define workflows as step graphs, start a run with inputs (a document set and parameters), fan out per document, aggregate, add optional human approval gates, see live progress, cancel, and...

High-Level Design
  • Workflow service: stores versioned definitions and creates runs.
  • Orchestrator (durable execution engine, either built on a database or something like Temporal): holds run state as an event...

Submit Your Answer
Markdown supported

Related Questions