LLM Web Search and File Reading: Who Owns the Execution Step

    This article breaks down the execution layer behind LLM web search and file reading, comparing client-side orchestration with server-side tools. It explains how to declare capabilities, why tool_choice restrictions matter, how thinking mode changes retrieval behavior, what file ingestion requires, and how to choose between the two paths based on control, observability, cost, and compliance. Readers will learn to verify whether an answer was actually grounded in external sources rather than trusting UI labels.

    1. The Starting Point: From “Answering” to “Retrieve, Then Answer”

    Letting a model answer directly and letting it gather evidence first are two very different engineering tasks. The first only requires sending a message and receiving text back from the inference side. The second requires wiring up retrieval services, fetching pages, extracting main content, cleaning noise, controlling length, and feeding the material back into the conversation context. The harder part is that a tool response is not the end: after seeing results, the model often issues another query, forcing the application into a “call, wait, backfill, call again” loop.

    A set of application interface capabilities recently opened by a cloud vendor moves part of this execution chain to the server side: retrieval, reading specified links, and context assembly can be completed within the same request semantics as inference. Developers still build the application, but they no longer have to implement every web action as a client-side loop.

    2. One Research Scenario, Two Paths

    Imagine an assistant that helps readers understand release notes: the user pastes a link to official documentation and asks which issues the update fixed. This is only to illustrate the flow and does not represent any measured conclusion.

    Under the self-orchestrated path, the application must: detect the link in the message; initiate the fetch; handle timeouts, retry on failure, and anti-scraping measures; extract the main content and strip navigation and ads; truncate or segment according to a length budget; and assemble the cleaned result into the prompt. If the model decides the information is insufficient, the application must also call the retrieval API, catch the results, and start the next round. The model makes the judgment; the application makes the tools actually run.

    Under the server-side tool path, the client only declares which capabilities are allowed, and execution plus material backfill are handled by the server. Judgment and execution remain two separate steps; the difference is that developers no longer have to shuttle intermediate results between them by hand.

    The official documentation clearly distinguishes the two entry points: use the in-conversation server-side tools if you want the model to decide on its own when to go online; use the standalone retrieval and fetch APIs if you want the application to control the query terms and receive retrieval or fetch results directly. The essential question in choosing a path is: who holds control of the flow.

    3. Declaring a Capability Does Not Force It to Trigger

    Web capabilities must be explicitly declared in the request: one type for retrieval and one for reading links in the user message. If you only want to read a specified link, you can declare only the latter.

    These two names look like ordinary functions, but they cannot use the full set of controls available to custom tools: the documentation states that you cannot select one of them via the tool selection parameter, otherwise a 400 is returned; whether retrieval or link reading actually happens is decided by the model; and setting tool selection to none disables these capabilities as well.

    This yields an important product conclusion: a UI showing “web access enabled” only means the capability is available; it does not prove that this particular answer actually consulted external sources. The application should judge based on returned tool events and citation information, rather than slapping on an “verified” label just because the answer sounds confident.

    1. {
    2. "tools": ["web_search", "read_url"],
    3. "tool_choice": "none"
    4. }

    4. How Thinking Mode Changes Behavior

    With retrieval enabled, turning thinking mode on or off produces behavioral differences. When it is off, the model retrieves as the question requires and provides citations. When it is on, the model can alternate across multiple reasoning steps among retrieving, opening pages, and locating snippets. A multi-step flow offers opportunities to keep verifying, but it does not guarantee that every conclusion is automatically correct; consistency between citations and the source text still needs validation on the application side.

    5. File Reading: Turn It into Usable Material First, Then Talk About Understanding

    File input is likewise not finished once you send the model a file name. Documents, spreadsheets, presentations, and images must go through text extraction or layout parsing before entering the context. Engineering typically includes: format detection and parsing, layout and reading-order restoration, preservation of table structure, routing images through multimodality or separate recognition, chunking and recall of oversized content, and page or paragraph annotations for traceability. Without this chain, the model can only answer based on incomplete text.

    6. Selection Advice and Common Pitfalls

    • If you need fine-grained control of the flow, custom query terms, and result post-processing: use the standalone APIs and orchestrate on the client.
    • If you want a simpler implementation and can accept the model deciding when to retrieve: use server-side tools.
    • Observability: log tool events, citation sources, and per-round latency so you can tell whether the model “did not search” or “searched wrong.”
    • Permissions and cost: estimate the worst-case multi-round retrieval and parsing overhead, and set limits on rounds and length.
    • Compliance: scraping and file handling require attention to authorization, privacy, and data retention policies; parse sensitive material in a controlled environment first.

    If the application runs in the cloud, you can place parsing and caching on a function compute or container platform, keep raw material in object storage, and hand tracing to logging and monitoring/alerting services; Baidu AI Cloud’s relevant general-purpose capabilities can serve as one hosting option. The core judgment is a single sentence: whoever controls the flow bears the execution.