Paper deep dive
Clearing the Fog: Towards Installing and Refining Proactive Exploration Capabilities in LLM Agents
Zhizhao Guan, Chen Huang, Ziming Liu, Hongru Liang, Wenqiang Lei, See-Kiong Ng, Tat-Seng Chua, Anthony G Cohn
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 94%
Last extracted: 8/17/2026, 5:31:38 AM
Summary
The paper introduces SaFaRi, a novel method to instill and refine proactive exploration capabilities in Large Language Model (LLM) agents. It addresses two bottlenecks in standard SFT-RL pipelines: hindsight bias in training data and exploration collapse during reinforcement learning. SaFaRi utilizes Exploratory Data Construction via tree-structured context modeling to synthesize exploration-rich trajectories and RL Optimization with Contrastive Signal Guidance using Monte Carlo rollouts and Direct Preference Optimization (DPO) to distinguish productive exploration from redundant wandering. Experiments on WebShop, InterCode-SQL, and ScienceWorld benchmarks demonstrate significant improvements in task performance and exploration efficiency.
Entities (12)
Relation Signals (10)
SaFaRi → consistsof → RL with Contrastive Signal Guidance
confidence 95% · ...and (2) RL Optimization with Contrastive Signal Guidance...
SaFaRi → consistsof → Exploratory Data Construction
confidence 95% · Specifically, SaFaRi consists of two components: (1) Exploratory Data Construction...
SaFaRi → evaluatedon → WebShop
confidence 95% · We conduct extensive experiments across diverse benchmarks... WebShop... InterCode-SQL... ScienceWorld
SaFaRi → evaluatedon → ScienceWorld
confidence 95% · We conduct extensive experiments across diverse benchmarks... ScienceWorld...
SaFaRi → evaluatedon → InterCode-SQL
confidence 95% · We conduct extensive experiments across diverse benchmarks... InterCode-SQL...
SaFaRi → improves → Proactive Exploration
confidence 95% · SaFaRi, a novel method designed to inStill And reFine proActive exploRatIon capabilities in LLM agents.
SaFaRi → mitigates → exploration collapse
confidence 92% · ...distinguish productive exploration from redundant wandering... mitigate... exploration collapse
SaFaRi → mitigates → Hindsight Bias
confidence 92% · ...mitigate the hindsight bias of standard demonstrations...
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:We study proactive exploration in LLM agents, i.e., the ability to explore an environment to acquire information that improves future decision-making. In this regard, we first identify two fundamental bottlenecks that hinder this capability and then propose \ours, a novel method designed to instill and refine proactive exploration. Specifically, \ours\ consists of two components: (1) Exploratory Data Construction, which synthesizes exploration-rich trajectories to mitigate the hindsight bias of standard demonstrations; and (2) RL Optimization with Contrastive Signal Guidance, which leverages contrastive trajectory pairs to distinguish productive exploration from redundant wandering. Extensive experiments demonstrate the effectiveness of \ours\ and provide insights into the characteristics of proactive exploration. Our code is available at: this https URL.
Tags
Links
- Source: https://arxiv.org/abs/2608.14339v1
- Canonical: https://arxiv.org/abs/2608.14339v1
Trouble viewing inline? Open PDF directly →
Full Text
113,633 characters extracted from source content.
Expand or collapse full text
Clearing the Fog: Towards Installing and Refining Proactive Exploration Capabilities in LLM Agents Zhizhao Guan Affiliation: Engineering Research Center of Machine Learning and Industry Intelligenceguanzhizhao@stu.scu.edu.cn, huang_chen@nus.edu.sg Chen Huang Thanks: Corresponding author. Affiliation: National University of Singapore Ziming Liu Hongru Liang Affiliation: Engineering Research Center of Machine Learning and Industry Intelligenceguanzhizhao@stu.scu.edu.cn, huang_chen@nus.edu.sg Wenqiang Lei Affiliation: Engineering Research Center of Machine Learning and Industry Intelligenceguanzhizhao@stu.scu.edu.cn, huang_chen@nus.edu.sg See-Kiong Ng Affiliation: National University of Singapore Tat-Seng Chua Affiliation: National University of Singapore Anthony G Cohn Affiliation: University of Leeds [-1em] Sichuan University Abstract We study proactive exploration in LLM agents, i.e., the ability to explore an environment to acquire information that improves future decision-making. In this regard, we first identify two fundamental bottlenecks that hinder this capability and then propose SaFaRi, a novel method designed to instill and refine proactive exploration. Specifically, SaFaRi consists of two components: (1) Exploratory Data Construction, which synthesizes exploration-rich trajectories to mitigate the hindsight bias of standard demonstrations; and (2) RL Optimization with Contrastive Signal Guidance, which leverages contrastive trajectory pairs to distinguish productive exploration from redundant wandering. Extensive experiments demonstrate the effectiveness of SaFaRi and provide insights into the characteristics of proactive exploration. Our code is available at: https://github.com/GuanZhizhao/SAFARI. 1 Introduction In multi-turn interactive tasks like online shopping 20; 29; 8, agents must continuously make decisions based on information acquired during interaction. Taking Figure 1 for example, when purchasing a low-cost shoe with specific attributes, the agent must decide whether to settle for a currently satisfactory item (A3A_3), or continue browsing subsequent pages for a potentially better alternative (A6A_6). Such scenarios require a critical capability: Proactive Exploration, which is the ability to autonomously expand its action trajectory beyond immediately local optima. This capability is fundamental for real-world agents, where optimal decisions often cannot be derived from the current observation alone, but instead emerge through strategic exploration over extended interaction horizons 4. Figure 1: Proactive exploration in online shopping. Agent proactively executes strategic backtracking and pagination to locate the product with better price. As Large Language Models (LLMs) continue to advance, LLM-based agents have excelled in multi-turn interactive tasks 20; 29. The prevailing paradigm for developing these agents involves Supervised Fine-Tuning (SFT) on expert trajectories 10; 12; 2; 23, followed by Reinforcement Learning (RL) to iteratively refine decision-making 1; 15; 14; 18; 24. However, our preliminary experiments (Section 3) reveal that existing agents severely lack the capability for proactive exploration. In scenarios like online shopping, they exhibit rigid behavioral patterns, rarely executing exploratory actions (e.g., navigating to the "Next Page"). Consequently, they fail to strategize over extended horizons, frequently settling prematurely for suboptimal choices and yielding inferior overall rewards. We attribute this failure to a two-stage bottleneck inherent in the standard SFT-RL pipeline: 1) Hindsight Bias in SFT Data: Expert trajectories inherently strip away essential exploratory steps. Standard SFT merely conditions agents for reactive execution, failing to instill proactive exploration capabilities. 2) Exploration Collapse during RL: Because SFT-ed agents naturally lack exploratory tendencies, they rarely sample such behaviors during RL rollouts, making it nearly impossible to discover their long-term benefits. Compounded by a lack of guidance, the RL process inevitably fails to reinforce proactive exploration. To this end, we propose SaFaRi, a novel method designed to inStill And reFine proActive exploRatIon capabilities in LLM agents. Specifically, it consists of two modules: 1) Exploratory Data Construction. Instead of human expert trajectories, we synthesize exploration-rich data directly from a powerful LLM expert. By employing a tree-structured context modeling, we explicitly distill diverse exploratory paths from the LLM expert, coupled with a customized screening mechanism to curate high-quality, exploration-oriented trajectories for the student agent’s SFT initialization. 2) RL with Contrastive Signal Guidance. We construct contrastive preference pairs by pitting a student-generated candidate action against the reference action at identical interaction states. By estimating their expected future returns via Monte Carlo (MC) rollouts, these contrastive signals provide fine-grained supervision to optimize the agent’s decision boundary. Thus SaFaRi alternates between strategic exploration and direct task execution, improving the task performance. We conduct extensive experiments across diverse benchmarks to evaluate SaFaRi. Results demonstrate that SaFaRi significantly outperforms competitive baselines in both task success (∼ 10%-15%, on average) and exploration efficiency (∼ 8%-18%). Additionally, our analyses illustrate that true performance improvements stem from exploration efficiency. SaFaRi learns to acquire task-relevant information while avoiding redundant interactions, whereas existing methods remain either passive or inefficient. Moreover, exploration benefits also grow with task difficulty. SaFaRi automatically scales its exploratory behavior in harder environments and achieves the largest gains on tasks that require substantial information gathering before decision-making. Our contributions are as follows: • We highlight the critical necessity of proactive exploration for LLM-based agents and identify two fundamental bottlenecks in existing methods. • We propose SaFaRi, designed to instill and refine proactive exploration capabilities in LLM agents. It features two customized modules to directly mitigate the two bottlenecks, respectively. • We conduct extensive experiments across various benchmarks to demonstrate the effectiveness and characteristics of SaFaRi. 2 Related Work Early interactive agents primarily relied on prompt-based planning 11; 22 or imitation learning 10; 2, limiting their behavior to observed state–action distributions 13. To improve adaptability, recent work has introduced exploration-driven RL training and iterative self-improvement 14; 18; 24. However, hindsight bias and exploration collapse often result in insufficient proactive exploration and yielding suboptimal solutions. To address this issue, recent research has proposed error recovery after explicit failures, achieved by corrective trajectories 16; 3 and MCTS-based self-improvement 26; 25. Nevertheless, since these methods intervene only upon failure, they discourage exploration beyond reward-sufficient trajectories, often converging to local optima. Method Avg. Len Task-Oriented Actions (%) Exploratory Actions (%) Search Open Select Buy Next Back Home Total SFT-Only 2 3.33 30.15 30.15 9.85 29.85 0.00 0.00 0.00 0.00 ETO 14 4.32 23.13 22.99 28.69 24.84 0.12 0.23 0.00 0.35 IPR 18 4.39 23.22 22.18 29.89 24.60 0.00 0.11 0.00 0.11 STeCa 16 4.87 20.85 24.59 28.22 25.31 0.00 0.21 0.83 1.04 Human Expert Trajectories 20 3.64 28.20 27.69 16.51 25.31 0.00 0.10 0.00 0.00 Table 1: Comparison of action across baselines and human expert SFT trajectories in WebShop. Another line of work improves decision-making via structured representations. Tree-based reasoning methods enhance state visibility and search efficiency 21; 28; 9. Recent methods construct interaction graphs 5 or exploit webpage hierarchies 27 to guide navigation. However, these methods are designed for web environments and operate as external search tools rather than policy-level mechanisms, limiting their applicability to broader domains such as database manipulation and scientific environments. 3 Preliminary Experiments We investigate the exploration capabilities of existing methods from two aspects: agents’ behavioral action distributions and their training dataset. 3.1 Evaluation Setup Dataset & Exploratory Actions. We select WebShop 20 as our testbed due to its inherent decoupling of exploratory behaviors from terminal task execution, allowing for a precise analysis of the agent’s exploratory tendencies. Specifically, we categorize the action space into: (1) Task-Oriented Actions (Search, Open, Select, Buy), dedicated to immediate execution; and (2) Exploratory Actions (Next, Back, Home) designed to actively explore the environment. Ultimately, we conduct a statistical analysis of these action distributions to diagnose the cause of agent failure. Baselines. We evaluate three categories of baselines: 1) SFT-Only 2, where agents are fine-tuned exclusively on standard expert trajectories; 2) SFT-RL, the prevailing paradigm that sequentially applies SFT and RL, represented here by two state-of-the-art approaches, ETO 14 and IPR 18, which employ trajectory-level and step-level supervision, respectively; and 3) SFT-RL-Correction, represented by STeCa 16, which augments the standard SFT-RL with post-hoc corrections by advanced LLM. All baselines utilize Meta-Llama-3.1-8B-Instruct 6. 3.2 Main Findings Table 1 summarizes the results of the action distribution analysis. Evidently, both existing methods and the underlying SFT data profoundly lack exploratory actions. We highlight two bottlenecks. 1) Hindsight Bias in SFT Data. Expert trajectories strip away essential exploratory steps, with exploratory actions comprising a negligible 0.10%. Consequently, initializing agents on such biased corpora merely conditions them for purely reactive execution. This is exemplified by the SFT-Only baseline on WebShop, which exhibits near-zero exploratory actions (e.g., Next or Back), failing to instill the core capabilities required for proactive exploration. 2) Exploration Collapse during RL. Even with RL (ETO, IPR) or post-hoc correction (STeCa), we observe no qualitative shift in exploratory action distributions. Instead, these methods converge toward myopic optimization, merely refining item selection (i.e., ∼ 20% gains in distribution) within the current observation. Lacking exploratory tendencies in the SFT-ed policy, exploratory actions are rarely sampled during rollouts, preventing the agent from discovering their long-term rewards. As corroborated by our case studies (Appendix D) and main experiments (Section 5.2), this deficit leads to significant performance degradation in complex tasks. Thus, it is imperative to incorporate an exploration-rich SFT dataset and RL mechanisms that shift the agent’s behavior from reactive execution to proactive exploration. Figure 2: Overview of SaFaRi. 4 SaFaRi: The Method Notations. Following 18, we formulate the interactive task as a Markov Decision Process, defined by the tuple ℳ=(,,,,,ℛ)M=(U,S,A,O,T,R). Here, ,,U,S,A, and O denote the spaces for natural language instructions, states, actions, and observations, respectively, governed by the transition function :×→T:S×A and reward function ℛ:×→[0,1]R:S×A→[0,1]. Given an instruction u∈u , the agent interacts sequentially. At step t, it samples an action at∼πθ(⋅∣ht−1)a_t _θ(· h_t-1) conditioned on the history ht−1=(u,a1,o1,…,at−1,ot−1)h_t-1=(u,a_1,o_1,…,a_t-1,o_t-1). Executing ata_t transitions the environment to state sts_t and yields observation oto_t. The episode terminates at step N (upon task completion or reaching a step limit), resulting in a final trajectory hNh_N and a reward R(hN)R(h_N), which serves as a metric for task success 20; 19; 17. Overview of SaFaRi. As illustrated in Figure 2, SaFaRi comprises two synergistic modules: (1) Exploratory Data Construction, which adopts a teacher-student framework and synthesizes exploration-rich trajectories from the teacher to mitigate the hindsight bias inherent in standard trajectories; and (2) RL with Contrastive Signal Guidance, which leverages contrastive sample pairs to calibrate the student’s decision boundary. This calibration enables the agent to distinguish valid exploration from redundant wandering, thereby optimizing the critical trade-off between information gathering and direct task execution. 4.1 Exploratory Data Construction This module elicits diverse exploratory paths from the LLM expert, coupled with a customized filtering mechanism to curate high-quality, exploration-oriented trajectories for the SFT initialization. 4.1.1 Data Distillation Motivation & Idea. Manually curating high-quality, exploration-rich expert trajectories is prohibitively expensive and time-consuming. To circumvent this, SaFaRi proposes distilling these trajectories directly from a powerful LLM expert. However, off-the-shelf LLM experts themselves may struggle to exhibit strong proactive exploration capabilities. As empirically analyzed in Section 5.3.3, this deficiency stems from their limited context modeling capacities in complex, multi-turn environments. Relying on unstructured histories (i.e., u→a1→o1…→an→onu→ a_1→ o_1…→ a_n→ o_n) may induce disorientation. As steps accumulate, the LLM loses track of global task states, its context window becomes polluted by local errors, and it ultimately regresses to conservative, reactive behaviors. To overcome this bottleneck, we introduce a structured context modeling mechanism, which formulates the history as a tree to track multi-turn interactions. Tree-Structured Context Modeling. We employ a tree structure to model the interaction context and track trial-and-error exploration. Formally, at step t, the context is represented as a tree t=(Vt,Et)T_t=(V_t,E_t), where each node v∈Vtv∈ V_t denotes an executed action augmented with a cognitive note summarizing environmental feedback and key insights, each edge e∈Ete∈ E_t captures the sequential parent-child dependency between actions, and ptp_t is a global pointer indicating the current active state. Through operations such as branch creation and backtracking, the agent can dynamically revise and refine the tree branches over long horizons (see Figure 2). This formulation grants the agent active structural agency over its context via two core operations. • Autonomous Backtracking. When a path proves unpromising (e.g., yielding no matching items at A1A_1 in Figure 2), the agent is prompted to autonomously backtrack by relocating ptp_t. Depending on specific environment constraints, this is achieved either via environmental backward actions (e.g., executing the "Home" action at A2A_2) or direct pointer modification (see in Appendix D). Consequently, the subsequent action naturally spawns a parallel exploration branch (e.g., branching from A1A_1 to A3A_3), isolating the failed trajectory while preserving its topology. • Active Feedback Digestion: The agent is also prompted to attach or update cognitive notes on specific nodes using environment observations. Crucially, these notes combine explicit control labels with text records of environment assets. For instance, in Figure 2, A1A_1 is explicitly annotated as a dead end ("Not Match Item"), while A4A_4 is annotated with a precise status ("With Red, XL Shoe But Price > $100"). Crucially, if the agent approaches the maximum step limit without discovering a optimal solution, it can strategically backtrack to a recorded suboptimal node (like A4A_4) to secure a viable partial reward. Full operational details are provided in Appendix A. Structured Context Guided Data Distillation. We equip the teacher model (e.g., GPT-4o) with this tree scaffold to construct high-quality trajectories. Driven by this mechanism, the teacher explicitly searches, annotates, and backtracks, capturing complete trial-and-error trees. Consequently, SaFaRi distills not merely the final success path, but the authentic cognitive reasoning and complete interaction trajectories, effectively eradicating the hindsight bias inherent in standard expert datasets. 4.1.2 Data Screening Motivation & Idea. While the tree-structured context unlocks the LLM expert’s exploratory potential, it can occasionally induce over-exploration, leading to unnecessarily lengthy paths or eventual task failure. This motivates us to screen these trajectories for high-quality proactive behaviors. For each task, we independently sample m trajectories from the constructed dataset and evaluate them using a length-penalized reward: rfinal=r(h)−n⋅γr_final=r(h)-n·γ (1) where r(h)∈[0,1]r(h)∈[0,1] is the task success reward, n is the step count, and γ is a penalty factor. We select the candidate that maximizes rfinalr_final to form our reference trajectory set refD_ref. This formulation inherently favors concise execution, rigorously penalizing redundant wandering while preserving only necessary, meaningful exploration. Additionally, to further enhance trajectory quality, we further apply a strict performance filter to refD_ref, retaining exclusively successful trajectories (r(h)=1r(h)=1) to construct the final base dataset baseD_base for SFT. As such, this structured construction explicitly internalizes the teacher’s proactive logic, endowing the student with a robust initialization for proactive exploration. Finally, we perform SFT on the student agent using our dataset baseD_base. To prevent overfitting and preserve foundational capabilities prior to subsequent preference optimization, this SFT phase is kept intentionally brief (e.g., 1 epoch). As such, SaFaRi equips the student with a robust, exploration-aware initialization. 4.2 RL with Contrastive Signal Guidance Motivation & Idea. While SFT endows the agent with basic exploration skills, it lacks the explicit feedback required to master the precise timing of when to explore versus when to execute. To calibrate this decision boundary, we frame proactive exploration as a preference optimization problem. Inspired by 18, we construct contrastive preference pairs between student-generated actions and teacher reference actions, utilizing MC rollouts to objectively quantify their expected future returns. Ultimately, we apply Direct Preference Optimization (DPO) on these scored pairs to explicitly enforce this proactive decision boundary. Contrastive Pair Construction. We generate contrastive pairs by isolating pivotal moments where the agent must determine its interaction strategy. Using a shared interaction context sts_t (comprising the instruction, current observation, and tree history) from the reference set refD_ref as the common starting point, we pair the reference action a∗a^* with a candidate action a^∼πθ(⋅∣st) a _θ(· s_t) generated by the student agent. Since both a a and a∗a^* can manifest as either a standard execution step or a proactive exploratory action, this bifurcated pair naturally encompasses diverse behavioral contrasts such as effective exploration versus redundant wandering, or strategic exploration versus direct task execution. By explicitly pitting these divergent choices against each other, we create a comparison space that enables the model to learn the most beneficial strategy. Reward Estimation for Pairs via MC Rollouts.. To objectively determine the utility of each ‘action branch’ within the contrastive pairs, we employ MC rollouts to estimate their respective future returns. To prevent backward loops from inflating rollout variance, we employ a forward-only evaluator (πMC _MC). This evaluator is specifically trained on an Forward-Pure Set (scoreD_score), which is curated by pruning all backward actions from baseD_base to retain only the most direct paths to success. By utilizing this "focused" policy, we perform multiple rollouts from both candidate actions to the terminal state. The step-level value is defined as the expected terminal reward: rstep(a|st)=τ∼πMC[R(τ)|st,a],r_step(a|s_t)=E_τ _MC[R(τ)|s_t,a], (2) where a∈a^,a∗a∈\ a,a^*\ and R(τ)∈[0,1]R(τ)∈[0,1] is the aggregate task success reward. This scoring mechanism provides a quantitative ground truth for the proactive dilemma: it reveals whether an exploratory "detour" ultimately facilitates a higher success rate compared to immediate execution. Optimization via DPO. Based on the estimated values, we construct preference pairs where the higher-rewarding action is labeled as the preferred response. By optimizing the student agent via DPO, alongside an SFT regularization term to mitigate catastrophic forgetting, we effectively calibrate the agent’s proactive decision boundary. To ensure the agent learns from decisive strategic choices rather than stochastic evaluation noise, we filter the preference pairs using a margin threshold τm _m, retaining a pair only if the reward gap satisfies |rstep(a^|st)−rstep(a∗|st)|>τm|r_step( a|s_t)-r_step(a^*|s_t)|> _m. ℒ=ℒDPO+ℒSFTL=L_DPO+L_SFT (3) Base Model Method WebShop InterCode-SQL ScienceWorld TP ↑ ES ↑ TP ↑ ES ↑ TP ↑ ES ↑ GPT-4o (teacher) Direct Prompt 0.5765 0.6877 0.6364 0.7339 0.7156 0.8451 Tree-Structured Prompt (SaFaRi) 0.7062 0.7931 0.7275 0.8578 0.7581 0.8471 Llama-3-8B SFT-Only 2 0.6267 0.6366 0.6320 0.6653 0.5608 0.6917 ETO 14 0.6642 0.6916 0.6655 0.7161 0.5206 0.6314 IPR 18 0.6966 0.7087 0.6740 0.7019 0.5681 0.6393 STeCa 16 0.6574 0.7864 0.6276 0.7940 0.5340 0.6593 SaFaRi 0.7209 0.8358 0.7255 0.8625 0.6063 0.7096 Mistral-7B SFT-Only 2 0.6037 0.6048 0.5315 0.7077 0.5368 0.6602 ETO 14 0.6297 0.6324 0.5961 0.6185 0.4448 0.6585 IPR 18 0.6207 0.6334 0.5821 0.7438 0.4689 0.5851 STeCa 16 0.6275 0.7372 0.5719 0.6849 0.4761 0.6095 SaFaRi 0.7168 0.7851 0.7058 0.8563 0.5884 0.7036 Table 2: Main results. We bold the best results and underline the second best. SaFaRi achieves strong performance in both execution (TP) and exploration (ES), validating the universal benefit of proactive exploration. 5 Experiment 5.1 Experimental Settings Baselines & LLM Backbones. We adopt the identical set of baselines previously analyzed in Section 3. Following established protocols 18, all evaluated baselines and SaFaRi share identical backbone LLMs: Meta-Llama-3.1-8B-Instruct 6 and Mistral-7B-Instruct-v0.3 7. Datasets. Following 18; 14, we consider three benchmarks presenting distinct challenges: 1) WebShop (20), an e-commerce platform for state-dependent spatial exploration and backtracking; 2) InterCode-SQL (19), a database querying environment for state-independent logical complexity and precise syntax generation; and 3) ScienceWorld (17), a text-based scientific simulator for long-horizon planning and persistent exploration in complex dynamics. Evaluation Metrics. We evaluate agents using two metrics: (1) Task Performance (TP): Following 18, we report the average final reward to quantify the agent’s problem-solving proficiency in real-world deployments. (2) Exploration Score (ES): Measured as the maximum reward achieved across five stochastic rollouts, this metric captures the agent’s exploratory upper bound and reflects its ability to discover high-quality trajectories through active exploration. Implementation Details. All baselines are implemented using their official code repositories. Following 16, we employ GPT-4o as teacher for data distillation. Refer to Appendix B for more implementation details. 5.2 Main Results Table 2 demonstrates the effectiveness of SaFaRi, as evidenced by the following observations. SaFaRi achieves strong performance in terms of both task success and exploration score. Compared to the best baselines, SaFaRi consistently achieves substantial gains across all benchmarks and backbones, delivering an average increase of approximately 10%-15% in task success and approximately 8%-18% in exploration score. Notably, the proposed tree-structured context modeling consistently boosts the performance of even the advanced teacher model (GPT-4o), proving that structuring history effectively resolves environmental uncertainty and facilitates systematic exploration (further discussed in Section 5.3.3). Impressively, our 8B SaFaRi model delivers performance comparable to/better than this enhanced teacher. This result suggests that our SFT+RL paradigm effectively internalizes trial-and-error behaviors, allowing a smaller model to match the proactive exploration capabilities of a leading proprietary LLM. 5.3 In-depth Analysis We study how efficiently SaFaRi explores, and how exploration scales with task difficulty. Figure 3: Exploration efficiency analysis across training phases. Baselines are either rigidly passive (ETO, IPR) or degenerate into blind wandering (STeCa). In contrast, SaFaRi successfully suppresses wasteful exploration (WEWE) and elevates effective exploration (EE) post-SFT, maximizing net efficiency (EffEff). 5.3.1 Exploration Efficiency Unlike random exploration, proactive agent relies not on the mere quantity of exploratory actions or trajectories, but on strategic efficiency, which is the ability to purposefully gather critical information for decision-making under bounded steps. We thus evaluate exploration efficiency to quantify how effectively the agent acquires useful information while avoiding redundant wandering. In our setting, we quantify exploration by tracking both how broadly the agent explores the environment and how deeply it investigates discovered entities. Setup. We evaluate all methods based on the Meta-Llama-3.1-8B-Instruct backbone and analyze their exploration dynamics across different training stages. We measure the exploration efficiency of a trajectory τ by a metric Eff(τ)Eff(τ) (detailed in Appendix C). Specifically, it quantifies the overall net utility of exploration by subtracting wasted efforts from effective gains: Eff(τ)=E(τ)−WE(τ)Eff(τ)=E(τ)-WE(τ), where E(τ)=R(τ)⋅E(τ)E(τ)=R(τ)· E(τ) and WE(τ)=(1−R(τ))⋅E(τ)WE(τ)=(1-R(τ))· E(τ) denote task-contributing and non-contributing exploration, respectively. Here, R(τ)∈[0,1]R(τ)∈[0,1] denotes the terminal task reward, and E(τ)∈[0,1)E(τ)∈[0,1) rigorously quantifies the surplus information acquired beyond basic task completion across different interaction depths (e.g., exposed and focused entities). Results. The evaluation results are illustrated in Figure 3. Overall, SaFaRi proactively acquires useful information while avoiding redundant exploration, leading to sustained improvements in both exploration efficiency and task performance. We derive the following detailed observations. Baselines fail to conduct effective exploration, resulting in lower EffEff values. On WebShop, ETO and IPR exhibit near-zero EE and WEWE across all phases, exposing their rigid passivity and perfectly aligning with our behavioral analysis in Section 3. Conversely, while the correction-based STeCa attempts exploration, its wasteful exploration (WEWE) aggressively overtakes effective exploration (EE), crashing its net efficiency. This confirms that existing methods tend to induce unfocused exploration rather than productive information seeking. SaFaRi successfully balances effective exploration and task execution. As shown in Figure 3, our SFT data encourages extensive exploration but lacks precision, resulting in high levels of both effective exploration (EE) and wasted exploration (WEWE). Upon entering the RL stage, our customized optimization progressively calibrates the exploration strategy. At RL1 (i.e., the first round of RL optimization), WEWE is sharply reduced, making the net exploration efficiency (Eff=E−WEEff=E-WE) positive. As training proceeds through RL2 and RL3, EE and WEWE follow similar trends, yet the gap between them steadily widens. This pattern closely mirrors the performance gains reported in Table 2, suggesting that SaFaRi proactively acquires task-relevant information while avoiding redundant exploration, rather than relying on exploration only when encountering dead ends. 5.3.2 Exploration Scales with Task Difficulty Method / Task Difficulty Count R↑R Len. E E WE Eff Easy (RB=1R_B=1) SaFaRi (R=1R=1) 60 1.00 4.47 0.08 0.08 0.00 0.08 SaFaRi (R∈[0.5,1)R∈[0.5,1)) 16 0.64 6.00 0.40 0.26 0.14 0.11 SaFaRi (R∈[0,0.5)R∈[0,0.5)) 4 0.21 8.00 0.32 0.08 0.24 -0.15 IPR (Overall) 80 1.00 3.97 0.02 0.02 0.00 0.02 SaFaRi (Overall) 80 0.89 4.95 0.16 0.12 0.04 0.08 Medium (RB∈[0.5,1)R_B∈[0.5,1)) SaFaRi (R=1R=1) 21 1.00 5.33 0.20 0.20 0.00 0.20 SaFaRi (R∈[0.5,1)R∈[0.5,1)) 46 0.64 5.17 0.17 0.11 0.07 0.04 SaFaRi (R∈[0,0.5)R∈[0,0.5)) 7 0.20 7.14 0.37 0.02 0.35 -0.32 IPR (Overall) 74 0.65 4.06 0.01 0.01 0.00 0.01 SaFaRi (Overall) 74 0.70 5.41 0.20 0.12 0.07 0.05 Hard (RB∈[0,0.5)R_B∈[0,0.5)) SaFaRi (R=1R=1) 7 1.00 4.43 0.13 0.13 0.00 0.13 SaFaRi (R∈[0.5,1)R∈[0.5,1)) 11 0.71 5.73 0.20 0.15 0.05 0.11 SaFaRi (R∈[0,0.5)R∈[0,0.5)) 26 0.19 6.88 0.47 0.09 0.38 -0.29 IPR (Overall) 44 0.23 4.18 0.01 0.00 0.01 0.00 SaFaRi (Overall) 44 0.45 6.20 0.35 0.11 0.24 -0.12 Total (All Tasks) SaFaRi (R=1R=1) 88 1.00 4.67 0.11 0.11 0.00 0.11 SaFaRi (R∈[0.5,1)R∈[0.5,1)) 73 0.65 5.44 0.23 0.15 0.08 0.07 SaFaRi (R∈[0,0.5)R∈[0,0.5)) 37 0.20 7.05 0.43 0.08 0.36 -0.28 IPR (Overall) 198 0.70 4.05 0.02 0.01 0.00 0.01 SaFaRi (Overall) 198 0.72 5.40 0.22 0.12 0.10 0.02 Table 3: Exploration scales with task difficulty. Tasks are stratified by the mean reward of IPR (RBR_B). Setup. To understand how proactive exploration contributes to task completion under different levels of difficulty, we analyze agent trajectories in WebShop and partition the evaluation set into Easy, Medium, and Hard subsets according to the baseline (IPR) average reward (RBR_B). Table 3 reports both task-level statistics (reward R and trajectory length Len.) and exploration metrics (E, EE, WEWE, and EffEff). We highlight three key findings. Exploration intensity increases with task difficulty. The baseline follows a largely fixed execution pattern across all difficulty levels, with trajectory lengths remaining around 4.0 and exploration extent (E) close to zero. In contrast, SaFaRi adjusts its exploration behavior according to task complexity. As difficulty increases from Easy to Hard, both exploration extent (E: 0.16 → 0.20 → 0.35) and trajectory length (4.95 → 5.41 → 6.20) increase accordingly. This suggests that SaFaRi allocates more exploratory effort when tasks require additional information gathering. Exploration is most beneficial in hard tasks. The largest performance gains are observed in the Hard subset, where SaFaRi improves the average reward from 0.23 to 0.45. Notably, these gains are accompanied by a substantial level of effective exploration (E=0.11E=0.11), indicating that the additional interactions contribute meaningful information rather than merely increasing search activity. This result suggests that proactive information acquisition becomes particularly valuable when direct task execution alone is insufficient. Exploration introduces a trade-off in easy tasks. In Easy environments (RB=1.0R_B=1.0), where tasks can often be solved through direct execution, proactive exploration provides less benefit and may introduce minor inefficiencies. Although the agent acquires useful contextual information (E=0.12E=0.12), the associated wasted exploration (WE=0.04WE=0.04) slightly reduces execution efficiency, leading to a modest decrease in reward (1.00 → 0.89). This observation highlights the trade-off between information gathering and execution efficiency when additional exploration is unnecessary. 5.3.3 Ablation Studies Variants are as follows (Appendix E for details). • Teacher Variants. We study how teacher (GPT-4o) affects the quality of exploration-rich data distillation. Specifically, we compare GPT-4o with and without an exploration-aware prompt, which instills a basic exploration instinct, and further test different context modeling strategies, including list-structured versus tree-structured histories, as well as the use of cognitive notes. • SaFaRi Variants. We perform ablations on all major components of SaFaRi. To evaluate the effectiveness of our SFT data, we train SaFaRi using the SFT data adopted by prior methods (i.e., w/ Original SFT). Backbone Method TP ES GPT-4o Direct Prompt 0.5765 0.6877 GPT-4o Exploration-aware Prompt 0.5946 0.7395 GPT-4o List-Structured Prompt w/o note 0.6471 0.7785 GPT-4o List-Structured Prompt 0.6640 0.7771 GPT-4o Tree-Structured Prompt w/o note 0.6724 0.7759 GPT-4o Tree-Structured Prompt 0.7062 0.7931 Llama-3-8B SaFaRi w/ Original SFT 0.6574 0.7914 Llama-3-8B SaFaRi w/o Tree-Structured 0.6843 0.8028 Llama-3-8B SaFaRi w/o Data Screening 0.6965 0.8108 Llama-3-8B SaFaRi w/o RL 0.6321 0.7949 Llama-3-8B SaFaRi 0.7209 0.8358 Table 4: Ablation studies on WebShop. Results. While explicitly encouraging exploration improves performance over direct prompting, the gains are relatively limited (+3.14% in TP and +7.53% in ES). In contrast, both list-structured and tree-structured contexts yield substantially larger improvements (+12.24% in TP and +13.28% in ES, +16.63% in TP and +12.83% in ES), highlighting the importance of organizing interaction histories for exploration. Among them, tree-structured prompts perform best, suggesting that preserving branching trial-and-error trajectories facilitates more effective exploration. Adding cognitive notes further improves performance (+5.03% in TP and +2.23% in ES), indicating that compact task-state summaries provide richer contextual signals for exploration. Importantly, the benefits transfer to downstream agent training. Equipping with tree-structured prompts and data screening leads to a high-quality SFT dataset and hence a noticeable performance gain (+9.66% in TP and +5.61% in ES). RL also contributes large gains. However, its effectiveness depends on prior SFT initialization, suggesting that basic exploration capabilities must first be installed before they can be further efficiently refined through RL. 6 Conclusion For real-world environments, intelligent behavior requires more than acting on currently available observations. Effective agents must proactively explore, strategically acquiring information that may incur short-term costs but improves future decision-making. Such behavior reflects the ability to reason not only about what action to take, but also about whether the current knowledge state is sufficient for reliable planning. We argue that proactive exploration is a foundational capability of next-generation agents, enabling robust decision-making in complex open-world environments where optimal actions depend on actively expanding and refining environmental understanding. Limitations In this section, we discuss the limitations of our work from the following perspectives: Heuristic Exploration Metrics. As an initial attempt toward evaluating proactive exploration in LLM agents, we propose the metric Eff(τ)Eff(τ) to measure exploration efficiency in our experimental setting. While Eff(τ)Eff(τ) provides a measurable proxy for exploration utility, it is not strictly equivalent to actual effective exploration. Because the calculation is explicitly anchored to the terminal task reward, it can inherently inflate the effective exploration scores in successful trajectories, regardless of whether the exploratory actions causally contributed to that success. Nevertheless, Eff(τ)Eff(τ) still exhibits a meaningful macroscopic correlation with exploration behavior. Developing more rigorous metrics to isolate the causal impact of exploration remains a direction for future work. SFT Dependency. While SaFaRi equips agents with proactive exploration capabilities, this ability currently relies on supervised fine-tuning (SFT) using exploration-aware trajectories distilled from a powerful LLM (e.g., GPT-4o). Our analysis shows that this stage is critical, as removing it leads to severe hindsight bias during training. However, the resulting exploratory behaviors may also be implicitly bounded by the prior knowledge of the teacher LLM. In our experiments, existing agents are still unable to efficiently interact with and acquire environmental knowledge entirely from scratch (as evidenced by the SaFaRi w/ Original SFT ablation). Moving beyond this SFT-dependent paradigm toward fully autonomous agents capable of proactive exploration from scratch remains an important direction for future work. LLM Usage LLMs are used in this work as the backbone models and the teacher models for trajectory data construction. In addition, LLMs are used only for language polishing during paper writing. References Carta et al. (2023) T. Carta, C. Romac, T. Wolf, S. Lamprier, O. Sigaud, and P. Oudeyer Grounding large language models in interactive environments with online reinforcement learning. In International conference on machine learning, p. 3676–3713. Cited by: §1. Chen et al. (2023) B. Chen, C. Shu, E. Shareghi, N. Collier, K. Narasimhan, and S. Yao Fireact: toward language agent fine-tuning. arXiv preprint arXiv:2310.05915. Cited by: §1, Table 1, §2, §3.1, Table 2, Table 2. Chen et al. (2025) Z. Chen, M. Li, Y. Huang, Y. Du, M. Fang, and T. Zhou Atlas: agent tuning via learning critical steps. In Findings of the Association for Computational Linguistics: ACL 2025, p. 25334–25349. Cited by: §2. Fang and Ke (2025) D. C. Fang and T. Ke Information seeking for robust decision making under partial observability. arXiv preprint arXiv:2510.01531. Cited by: §1. Gandhi and Neubig (2025) A. Gandhi and G. Neubig Go-browse: training web agents with structured exploration. arXiv preprint arXiv:2506.03533. Cited by: §2. Grattafiori et al. (2024) A. Grattafiori, A. Dubey, A. Jauhri, A. Pandey, A. Kadian, A. Al-Dahle, A. Letman, A. Mathur, A. Schelten, A. Vaughan, et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783. Cited by: §E.1, §3.1, §5.1. Jiang et al. (2023) A. Q. Jiang, A. Sablayrolles, A. Mensch, C. Bamford, D. S. Chaplot, D. d. l. Casas, F. Bressand, G. Lengyel, G. Lample, L. Saulnier, et al. Mistral 7b. arXiv preprint arXiv:2310.06825. Cited by: §5.1. Koh et al. (2024a) J. Y. Koh, R. Lo, L. Jang, V. Duvvur, M. C. Lim, P. Huang, G. Neubig, S. Zhou, R. Salakhutdinov, and D. Fried Visualwebarena: evaluating multimodal agents on realistic visual web tasks. arXiv preprint arXiv:2401.13649. Cited by: §1. Koh et al. (2024b) J. Y. Koh, S. McAleer, D. Fried, and R. Salakhutdinov Tree search for language model agents. arXiv preprint arXiv:2407.01476. Cited by: §2. Lin et al. (2023) B. Y. Lin, Y. Fu, K. Yang, F. Brahman, S. Huang, C. Bhagavatula, P. Ammanabrolu, Y. Choi, and X. Ren Swiftsage: a generative agent with fast and slow thinking for complex interactive tasks. In Proceedings of the 36th Conference on Neural Information Processing Systems, Vol. 36, p. 23813–23825. Cited by: §1, §2. Madaan et al. (2023) A. Madaan, N. Tandon, P. Gupta, S. Hallinan, L. Gao, S. Wiegreffe, U. Alon, N. Dziri, S. Prabhumoye, Y. Yang, et al. SELF-refine: iterative refinement with self-feedback. In Proceedings of the 37th International Conference on Neural Information Processing Systems, p. 46534–46594. Cited by: §2. Rita et al. (2024) M. Rita, F. Strub, R. Chaabouni, P. Michel, E. Dupoux, and O. Pietquin Countering reward over-optimization in llm with demonstration-guided reinforcement learning. arXiv preprint arXiv:2404.19409. Cited by: §1. Seo et al. (2024) S. Seo, B. Lee, J. Lee, H. Hwang, H. Yang, and K. Kim Mitigating covariate shift in behavioral cloning via robust stationary distribution correction. Advances in Neural Information Processing Systems 37, p. 109177–109201. Cited by: §2. Song et al. (2024) Y. Song, D. Yin, X. Yue, J. Huang, S. Li, and B. Y. Lin Trial and error: exploration-based trajectory optimization for llm agents. arXiv preprint arXiv:2403.02502. Cited by: §1, Table 1, §2, §3.1, Table 2, Table 2, §5.1. Tan et al. (2024) W. Tan, W. Zhang, S. Liu, L. Zheng, X. Wang, and B. An True knowledge comes from practice: aligning llms with embodied environments via reinforcement learning. arXiv preprint arXiv:2401.14151. Cited by: §1. Wang et al. (2025) H. Wang, J. Wang, C. T. Leong, and W. Li Steca: step-level trajectory calibration for llm agent learning. In Findings of the Association for Computational Linguistics: ACL 2025, p. 11597–11614. Cited by: Table 1, §2, §3.1, Table 2, Table 2, §5.1. Wang et al. (2022) R. Wang, P. Jansen, M. Côté, and P. Ammanabrolu Scienceworld: is your agent smarter than a 5th grader?. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, p. 11279–11298. Cited by: §4, §5.1. Xiong et al. (2024) W. Xiong, Y. Song, X. Zhao, W. Wu, X. Wang, K. Wang, C. Li, W. Peng, and S. Li Watch every step! llm agent learning via iterative step-level process refinement. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, p. 1556–1572. Cited by: §1, Table 1, §2, §3.1, §4.2, Table 2, Table 2, §4, §5.1, §5.1, §5.1. Yang et al. (2023) J. Yang, A. Prabhakar, K. Narasimhan, and S. Yao Intercode: standardizing and benchmarking interactive coding with execution feedback. Advances in Neural Information Processing Systems 36, p. 23826–23854. Cited by: §4, §5.1. Yao et al. (2022) S. Yao, H. Chen, J. Yang, and K. Narasimhan Webshop: towards scalable real-world web interaction with grounded language agents. In Proceedings of the 35th Conference on Neural Information Processing Systems, Vol. 35, p. 20744–20757. Cited by: §1, §1, Table 1, §3.1, §4, §5.1. Yao et al. (2023a) S. Yao, D. Yu, J. Zhao, I. Shafran, T. Griffiths, Y. Cao, and K. Narasimhan Tree of thoughts: deliberate problem solving with large language models. Advances in neural information processing systems 36, p. 11809–11822. Cited by: §2. Yao et al. (2023b) S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. Narasimhan, and Y. Cao React: synergizing reasoning and acting in language models. In Proceedings of the 11th International Conference on Learning Representations, Cited by: §2. Yin et al. (2023) D. Yin, F. Brahman, A. Ravichander, K. Chandu, K. Chang, Y. Choi, and B. Y. Lin Lumos: learning agents with unified data, modular design, and open-source llms. In ICLR 2024 Workshop on Large Language Model (LLM) Agents, Cited by: §1. Yu et al. (2024) X. Yu, B. Peng, V. Vajipey, H. Cheng, M. Galley, J. Gao, and Z. Yu Exact: teaching ai agents to explore with reflective-mcts and exploratory learning. arXiv preprint arXiv:2410.02052. Cited by: §1, §2. Yu et al. (2025) X. Yu, B. Peng, V. Vajipey, H. Cheng, M. Galley, J. Gao, and Z. Yu Exact: teaching ai agents to explore with reflective-mcts and exploratory learning. In International Conference on Learning Representations, Vol. 2025, p. 65157–65184. Cited by: §2. Yuan et al. (2025) S. Yuan, Z. Chen, Z. Xi, J. Ye, Z. Du, and J. Chen Agent-r: training language model agents to reflect via iterative self-training. arXiv preprint arXiv:2501.11425. Cited by: §2. Zhang et al. (2026) X. Zhang, Y. Han, J. Qi, M. Xie, Z. Wu, and X. Dai WebNavigator: global web navigation via interaction graph retrieval. arXiv preprint arXiv:2603.20366. Cited by: §2. Zhou et al. (2023a) A. Zhou, K. Yan, M. Shlapentokh-Rothman, H. Wang, and Y. Wang Language agent tree search unifies reasoning acting and planning in language models. arXiv preprint arXiv:2310.04406. Cited by: §2. Zhou et al. (2023b) S. Zhou, F. F. Xu, H. Zhu, X. Zhou, R. Lo, A. Sridhar, X. Cheng, T. Ou, Y. Bisk, D. Fried, et al. Webarena: a realistic web environment for building autonomous agents. arXiv preprint arXiv:2307.13854. Cited by: §1, §1. Appendix A Details of the Interactive Tree-Structured History with Cognitive Notes In this section, we provide the formalization, algorithmic conversion, operational mechanisms, and environment-specific implementations of our proposed Tree-Structured History. A.1 Formalization and Algorithmic Conversion In multi-turn interactive environments, an interaction trajectory is conventionally represented as a flat, chronological sequence of dialogue turns: ℋt=u,(a1,o1),(a2,o2),…,(at,ot),H_t=\u,(a_1,o_1),(a_2,o_2),…,(a_t,o_t)\, where u is the task instruction, aia_i is the executed action, and oio_i is the environmental observation. This linear representation implicitly conflates productive forward execution with exploratory detours. When an agent backtracks after a failed attempt, a flat list still records the abandoned branch in sequence, which frequently misleads the agent into treating a discarded state as part of its active context. To resolve this linear disorientation, we map the trajectory into a topological action tree tT_t. Formally, each node vi∈tv_i _t is defined as a tuple: vi=(idi,ai,parenti,childreni,notei),v_i=(id_i,a_i,parent_i,children_i,note_i), where idiid_i is a unique node identifier, aia_i is the executed action, parentiparent_i points to the preceding action node from which the current branch originates, and childrenichildren_i stores the tracking IDs of subsequent action branches. Crucially, noteinote_i is a plain-text field managed by the agent. It can either start with an optional control label followed by text, or consist of plain text alone. The optional labels represent different exploration states: [SUCCESS] for completed milestones, [FAILED] for execution errors, [DEAD END] for fully exhausted paths, and [SUB-OPTIMAL] for imperfect backup candidates. Furthermore, we found that the plain text splits into two types of information: a record to log valuable content about the current state, and a note to serve as a self-reminder, without requiring any rigid tags to separate them. The active position pointer ptp_t is maintained globally outside the nodes to track the agent’s current state. For the exact structured output formats and prompt execution templates, refer to Appendix F. The operational sequence-to-tree conversion pipeline is formalized in Algorithm 1. Algorithm 1 Dialogue-to-Tree History Conversion 1: Initialize a root node v1v_1 as START; set current pointer p←v1p← v_1. 2: for each interaction turn t do 3: Receive latest observation oto_t, current tree tT_t, global pointer p, and step count. 4: Agent Inference: Analyze the history and plan the exploration strategy based on oto_t and tT_t. 5: Agent Output: Generate structured fields: action, tree_signal, and optional tree.change(id, note). 6: if tree_signal specifies Next Parent Assignment to vjv_j (where vjv_j can be p) then 7: Append action as a child node of historical node vjv_j. 8: Move global pointer p to this newly created node after execution. 9: else if tree_signal specifies Target Node Relocation to vjv_j then 10: Teleport global pointer p directly to existing node vjv_j without expanding a new node. 11: end if 12: end for A.2 Dual Relocation Mechanisms Across Different Target Domains A core strength of our framework is its adaptability to environments with entirely different action dynamics. As introduced in Algorithm 1, relocating the active tree pointer ptp_t during backtracking is operationalized via two distinct paradigms depending on whether the environment natively supports structural reversion: 1) Action-Driven Synchronization (WebShop): In environments that inherently support explicit backward actions (e.g., clicking a <Back> button on an e-commerce interface), tree relocation is perfectly synchronized with environmental state transitions. Unproductive paths are structurally isolated into parallel side branches whenever the agent executes a physical backtracking command provided by the environment. 2) Direct Pointer Modification (InterCode-SQL & ScienceWorld): In domains like database manipulation or textual scientific simulations, environments lack automated or single-step physical backtracking mechanisms to restore full historical contexts. To resolve this, tree relocation is handled via direct pointer modification, where the system overwrites the global pointer ptp_t outside the environmental execution loop. As illustrated in Figure 4, this direct modification operates under the two control modes defined in our algorithm: • Target Node Relocation: The active position pointer ptp_t immediately jumps back to a designated historical node ID, allowing the policy to re-examine or resume execution from that past checkpoint without spawning a new node. • Next Parent Assignment: The agent assigns a historical node ID as the parent for its next action. The subsequent action is then executed from this designated parent context, automatically spawning a new parallel exploration branch (e.g., the transitions from A3→A4A_3→ A_4 and A5→A6A_5→ A_6 in Figure 4). Figure 4: Tree-structured context modeling in InterCode-SQL via direct pointer modification. Only the solid-line tree paths are visible to the agent’s policy during execution. A.3 Operational Roles of Cognitive Notes with Concrete Case Study Cognitive notes transform the passive tree topology into an operational working memory. Rather than serving as a plain textual summary, these fields are autonomously filled by the agent’s policy to perform four interconnected roles. We illustrate these roles using a concrete long-horizon task in ScienceWorld ("freeze orange juice"), where the agent must navigate a complex environment based on an unverified hypothesis that orange juice must be extracted from a raw orange. START(id=1) |-- teleport to kitchen(id=2) | |-- pick up orange(id=3) | ‘-- pick up orange (specific location)(id=4) | |-- look at drawer(id=7) | ‘-- examine cupboard(id=9) ‘-- teleport to workshop(id=10) Node Agent-Generated Cognitive Note 1 Hypothesis: kitchen likely contains orange juice. 2 Found orange; unexamined drawer, cupboard, freezer, fridge. 3 [FAILED] Ambiguous request; RULE LEARNED: select index. 4 [SUCCESS] Orange picked up; search for juicing tool. 7 [DEAD END] No tools. 9 [DEAD END] No juicing tools. 10 Look around just now. → [DEAD END] Workshop contains no juicing tools. … Figure 5: An excerpt of the tree history from the orange-juice freezing task in ScienceWorld. Green and red text signify productive and dead-end action paths, respectively. • Caching Verified Environmental Facts: Interactive environments often present observations in a forgetful stream. As shown in Figure 5, node 2 caches a clean snapshot of unexamined kitchen appliances (freezer, fridge). This ensures that even when the agent leaves the kitchen, it retains high-fidelity spatial knowledge without relying on repetitive look around actions. • Recording Branch Status: Notes use explicit tags to manage search boundaries. At node 10 (teleport to workshop), after finding no juicing utilities, the agent updates the note with a [DEAD END] tag. This explicit status marker signals the policy to immediately halt forward execution along this unpromising branch. • Encoding Learned Rules: When actions trigger environmental constraints, the agent records them under a RULE LEARNED prefix. For instance, at node 3, the environment rejects a vague picking action, prompting the agent to log RULE LEARNED: select index. This prevents the agent from repeating syntactical or mechanical errors in future turns. • Hypothesis Revision and Checkpoint Recovery: When a core assumption fails, the note preserves the failure rationale to guide hypothesis shifting. Upon exhausting the workshop branch (node 10), the agent deduces that raw oranges are a dead end. It writes: "[DEAD END] Workshop contains no juicing tools. RULE LEARNED: Avoid implicit constraints. Hypothesis revised: Pre-made juice likely exists in unexamined kitchen appliances." Simultaneously, the agent triggers a pointer relocation outside the environment loop: Current position id: 2, returning directly to the kitchen checkpoint. Guided by the cached facts at node 2, the agent seamlessly initiates a new sibling branch targeting the fridge or freezer. This synergy between topological pointer recovery and autonomous cognitive notes ensures the agent eliminates redundant wandering and achieves purposeful, proactive exploration. Appendix B Hyperparameters and Implementation Details This section details the exhaustive hyperparameters and implementation configurations utilized across the different training phases of SaFaRi to ensure full reproducibility. All experiments are conducted on 3 NVIDIA A100 (80GB) GPUs, while the corresponding core prompt templates are provided in Appendix F. • Data Synthesis via Teacher Model: Reference trajectories are synthesized utilizing GPT-4o. Specifically, for each individual task, we independently sample m=5m=5 candidate trajectories. The decoding temperature is set to T=1.0T=1.0 with a top_p of 0.85. The step penalty factor γ is set to 0.1 for WebShop and InterCode-SQL, and 0.01 for ScienceWorld. • Supervised Fine-Tuning (SFT) Phase: Prior to contrastive optimization, the core components undergo initial fine-tuning. The proactive agent is trained for strictly 1 epoch with a learning rate of 3×10−63× 10^-6 to establish baseline capabilities while preventing premature overfitting. Concurrently, the MC evaluator (πMC _MC) is fine-tuned on the Forward-Pure Set (scoreD_score) for 3 epochs with a learning rate of 2×10−52× 10^-5. • Exploration Mechanics: During the active exploration phase, the agent utilizes deterministic greedy decoding (T=0T=0). For step-wise reward estimation, the MC rollout process switches to stochastic decoding (T=1.0T=1.0) to execute 5 independent rollouts per candidate action. • Contrastive Data Construction: To isolate decisive strategic differences from environmental noise, the margin threshold τm _m is set to 0.01 for both WebShop and ScienceWorld, and 0.1 for the discrete action space of InterCode-SQL. • Contrastive Policy Optimization: The contrastive learning update employs a learning rate of 5×10−75× 10^-7 and a KL regularization coefficient β=0.1β=0.1. The model is optimized for 3 epochs per global training iteration. • Global Pipeline Iterations: The entire closed-loop training cycle (encompassing active exploration, MC utility estimation, and contrastive policy calibration) is executed for 3 global iterations on WebShop and InterCode-SQL. For ScienceWorld, the framework converges optimally within 1 global iteration. Appendix C Information-Theoretic Exploration Metrics This metric quantifies the net utility of exploration along a trajectory by jointly measuring how broadly the agent acquires candidate information and how deeply it verifies that information through explicit interaction, and then coupling the result with the task reward. Trajectory entity extraction. Given a trajectory hN=(u,a1,o1,…,aN,oN)h_N=(u,a_1,o_1,…,a_N,o_N) of N interaction turns, at each step t we extract two raw entity sets from the current action-observation pair (at,ot)(a_t,o_t): E^t E_t (exposed) and F^t F_t (focused). Exposed entities represent information breadth, capturing entities coarsely revealed by the environment observation without direct interaction. Focused entities represent information depth, capturing entities that the agent explicitly inspects or manipulates (e.g., entering a specific link, selecting an option, or clicking to read details). In WebShop, after a search or page-turn action, product IDs visible in the current result list are counted as exposed entities; a product is counted as focused only if the agent has clicked into its detail page at least once. Formally, we define an environment-specific extraction function ϕtask _task and a canonicalization filter ψtask _task. The extraction process uses the history context ht−1h_t-1 to resolve coreferences or contextual entities. After task-specific filtering, we obtain the valid step-level sets EtE_t and FtF_t, which are then accumulated and deduplicated over the full trajectory: E(hN)=⋃t=1NEt,F(hN)=⋃t=1NFt.E(h_N)= _t=1^NE_t, F(h_N)= _t=1^NF_t. (4) Crucially, in our current implementation, the extraction functions (ϕtask _task, ψtask _task) and the entity category mappings (κ) are entirely rule-based. These parsing rules and token-matching heuristics are manually customized and hard-coded for each specific target environment to ensure exact factual alignment. Algorithm 2 Trajectory-Level Entity Accounting 1: E←∅,F←∅E← ,\ F← 2: for t=1,…,Nt=1,…,N do 3: (E^t,F^t)←ϕtask(at,ot,ht−1)( E_t, F_t)← _task(a_t,o_t,h_t-1) contextual raw extraction via heuristic rules 4: (Et,Ft)←ψtask(E^t,F^t)(E_t,F_t)← _task( E_t, F_t) canonicalize & filter via heuristic rules 5: E←E∪Et,F←F∪FtE← E∪ E_t,\ \ F← F∪ F_t trajectory-level dedup 6: end for 7: Compute Ne(c,hN),Nf(c,hN)c∈\N_e(c;h_N),N_f(c;h_N)\_c from E,FE,F via Eq. (5) 8: Normalize by fixed pool reference Ne0(c),Nf0(c)c∈\N_e^0(c),N_f^0(c)\_c to get xe(c,hN),xf(c,hN)\x_e(c;h_N),x_f(c;h_N)\ 9: Aggregate category gains to obtain global trajectory scores Xe(hN),Xf(hN)X_e(h_N),X_f(h_N) 10: Compute saturation P(hN)P(h_N) via exponential mapping 11: Compute final dimensions: E(hN),WE(hN),Eff(hN)E(h_N),WE(h_N),Eff(h_N) Category entity counts. Let C be the task-specific category set, and let κ(e)∈κ(e) map an entity e to its corresponding category. For each category c∈c , we aggregate the total number of unique entities encountered across the entire trajectory. The accumulated counts for exposed and focused states are defined as: Ne(c,hN) N_e(c;h_N) =∑e∈E(hN)[κ(e)=c], = _e∈ E(h_N)I[κ(e)=c], (5) Nf(c,hN) N_f(c;h_N) =∑e∈F(hN)[κ(e)=c], = _e∈ F(h_N)I[κ(e)=c], where [⋅]I[·] is the standard indicator function that outputs 1 if the condition holds and 0 otherwise. Unified-mean baseline. To establish a stable reference of standard agent behavior and filter out basic entities that are mandatory for simple task completion, we introduce a shared reference baseline pool ℬB. To avoid numerical drifting across different experimental runs, ℬB is fixed as the collection of validation trajectories generated by the backbone’s vanilla SFT checkpoints across all evaluation methods. The cross-method mean baselines are calculated as: Ne0(c)=1|ℬ|∑h′∈ℬNe(c,h′), N_e^0(c)= 1|B| _h N_e(c;h ), (6) Nf0(c)=1|ℬ|∑h′∈ℬNf(c,h′). N_f^0(c)= 1|B| _h N_f(c;h ). If a denominator N0(c)N^0(c) is non-positive (i.e., an entity category is never discovered by any method in the baseline pool), we safely clip the corresponding normalized gain to 00 to avoid division-by-zero errors. Normalized gains. We convert raw metrics into surplus gains achieved beyond the standard community baseline: xe(c,hN) x_e(c;h_N) =max(0,Ne(c,hN)Ne0(c)−1), = \! (0, N_e(c;h_N)N_e^0(c)-1 ), (7) xf(c,hN) x_f(c;h_N) =max(0,Nf(c,hN)Nf0(c)−1). = \! (0, N_f(c;h_N)N_f^0(c)-1 ). The max(0,⋅) (0,·) operator discards negative variances. This design guarantees that only proactive exploration exceeding the baseline standard contributes to the score, while substandard wandering is bounded at zero. Category aggregation. We aggregate category-wise gains into two global trajectory scores: Xe(hN)=Aggc∈xe(c,hN), X_e(h_N)=Agg_c x_e(c;h_N), (8) Xf(hN)=Aggc∈xf(c,hN), X_f(h_N)=Agg_c x_f(c;h_N), where Agg∈mean,sumAgg∈\mean,sum\. In our primary analysis, we employ meanmean to balance information acquisition evenly across distinct domains. Saturation. To prevent arbitrarily long trajectories from disproportionately inflating the exploration metrics through brute-force wandering, we apply an exponential saturation function: P(hN)=1−e−α(Xe(hN)+Xf(hN)),P(h_N)=1-e^-α\,(X_e(h_N)+X_f(h_N)), (9) where α=1α=1 is a fixed scaling hyperparameter across all reported experiments. Reward coupling. Finally, we couple the exploration intensity P(hN)P(h_N) with the environment task reward R(hN)∈[0,1]R(h_N)∈[0,1] to differentiate purposeful information gain from blind, ungrounded wandering. To achieve this, we decouple the raw exploration score into two orthogonal dimensions: • Effective Exploration (E): This dimension captures the volume of proactive exploration that successfully aligns with final task resolution. It is defined as: E(hN)=R(hN)P(hN).E(h_N)=R(h_N)\,P(h_N). (10) • Wasted Exploration (WE): This dimension penalizes redundant or aimless exploration paths that fail to contribute to terminal task success. It is defined as: WE(hN)=(1−R(hN))P(hN).WE(h_N)= (1-R(h_N) )\,P(h_N). (11) By subtracting the wasted overhead from the productive exploration gains, we derive the comprehensive Exploration Efficiency (Eff), which represents the true net utility of the agent’s behavior: Eff(hN)=E(hN)−WE(hN).Eff(h_N)=E(h_N)-WE(h_N). (12) Equivalently, this net utility formulation mathematically simplifies to a cleaner, unified expression modulated by the terminal environment reward: Eff(hN)=P(hN)(2R(hN)−1).Eff(h_N)=P(h_N) (2R(h_N)-1 ). (13) Appendix D Case Study: Overcoming Hallucination via Proactive Exploration In this section, we present concrete qualitative case studies across distinct domains to intuitively demonstrate how SaFaRi leverages its tree-structured memory and cognitive notes to systematically audit environment candidates, gather missing contextual knowledge, and eradicate fatal decision hallucinations. D.1 Case 1: Webshop Stage SaFaRi: Proactive Candidate Verification Baselines: Premature Purchase Request A box of individually wrapped chocolate cereal bars, price lower than 50.00 dollars. Search search[individually wrapped chocolate cereal bars box under $50] search[individually wrapped chocolate cereal bars] or search[box of individually wrapped chocolate cereal bars] Key decision Treats product pages as candidates and returns to search results when a product is only a partial match. click[B09G77LP66] < Prev click[B098BTG68C] < Prev click[B08FSC3XG3] Clicks the first lexically plausible product and buys without comparative verification. IPR/ETO: click[B09RND5D4Y] STeCa: click[B002YM58UE] Final action click[B08FSC3XG3] click[chocolate] click[Buy Now] options: "flavor name": "chocolate" click[Buy Now] IPR/ETO purchase: B09RND5D4Y STeCa purchase: B002YM58UE Outcome Reward = 1.0 Correctly selects a chocolate option after checking multiple candidates. Reward = 0.3333 / 0.0667 Purchases a partial lexical match or wrong product type. Table 5: Case study on WebShop task 9021. SaFaRi avoids premature purchase by proactively comparing candidate products and selecting the required chocolate option. To intuitively illustrate the necessity of proactive exploration in product search, Table 5 contrasts trajectory logs from WebShop (Task 9021: “i would like a box of individually wrapped chocolate cereal bars, and price lower than 50.00 dollars”). The Pitfall of Premature Purchase. Baselines (e.g., IPR, ETO, and STeCa) exhibit passive, one-shot execution. After issuing a broad search query, they click the first lexically plausible product and immediately purchase it without comparative verification. IPR and ETO buy B09RND5D4Y, which is a white-chocolate fruity cereal candy bar pack rather than the requested box of chocolate cereal bars. STeCa buys B002YM58UE, a Special K protein bar product that satisfies the price constraint but mismatches the target product type. These trajectories exploit the first partial match and terminate after only three steps, resulting in low rewards (R=0.3333R=0.3333 for IPR/ETO and R=0.0667R=0.0667 for STeCa). Proactive Candidate Verification. In stark contrast, SaFaRi explicitly avoids blind purchase. It searches with the full constraint, including “box” and the price limit, and then treats each product page as a candidate to be verified rather than as an immediate buying target. It first inspects B09G77LP66, recognizes that it is an assorted snack care pack, and returns to the search page. It then inspects B098BTG68C, which is closer but still not selected as the final answer. Finally, SaFaRi opens B08FSC3XG3, observes the available flavor options, selects chocolate, and purchases the product with the option "flavor name": "chocolate", achieving full reward (R=1R=1). This qualitative case corroborates our quantitative insights: proactive exploration is not random browsing, but a targeted candidate-auditing strategy. By comparing alternatives, recording product-level mismatches, and delaying the purchase until the key constraints are grounded in the environment, SaFaRi avoids premature exploitation and substantially reduces environment-induced shopping errors. D.2 Case 2: Intercode-Sql Stage SaFaRi: Proactive Exploration Baselines: Hallucination-driven Guessing Question How many official languages are spoken in Afghanistan? Shared schema SHOW TABLES -- city, country, countrylanguage DESCRIBE countrylanguage -- CountryCode, Language, -- IsOfficial, Percentage SHOW TABLES -- city, country, countrylanguage DESC countrylanguage -- CountryCode, Language, -- IsOfficial, Percentage Key decision Peoactive explores country to identify the reliable join key. DESCRIBE country -- Code, Name, -- Continent, Region, ... Skips country and guesses the country code. Final query SELECT COUNT(DISTINCT cl.IsOfficial) FROM country c JOIN countrylanguage cl ON c.Code = cl.CountryCode WHERE c.Name = ’Afghanistan’ SELECT COUNT(*) FROM countrylanguage WHERE CountryCode = ’AFG’ AND IsOfficial = ’yes’ Outcome Answer: 2 Reward = 1.0 Answer: 0 Reward = 0.0 Table 6: Case study on InterCode-SQL task 119. SaFaRi avoids hallucinating the country code by proactively exploring the related schema. To intuitively illustrate the necessity of proactive exploration, Table 6 contrasts trajectory logs from InterCode-SQL (Task 119: “How many official languages are spoken in Afghanistan?”). The Pitfall of Rigid Execution. Baselines (e.g., IPR, STeCa) exhibit passive, rigid execution. After inspecting only the countrylanguage table, they fatally hallucinate the unverified country code (guessing ’AFG’ or ’AF’). This premature exploitation completely bypasses semantic grounding, directly resulting in execution failure (R=0R=0). Proactive Context Gathering. In stark contrast, SaFaRi explicitly avoids blind assumptions. It proactively expands its search to inspect the country table schema, acquiring the critical mapping between Name and Code. Ultimately, SaFaRi synthesizes the flawless query and retrieves the correct answer (R=1R=1). This qualitative case strictly corroborates our quantitative insights: proactive exploration is not mere random wandering, but a purposeful strategy to align internal beliefs with external reality, thereby completely eradicating environmental hallucinations. Appendix E Implementation Details of Ablation Studies This section details the ablation variants, evaluation environments, and backbone models used in our experiments. All task-specific prompts for the teacher model under the WebShop environment are provided in Appendix G. E.1 Environment and Model Configurations We evaluate our shopping exploration methods on the WebShop benchmark. For trajectory synthesis and exploration data distillation, we employ gpt-4o as the teacher backbone. For downstream policy learning, we adopt Meta-Llama-3.1-8B-Instruct 6 as the student backbone for both the Supervised Fine-Tuning (SFT) and Agentic Reinforcement Learning (RL) phases. E.2 Teacher-Driven Trajectory Synthesis These variants study how different prompt designs and history structures affect the quality of distilled exploration data. Crucially, all prompt configurations include identical task-specific few-shot exemplars to ensure consistent formatting and baseline operational capability. • Direct Prompt: The baseline setting containing only standard task instructions and action formatting. It lacks any explicit exploration or backtracking guidance. • Exploration-aware Prompt: Augments the baseline with explicit text rules for active hypothesis testing, proactive backtracking, and environment search tolerance. • List-Structured Prompt (w/ & w/o note): Represents the history as a linear chronological list. The "w/ note" variant allows the agent to write text reflections at each step, but the history remains sequential. • Tree-Structured Prompt (w/ & w/o note): Structures the history as a topological behavior tree for branch tracking. The "w/ note" variant enables the agent to fill node-level cognitive notes. E.3 Student Downstream Policy Learning These variants remove specific components from the student training pipeline to evaluate their individual contributions. • SaFaRi w/ Original SFT: Substitutes our exploration-rich fine-tuning data with the standard, trajectory-agnostic SFT data adopted by prior methods to isolate the impact of our data distillation. • SaFaRi w/o Tree-Structured: Trains and evaluates the student model using a flat, chronological list instead of the proposed tree-structured memory during both SFT and RL. • SaFaRi w/o Data Screening: Removes the trajectory filtering step. The student is trained on all generated trajectories regardless of their final task success or exploration quality. • SaFaRi w/o RL: Skips the reinforcement learning phase entirely. The student model is evaluated strictly after the SFT phase. Appendix F Prompts for SaFaRi Across Benchmarks This section presents the complete system prompts for our proposed tree-structured history framework with explicit external note-taking (SaFaRi). To demonstrate the generalizability of our method, we detail the exact runtime input templates and full instructions deployed across three distinct interactive environments: WebShop, InterCode-SQL, and ScienceWorld. F.1 Model Input Wrappers and Context Templates To clarify how interaction histories are formatted during runtime execution, we outline the exact input templates wrapped around the environment payloads at each decision turn. For SaFaRi, the serialized tree topology and memory metadata are injected dynamically into the action history slot as follows: ⬇ ## Instruction: instruction ## Observation: observation ## Action History: interaction_history ## Output: F.2 Full Prompt for the WebShop Environment ⬇ You are an autonomous web shopping agent. I will give you instructions about what to do. You have to follow the instructions. Every round I will give you an observation, an instruction, and your action_history. - the instruction: your ultimate goal. - the observation: current state and a list of available actions. - action_history: past interactions (a behavior tree), current position ID (where you are now in the tree), and current step number. You have to respond with an action based on these inputs. You can use the search action if search is available. You can click one of the buttons in clickables. An action should be of the exact following structure: search[keywords] click[value] If the action is not valid, perform nothing. ### Core Exploration & Decision Strategies: 1. Titles are Deceptive (Click to Verify): Search result titles ONLY show the default variant. If a product matches your target in category, brand, and price, but the title shows the wrong color, size, or flavor, YOU MUST CLICK INTO IT. The exact attribute you need is likely hidden inside as a clickable button. Do not reject items from the search page just because the title’s default attribute is wrong. 2. Product Configuration is MANDATORY: Product pages are interactive. Before you click ‘Buy Now‘, you MUST configure the product. If your target attribute (e.g., a specific color, size, or flavor like ‘[SEP] classic tonic [SEP]‘ or ‘[SEP] 2 pink [SEP]‘) is visible as a button on the product page, clicking it is your HIGHEST priority. NEVER click ‘< Prev‘ or ‘Buy Now‘ if a required attribute is available to be clicked on the current page. 3. BANNED ACTIONS (Zero Tolerance): - NEVER click ‘[Description]‘, ‘[Features]‘, or ‘[Reviews]‘. They do not contain clickable attributes and only cause you to lose your state. - NEVER output ‘perform nothing‘ or ‘Nothing‘. 4. Triggering Proactive Exploration (Pivot/Backtrack): If you have ANY doubts about the current state (e.g., a specific target attribute is missing, or the material/style is sub-optimal), DO NOT force a forward action. In early steps (e.g., steps 1-5), you must maintain STRICT ZERO TOLERANCE for imperfections. Use ‘click[< Prev]‘ to return to the parent node, or ‘click[Back to Search]‘ to return to the root node to spawn a new branch. 5. Adaptive Tolerance (Fallback): You must complete the task within 10 steps. If you have explored multiple nodes and are running out of steps (e.g., step 7 or later), you MUST lower your standards immediately. Accept a recorded "sub-optimal" backup option rather than failing the task by wasting remaining steps on more searches. Even in Fallback, you MUST configure the closest matching attributes before buying. 6. Generalize, Do Not Memorize: Your actions and tree updates must be based on YOUR OWN independent judgment of the real-time observation. All punctuation must be standard English half-width symbols. 7. Confident Exploitation: If the current state perfectly matches the requirements, proceed directly to complete the task. ### Action History Tree Management: The ‘action_history‘ is a Behavior Tree representing your shopping exploration paths. - Nodes & Navigation: Every forward action creates a new child node with a unique ID. Navigating backward DOES NOT automatically create new nodes; it moves your active pointer back to existing nodes. - Memory Updates & State Caching: The observation stream only displays the current page. You are absolutely responsible for caching verified item details and variant options in your node notes immediately. - Status Tracking (MANDATORY PREFIXES): * ‘[FAILED]‘: Start with this tag if your action leads to an invalid page, network blocker, or broken state. * ‘[DEAD END]‘: Start with this tag if the product page completely lacks the core target item type, or the price heavily exceeds the budget with no other options. * ‘[SUB-OPTIMAL]‘: Start with this tag if the product is a partial match (e.g., correct brand and item, but missing the exact flavor or size). This saves the node as a valid backup candidate for later Fallback. * ‘[SUCCESS]‘: Start with this tag if the product page perfectly matches all required attributes, or when an attribute configuration is successfully locked. - Tree Control Signals: * Next Parent Assignment: To branch or go deeper, set ‘Next parent position id‘ to a target node ID. If you need to abandon a sub-optimal product and spawn a new parallel search from a previous history checkpoint, set it to that historical node ID. * Target Node Relocation: Set ‘Current position id‘ to a historical node ID if you want to shift your active pointer back to a stable context without creating an empty child node. Your response MUST strictly use the following formatted tags: <state_analyze> 1. Current State: Define your immediate goal. Analyze the latest shopping observation. If preparing to purchase, explicitly verify: Does the product configuration match the instruction perfectly? 2. History Check: Review the ’action_history’ tree tags and notes. What candidate products have you verified, which paths hit a dead end, and what [SUB-OPTIMAL] backups have you recorded so far? 3. Step Check: Current step number. - Steps 1 to 6: STRICT EXPLORATION. Maintain zero tolerance for incomplete attributes. Backtrack to find a perfect match. - Steps 7 or higher: ADAPTIVE TOLERANCE. You MUST finalize, configure, and purchase the best recorded [SUB-OPTIMAL] backup candidate. </state_analyze> <action_analyze> Identify the next logical shopping or searching action based on clear reasoning. CRITICAL: If on a product page, you MUST click available attribute buttons to configure the product before clicking ’Buy Now’. </action_analyze> <action> [YOUR ACTION HERE] (e.g., search[keywords] OR click[value]) </action> <change_action_history_tree> Next parent position id: "node_ID" OR Current position id: "node_ID" tree.change("node_ID", "Status Tag + Concise summary of price, available variants, or missing attributes.") OR "no need change" </change_action_history_tree> F.3 Full Prompt for the InterCode-SQL Environment ⬇ You are a helpful assistant assigned with the task of problem-solving. To achieve this, you will interact with a MySQL Database system using SQL queries to answer a question. Every round I will give you an instruction, an observation, and your action_history. - the instruction: your ultimate goal (the text question to answer). - the observation: the standard tabular output or system error returned by your last executed SQL command. - action_history: past interactions (a behavior tree), current position ID (where you are now in the tree), and current step number. Your objective is to output exactly ONE valid action encapsulated in the required structured tags. You have two options for your action: 1) Execute a query in the MySQL programming environment. Your code must be surrounded with standard Markdown SQL syntax inside the tags. 2) Directly submit the current table results if they perfectly answer the instruction. ### Core Exploration & Non-Linear Decision Strategies: 1. BANNED ACTIONS: NEVER output "perform nothing", "Nothing", or empty queries. 2. Active Branching & Backtracking (Crucial): Do NOT just build a linear execution history. Use the ‘action_history‘ tree to explore the database schema intelligently. - Forwarding: If the last SQL execution successfully returned meaningful data or columns, continue refining your query from the current node. - Branching/Backtracking: If you hit an error (e.g., SQL syntax error, missing columns, empty sets), DO NOT try the same wrong query again. Look at your history tree, pick a previous successful node (e.g., where you successfully described the table schema), and backtrack to try a completely different query structure or subquery strategy. 3. Adaptive Tolerance (Database Fallback): You must complete the task within 10 steps. If you reach step 7 or later and are struggling with complex, non-verifiable multi-table JOINs, lower your structural complexity immediately. Fallback to querying foundational single-table rows or simplify the WHERE clause to ensure a valid baseline data extraction rather than failing completely with a broken syntax error. 4. Confident Exploitation: If the current observation table perfectly and completely satisfies the instruction, proceed directly to output ‘submit‘. 5. STRICT ALIGNMENT: The final fetched table results MUST strictly match the instructions in **quantity**, **order**, and **one-to-one correspondence**. Any column reordering or missing target rows will result in a strict failure. All punctuation must be standard English half-width symbols. 6. SQL SPECIFICATION (ANTI-OVERENGINEERING): - NO EXTRA COLUMNS [CRITICAL]: If the instruction asks "What is the [X]", ONLY select [X]. DO NOT select COUNT(*), SUM(), or any other unrequested helper metrics in the SELECT clause. - ORIGINAL HEADERS ONLY: NEVER use the ‘AS‘ keyword to rename columns unless explicitly requested. Always retain original schema column names. In JOIN queries, use table alias prefixes (e.g., T1.Name) to resolve ambiguity but do not alter the header. - SINGLE-COLUMN SORTING: If the instruction specifies an order without naming a column, ONLY apply ORDER BY to the FIRST column listed in your SELECT clause. - AGGREGATION RIGOR: When using aggregate functions alongside regular columns, ensure all non-aggregated attributes are explicitly included in the GROUP BY clause. ### Action History Tree Management: The ‘action_history‘ is a Behavior Tree representing your database exploration paths. - Memory Updates & Schema Caching: The database observation only displays the result of the *last* executed query. To avoid losing previously discovered table schemas, you must explicitly cache verified column mappings in your node notes. - Status Tracking (CRITICAL): * ‘[FAILED]‘: Start with this tag if the SQL query returns a database execution error or syntax blocker. * ‘[DEAD END]‘: Start with this tag if the query executes successfully but returns an empty set or irrelevant data that cannot answer the prompt. * ‘[SUCCESS]‘: Start with this tag if the query runs successfully and returns valid candidate rows or critical schema information. * Neutral Records (No Bracketed Tag): If the current turn is purely for structural schema exploration (e.g., DESCRIBE or SHOW TABLES), table metadata mapping, or establishing query layout plans, DO NOT use any bracketed status tags. Start directly with your clear plain-text factual findings and columns clues (records). - Tree Control Signals: * Next Parent Assignment: To branch or go deeper, set ‘Next parent position id‘ to a target node ID. If your last action failed, set it to a historical successful node to spawn a new parallel query branch. * Target Node Relocation: Set ‘Current position id‘ to a historical node ID if you want to teleport your active pointer back to a stable checkpoint context without creating an empty child node. Your response MUST strictly use the following formatted tags: <state_analyze> 1. Current State: Define your immediate goal. Analyze the latest SQL observation. If preparing to submit, explicitly verify: Does the current tabular data match the instruction strictly from left to right (quantity, schema order)? 2. History Check: Review the ’action_history’ tree tags and notes. What tables/columns have you verified, what syntax approaches failed, and which historical checkpoint is the safest backup? 3. Step Check: Current step number. - Steps 1 to 6: STRICT EXPLORATION. Maintain zero tolerance for incomplete records. Backtrack to verify schemas if uncertain. - Steps 7 or higher: ADAPTIVE TOLERANCE. Finalize and submit the best possible database extraction. </state_analyze> <action_analyze> Identify the next logical SQL query or submission action based on clear reasoning. CRITICAL: Double-check the column order request. Your SELECT clause sequence MUST match the target attribute sequence strictly from left to right. </action_analyze> <action> ‘sql [YOUR SQL QUERY HERE] ‘ OR submit </action> <change_action_history_tree> Next parent position id: "node_ID" OR Current position id: "node_ID" tree.change("node_ID", "[Optional Status Tag] Concise summary of verified table columns, schemas, execution plans, or exact database errors.") OR "no need change" </change_action_history_tree> F.4 Full Prompt for the ScienceWorld Environment ⬇ You are a Proactive Scientific Researcher. You do not just follow instructions; you manage experiments, generate hypotheses, test them, and iterate based on evidence. Your goal is to complete the experiment successfully. In the environment, there are several rooms: kitchen, foundry, workshop, bathroom, outside, living room, bedroom, greenhouse, art studio, and hallway. Every round I will give you an instruction, an observation, and your action_history. - the instruction: your ultimate goal. - the observation: the latest state returned by the environment. - action_history: past interactions (a behavior tree), current position ID (where you are now in the tree), and current step number. You should explore the environment and find the items you need to complete the experiment. The available actions are: open OBJ: open a container close OBJ: close a container activate OBJ: activate a device deactivate OBJ: deactivate a device connect OBJ to OBJ: connect electrical components disconnect OBJ: disconnect electrical components use OBJ [on OBJ]: use a device/item look around: describe the current room examine OBJ: describe an object in detail look at OBJ: describe a container’s contents read OBJ: read a note or book move OBJ to OBJ: move an object to a container pick up OBJ: move an object to the inventory pour OBJ into OBJ: pour a liquid into a container mix OBJ: chemically mix a container teleport to LOC: teleport to a specific room focus on OBJ: signal intent on a task object wait: take no action for 10 steps wait1: take no action for a step You can teleport to any room in one step (including "outside"). ### Core Exploration & Decision Strategies: 1. **Proactive Information Gathering**: Every action must be aimed at closing an "Information Gap". If you do not know where an item is, do not guess. Systematically explore rooms and containers. 2. **Hypothesis Testing**: Treat your plan as a hypothesis. If an observation contradicts your expectation, update your mental model and pivot. Do not retry failing paths. 3. **Proactive Multi-step Management**: Do not wait for prompts. Proactively manage the workflow yourself. 4. **Active Verification**: You are responsible for your data. If you perform a process, you MUST verify the outcome (e.g., ‘examine‘ or ‘look at‘ the result). 5. **Exact Syntax & Truth**: Follow exact object names. Treat observations as the "Absolute Truth." If a container is empty, it is empty. Do not hallucinate. All punctuation must be standard English half-width symbols. ### Action History Tree Management: The ‘action_history‘ is a **Behavior Tree**, not a flat list. It represents your exploration timelines. Each node is an executed action. If you fail and backtrack, you create parallel branches (sibling nodes) from an older parent. You must read this tree to understand your current timeline, identify abandoned dead-ends, and find safe checkpoints. - Memory Updates & State Refreshing: * Exclusive Observation Principle: The environment operates on a strict "forgetful" stream---past room details and container contents will NOT be re-displayed unless explicitly re-examined. You are absolutely responsible for caching every potentially useful asset in your node notes immediately. * The ‘look around‘ Protocol (No New Node): Executing ‘look around‘ does NOT advance your position in the tree or generate a new child node. It is purely a local state refresh. When you first transition to a room, you must initially label that action node’s note with a temporary token: ‘Look around just now‘. Once the environment returns the comprehensive room description, you SHOULD overwrite and replace that temporary ‘Look around just now‘ text with a concise summary of the newly discovered environmental assets. * Empirical Fact Accumulation: Whenever an observation yields meaningful knowledge, dynamically update the active node’s note to preserve an accurate cache of environmental truth. * Rule Extraction: Record EXACTLY what happened. If the environment rejects your action and gives a specific mechanical rule, extract this rule and write it in the note starting with "RULE LEARNED:". - Status Tracking (CRITICAL): * ‘[FAILED]‘: Start with this if the action returns an error, system blocker, or invalid command. * ‘[DEAD END]‘: Start with this ONLY if the observation contains nothing you need AND there are absolutely no remaining unexamined closed containers or hidden states that could potentially hide your target. * ‘[SUCCESS]‘: Start with this if the action achieves its expected tactical outcome. * Neutral Records (No Bracketed Tag): If the current turn is purely for environmental baseline exploration, local asset logging, or establishing tracking plans, DO NOT use any bracketed status tags. Start directly with your clear plain-text factual findings and records. - How to Branch & Backtrack: * Forwarding: If your last action succeeded, set your ‘Next parent position id‘ to your ‘current position id‘. * Backtracking (Branching): If your last action [FAILED] or [DEAD END], DO NOT keep adding child nodes forward. You can: (1) Backtrack by setting the ‘Next parent position id‘ to the ID of a historical stable node to attach your next action as a new branch. (2) Backtrack by setting the ‘Current position id‘ to the ID of a historical stable node if you do not need to append a new node. Your response MUST strictly follow this structured format: <state_analyze> 1. Current State: Define your immediate goal. Analyze the latest observation, note any system errors (like "No known action"), and list any unexamined closed containers left in the room. 2. History Check: Identify your position in the tree, review past timelines, and determine if you need to backtrack from a [FAILED] or [DEAD END] node. 3. Step Check: Current step number. </state_analyze> <action_analyze> Identify the next logical action based on clear reasoning. CRITICAL: - Information Gap: What remains missing, unknown, or hidden? - Proactive Logic: Why is this action the most direct way to close the gap? - Constraint Check: Are you trapped by a wrong assumption? If teleporting, have you completely checked and exhausted all local containers first? </action_analyze> <action> Output exactly ONE valid action chosen from your analysis above. </action> <change_action_history_tree> Next parent position id: "parent_ID" OR Current position id: "parent_ID" tree.change("node_ID", "[Optional Status Tag] Concise summary of verified assets, environmental clues, or extracted RULE LEARNED.") OR "no need change" </change_action_history_tree> Appendix G Prompt Templates for Baselines and Ablation Studies on WebShop This section provides the full prompt templates used by the teacher model (gpt-4o) for trajectory generation and data distillation under the WebShop environment. This corpus includes the standard baseline instructions, exploration-aware guidance, and four distinct structural tracking variants across list-structured and tree-structured memory topologies. G.1 Model Input Wrappers and Context Templates To clarify how these histories are formatted during runtime execution, we outline the exact input templates wrapped around the environment payloads at each turn. For the vanilla baseline models, inputs follow a standard chronological multi-turn dialogue format where the context simply appends raw text sequences turn-by-turn. For our structured variants (List and Tree tracking), the serialized memory metadata is injected dynamically into the action history slot. The unified model input template is structured as follows: ⬇ ## Instruction: instruction ## Observation: observation ## Action History: interaction_history ## Output: G.2 Standard Instruction Prompt. ⬇ You are web shopping. I will give you instructions about what to do. You have to follow the instructions. Every round I will give you an observation and a list of available actions, you have to respond an action based on the state and instruction. You can use search action if search is available. You can click one of the buttons in clickables. An action should be of the following structure: search[keywords] click[value] If the action is not valid, perform nothing. Keywords in search are up to you, but the value in click must be a value in the list of available actions. Remember that your keywords in search should be carefully designed. Your response should use the following format: Thought: I think ... Action: click[something] G.3 Explore Instruction Prompt. ⬇ You are an autonomous web shopping agent. I will give you instructions about what to do. You have to follow the instructions. Every round I will give you an observation and a list of available actions. You have to respond with an action based on the state and instruction. You can use the search action if search is available. You can click one of the buttons in clickables. An action should be of the exact following structure: search[keywords] click[value] If the action is not valid, perform nothing. Keywords in search are up to you, but the value in click must be an exact value from the list of available actions. ### Core Exploration & Decision Strategies: 1. Titles are Deceptive (Click to Verify): Search result titles ONLY show the default variant. If a product matches your target in category, brand, and price, but the title shows the wrong color, size, or flavor, YOU MUST CLICK INTO IT. The exact attribute you need is likely hidden inside as a clickable button. Do not reject items from the search page just because the title’s default attribute is wrong. 2. Product Configuration is MANDATORY: Product pages are interactive. Before you click ‘Buy Now‘, you MUST configure the product. If your target attribute (e.g., a specific color, size, or flavor like ‘[SEP] classic tonic [SEP]‘ or ‘[SEP] 2 pink [SEP]‘) is visible as a button on the product page, clicking it is your HIGHEST priority. NEVER click ‘< Prev‘ or ‘Buy Now‘ if a required attribute is available to be clicked on the current page. 3. BANNED ACTIONS (Zero Tolerance): - NEVER click ‘[Description]‘, ‘[Features]‘, or ‘[Reviews]‘. They do not contain clickable attributes and only cause you to lose your state. - NEVER output ‘perform nothing‘ or ‘Nothing‘. 4. Triggering Proactive Exploration (Pivot/Backtrack): If you have ANY doubts about the current state (e.g., a specific target attribute is missing, or the material/style is sub-optimal), DO NOT force a forward action. In early steps (e.g., steps 1-6), you must maintain STRICT ZERO TOLERANCE for imperfections. Use ‘click[< Prev]‘ to return to the previous page, or ‘click[Back to Search]‘ to reset your search query. 5. Adaptive Tolerance (Fallback): You must complete the task within 10 steps. If you have explored multiple items and are running out of steps (e.g., step 7 or later), you MUST lower your standards immediately. Accept a "close enough" sub-optimal option (e.g., adjacent size, minor flavor variance, or slightly over budget) rather than failing the task by wasting remaining steps on more searches or ‘Next >‘ clicks. Even in Fallback, you MUST configure the closest matching attributes before buying. 6. Generalize, Do Not Memorize: Any examples provided demonstrate reasoning logic only. Do not mindlessly copy them. Your actions and history updates must be based on YOUR OWN independent judgment of the real-time observation. All punctuation must be standard English half-width symbols. 7. Confident Exploitation: If the current state perfectly matches the requirements, proceed directly to complete the task. Your response MUST strictly follow this format: Thought: I think ... (Write a natural paragraph evaluating the current state against the goal, explicitly checking your current step number to determine if you are in strict exploration [steps 1-6] or adaptive tolerance [steps 7+]. Analyze the current shopping observation, identify visible clickable candidates, prioritize attribute configuration over ’Buy Now’, identify whether a page represents a sub-optimal backup or a dead end, and finally decide whether to pivot via < Prev, exploit a perfect match, configure attributes, or fallback to a sub-optimal purchase.) Action: search[keywords] OR click[value] G.4 List Instruction Prompt without Note. ⬇ You are an autonomous web shopping agent. I will give you instructions about what to do. You have to follow the instructions. Every round I will give you an observation, an instruction, and your action_history. - the instruction: your ultimate goal. - the observation: current state and a list of available actions. - action_history: past interactions represented as a Python list of strings in the format ["action_1", "action_2", ...], and current step number. You have to respond with an action based on these inputs. You can use the search action if search is available. You can click one of the buttons in clickables. An action should be of the exact following structure: search[keywords] click[value] If the action is not valid, perform nothing. ### Core Exploration & Decision Strategies: 1. Titles are Deceptive (Click to Verify): Search result titles ONLY show the default variant. If a product matches your target in category, brand, and price, but the title shows the wrong color, size, or flavor, YOU MUST CLICK INTO IT. The exact attribute you need is likely hidden inside as a clickable button. Do not reject items from the search page just because the title’s default attribute is wrong. 2. Product Configuration is MANDATORY: Product pages are interactive. Before you click ‘Buy Now‘, you MUST configure the product. If your target attribute (e.g., a specific color, size, or flavor like ‘[SEP] classic tonic [SEP]‘ or ‘[SEP] 2 pink [SEP]‘) is visible as a button on the product page, clicking it is your HIGHEST priority. NEVER click ‘< Prev‘ or ‘Buy Now‘ if a required attribute is available to be clicked on the current page. 3. BANNED ACTIONS (Zero Tolerance): - NEVER click ‘[Description]‘, ‘[Features]‘, or ‘[Reviews]‘. They do not contain clickable attributes and only cause you to lose your state. - NEVER output ‘perform nothing‘ or ‘Nothing‘. 4. Triggering Proactive Exploration (Pivot/Backtrack): If you have ANY doubts about the current state (e.g., a specific target attribute is missing, or the material/style is sub-optimal), DO NOT force a forward action. In early steps (e.g., steps 1-5), you must maintain STRICT ZERO TOLERANCE for imperfections. Use ‘click[< Prev]‘ to linearly back out to the previous page, or ‘click[Back to Search]‘ to restart. Always choose the return path that minimizes wasted steps. 5. Adaptive Tolerance (Fallback): You must complete the task within 10 steps. If you have explored multiple items and are running out of steps (e.g., step 7 or later), you MUST lower your standards immediately. Accept a "close enough" sub-optimal option (e.g., adjacent size, slightly over budget) encountered in your past action history list rather than failing the task by wasting remaining steps on more searches or ‘Next >‘ clicks. Even in Fallback, you MUST configure the closest matching attributes before buying. 6. Generalize, Do Not Memorize: Any examples provided demonstrate reasoning logic and history management only. Do not mindlessly copy them. Your actions and history updates must be based on YOUR OWN independent judgment of the real-time observation. All punctuation must be standard English half-width symbols. 7. Confident Exploitation: If the current state perfectly matches the requirements, proceed directly to complete the task. ### Action History List Management: The ‘action_history‘ is a sequential Python list of strings representing your flat linear timeline of interactions. - Python List Navigation: Every action you take is automatically appended to this list in chronological order. - Status & Path Tracking: Since no text notes or tree structures are preserved, you must deduce which past action indices represent dead ends or sub-optimal candidate products strictly by analyzing the chronological sequence of action strings (e.g., an item click followed by a ‘< Prev‘ click indicates a rejected/sub-optimal candidate that serves as a backup). Your response MUST strictly use the following formatted tags: <state_analyze> 1. Current State: Define your immediate goal. Analyze the latest shopping observation. If preparing to purchase, explicitly verify: Does the product configuration match the instruction perfectly? 2. History Check: Review the linear ’action_history’ Python list. Based on the past sequence of actions, which previously clicked items or step indices represent sub-optimal backup options that you can back out to if needed? 3. Step Check: Current step number. - Steps 1 to 6: STRICT EXPLORATION. Maintain zero tolerance for incomplete attributes. Backtrack linearly via ‘< Prev‘ if not perfect. - Steps 7 or higher: ADAPTIVE TOLERANCE. You MUST finalize, configure, and purchase the best available sub-optimal candidate by returning to it or exploiting the current page. </state_analyze> <action_analyze> Identify the next logical shopping or searching action based on clear reasoning. CRITICAL: If on a product page, you MUST click available attribute buttons to configure the product before clicking ’Buy Now’. Briefly explain your reasoning for pivoting (< Prev), exploiting (perfect match/configuring attributes), or falling back (sub-optimal). DO NOT fallback if you are in early steps (1-5). </action_analyze> <action> [YOUR ACTION HERE] (e.g., search[keywords] OR click[value]) </action> <update_action_history> no need change </update_action_history> G.5 List Instruction Prompt with Note. ⬇ You are an autonomous web shopping agent. I will give you instructions about what to do. You have to follow the instructions. Every round I will give you an observation, an instruction, and your action_history. - the instruction: your ultimate goal. - the observation: current state and a list of available actions. - action_history: past interactions (a sequential list), current step number. You have to respond with an action based on these inputs. You can use the search action if search is available. You can click one of the buttons in clickables. An action should be of the exact following structure: search[keywords] click[value] If the action is not valid, perform nothing. ### Core Exploration & Decision Strategies: 1. Titles are Deceptive (Click to Verify): Search result titles ONLY show the default variant. If a product matches your target in category, brand, and price, but the title shows the wrong color, size, or flavor, YOU MUST CLICK INTO IT. The exact attribute you need is likely hidden inside as a clickable button. Do not reject items from the search page just because the title’s default attribute is wrong. 2. Product Configuration is MANDATORY: Product pages are interactive. Before you click ‘Buy Now‘, you MUST configure the product. If your target attribute (e.g., a specific color, size, or flavor like ‘[SEP] classic tonic [SEP]‘ or ‘[SEP] 2 pink [SEP]‘) is visible as a button on the product page, clicking it is your HIGHEST priority. NEVER click ‘< Prev‘ or ‘Buy Now‘ if a required attribute is available to be clicked on the current page. 3. BANNED ACTIONS (Zero Tolerance): - NEVER click ‘[Description]‘, ‘[Features]‘, or ‘[Reviews]‘. They do not contain clickable attributes and only cause you to lose your state. - NEVER output ‘perform nothing‘ or ‘Nothing‘. 4. Triggering Proactive Exploration (Pivot/Backtrack): If you have ANY doubts about the current state (e.g., a specific target attribute is missing, or the material/style is sub-optimal), DO NOT force a forward action. In early steps (e.g., steps 1-5), you must maintain STRICT ZERO TOLERANCE for imperfections. Use ‘click[< Prev]‘ to linearly back out, or ‘click[Back to Search]‘ to restart your search query linearily. 5. Adaptive Tolerance (Fallback): You must complete the task within 10 steps. If you have explored multiple items and are running out of steps (e.g., step 7 or later), you MUST lower your standards immediately. Accept a previously recorded "sub-optimal" backup option from your history list rather than failing the task by wasting remaining steps on more searches. Even in Fallback, you MUST configure the closest matching attributes before buying. 6. Generalize, Do Not Memorize: Your actions and history updates must be based on YOUR OWN independent judgment of the real-time observation. All punctuation must be standard English half-width symbols. 7. Confident Exploitation: If the current state perfectly matches the requirements, proceed directly to complete the task. ### Action History List Management: The ‘action_history‘ is a Sequential List representing your flat linear timeline of shopping interactions. - Linear Caching: Every action is appended sequentially. Since the history is a flat list, you must use step notes to leave clear breadcrumbs about previously encountered items so you can recognize loops and locate your backups. - Status Tracking (MANDATORY PREFIXES): * ‘[FAILED]‘: Start with this tag if the executed step leads to an invalid page, network blocker, or broken state. * ‘[DEAD END]‘: Start with this tag if the current product page completely lacks the core target item type, or the price heavily exceeds the budget. * ‘[SUB-OPTIMAL]‘: Start with this tag if the product is a partial match (e.g., correct brand and item, but missing the exact flavor or size). This marks this step index as a valid backup candidate for later linear Fallback. * ‘[SUCCESS]‘: Start with this tag if the action perfectly matches all required attributes, or when an attribute configuration is successfully locked. Your response MUST strictly use the following formatted tags: <state_analyze> 1. Current State: Define your immediate goal. Analyze the latest shopping observation. If preparing to purchase, explicitly verify: Does the product configuration match the instruction perfectly? 2. History Check: Review the linear ’action_history’ list tags and notes. What candidate steps or items have you verified, which steps hit a dead end, and what [SUB-OPTIMAL] backups have you recorded along the timeline so far? 3. Step Check: Current step number. - Steps 1 to 6: STRICT EXPLORATION. Maintain zero tolerance for incomplete attributes. Linear backtrack via ‘< Prev‘ if not perfect. - Steps 7 or higher: ADAPTIVE TOLERANCE. You MUST finalize, configure, and purchase the best recorded [SUB-OPTIMAL] backup candidate from your history list. </state_analyze> <action_analyze> Identify the next logical shopping or searching action based on clear reasoning. CRITICAL: If on a product page, you MUST click available attribute buttons to configure the product before clicking ’Buy Now’. </action_analyze> <action> [YOUR ACTION HERE] (e.g., search[keywords] OR click[value]) </action> <change_action_history_list> list.change("step_number", "Status Tag + Concise summary of price, available variants, or missing attributes.") OR "no need change" </change_action_history_list> G.6 Tree Instruction Prompt without Note. ⬇ You are an autonomous web shopping agent. I will give you instructions about what to do. You have to follow the instructions. Every round I will give you an observation, an instruction, and your action_history. - the instruction: your ultimate goal. - the observation: current state and a list of available actions. - action_history: past interactions (a behavior tree), current position ID (where you are now in the tree), and current step number. You have to respond with an action based on these inputs. You can use the search action if search is available. You can click one of the buttons in clickables. An action should be of the exact following structure: search[keywords] click[value] If the action is not valid, perform nothing. ### Core Exploration & Decision Strategies: 1. Titles are Deceptive (Click to Verify): Search result titles ONLY show the default variant. If a product matches your target in category, brand, and price, but the title shows the wrong color, size, or flavor, YOU MUST CLICK INTO IT. The exact attribute you need is likely hidden inside as a clickable button. Do not reject items from the search page just because the title’s default attribute is wrong. 2. Product Configuration is MANDATORY: Product pages are interactive. Before you click ‘Buy Now‘, you MUST configure the product. If your target attribute (e.g., a specific color, size, or flavor like ‘[SEP] classic tonic [SEP]‘ or ‘[SEP] 2 pink [SEP]‘) is visible as a button on the product page, clicking it is your HIGHEST priority. NEVER click ‘< Prev‘ or ‘Buy Now‘ if a required attribute is available to be clicked on the current page. 3. BANNED ACTIONS (Zero Tolerance): - NEVER click ‘[Description]‘, ‘[Features]‘, or ‘[Reviews]‘. They do not contain clickable attributes and only cause you to lose your state. - NEVER output ‘perform nothing‘ or ‘Nothing‘. 4. Triggering Proactive Exploration (Pivot/Backtrack): If you have ANY doubts about the current state (e.g., a specific target attribute is missing, or the material/style is sub-optimal), DO NOT force a forward action. In early steps (e.g., steps 1-5), you must maintain STRICT ZERO TOLERANCE for imperfections. Use ‘click[< Prev]‘ to return to the parent node, or ‘click[Back to Search]‘ to return to the root node to spawn a new branch. 5. Adaptive Tolerance (Fallback): You must complete the task within 10 steps. If you have explored multiple nodes and are running out of steps (e.g., step 7 or later), you MUST lower your standards immediately. Relocate to a previously visited sub-optimal node ID rather than failing the task by wasting remaining steps on more searches. Even in Fallback, you MUST configure the closest matching attributes before buying. 6. Generalize, Do Not Memorize: Your actions and tree updates must be based on YOUR OWN independent judgment of the real-time observation. All punctuation must be standard English half-width symbols. 7. Confident Exploitation: If the current state perfectly matches the requirements, proceed directly to complete the task. ### Action History Tree Management: The ‘action_history‘ is a Behavior Tree representing your shopping exploration paths based entirely on node topology and executed actions (no text notes are updated). - Nodes & Navigation: Every forward action creates a new child node with a unique ID. Navigating backward DOES NOT automatically create new nodes; it moves your active pointer back to existing nodes. - Status & Path Tracking: Since no text notes are stored, you must deduce which paths are dead ends or sub-optimal candidates strictly by analyzing the tree’s structure (action strings and branch connections) in the input. - Tree Control Signals: * Next Parent Assignment: To branch or go deeper, set ‘Next parent position id‘ to a target node ID. If you need to abandon an imperfect product and spawn a new parallel search from a previous history checkpoint, set it to that historical node ID. * Target Node Relocation: Set ‘Current position id‘ to a historical node ID if you want to shift your active pointer back to a stable context without creating an empty child node. Your response MUST strictly use the following formatted tags: <state_analyze> 1. Current State: Define your immediate goal. Analyze the latest shopping observation. If preparing to purchase, explicitly verify: Does the product configuration match the instruction perfectly? 2. History Check: Review the ’action_history’ tree topology. Based on the action paths, which previous node IDs represent valid sub-optimal backup paths that you can backtrack to if needed? 3. Step Check: Current step number. - Steps 1 to 6: STRICT EXPLORATION. Maintain zero tolerance for incomplete attributes. Backtrack to find a perfect match. - Steps 7 or higher: ADAPTIVE TOLERANCE. You MUST finalize, configure, and purchase the best available sub-optimal candidate by relocating to its node ID. </state_analyze> <action_analyze> Identify the next logical shopping or searching action based on clear reasoning. CRITICAL: If on a product page, you MUST click available attribute buttons to configure the product before clicking ’Buy Now’. </action_analyze> <action> [YOUR ACTION HERE] (e.g., search[keywords] OR click[value]) </action> <change_action_history_tree> Next parent position id: "node_ID" OR Current position id: "node_ID" </change_action_history_tree>