LLM Web Access and File Reading: Who Owns Execution Control
This article explains execution ownership in LLM applications when handling web access and file reading. It compares two implementation paths—application-side orchestration and server-side tools—and shows that the real difference is who controls the workflow, not whether the model can go online. You will learn why tool availability does not guarantee a live web lookup, how to choose between in-session server tools and standalone retrieval APIs, how thinking mode changes search behavior, and how to turn files into structured context through parsing, chunking, and retrieval. A practical engineering checklist covers permissions, observability, trust, cost, and prompt injection defense.
1. The Starting Point: One “Look It Up” Request, Two Implementation Paths
To understand execution ownership, start with a typical scenario: a user sends a product website link and asks what the latest update fixed. This example only illustrates the flow and does not represent any measured result.
In the first path, the application handles the orchestration itself. It identifies the link in the user message, issues the web request, handles timeouts, redirects, and download failures, then performs content extraction (removing ads, navigation, and footers) and appends the cleaned text to the context for the model. If the model decides the information is insufficient, the application must also call a search API, receive the results, and continue into the next round until the model stops requesting new tools.
The second path hands execution to the server side. The client declares the capabilities it is allowed to use in the request, and the server performs the actual search or fetch and backfills the results into the context, completing this within the same or consecutive server-side flows alongside model inference.
The difference between the two paths is not “whether it can go online” but who holds workflow control. In the first path, the model makes judgments while the application makes the tools actually run. In the second path, judgment and execution still belong to separate stages; only the transport of results is handled by the server.
2. The Nature of the Division: Model Decisions and Tool Execution Are Two Stages
The responsibilities become clearer when separated:
- Model side: understanding intent, deciding whether to issue a tool call, deciding the query terms or which link to read, and summarizing and citing the returned material.
- Execution side: network access, page download, content extraction, search recall, and result truncation and backfill.
No technical solution can merge these two into one—a model cannot replace a network request, and a network request will not make judgments for the model. So-called “server-side tools” change where execution belongs and where results are backfilled, not the division of labor itself.
This leads to a frequently overlooked conclusion: tool availability ≠ this answer went online. A UI showing “web access enabled” only means the capability is declared and the channel is available; whether a search or link read is actually triggered is still decided by the model based on the question. If you need certainty, the application must hold the trigger.
3. Choosing Between the Two Entry Points: Let the Model Decide or Let the Application Decide
A common industry practice is to split entry points into two categories, with a single selection criterion: who owns workflow control.
The first category is in-session server tools. These suit open-ended Q&A, where the developer only declares capabilities and the model decides when to go online and which link to read. A typical declaration looks like this:
{"tools": [{ "type": "deepseek_web_search" },{ "type": "deepseek_read_url" }]}
The second category is standalone retrieval and fetch APIs. These suit scenarios where the application must control the query terms itself, decide the fetch targets itself, or feed results into its own pipeline (storage, secondary processing, batch comparison).
The two entry points also differ in constraints, which should be confirmed during the design phase:
- Server tools usually cannot be precisely selected via
tool_choice; forcing a selection returns 400 directly. - Setting
tool_choicetononealso disables these server tools. - Whether a search or link read is actually executed is decided by the model and cannot be inferred by the application from the declaration alone.
Therefore, if the business requires “every answer must have a verifiable external source,” the correct approach is the application-controlled path, where the application explicitly initiates retrieval and fetching and assembles the context itself. For an open-ended assistant with low orchestration cost, in-session tools are more suitable.
4. Behavioral Differences from Thinking Mode
With the same search capability declared, enabling thinking mode produces observable behavioral differences. When disabled, the model typically searches once as needed and provides citations. When enabled, the model may repeatedly search, open pages, and locate passages across multiple reasoning steps.
The value of a multi-step flow is the opportunity to keep verifying: a rough search to locate, close reading of the source, then cross-validation. But it also amplifies two risks: increased latency and call volume, and errors in intermediate steps propagating forward. The engineering response is to write “trust requirements” into the product definition—enable multi-step verification for scenarios that need verifiable citations and retain the sources; limit the step count for latency-sensitive interactions.
5. File Reading: Materialize First, Then Enter the Context
File input does not end with “sending the file name to the model.” PDFs, Office documents, and images must go through text extraction or layout parsing to become structured material that can enter the context before Q&A is possible.
A practical processing chain typically includes:
- Storage and validation: the file first enters object storage, recording type, size, and checksum to avoid large files blocking the request path.
- Type detection and parsing dispatch: text-based PDFs are extracted directly; scanned PDFs and images go through layout analysis or recognition; tables are restored into structured rows separately.
- Cleaning and chunking: remove headers and footers, merge broken lines, split by semantic boundaries, and retain locators such as page numbers.
- Vectorization and recall: chunks are written into a vector retrieval service and relevant segments are recalled during Q&A.
- Context assembly and citation: control the injected length and annotate source locations so answers can include verifiable references.
Sample code (pseudo-implementation, showing order only):
raw = storage.get(file_id)doc = parser.parse(raw) # text extraction / layout parsingchunks = cleaner.split(doc, keep_page=True)index.upsert(chunks) # write to vector retrievalhits = index.search(question, top_k=5)answer = model.chat(context=render(hits))
6. Engineering Checklist: Caging Uncertainty
- Least privilege: declare only the tools the current scenario truly needs; if reading a link is enough, do not enable search.
- Observable failures: set timeouts, retries, and fallbacks for fetching and parsing, and log a summary of each tool call’s input and output to trace “whether it actually looked this up.”
- Trustworthy results: attach sources to external information in answers where possible; when there is no source, clearly mark it as model inference.
- Cost control: limit tool calls per round and injection length; for long documents, recall first, then inject.
- Security boundary: apply prompt injection protection to fetched content; treat external text as material, not instructions.
7. Conclusion
Opening up web access and file reading essentially extracts “execution” from the client-side loop and hands it to the server to complete uniformly, while “judgment” remains on the model side. Developers have only two decisions to make: which side holds workflow control, and how material is reliably structured. Once these two points are clear, orchestration complexity, latency, and answer trustworthiness have predictable boundaries.
