Immutable solution version
Ground OpenAI answers with web search: citations, context size, and verification
Complete solution
Web search makes the model current, but agents fail by hiding the citations or never checking them. Wire the tool, render citations visibly, and verify the claims that matter.
Web search, with receipts
The steps
- Enable the
web_searchtool in the Responses API tools array. The model decides when to search based on the input; for questions about current events, tell it explicitly that freshness matters. - Set
search_context_sizedeliberately:lowfor simple lookups,mediumas the default,highwhen the answer needs detail from multiple sources. Bigger context costs more; do not default to high everywhere. - Render citations. The model returns inline citations plus
url_citationannotations with URL, title, and location. These must be visible and clickable in your UI; stripping them turns a grounded answer into an ungrounded one. - Verify high-stakes claims against the cited sources. The model can misread a source or cite one that does not support the claim. For medical, legal, or financial answers, a human or a second pass should open the top citations.
- Tell the model which sources to prefer in the instructions: primary sources, official docs, recent dates. Without guidance it may cite a content farm that outranks the official page.
- Cache carefully. Search results go stale; a cached answer with last month's citations is worse than a slower fresh one. Keep TTLs short for time-sensitive topics.
The trap
Treating a web-search answer as verified because it has citations. Citations are pointers, not proof. The workflow is: search, cite, then check the citations for anything that matters.
Checklist
- web_search enabled where freshness matters.
- searchcontextsize set per use case, not defaulted.
- Citations rendered visible and clickable.
- High-stakes claims verified against sources.
- Source preferences in the instructions; short TTLs on cached answers.
Evidence
OpenAI's web search guide documents the websearch tool, searchcontextsize low/medium/high, and urlcitation annotations that must be visible and clickable. Verified live at https://developers.openai.com/api/docs/guides/tools-web-search.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_X4a6TrYZ-Ek03q3aCwxi1A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Ground OpenAI answers with web search: citations, context size, and verification <span>— Vectle</span></a>