Agentic Search for Multi-Source Legal Research Intelligence

harvey · Legal · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.2 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Legal research

Harvey needed retrieval that could follow the iterative reasoning loops lawyers use across statutes, case law, internal documents, and proprietary legal sources.

Constraints:

Architecture

Harvey built Agentic Search as a ReAct-style retrieval loop for legal research: the agent plans the query, selects among legal knowledge sources, retrieves and reasons over results, checks whether the context is sufficient, and only then synthesizes a citation-backed response. The loop sits beside a privacy-preserving evaluation flywheel where legal experts create synthetic queries, OpenTelemetry traces feed LangSmith offline evals, and improvements tune tool descriptions, prompts, and source-selection signals.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  query-planner[Query planner] --> tool-selector-and-retriever[Tool selector and retriever]
  tool-selector-and-retriever --> knowledge-sources[Knowledge sources]
  tool-selector-and-retriever --> reasoning-synthesizer[Reasoning synthesizer]
  reasoning-synthesizer --> completeness-checker[Completeness checker]
  completeness-checker --> tool-selector-and-retriever
  completeness-checker --> citation-synthesizer[Citation synthesizer]
  reasoning-synthesizer --> citation-synthesizer
  citation-synthesizer --> knowledge-sources
  evaluation-flywheel[Evaluation flywheel] --> tool-selector-and-retriever
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Query planner Analyzes the legal research request and decides which information and knowledge sources are needed. Tool selector and retriever
Tool selector and retriever Chooses source-specific tools, writes retrieval queries, executes searches, and gathers context. Query planner, Knowledge sources, Reasoning synthesizer, Completeness checker
Knowledge sources Harvey knowledge layer including 150+ legal sources, Vault documents, iManage integrations, and LexisNexis case law. Tool selector and retriever, Citation synthesizer
Reasoning synthesizer Connects retrieved information and applies legal standards to facts or provisions. Tool selector and retriever, Completeness checker, Citation synthesizer
Completeness checker Decides whether enough information has been gathered or whether another retrieval round is needed. Reasoning synthesizer, Tool selector and retriever, Citation synthesizer
Citation synthesizer Produces the final answer with citations to internal documents and legal authorities. Reasoning synthesizer, Knowledge sources
Evaluation flywheel Uses legal-expert synthetic queries, OpenTelemetry traces, LangSmith offline evals, and feedback to improve tool selection and effort calibration. Tool selector and retriever

Data flow

A legal user submits a complex research prompt. The query planner identifies what information is needed and which legal sources are relevant. The tool-selection layer formulates source-specific searches across Harvey knowledge sources, Vault/iManage documents, and LexisNexis case law. The reasoning step connects retrieved facts to legal standards, the completeness checker loops back for more retrieval when gaps remain, and the final synthesizer writes a source-cited answer.

4 supporting quotes
“1. Query Understanding and Planning: The agent analyzes what information is needed and develops a search strategy. For complex queries, it identifies which knowledge sources will be relevant.”article, stated
“2. Dynamic Tool Selection and Retrieval: The agent decides which sources to query and formulates specific search queries for each. It then executes searches and retrieves relevant information.”article, stated
“4. Completeness Check: The agent evaluates whether it has sufficient information to fully address the query. If gaps remain, it returns to Step 2 for additional retrieval rounds with refined queries.”article, stated
“5. Citation-Backed Response: Once satisfied with the gathered context, the agent synthesizes findings into a comprehensive response with specific citations to source documents.”article, stated

Why this architecture

The architecture is a loop because legal research is iterative and source-dependent: one-shot RAG cannot adjust strategy, pick sources, or know when context is sufficient. The evaluation layer exists because Harvey cannot inspect customer queries, so expert-generated queries and telemetry-backed offline evals substitute for direct production review.

“Traditional one-shot retrieval fails here because it can't adapt its strategy as it discovers information; it can't decide which knowledge sources are relevant; and it can't determine when it has gathered sufficient context.”article, stated
“Since Harvey's privacy guarantees mean no human has access to or reviews actual customer queries, we faced the question: How do you improve a system when you can't directly observe its real-world performance?”article, stated

Models used: LLMs · OpenAI Agent SDK instrumentation

Scale

Alternatives considered (roads not taken)

Static one-shot retrieval

Rejected because: It cannot adapt as discoveries change the search strategy, decide relevant sources, or determine context sufficiency.

“Traditional one-shot retrieval fails here because it can't adapt its strategy as it discovers information; it can't decide which knowledge sources are relevant; and it can't determine when it has gathered sufficient context.”article, stated

Direct human review of production customer queries

Rejected because: Harvey privacy guarantees prevent humans from accessing real customer queries, so improvement must use synthetic expert queries and aggregate feedback.

“Since Harvey's privacy guarantees mean no human has access to or reviews actual customer queries, we faced the question: How do you improve a system when you can't directly observe its real-world performance?”article, stated

Fixed one-or-two-tool-call agent behavior

Rejected because: The team found simple and complex queries need different effort levels; evaluation calibrated retrieval operations to query demands.

“Initially, the agent treated nearly every query the same way — making one or two tool calls and moving on. The agent lacked a calibrated sense of when "good enough" was sufficient and when a query demanded exhaustive coverage.”article, stated

Patterns

rag-retrieval (retrieval)

The system expands naive RAG into source-aware legal research over Harvey knowledge, internal files, and legal databases.

“fit from iterative refinement and intelligent query handling. * Scalable knowledge: Agents tap into Harvey's 150+ legal knowledge sources, internal Vault documents, [iManage integration](https://www.harvey.ai/blog/harveys-imanage-”article, stated

eval-driven-development (quality)

Legal experts created synthetic eval queries and offline traces to tune source selection and retrieval depth without exposing customer queries.

“Our solution was to build a systematic evaluation process powered by Harvey's in-house legal experts.”article, implied

Tradeoffs

How to improve production search under strict privacy limits.

Chose synthetic expert-generated evaluation over human review of real customer queries.

Rationale: The privacy model prevented direct inspection of real queries, so improvement had to come from expert-created proxies and telemetry.

“Since Harvey's privacy guarantees mean no human has access to or reviews actual customer queries, we faced the quest”article, implied

Retrieval effort calibration.

Chose adaptive retrieval that scales from minimal lookup to multiple rounds over a fixed one-or-two-tool-call budget for nearly every query.

Rationale: Simple lookups should stay cheap, but complex legal research needs enough retrieval rounds to gather and reconcile complete context.

“Simple questions like "What's the notice period in section 8.2?" should resolve quickly with minimal retrieval, while complex questions should trigger extensive research.”article, stated

Search architecture for professional legal research.

Chose an iterative agentic search loop over static one-shot retrieval.

Rationale: The loop mirrors how lawyers refine research, cross-check sources, and dig deeper before producing a cited answer.

“Legal research has always been iterative: searching case law, discovering a new angle, refining your query, checking another jurisdiction, cross-referencing with statutes, and repeat.”article, stated

Gotchas (what bit them)

The first agent treated simple and complex questions too similarly.

Root cause: It lacked calibrated effort for when a query demanded exhaustive multi-source coverage.

Resolution: Use eval data to calibrate effort so complex legal questions trigger more retrieval operations.

“Initially, the agent treated nearly every query the same way — making one or two tool calls and moving on.”article, stated

Evaluation

Harvey tracked hallucination, tool recall, retrieval recall, formatting, answer quality, and source-selection precision in offline evals.

Metrics: tool selection precision 0.8-0.9 · 3-10 retrieval operations for complex queries · hallucination · answer quality

“This approach solved our source selection challenge by giving the agent clearer signals about when to use each knowledge source — improving tool selection precision from near zero to 0.8-0.9.”article, stated

Outcomes

The source describes broad product use across legal knowledge sources rather than only one workflow.

“This capability helps raise the baseline quality of queries in Harvey Assistant, while also serving as the technical foundation for Deep Research — our most comprehensive mode for multi-source legal analysis.”article, stated