Who Executes Web Search and File Reading in LLM Applications: Client-Side Orchestration vs. Server-Side Tools
This article explains who actually executes web search and file reading when an LLM answers a question, comparing client-side orchestration with server-side tool declarations. It covers how to declare web tools, why enabling a tool does not guarantee it was invoked, how file inputs are turned into usable context, and how to verify with tool events and citations that external material was really retrieved.
1. Where the Problem Comes From: The Engineering Split Behind “Look It Up, Then Answer”
Letting a model answer a question directly and letting it look up material first have long been two different engineering tasks. The first only requires sending a message to start inference. The second has to connect a search service, download pages, extract the main text, clean out noise, and stitch the material back into the conversation context. It gets more involved when the model returns an intent to call a tool: the application usually has to keep executing the next step, forming a multi-turn loop.
A cloud vendor recently opened up a set of application-side API capabilities. The point is not that there are more endpoints, but that some of the work has moved to the server side: search, link reading, and context assembly can now happen within the same pipeline as model inference. Developers still build the application, but they no longer have to implement every web action as a client-side loop. This article discusses the general engineering model behind such capabilities from a neutral perspective and does not cover any specific product.
2. Two Paths: Client-Side Orchestration vs. Server-Side Tools
Suppose you want to build an assistant that helps readers compare product updates: a user sends a link to an official site and asks what the latest update fixed. The example only illustrates the flow and does not represent any measured result.
Path A: The Application Orchestrates Everything
- The application detects the link in the message.
- The application requests the page and handles timeouts, download failures, and encoding errors.
- The application extracts the main text and strips ads and navigation noise.
- The application feeds the cleaned material back to the model.
- If the model decides the information is insufficient, the application calls the search API, catches the results, and starts the next round.
The defining trait of this path is that the model makes the judgment while the application is responsible for actually running the tools.
Path B: Declaring Server-Side Tools
The client declares which capabilities are allowed in the request, and the server handles execution and context injection. Model judgment and tool execution are still separate stages; the difference is that developers no longer have to shuttle results between them by hand.
The official documentation usually distinguishes two kinds of entry points: if you want the model to decide on its own when to go online, use the server-side tools inside the conversation; if the application needs to control the query terms itself and get search or fetch results directly, use the standalone retrieval and fetching endpoints. Which path to choose comes down to one key question: who controls the flow.
3. Declaring a Capability Does Not Force It to Trigger
Web tools must be explicitly declared in the request. The common semantics are one tool for search and one for reading links in the user message. If you only want to read a specific link, you can declare the reading capability alone.
Although these tool names look like ordinary functions, you cannot simply apply the control mechanisms used for custom tools. Common constraints include:
- You cannot pick one of them through the tool-choice parameter; otherwise the request is rejected (for example, with a 400 response).
- Whether a search or link read actually happens is decided by the model.
- Setting tool choice to
nonedisables these capabilities as well.
This leads to an important product conclusion: a UI that says “web access enabled” only means the capability is available; it does not prove that this particular answer consulted external material. The application should rely on the returned tool events and citation information rather than labeling an answer as “verified” just because it sounds confident.
Enabling search does not guarantee identical behavior either, because thinking mode matters. Without thinking enabled, the model searches as the question requires and returns citations. With thinking enabled, the model can search, open pages, and look for content across multiple reasoning steps. A multi-step flow creates opportunities for further verification, but it does not guarantee that every conclusion is automatically correct.
4. Reading Files: Turn Them into Usable Material First
File input does not end with “send the file name to the model.” PDFs, Office documents, images, and similar material need text extraction or layout parsing before they enter the conversation context. The engineering work typically includes:
- Format detection and type validation;
- Text extraction (including optical character recognition for scanned documents);
- Layout and reading-order reconstruction, handling multi-column pages, tables, headers, and footers;
- Chunking and metadata tagging (page numbers, sections, source positions);
- Truncation, summarization, or retrieval-based recall for oversized material.
Illustrative pseudocode:
def build_context(files, question):parts = []for f in files:text = extract_text(f) # extract textchunks = split_by_layout(text) # split by layouthits = retrieve(chunks, question) # recall relevant chunksparts.extend(annotate(hits, source=f.name))return assemble(parts)
5. Observability and Acceptance: Proving It Really Looked Things Up
To make “whether it went online and what it read” verifiable, it is advisable to record structured events on the application side: tool call start and end, a summary of request parameters, the returned citation list, elapsed time, and failure reasons. Acceptance checks should cover at least three points: whether citations support the key conclusions, whether failures have a fallback strategy, and whether behavior for the same question differs between thinking and non-thinking modes as expected.
6. Practical Recommendations
- Define who owns the flow: when you need precise control over query terms and fetch scope, prefer application-side orchestration.
- Declare the minimum: expose only the capabilities you need to reduce uncontrolled triggering.
- Drive the UI with citations: treat citations and tool events as the only basis for a “verified” label.
- Degrade gracefully: when search or fetching fails, show a readable message and a retry strategy.
- Govern files first: make parsing, chunking, and recall separate, observable stages.
- Keep evaluation reproducible: fix a sample set and compare citation coverage and stability across modes.
In summary, the “executor” of web access and file reading is not an either-or choice: the model makes the judgment, while the server or the application does the execution. Understanding the boundary, declaring capabilities correctly, and driving the UI with evidence are what matter when putting these capabilities into practice.
