Design a multi-agent system that redlines a contract against a playbook
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI system design interview question asked in Harvey's system design (LLM applications) round. It tests agents, legal and document editing.
A law firm has a playbook of 30 to 80 rules for one type of contract: liability caps, governing law, assignment, confidentiality terms. Given a counterparty's 50-page draft, produce a redline: tracked changes that bring the contract in line with every rule, each tied to its rule and explained, for a lawyer to accept or reject. Design it as a system of cooperating AI agents.
Requirements
- Functional: parse the draft (Word) into clauses with stable positions; check each rule against the contract; propose edits as tracked changes in the original document with a comment citing the rule; flag rules that can't be satisfied by an edit (a missing clause, a business decision); merge edits from different rules that touch the same text; verify the result; record the lawyer's accept or reject decisions.
- Non-functional: a full redline in minutes; edits anchored exactly so they apply to the real document; no silent changes outside what a rule requires; token cost per contract within budget; confidential documents never leave the firm's approved boundary.
Clarifying questions
- Is the playbook written as plain-language rules with preferred and fallback positions?
- How long and how consistent are the contracts? Are defined terms and cross-references common?
- Should the system ever rewrite whole clauses, or only make minimal edits?
- What do lawyers do with the output today, and what would make them trust it?
- Which models are allowed for confidential data?
What a strong answer covers
- Splitting the work: a coordinator that maps rules to the clauses they concern, rule agents that each handle one rule (or a group of related rules) with only the relevant clauses and the definitions they use in context, and a reviewer agent.
- Context control: defined terms and cross-referenced clauses pulled in explicitly, so agents see what they need without the whole contract each time.
- Edits as structured operations (clause id, exact span, replacement text, rule id, explanation) rather than free text, anchored to the document's real positions and converted to tracked changes.
- Merging: detecting overlapping spans from different rules, resolving them with a merge step that sees both rules, or flagging conflicts for the lawyer.
- Verification: re-checking every rule against the edited contract, checking that nothing changed outside proposed spans, and that defined terms and numbering still hold.
- Latency and cost: running rule agents in parallel, caching the shared contract context, tokens per agent call times rules, and choosing smaller models for the mapping step.
- Learning from lawyers: storing accept and reject decisions with reasons, turning them into playbook clarifications and evaluation cases, and measuring acceptance rate per rule.
Follow-ups
- Two rules require conflicting edits to the same sentence. What happens?
- The counterparty's draft is a scanned PDF. What changes?
- How do you evaluate a new model before switching to it?
- The firm wants a negotiation history: what was conceded in earlier rounds. How does that feed in?
Where it's asked
- Harvey · System design (LLM applications)60 min · Design discussion on a whiteboard or doc
What it tests
agents · legal · document editing · evals
Sign in to see the worked answer
The full answer, chapter by chapter, with what interviewers expect at each level. New accounts get 5 credits: each one unlocks a question for good.
What the labs asked this week
A weekly email of what OpenAI, Anthropic and the other top AI labs asked engineers, round by round.
