Design an AI Contract Review Agent With Evaluations

Last updated: November 29, 2026

Quick Overview

Legal teams want an agent that reviews an incoming vendor contract against the customer's own playbook (acceptable liability caps, data protection terms, auto-renewal rules), flags deviations with cited clauses, and suggests redlines. Design the system, including how you know it works.

ZipHQ
ML System Design
Machine Learning Engineer
ZipHQ
November 29, 2026
Machine Learning Engineer
System Design Round
ML System Design
Hard

0

0

0 solved


Legal teams want an agent that reviews an incoming vendor contract against the customer's own playbook (acceptable liability caps, data protection terms, auto-renewal rules), flags deviations with cited clauses, and suggests redlines. Design the system, including how you know it works.

Zip ships AI agents for procurement, including contract review, and its engineers have written about evaluating agents rigorously rather than by impression. This round checks retrieval and grounding design, per-tenant playbooks, structured outputs, and an evaluation plan that would catch regressions before customers do.

What the Interviewer Expects
  • Break the task into steps (clause segmentation, playbook retrieval, per-rule judgment, redline drafting) rather than one giant prompt
  • Ground every flag in a cited clause span and a specific playbook rule
  • Treat each customer's playbook as data, with tenant isolation of documents
  • Define an offline eval set with expert labels and per-rule precision and recall
  • Plan online signals (accepted or edited suggestions) and regression gates on prompt or model changes
  • Discuss cost, latency, and what the agent must never do autonomously
Key Topics to Cover
LLM agents
retrieval augmented generation
structured output
evaluation harness
grounding
tenant isolation
How to Approach This
  1. Start by mapping the business objective to a concrete ML objective and metric.
  2. Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
  3. Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
  4. Address the serving latency budget and whether batch or real-time inference is needed.
  5. Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
  • How would you detect and reduce hallucinated clause citations?
  • A customer's playbook rule is ambiguous. How does the agent behave?
  • How do you evaluate redline quality, which is not a simple label?
  • How would you roll out a new base model safely across tenants?
Sharpen Your Skills on Codemia

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

Practice ML System Design Problems
Sample Answer
Requirements

Input: contract (PDF or DOCX, often 20 to 60 pages) plus the tenant's playbook of 20 to 100 rules. Output: per-rule verdict (compliant, deviates, missing, unclear), cited clause spans, an explanation,...

High-Level Design

Pipeline on the shared agent execution engine: 1) parse and segment the contract into clauses with stable ids and offsets; 2) for each playbook rule, retrieve candidate clauses with hybrid search (emb...


Submit Your Answer
Markdown supported

Related Questions