Built-in tools: web search, code and file search
Providers run some tools for you, so the model can search the web or run code without you writing the tool.
Words on this page (5)
- tool
- : A function the model can ask your program to run, described by a name, description and argument schema.
- sandbox
- : A restricted environment where code can run with limited access to files and the network.
- retrieval
- : Finding the most relevant pieces of text for a query.
- agent
- : A model run in a loop that chooses its own tools and steps until the task is done.
- logarithm
- : The power you raise a base to in order to get a number. log base 2 of 8 is 3 because 2 to the power 3 is 8.
What they are
A server-side is executed by the provider. You switch it on in the request, and the model decides when to use it. Common ones are web search, code execution in a , file search over uploaded documents and computer use. The results come back in the same response, often with citations.
When to use them
Web search for facts after the model's cutoff or anything that changes. Code execution for exact math, data analysis and charts. File search for quick without building your own index. They are fast to add and cost extra per use. Your own tools are better when you need control over data, permissions or ranking.
Cautions
Web pages are untrusted content, so search results can contain injected instructions. Keep sensitive tools away from an that also browses. Show citations so a user can check claims. tool usage for cost and for debugging.
A worked example: choosing between built-in and your own
Question: "What did the central bank announce today?" Built-in web search fits: current facts, public sources. Question: "How many open tickets does customer 4412 have?" Your own tool fits: private data, your permissions, your database. Many apps use both.
Watch the cost and the trust
Each search or code run can add charges. Search results can contain hidden instructions written by strangers, so do not combine web search with tools that can send emails or move money without a human check.
How a server-side tool runs
- You switch the tool on in the request.
- The model decides it needs a search and writes a query.
- The provider runs the search on its own servers and feeds the results to the model.
- The model may search again, then writes its answer.
- You receive one response containing the answer, usually with citations and often a record of the searches made.
The difference from your own tools is that you never run the loop. That saves work and also means you control less.
A second example: where it fails or is not needed
You ask "What is 4,817 x 3,296?" A model guessing digits can slip. Code execution computes it exactly: 15,876,832. Web search would be pointless here. Now ask about your company's internal wiki. Web search cannot see it, so the model either says it cannot find anything or, worse, guesses. The right choice is file search over your own documents or a tool of your own.
What goes wrong
A citation does not support the claim next to it. Symptom: a confident answer with a link whose page says something different. To confirm, open the link and find the sentence.
The sources are weak: a forum post or an out-of-date page. The model rarely judges source quality well, so show the source name to the user.
The cost climbs because one question triggered many searches. Check your usage logs for tool counts per answer.
A page contains hidden instructions. See the caution above and keep write-capable tools away from browsing.
How to tell it is working
Prepare five questions: three about recent events and two timeless ones, such as "What is a prime number?" The search tool should fire for the first three and stay quiet for the others. Open every cited link and look for the exact claim. Expect to find at least one weak citation, which is why checking matters.
Common mistake
Presenting search-backed answers without showing the sources. Users should be able to check.
You ask a model about yesterday's football result. It was trained months ago, so it cannot know. With the provider's web search switched on, it searches, reads two pages, and answers with links. You did not write a search tool. The provider ran it for you.
Check yourself
Who runs a server-side web search tool?
Not quite. You enable it, and the provider runs it and returns results.
Why be careful combining web search with sensitive tools?
Not quite. Untrusted content plus powerful tools is the injection risk.
You need the status of customer 4412's tickets from your own database. Which tool fits?
Not quite. Private data and your access rules belong in a tool you control.
You got 0 of 3 right.
Go deeper
- DocsWeb search toolDocs
Anthropic · Enabling search and handling citations.
- Docs
Anthropic · Running Python in a sandbox.
- Docs
OpenAI · Web search, file search and more in the Responses API.
Spotted a mistake or something unclear? Report it on GitHub.