Have an agent build it. Copy the brief below into Claude Code, Cursor, or any coding agent with access to your project. It states the calls, the questions worth asking you first, and the mistakes to avoid.
Agent brief
Agent brief
search finds the ranked results, and with scrapeResults turned on it returns each page’s cleaned content in the same response, so there is no second round of fetching.
The pipeline
1. Search, and ask for the content
scrapeResults you get titles, URLs, and snippets for one credit, which is enough when you only need links. With it, each result also carries a data object holding the page as Markdown.
2. Keep the URL next to the text
Every result carries itsurl and rank. Carry both into your prompt so the model can cite them, and so you can show the reader where an answer came from. An answer without a link is a claim the reader has to take on faith.
3. Build the prompt from what came back
Give the model the snippets and the fetched Markdown, and tell it to answer only from those sources and to name which one supports each claim. This is the whole difference between a summary and a citation.Two passes beat one
Fetching every result in full is the obvious move and usually the wrong one. Run the first pass withoutscrapeResults. You get titles, URLs and snippets for a single credit, and for a surprising share of questions the snippets already contain the answer or make it obvious which two results are worth reading.
Then fetch only what you chose. A batch over three URLs costs three credits, against fifteen for fetching a full page of results you will not read. On a question that turns out to be answerable from snippets, the whole thing cost one.
The exception is when latency matters more than credits. A single search with scrapeResults is one round trip, and two passes are two.
When the sources disagree
Real search results contradict each other, and a model handed conflicting text will usually pick one and sound certain. Give the model the publication dates where you have them.metadata.publishedTime comes back on pages that declare one, and “the older source says otherwise” is a resolution rule a model can actually apply.
Tell it what to do with a genuine conflict: say the sources disagree and show both, rather than silently choosing. A visible disagreement is useful to a reader, and a hidden one is a coin flip presented as fact.
Watch out for consensus that is really one source repeated. Five results agreeing often means four of them copied the fifth, so weight a primary source above the sites that quote it.
Handling a bad search
Not every query returns something usable, and the failure should be visible rather than papered over. An empty or thin result set is an answer: say that nothing useful was found. A model asked to answer from three irrelevant snippets will produce something, and that something is worse than an admission. Check relevance before you spend on fetching. If the top results are dictionary definitions or a homepage when the query was specific, refining the query is cheaper than reading five wrong pages. Try a rephrasing before giving up, but cap it. Two attempts is diligence and six is a loop.Knowing the answers are good
Keep a set of questions with known answers and run them regularly. Retrieval quality drifts as the web changes, and without a fixed set you will only notice when someone complains. Log the query, the URLs returned, and the answer. When a bad answer surfaces, the only useful question is which sources produced it, and that is unanswerable after the fact unless it was recorded. Sample the citations. An answer that cites a page which does not actually support it is the most damaging failure here, because the citation makes it more convincing rather than less.What it costs
The search itself is 1 credit. Each result you asked us to fetch bills 1 more. A five result search with content is 6 credits, and the same search without content is 1.limit runs from 1 to 15. Ask for what you will actually read: fetching 15 pages to use 3 costs 12 credits for nothing.
What to watch for
Search is the narrowest pipe we run, so batch your queries rather than firing one per keystroke, and cache results you will reuse. A query typed by a user is a query you will see again. TurnscrapeResults off for the first pass when you are exploring. Snippets are often enough to decide which three of fifteen results are worth the credits.
Use timeRange when recency matters. A question about a current version answered from a three year old page is worse than no answer, because it looks right.