Who Executes Web Search and File Reading in LLM Application APIs?
When mainstream LLM application APIs begin to offer web search, link reading, and related capabilities, the key design question is not how many endpoints exist but where responsibilities sit: client-side orchestration versus server-side hosted tools. This article explains the two implementation paths, how to choose between them, how built-in web tools and reasoning modes behave, and what file preprocessing must happen before model inference.
When a class of mainstream large models begins to provide web search, link reading, and similar capabilities in its application APIs, the first thing developers need to clarify is often not the number of interfaces, but the boundary of responsibilities: do search, web page fetching, and file reading happen on the client or on the server? Between model inference and tool execution, who moves the intermediate results? Understanding this directly determines an application’s architectural complexity, controllability, and maintainability.
1. A Research Question Has Two Implementation Paths
Consider a typical scenario: building an assistant that helps readers compare product updates. A user sends an official website link and asks, “What problems did this update solve?” To answer, the system needs at least three steps: identify and fetch the link content, possibly supplement background information through search, and hand the organized material to the model to generate an answer. Around these three steps, the industry has two mainstream implementation paths.
Path 1: Client-side orchestration. Application code first parses the user message and identifies the link. It then makes its own HTTP request to fetch the web page, handling exceptions such as timeouts, redirects, anti-scraping measures, and encoding. Next, it extracts the main body from the HTML by removing noise and ads and truncating length. Finally, it inserts the organized material into the prompt and sends it to the model. If the model decides during answering that more information is needed, the application must call the search API again, capture the results, feed them back to the model, and enter the next round. In this path, the model is only responsible for deciding whether to use a tool and with what parameters; the actual execution of the tool is fully handled by the application. Developers are effectively writing a ReAct-style agent loop: the model outputs tool-call intent, the application executes, results are filled back in, and inference continues. The advantage is strong control: query terms, fetch strategies, and result filtering can all be customized. The cost is engineering effort: every web action must be connected into a client-side loop, and error handling, concurrency, and context window management must all be handled by the developer.
Path 2: Server-side hosted tools. The client declares in the request which capabilities are allowed, such as search and link reading. During inference, the model independently decides when to call them, the server executes search and fetching on its behalf, automatically fills the result material back into the context, and finally returns an answer with citations. Note that model judgment and tool execution are still two different stages; only the execution stage has moved from the client to the server, so developers no longer need to repeatedly move results between the two. Architecturally, this internalizes the agent loop inside the inference service.
2. How to Choose: It Depends on Who Controls the Flow
The two paths are not mutually exclusive. In practice, the industry usually provides both types of entry points:
- In-conversation server-side tools: give the model the decision power over when to go online and what to search for. Suitable for general Q&A and assistant scenarios, with low development cost.
- Independent search and fetch APIs: the application controls query terms and obtains raw results itself. Suitable for scenarios that require precise control over retrieval strategy, result caching, or integration with proprietary ranking logic, such as RAG pipelines.
The selection criteria are clear: if the business has strong requirements for retrieval quality, result sources, and cost control, use independent APIs and orchestrate them yourself. If the goal is rapid integration and a conversational experience, hand the work to server-side tools. In practice, the two can also be mixed: use independent APIs for controlled initial retrieval and use server-side tools for supplementary queries the model makes midstream.
3. Enabling Search Does Not Mean Forced Search Every Time
This is the most easily misunderstood point. Server-side web tools need to be explicitly declared in the request, for example by declaring a “search” tool and a “read links in the user message” tool. If you only want the model to read a specified link and not allow it to search freely, you can declare only the latter. This is an effective way to narrow permissions.
However, these built-in tools cannot fully use the same control methods as custom function tools. Common design constraints include:
- Invocation cannot be forced: forcing invocation of a built-in web tool through a parameter such as
tool_choiceusually returns a parameter error directly (e.g., 400). Whether to search and whether to read links are decided by the model based on the question. - Disabling is global: setting tool selection to “do not use any tools” will also disable these built-in web capabilities.
- Capability available does not mean used this time: a product interface showing “web enabled” only indicates that the capability is available; it does not prove that this answer actually consulted external material. If the application wants to label an answer as “verified”, it must inspect tool-call events and citation information in the returned result, rather than concluding from a confident tone alone. This is especially important for scenarios with high compliance requirements, such as medical, financial, and legal Q&A.
4. How Reasoning Modes Affect Web Behavior
With search enabled, whether deep reasoning mode is turned on makes a clear behavioral difference:
- Without reasoning: the model performs several searches as needed by the question and then gives a cited answer in one pass. The flow is close to a single-round “retrieval-generation” structure.
- With reasoning: the model can alternate search, opening pages, locating content, and revising query terms across multiple reasoning steps, forming a multi-step verification chain.
Multi-step flows provide an opportunity to continue verifying after finding that initial results are unreliable, and they are often helpful for complex factual questions. But it must be emphasized: multi-step does not equal correct. The model may go further astray in the wrong direction, or it may lack judgment about source quality. Engineering should retain the ability to audit cited sources and present citations faithfully in the frontend so users can trace and verify them.
5. Reading Files: First Turn the File into Usable Material
File input also involves the question of responsibility division. Sending a file name or binary attachment to the model does not mean the model has “read” the file. PDFs, Office documents, scanned images, and other materials need text extraction or layout parsing first, converted into plain text or structured content, before they can enter the conversation context.
This preprocessing chain usually involves:
- Text extraction: extracting text streams from native PDFs and Office files.
- Layout and structure parsing: restoring heading hierarchy, tables, and lists. Tables are especially prone to losing semantics after plain-text conversion.
- OCR: performing text recognition on scanned documents and images.
- Chunking and truncation: splitting long documents according to context window limits and, when necessary, combining retrieval instead of inserting everything at once.
Regardless of whether this work is done by the client, a separate document parsing service, or server-side capabilities, it essentially happens before model inference. When evaluating a solution, developers should confirm: whether parsing is server-hosted or self-integrated, which formats are supported, in what form parsing results enter the context, and how overly long documents are handled.
6. Engineering Practice Recommendations
Based on the analysis above, here are several practical recommendations:
- Clarify responsibility boundaries before starting: first draw a responsibility map of “model judgment, tool execution, result backfill” and decide whether each stage sits on the client or the server.
- Declare capabilities as needed: only expose the tools truly needed for the current scenario, reducing cost and uncontrollability caused by the model misusing web capabilities.
- Use events, not the interface, as the source of truth: whether the web was used and which link was read should be determined from returned tool-call records and citation fields, and logs should be recorded for auditing.
- Plan fallbacks for failure: server-side fetching may fail or return empty content. The application layer should have degradation strategies, such as asking the user to resend the link or paste the body text instead.
- For long documents, prefer retrieval over full insertion: combine general vector retrieval ideas, chunk and index file materials, and retrieve them on demand. This saves context and improves relevance.
In summary, capabilities such as web search and file reading are moving from “developer-built agent loops” to “server-hosted execution”, but the logical layering between model decision-making and tool execution has not changed. What truly requires developer effort is choosing the right path, managing declarations, and watching events according to business requirements for control, cost, and auditability, rather than simply flipping a “web switch”.
