Use the web_search tool
Unit 4 of 8 · Module 4: Develop generative AI apps that use tools
Read this lesson
Fresh information
The web search tool lets your model go and check the internet while it's putting an answer together. Rather than leaning only on its training data, the model writes its own search query, reads what comes back, and answers from what's current. That matters most for facts with a short shelf life: prices, product launches, rule changes, and the news. What you get: live retrieval of recent information; answers that point back to the sources they came from; a lower chance of made-up facts, since the model checks outside sources; automatic queries, with the model deciding when to search and what to type; and a seamless flow, with searching and answering in one go. People use it to sum up the latest news, research competitors' new features and prices, keep an eye on changing regulations, and fact-check claims against trustworthy sources.
How it works
To turn it on, put a tool with the type web search in the tools list, and say in the instructions that the model should search the web whenever it needs current information. Then ask something like, what were three big announcements at Microsoft Build this week, and you'll get a short answer based on recent sources, though the exact details depend on what's on the web at that moment. Here's what happens under the hood: your request arrives with the tool attached. The model weighs whether it actually needs fresh information from the web. If it does, it runs one or more searches. It picks the most useful pages, and summarizes them. Then it weaves what it found into the final answer.
Practices and limits
A few habits get better results: make questions time-aware, with words like latest or current, or an exact date range. When accuracy matters, ask it to stick to official or well-known sources. Ask for a short summary of the key points. If the answer really matters, like a medical or legal question, check the critical facts yourself. And keep an eye on usage and latency, since every web lookup adds time and tokens. It has limits too: it can only find what's public and indexed at the moment you ask. Some sources are better than others, so a human may need to review the output. The web keeps changing, so the same question can get a different answer tomorrow. And some setups block web access altogether, because of region, company policy, or the network. Use it wisely, and your model is no longer stuck on the day its training ended: it gives timely answers that show where they came from.
Facts from Microsoft's documentation: Web search with the Responses API (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. The coding lab is based on code samples in Microsoft's Azure AI documentation (MicrosoftDocs/azure-ai-docs, MIT License; notice). Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.