arXiv(opens in a new tab)cs.CLOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.06689

Programmatic Search Agents: Extending Agentic Search Beyond Query Reformulation

Jiaming Qian, Huiyan Yang, Mandi Liu, Jie Liu, Wenkai Shen, Pengyang Zhou, Jing Jin, Jin Ma, Dezhi Ye, Chaochao Chen

ABSTRACT

Search agents adapt their queries, yet fixed search interfaces leave candidate processing and evidence presentation outside the agent's direct control. Our trajectory analysis shows that supporting passages can be retrieved yet never delivered to the agent; a same-page oracle intervention shows that changing the returned evidence can reduce subsequent search. We introduce Programmatic Search Agent (PSA), which makes a local executable computation over candidates the unit of a search action. PSA unifies a persistent candidate workspace, flexible primitive composition, and selective evidence presentation. It incrementally generates program cells that reuse candidates, execute dependent operations, and select what the agent inspects next. The runtime resolves specified data dependencies within each cell, while the agent adapts its search strategy across cells as new evidence arrives. We compare PSA with the Query-based Agent and Tool-based Agent on InfoSeek-Eval and BrowseComp-Plus using five policy backbones without task-specific training. All three interfaces share the search substrate, and the Tool-based Agent also shares PSA's primitives and persistent workspace. Relative to the Query-based Agent, PSA improves macro-averaged task success by 4.00 and 7.56 percentage points on the two benchmarks, respectively; within-backbone reductions in final-step tokens average 28.3% and 33.9%. These results support extending agent control beyond query reformulation to the processing and presentation of retrieved evidence. Code will be released subject to approval.

1 INTRODUCTION

Effective search requires more than finding relevant pages: an agent must also identify and use the evidence they contain. Large language model agents interleave reasoning and retrieval, reformulating queries to follow leads, resolve relations, and verify candidate answers (Jin et al., 2025b; Li et al., 2026). Yet a fixed search (query) interface leaves candidate processing outside the agent's direct control: the pipeline decides which candidates to retain, how to rank them, and which passages to return. The agent can revise its query, but cannot directly revisit those processing choices. This raises our central question: Should agents only reformulate queries, or also control how retrieved candidates are processed and presented?

Our motivating analysis shows why this distinction matters. In natural Query-based Agent trajectories on BrowseComp-Plus (Chen et al., 2026), supporting passages can reach the extraction stage without ever appearing in the agent's observations; later search recovers only some of these omissions (Section 2). A controlled oracle intervention reveals the downstream consequences: for complete omissions, substituting a supporting passage from the same retrieved page improves task success and reduces subsequent search decisions in the analyzed cohort. The bottleneck can therefore lie not only in finding evidence, but also in processing and presenting evidence already retrieved. These findings motivate giving the agent control over this part of the search process.

Exposing individual search operations as tools provides finer control, but leaves open the appropriate unit of interaction. In our stepwise Tool-based Agent, independent calls can be batched, whereas dependent stages require separate model turns to consume preceding outputs. However, a

∗^{*}Work done during internship at Tencent Yuanbao.

Query-based Agent

Tool-based Agent

PSA (Ours)

Figure

Figure 1: From query generation to programmatic search. All three agents iteratively act on search observations, but differ in their decision units: queries, tool calls, or a program cell. The Query-based Agent invokes a fixed search pipeline, the Tool-based Agent selects one primitive stage per turn (possibly batching independent calls), and PSA generates executable cells that compose operations over retained and new candidates. The illustrated cell filters retained candidates, conditionally retrieves and merges more candidates, then reranks and extracts evidence within one action.

data dependency need not require a new model judgment: once the agent has specified how to retrieve, rerank, and extract, the runtime can execute that sequence before returning control for further reasoning. Building on composable retrieval pipelines (Macdonald & Tonellotto, 2020), executable agent actions (Wang et al., 2024), and tool planning (Kim et al., 2024), we make a local computation over candidates the unit of a search action (Figure 1).

Inspired by Perplexity’s Search as Code architecture (Perplexity, 2026), we introduce Programmatic Search Agent (PSA). Conditioned on the task, interaction history, and a compact description of retained state, PSA incrementally generates executable program cells. Three mechanisms organize this control: a persistent candidate workspace retains objects for later reuse; flexible primitive composition combines retrieval, filtering, reranking, extraction, and deduplication through variables, collection operations, and bounded control flow; and selective evidence presentation determines which results become the next observation. For example, a cell can filter and re-extract from a retained pool without another query, then return selected source notes while keeping the underlying candidates available. Each new observation guides the next cell, so the search strategy evolves with the evidence. A cell may contain a single operation when immediate feedback is needed, or a dependent chain when its processing logic can already be specified.

We evaluate PSA against the Query-based Agent and Tool-based Agent on InfoSeek-Eval and BrowseComp-Plus with five policy backbones and no task-specific parameter training. All three interfaces share the same search substrate; the Tool-based Agent also shares PSA's primitives and persistent candidate workspace. PSA achieves the highest task success for all five backbones on InfoSeek-Eval and four of five on BrowseComp-Plus, while using the fewest final-step tokens in every backbone–dataset comparison. Relative to the Query-based Agent, macro-averaged task success improves by 4.00 and 7.56 percentage points on the two benchmarks, respectively; within-backbone reductions in final-step tokens average 28.3% and 33.9%. PSA also improves macro-averaged success over the Tool-based Agent, which shares its primitives and persistent workspace.

Our contributions are threefold: (i) an empirical analysis of evidence-delivery limitations in fixed search pipelines, using natural trajectories and a same-page oracle intervention; (ii) PSA, a search interface that unifies persistent candidate reuse, flexible primitive composition, and selective evidence presentation within executable cells; and (iii) a cross-model evaluation of task success and final-step tokens, complemented by controlled feedback and decision-budget experiments.

References (72)