Who Executes Web Search and File Reading in LLM Applications: Client-Side Orchestration vs. Server-Side Tools
This article explains who actually performs web search and file reading in LLM applications: the client application or the server. It compares client-side orchestration loops with server-side tool execution, outlines the constraints of built-in web tools, describes the pipeline that turns documents into usable context, and provides a reliability checklist covering observability, fallback, compliance, cost, and citation labeling.
1. Starting Point: From “Answering” to “Searching First, Then Answering”
Letting a model answer directly and letting it retrieve information before answering are two tasks with very different engineering complexity. The former only requires building a prompt and sending a request. The latter additionally requires connecting a retrieval service, fetching web pages, cleaning the main content, chunking and reranking, and then feeding the material back into the conversation context. What makes it harder is that after a tool call returns, the application usually has to drive the next reasoning turn, forming a loop of “model decides - tool executes - result is fed back - model decides again.”
A cloud vendor recently exposed a set of application-layer API capabilities that move part of the work previously handled on the client to the server: retrieval, link reading, and context assembly can now be coordinated with model inference within the semantics of a single request. Developers still need to build the application, but they no longer have to implement every web action as a client-side loop.
This article takes a general architecture perspective and discusses one core question: who actually performs web search and file reading?
2. Two Paths: Client-Side Orchestration vs. Server-Side Tools
Suppose you want to build an assistant that helps readers compare product version updates. A user sends a link to an official site and asks “what problem did this update fix.” This example is only used to explain the flow and does not represent any measured result.
Path A: The Application Orchestrates Itself (Client-Side Loop)
- The application identifies the link in the user message;
- The application issues a fetch request and handles timeouts, redirects, and download failures;
- The application extracts the main content, removes noise, and chunks it;
- The application assembles the cleaned material into the context and passes it to the model;
- If the model decides the information is insufficient, it returns a tool-call intent;
- The application calls the search API again, receives the results, and enters the next turn.
The defining feature of this path is: the model makes the judgment, and the application makes the tools actually run. It offers the most control, but also the highest cost in boilerplate code and exception handling.
Path B: Using Server-Side Tools (Capability Declaration + Server-Side Fill-In)
The client declares the capabilities it allows in the request, and the server executes them and fills the material back into the context. Model judgment and tool execution are still two separate steps; the difference is that developers no longer have to shuttle results between them repeatedly.
Official documentation usually distinguishes two types of entry points:
- Let the model decide when to go online: use the server-side tools inside the conversation;
- The application controls the query terms itself and gets retrieval or fetch results directly: use the standalone retrieval and fetch APIs.
Which path to choose essentially comes down to one question: who owns control of the flow.
# Pseudocode: comparing the two control models# A. The client owns the flowraw = fetch(url) # the application fetches and cleansanswer = chat(context=raw) # the model only judgesif answer.need_more:hits = search(answer.query) # the application runs the second searchanswer = chat(context=hits)# B. The server owns executionresp = chat(tools=["web_search", "read_url"], # only declare capabilitiesmessages=[user_msg],)events = resp.tool_events # the application only observes and displays
3. Enabling Search Does Not Mean Every Request Forces a Search
Web tools must be declared explicitly in the request: one for retrieval and one for reading links in the user message. If you only want to read a specific link, you can declare only the reading capability.
These tools look like ordinary functions, but you cannot simply apply all the control methods of custom tools to them. Common constraints include:
- You cannot use the tool-choice parameter to specify “call only one of them,” or the request will be rejected (typically with a 400 response);
- Whether a search or link read actually happens is decided by the model based on the semantics of the question;
- Setting tool choice to “none” disables these capabilities as well.
This leads to an important product conclusion: a UI showing “web access enabled” only means the capability is available; it does not prove the answer actually consulted external material. The application should judge based on the returned tool events and citation information, rather than slapping on a “verified” label just because the tone of the answer sounds confident.
In addition, thinking mode also affects behavior. Without thinking enabled, the model searches as needed for the question and provides citations. With thinking enabled, the model can repeatedly search, open pages, and locate content across multiple reasoning steps. A multi-step flow provides opportunities for further verification, but it does not guarantee every conclusion is automatically correct.
4. File Reading: First Turn the File into Usable Material
File input is also not finished once you “send the file name to the model.” Materials such as PDFs, office documents, and images need text extraction or layout parsing before they enter the conversation context. Engineering typically involves the following steps:
- Upload and storage: the file first lands in object storage and gets a stable identifier, avoiding stuffing large files directly into the request body;
- Type detection and parsing: choose text extraction or layout analysis by format; tables, footnotes, and multi-column layouts are the main difficulties;
- Cleaning and chunking: remove headers and footers, merge broken lines, split into blocks along semantic boundaries, and preserve section hierarchy;
- Indexing and recall: for long documents, first do vector or keyword recall and only feed relevant fragments into the context;
- Citation traceability: keep a mapping between fragments and their original positions so answers can cite sources.
Illustrative structure:
{"file_id": "obj://bucket/doc-123","chunks": [{"id": "c1", "text": "...", "page": 3, "section": "Release Notes"}],"usage": {"prompt_tokens": 0, "cited_chunks": ["c1"]}}
5. Reliability Design Checklist
- Observability: log tool events, query terms, and citation lists to form an auditable chain;
- Failure fallback: when a fetch fails, fall back to “answer based only on the provided material” and explicitly state the limitation;
- Permissions and compliance: validate domain allowlists and authorization before fetching, run file parsing in isolation, and avoid injecting instructions from untrusted content;
- Cost control: use recall and reranking to compress the context, cache parsing results for high-frequency documents, and use logging services and monitoring alerts to locate anomalies;
- Result labeling: distinguish “model inference” from “supported by external material”; the former should not be presented as a verified fact.
6. Conclusion
The execution authority for web access and file reading can be divided by “who owns the flow”: when you need fine-grained control over query terms, fetch strategies, and retry logic, let the application orchestrate; when you want to reduce boilerplate code and let the model decide when to verify, hand it to server-side tools. Either way, judging whether an answer is truly based on external material should come back to the tool events and citation information themselves, not to a UI toggle or the tone of the wording.
