Web Search Practices for Agent Task Planning and Execution Frameworks

    This article explains how to turn an LLM agent's web search capability into a controllable task-completion ability. It covers the division of work between a planning layer and an execution framework, how to design search as an explicit capability contract, source filtering and time constraints, query rewriting, an evidence-centered execution loop, safety boundaries for web-connected agents, observability and evaluation, and practical advice for building a minimal verifiable closed loop first.

    1. From “Model Answers” to “Task Execution”

    Large language models can understand questions, generate content, and propose solutions based on their existing knowledge, but the information encoded in model parameters cannot guarantee coverage of the latest situation at the time a task occurs. For issues such as policy changes, technical documentation updates, or service rule adjustments, relying solely on model memory easily produces outdated conclusions.

    Web search can supplement external information, but “connecting to search” does not equal “obtaining trustworthy answers.” Search results may contain outdated pages, reposted content, promotional material, and fragments irrelevant to the question. If an agent simply hands the top-ranked results to the model for summarization, it may still produce a fluent answer that lacks supporting evidence.

    Therefore, the engineering goal should not be merely to give the agent network access, but to establish a complete pipeline:

    Clarify the task → make a plan → retrieve candidate information → acquire and verify evidence → adjust the plan → generate a conclusion with supporting evidence.

    Task planning determines “what needs to be confirmed,” the execution framework constrains “how information is acquired and used,” and retrieval capability discovers “potentially relevant external material.” Only when the three work together can web access be converted into controllable task-completion ability.

    2. How the Planning Layer and Execution Framework Divide Responsibilities

    2.1 Planning Layer: Breaking User Questions into Verifiable Subtasks

    Planning is not generating a seemingly complete explanation of reasoning; it is producing a task list that can be executed and checked.

    For example, when a user asks “has a certain technical specification changed recently, and how should our existing system be adjusted,” the planning layer should identify at least the following subtasks:

    • Confirm which specification the user refers to and its applicable scope;
    • Find the currently effective version and its release date;
    • Obtain historical versions or changelogs;
    • Distinguish formal requirements, recommended measures, and explanatory material;
    • Map the changes to the relevant modules of the existing system;
    • Mark the parts that cannot be determined from public material.

    Each subtask should have inputs, expected evidence, and completion conditions. “Understand the latest situation” is not a sufficiently well-defined task; “find the current document from the issuing organization and confirm its effective date” is suitable for the execution layer.

    If the user has not provided region, version, or business context, and these factors would materially affect the conclusion, clarification should come first. If a general analysis can proceed anyway, assumptions must be explicitly stated so that default conditions are not mistaken for user facts.

    2.2 Execution Layer: Turning Plans into Constrained Actions

    The execution framework is the control layer between the model and external capabilities. It can take responsibility for state maintenance, tool scheduling, permission checks, retries, budget control, and logging.

    The planning layer may propose retrieval needs, but it should not directly decide that all external operations can be executed. The execution layer needs to check:

    • Whether the current action is within the allowed scope;
    • Whether the retrieval content contains sensitive information;
    • Whether call counts or time budgets have been exceeded;
    • Whether returned content meets basic format requirements;
    • Whether a retry, degradation, or handover to human judgment is needed.

    This division prevents the model from searching indefinitely due to a local misjudgment, and it also helps integrate different retrieval capabilities into a unified pipeline. Even if the underlying implementation changes, task state and evidence-handling logic can remain relatively stable.

    3. Designing Web Retrieval as an Explicit Capability Contract

    3.1 Input Is More Than Keywords

    A maintainable retrieval request should express task intent, not just pass a string of keywords. Internally, an application can organize the following information:

    • Retrieval goal: the specific fact to be confirmed this time;
    • Query text: the expression used to discover relevant material;
    • Time conditions: whether recent information is needed, or information from a specified historical period;
    • Source conditions: which types of publishing entities to prioritize;
    • Scope conditions: region, language, document type, or applicable audience;
    • Resource budget: allowed call counts, elapsed time, or number of candidate materials.

    These are application-layer design fields and do not represent the fixed interface of any existing service. During actual integration, they should be mapped according to the capabilities the retrieval tool genuinely provides. Constraints that the tool does not support need to be enforced during result processing, with the limitation noted for upper layers.

    3.2 Output Should Preserve Evidence Trails

    Retrieval results should at least help downstream modules identify a material’s title, source location, summary, and available time information. In the evidence-processing stage, the original passages supporting a conclusion, the corresponding subtask, and the acquisition time should also be recorded.

    A search result summary cannot be directly equated with original-source evidence. Summaries may be truncated or may omit qualifying conditions. For important facts that influence decisions, the original material should be obtained whenever possible, and the body text, attachments, and version notes should be checked.

    If the original page is inaccessible and only a summary is available, the evidence level should be explicitly downgraded, rather than writing unverifiable material as a definite conclusion.

    4. Correct Use of Source Filtering and Time Constraints

    4.1 Source Authority Must Be Judged per Question

    Authoritative-source filtering reduces noise, but it cannot be simplistically understood as “all content from a certain type of site is reliable.”

    For regulatory and policy questions, the issuing organization’s formal documents are usually more suitable than reposted articles for confirming original requirements. For technical behavior, official technical documentation, standards text, and reproducible test records carry different evidentiary value. For real-world operating results, the publisher’s own description cannot replace validation in the current environment.

    Source evaluation should therefore focus on four dimensions:

    1. Whether the publishing entity has direct responsibility for interpreting or issuing the matter;
    2. Whether the material is an original document rather than a secondary retelling;
    3. Whether the content applies to the version, region, and scenario under discussion;
    4. Whether any later corrections, retractions, or superseding documents exist.

    Preferred-source rules can improve retrieval efficiency, but they cannot replace verifying specific content. If multiple articles all cite the same unconfirmed material, they cannot be counted as multiple independent pieces of evidence.

    4.2 Distinguish Publication Date, Effective Date, and Crawl Time

    “Latest” is not a single time concept. A page’s update time, a document’s publication date, a regulation’s effective date, and the system’s crawl time can all be different.

    For example, a document published long ago may still be in force, while a freshly updated introductory page may reference an old version. When judging the current state, version relationships and validity should be confirmed first, rather than simply sorting by page date.

    Time-range filtering is suitable for discovering recent changes, but it may miss foundational rules that remain in effect. A more robust approach is to separately retrieve “currently effective basis” and “recent change materials,” then verify the relationship between the two.

    If a material has no reliable date, it should be marked as time-unknown; the model should not infer dates from the tone of the text or from search ranking.

    5. Automatic Query Rewriting: Improving Recall Without Changing the Question

    A user’s natural-language expression usually contains business context but may not be directly suitable for retrieval. Query rewriting can split a long question into several clearer retrieval expressions and supplement them with common terminology, version conditions, and document types.

    For example, “will the recent specification adjustments affect our legacy system” can be decomposed into:

    • Specification name plus current effective version;
    • Specification name plus revision notes;
    • The version used by the legacy system and its applicable scope;
    • Transition periods, compatibility requirements, and exception conditions.

    Rewriting must preserve the user’s core constraints. “Current requirements in a specific region” must not be broadened into nationwide requirements, and “whether adjustment is mandatory” must not be rewritten as “how to upgrade,” which would presuppose that adjustment is necessary.

    It is advisable to preserve the correspondence between the original question and each round of queries, and to record the reasons for rewriting. Any newly added condition that would affect the conclusion should be confirmed by the user or noted in the final answer.

    Query expansion should also have an upper limit. When results are insufficient, one round of terminology rewriting or source expansion can be added; when several consecutive rounds yield no new valid evidence, retrieval should stop and the information gap should be stated.

    6. Building an Evidence-Centered Execution Loop

    A practical execution process can adopt the following states:

    Pending clarification, pending retrieval, pending verification, conflicting evidence, evidence sufficient, unconfirmable, completed.

    Each subtask maintains its state independently. This prevents the failure of one step from blocking the whole task, and prevents locally insufficient evidence from being hidden inside a complete-looking answer.

    The recommended flow is:

    1. Establish subtasks and completion conditions from the user’s question;
    2. Generate initial retrieval requests for each subtask;
    3. Filter out results that are clearly irrelevant, duplicated, or out of scope;
    4. Obtain key original materials and extract evidence directly related to the task;
    5. Compare materials across versions, dates, applicable scope, and conclusions;
    6. Perform limited supplementary retrieval for missing items;
    7. Decide whether to answer, clarify, or retain uncertainty based on evidence state;
    8. Associate the final conclusions with evidence item by item.

    When evidence conflicts, the model should not simply “pick the more trustworthy paragraph.” First determine whether the conflict stems from version differences, regional differences, differing term meanings, or different material update times. Only after these factors are ruled out should genuine factual conflict handling begin.

    If the conflict still cannot be resolved, the disagreement and its impact on the conclusion should be presented explicitly, and manual verification should be recommended when necessary.

    7. Safety Boundaries a Web-Connected Agent Must Have

    7.1 External Web Pages Are Data, Not Instructions

    Web pages, documents, and search summaries may all contain text that asks the agent to change its behavior. Such content must always be treated as material to be analyzed; it must not override system rules or trigger additional permissions.

    The execution framework needs to isolate external content from control instructions. Retrieved material can support factual judgments, but it must not be used to automatically modify access permissions, submit data, or perform write operations.

    7.2 Check for Sensitive Information Before Querying

    User questions may contain internal project codenames, account information, personal data, or undisclosed business data. Sending the complete question directly to an external retrieval service may cause unnecessary information exposure.

    A safer approach is to first extract the public concepts needed to complete the task and remove internal identifiers that do not affect retrieval. If sensitive information is irreplaceable and an external query is genuinely necessary, it should be handled according to the organization’s data governance requirements, not decided by the model on its own.

    7.3 Separate Retrieval Permissions from Business Operation Permissions

    Discovering material, reading material, and modifying business systems should fall under different permission boundaries. An agent used for information lookup should not by default obtain configuration-modification or data-write permissions.

    For high-impact operations, the operation target, basis, and expected impact should be presented, with manual confirmation or an independent approval step in place.

    8. Exception Handling, Observability, and Effectiveness Evaluation

    Failures of web-connected tasks appear not only as tool errors but also as “seemingly successful runs with insufficient evidence.” Engineering implementations should distinguish connection failures, access restrictions, empty results, parsing failures, stale information, and factual conflicts.

    Transient failures may be retried a limited number of times; permission problems should not be retried repeatedly; insufficient evidence should trigger query adjustment or lower answer certainty. If the system cannot complete online verification, it may provide background explanation, but it must clearly state that the latest status has not been confirmed.

    Logs should record plan versions, retrieval intent, call status, evidence identifiers, and stop reasons. When sensitive content is involved, redaction, access control, and reasonable retention periods should be applied, so that debugging does not expand data exposure.

    Evaluation should not look only at whether the answer reads fluently. It is recommended to combine manual spot checks with test sets and examine:

    • Whether subtasks cover the user’s key concerns;
    • Whether key facts have applicable and verifiable evidence;
    • Whether cited content genuinely supports the corresponding conclusion;
    • Whether time, version, and scope qualifications are complete;
    • Whether repost duplication and evidence conflicts are identified;
    • Whether uncertainty is correctly retained when information is insufficient;
    • Whether call counts, response time, and cost remain controllable.

    These metrics should be used together. Simply increasing the number of searches may increase the volume of material without necessarily improving answer quality.

    9. Implementation Advice: Start with a Minimal Verifiable Closed Loop

    When building for the first time, there is no need to introduce complex autonomous planning immediately. Start with a query scenario with clear boundaries, using fixed subtask templates, a limited number of retrieval rounds, and clear source rules, to verify that the “question–evidence–conclusion” linkage is reliable.

    On that foundation, gradually add dynamic query rewriting, conflict handling, result caching, and plan adjustment. Cache validity should be set according to how frequently the material updates and the business risk involved; a single retrieval result must not be treated as current fact for a long time.

    Ultimately, a reliable web-connected agent is not the system that searches the most or answers the fastest, but the one that knows what to look up, what to base its answers on, and when to stop and admit that something has not been confirmed—all within limited resources. Task planning provides direction, the execution framework provides boundaries, and evidence management provides a trustworthy foundation. Together, the three determine whether an application can move from demo to stable operation.