For the complete documentation index, see llms.txt. This page is also available as Markdown.
Build a literature review agent
Outcome: a loop that takes a research question, searches at increasing depth, screens the papers, and returns a cited summary your users can verify.
What you need
Key with search:write, papers:read; credits for at least one deep_review.
Approach
Escalate depth only when the cheap pass is thin. That single decision dominates cost.
Walkthrough
Expand the question into topics to catch vocabulary you would have missed
Run a
standardsearch per topicScreen: drop retracted papers, apply year and open-access filters
Escalate to
deep_reviewonly where evidence is thinRender the answer with clickable citations
Handling the hard parts
Deep reviews take minutes — stream or webhook, never block a request thread (streaming-deep-review)
Deduplicate papers across topic searches by
pap_ID, not titleAlways surface
is_retractedNever drop the citations to make the summary tidier — that is the product
Cost
As written — one topic search plus three standard searches, escalating one to deep_review — the
walkthrough costs 4 + (3 × 5) + 60 = 79 credits. Without the escalation it is 19.
At 1,000 questions a day with a 10% escalation rate: roughly 10,500 credits a day, ~315,000 a month. The escalation rate is the number to watch — see cost-control.
Production checklist
Idempotency keys · webhooks over polling · cache paper metadata, not full text
(see content-licensing) · alert on X-Credits-Remaining · handle 402 gracefully
Related
searches · topics · depth · cost-control
Last updated