LLM Application APIs: Who Executes Web Search and File Reading

    This article examines how execution boundaries are shifting in large language model application APIs, moving web retrieval, URL reading, and context assembly into a single server-side flow. It compares client-side orchestration with server-hosted tools, explains how to choose between them based on control over the workflow, and clarifies why declaring a tool does not guarantee that a live search occurred. It also covers how thinking modes affect retrieval behavior, key practices for turning files into usable context, and a practical checklist for developers building retrieval-augmented applications.

    1. Where the Problem Comes From: It Is Not About More APIs, It Is About Where Execution Happens

    A cloud provider recently opened up a set of LLM API capabilities aimed at the application layer. On the surface, this simply means more available endpoints. What actually affects architecture is that the execution boundary has moved: actions such as web retrieval, link reading, and context assembly can now be completed within the same server-side processing flow as model inference.

    For developers, the application layer still needs to exist. It remains responsible for session management, access control, result rendering, and persisting business data. What it no longer has to do is implement every “open a web page” or “call a search engine” step as a loop in client-side code. Understanding this is the first step in designing retrieval-augmented applications.

    2. Two Paths: A Question About “Comparing Product Updates”

    Suppose you are building an assistant that helps readers understand version updates. A user sends a link to an official page and asks what the update mainly fixed. This example only illustrates the flow and does not represent any measured result.

    Path 1: Client-Side Orchestration

    1. The application identifies the link in the user’s message.
    2. The application issues the web request and handles timeouts, redirects, download failures, anti-scraping measures, and main-content extraction.
    3. The application stitches the cleaned material into the context and passes it to the model.
    4. If the model decides the information is insufficient and more lookup is needed, the application calls the search API, receives the results, and starts another round.
    5. The loop continues until it converges or a fallback strategy is triggered.

    The division of labor on this path is clear: the model decides “whether to search and what to search for,” while the application makes the tools actually run and owns all the engineering details.

    Path 2: Server-Hosted Tools

    The client declares which capabilities are allowed in the request, and the server takes care of execution and filling results back in. Model judgment and tool execution are still two distinct stages; the difference is that developers no longer have to shuttle intermediate results back and forth themselves, which means less glue code and one fewer place for errors.

    How to Choose: Who Controls the Flow

    The official documentation clearly distinguishes two types of entry points: if you want the model to decide on its own when to go online, use the server-side tools in 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 APIs.

    The criterion is not complicated: who holds control of the flow. If you need strong determinism, auditable and reproducible query terms, choose the standalone APIs. If you want to reduce orchestration costs and let the model adaptively perform follow-up lookups, choose the server-side tools. The two can also be mixed, but the boundary should be clearly written in the design document.

    3. Declaring a Tool Does Not Mean It Will Go Online This Time

    Online capability must be explicitly declared in the request: one tool for search, and one for reading links in the user message. If you only want to read a specified link, you can declare only the latter to avoid unnecessary retrieval overhead.

    It is worth noting that these built-in tools cannot simply reuse the control approach of custom tools:

    • You cannot specify one of them through the tool-choice parameter; otherwise the request will be rejected (usually with a 400 response).
    • Whether to actually search or read a link is decided by the model based on the question.
    • If tool choice is set to “none,” these built-in capabilities are turned off 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 that this particular answer actually consulted external sources. To determine whether retrieval really happened, rely on structured signals such as returned tool events and citation sources, rather than labeling an answer as “verified” just because it sounds confident.

    A schematic request structure (expressing field relationships only, not a specific API):

    1. {
    2. "messages": [{"role": "user", "content": "Look at this link, what did this update fix? https://example.org/update"}],
    3. "tools": ["web_search", "read_url"],
    4. "tool_choice": "auto"
    5. }

    4. Thinking Mode Changes Retrieval Behavior

    With search enabled, turning thinking mode on or off makes a clear difference. When it is off, the model retrieves as needed for the question and provides citations, with a shorter path and lower latency. When it is on, the model can alternate among retrieval, opening pages, and locating content across multiple reasoning steps, forming multi-step verification.

    The value of a multi-step flow is that it creates opportunities to “keep following up on evidence,” but it does not guarantee that every conclusion is automatically correct. In engineering terms, it should be paired with citation backlinks, confidence hints, and a human review entry point, so that multi-step reasoning is not mistaken for a factual guarantee.

    5. Reading Files: First Turn the File into Usable Material

    File input is also not finished once you “send the file name to the model.” Document, spreadsheet, and image materials usually need text extraction or layout parsing before entering the conversation context. In practice, four points deserve attention:

    1. Parsing quality: whether columns, tables, headers and footers, and scanned pages are usable.
    2. Chunking strategy: split by semantic paragraphs while preserving locating information such as heading hierarchy and page numbers.
    3. Context budget: when material is too long, retrieve first and then assemble, rather than stuffing everything in.
    4. Traceability: build a mapping between answers and source snippets so users can verify them.

    If the material is large in scale, you can use object storage to keep the original files, a message queue to smooth out peaks, and logging and monitoring with alerts to track parsing failure rates, forming a closed loop. Baidu AI Cloud offers corresponding product categories for these general capabilities, which can be combined as needed.

    6. A Practical Checklist for Developers

    • Decide “who controls the flow” before choosing between hosted tools and standalone APIs.
    • Collect tool declarations, tool events, and citation information as observability metrics.
    • Design fallbacks and degradation for parsing failures, empty retrieval, and loops that fail to converge.
    • In product copy, distinguish “capability enabled” from “retrieved this time.”
    • For multi-step reasoning scenarios, preserve the evidence chain and a human review path.
    • Use a unified evaluation set to compare the two paths in terms of accuracy, latency, and cost.

    7. Conclusion

    Who completes web access and file reading is essentially a question of dividing responsibilities: the model makes judgments, the execution layer does the work, and the developer makes the trade-offs. Only when the boundary is drawn clearly can an application stay deterministic without losing flexibility.