How Agentic Search Unlocks Legal Research Intelligence at Harvey

Lysia Li, Varun Nair, Aaron Stern, Pablo Felgueres, Calvin Qi, Philip Cerles10 Dec 2025

Problem

Harvey, a legal AI platform, answers lawyers' questions over client documents, statutes, case law and 150+ legal knowledge sources. A one-shot pipeline (embed the query, retrieve chunks, answer) cannot adapt after the first lookup, choose sources or tell when it has enough context. The first agent prototype also failed on real queries: it queried one or two sources when more were needed and handled every question the same way. Privacy guarantees keep engineers from reading real customer queries to find out why.

Example from the article: "Review all employment agreements in the data room and identify any non-compete provisions that may be unenforceable under California law. For each provision, cite the relevant California statute or case law."

Solution in brief

Replace one-shot retrieval with a ReAct-style loop: plan, pick sources as tools, retrieve, check completeness, repeat. Tune source choice and effort on an offline evaluation set written by in-house legal experts, changing prompts and tool descriptions.

Questions this case answers
  • How to make a retrieval agent pick the right sources and the right amount of effort per query when the question never names its sources
  • How to evaluate and improve an LLM agent offline when real user queries cannot be inspected for privacy reasons
  • How to make a RAG assistant choose the right knowledge sources for vague user questions
  • How to make an agent spend one tool call on a simple question and many on a complex one

Tools and methods

  • Agentic RAG with a ReAct loop — the agent interleaves reasoning with tool calls instead of retrieving once
  • Knowledge sources as tools — one tool per source
  • Expert-written evaluation queries — in-house former lawyers write queries that mirror real usage
  • OpenAI Agents SDK with OpenTelemetry traces — captures each agent run for offline evaluation
  • LangSmith — runs the offline evaluations and tracks the metrics
Continue reading — it's free

Google or a one-time email code. No password.