Design a Deep Research Agent
Understanding the Problem
🔎 What is a deep research agent? A deep research agent takes an open-ended question ("compare the economics of grid-scale battery chemistries" or "what's known about drug X's long-term side effects") and works on it for many minutes: it plans sub-questions, runs dozens of searches, reads and extracts from a hundred or more pages, notices gaps and searches again, then writes a structured report where every claim cites its source. OpenAI, Google, Anthropic and Perplexity all ship products in this category.
It's related to AI search, but the shape is different. AI search answers in two seconds from the top few results. Deep research trades latency for depth: it's a long-running background job with a plan, a budget and hundreds of model calls, and its output is a document people may rely on for decisions. That moves the hard parts to orchestration (how the job survives 30 minutes of flaky web fetches), provenance (how we prove each sentence came from somewhere) and cost (how we stop it spending $50 on a question worth $2).
The general agent platform (tool gateway, durable runs, memory) is covered in Design an Agentic System, and loop patterns like plan-and-execute and reflection in Agent Design Patterns. Here we focus on what's specific to research.
Functional Requirements
Core Requirements
- Users should be able to submit a research question, answer a few clarifying questions, and see the plan the agent will follow.
- The agent should search the web (and optionally the user's uploaded files or connected sources), read sources, and iterate until it has enough evidence or runs out of budget.
- Users should get a structured report where every factual claim links to the specific source passage that supports it.
- Jobs should run in the background for up to about 30 minutes, with live progress, cancel, and a notification when done, and survive crashes without starting over.
Below the line (out of scope)
- Building our own web index (we'll use a search API plus our own fetcher; see the AI search post for index choices).
- Paywalled sources and logins.
- Collaborative editing of the report.
Non-Functional Requirements
Ask about volume, how long users will wait, and the price point. We'll assume 500,000 research jobs a day.
Core Requirements
- A job should finish in 5-30 minutes, with first visible progress (the plan) in under 10 seconds.
- Citations must be accurate: a cited passage must actually support the claim next to it. We'll target over 95% citation precision on our eval set.
- Each job's cost must be bounded by a budget (tokens, pages, wall clock), with a predictable average.
- Jobs must be durable: a worker crash or a model API outage pauses a job, it doesn't lose 20 minutes of work.
- The agent must not be steered by instructions embedded in pages it reads.
Below the line (out of scope)
- Real-time collaboration and sharing permissions.
- Multi-region data residency.
Back-of-the-envelope, assuming list prices of about $3 per million input tokens for a strong model and about $0.25 per million for a small one (actual prices vary):
- A typical job runs ~30 search queries and reads ~100 pages at ~6,000 tokens each after cleanup: 600k tokens of reading. With a small model doing extraction, that's about $0.15.
- The orchestrator (strong model) takes ~40 turns with a context that grows to ~40k tokens: roughly 1M input tokens, mostly cached, plus ~20k output tokens: about $1.
- Synthesis: ~100k tokens of evidence in, ~10k tokens of report out: about $0.45.
- So ~$1.50-2 per job, and ~$1M a day at 500k jobs. A runaway job that reads 2,000 pages costs 20x the average, which is why budgets matter.
- Concurrency by Little's law: 500k jobs x 15 minutes / 1,440 minutes ≈ 5,200 jobs running on average, maybe 15,000 at peak.
- Fetches: 500k x 100 = 50M page fetches a day, about 600 per second on average.
Two numbers change the design. Reading dominates token volume, so it goes to a cheap model and never to the orchestrator's context. And thousands of concurrent 15-minute jobs mean we need a durable workflow engine, not a process holding a loop in memory.