Optimizing Agent Tool-Use via Trajectory-based Insight Evolution

Hanchen Qiu, Haojia Zhu, Yifan Meng, Jiahui JinNeurIPS 2026

TL;DR

When AI agents fail to use external tools properly, we usually blame the model and try to fix its weights—ignoring the fact that the API documentation we gave it might just be terrible. OPTOOL flips the script by keeping the Large Language Model (LLM) completely frozen and instead evolving the tool documentation itself through trial, error, and contrastive reflection. By automatically writing better instruction manuals for its tools, a lightweight model can outperform much larger counterparts while using fewer reasoning steps and less compute.

What Problem Does This Paper Address?

Picture yourself trying to assemble a desk late at night, except the manual skips three steps and calls two different screws by the exact same name. That is the daily reality of tool-using LLM agents. Real-world API documentation—often scraped from the web or hastily written once—is frequently vague about edge cases, output formats, and usage boundaries. In an empirical study of 635 tasks across six domains, the authors found that 16.2% of agent failures were directly caused by insufficient tool documentation.

Figure 1: (1) An illustration of the problem where insuf- ficient tool configuration leads to the agent’s incorrect tool calls. (2) OPTOOL captures generalizable tool insights and injects them into tool documents.

Currently, researchers try to fix tool-use errors in two ways:

  1. Parametric Tuning (Fine-tuning / RL): Baking tool-use habits directly into model weights. This is computationally expensive and brittle—the moment an API updates, your hard-earned weights go stale.
  2. In-Context Learning (Agent Memory): Stuffing past interaction logs into the prompt. Because rewards are sparse (did the whole 10-step task succeed or fail?), it is hard to know which specific tool call actually helped, often polluting the prompt with noisy, suboptimal habits.

Instead of tuning the agent or hoarding raw task logs, the authors ask: What if we treat the tool documentation itself as a learnable, evolvable configuration?

Methods

OPTOOL keeps the LLM's parameters frozen and upgrades static documentation through an offline, three-stage evolutionary loop:

Figure 2: Overview of OPTOOL framework.
  • Stage 1: Contrastive Trajectory Generation. Standard beam search greedily keeps only the top-$K$ highest-scoring paths. OPTOOL introduces Contrastive Beam Search (CBS), intentionally keeping both the top $K/2$ best and bottom $K/2$ worst trajectories (scored via step information gain, final answer accuracy, and a length penalty). Next, Retrospective Global Credit Assignment looks backward from the end of each trajectory to grade every individual tool call (0, 1, or 2) on how much it actually contributed to the final outcome, curing short-sighted step evaluations.
  • Stage 2: Trajectory-based Insight Extraction. By contrasting high-credit successes against low-credit failures, a frozen LLM distills structured natural-language rules at two granularities: Tool-level insights (quirks, input/output formats, and boundaries of a single tool) and Toolkit-level insights (how multiple tools should be orchestrated together).
  • Stage 3: Tool Documentation Evolution. Insights aren't just endlessly appended until the context window bursts. OPTOOL manages them like a curated forum using five operations: ADD, EDIT, UPVOTE, DOWNVOTE, and DELETE (triggered when an insight's utility score drops to zero). If the insight list exceeds a strict capacity limit, the LLM semantically compresses redundant rules, and an early-stopping check halts evolution once changes plateau to prevent overfitting.

Datasets

The authors do not introduce a new dataset; instead, they evaluate OPTOOL across six existing vertical-domain benchmarks sourced from prior tool-use suites (such as ToolQA): Tourism, Business, Geography, Social, Biography, and Encyclopedia. Together, these span structured databases, knowledge graphs, and text corpora.

Key Insights and Ideas

  • Failures are half the signal: Replacing Contrastive Beam Search with standard top-$K$ selection causes a steep drop in accuracy. Seeing how a tool call goes wrong right alongside how it goes right is essential for mapping out crisp usage boundaries.
  • Better docs beat bigger brains: Compensating for logical gaps in documentation allows a smaller, cheaper model (GPT-4o-mini with OPTOOL: 40.9% accuracy) to outperform a much stronger model running standard ReAct (Qwen3.5-plus: 37.4% accuracy).
  • Longer prompts can still save money: Injecting evolved insights makes the system prompt longer, which sounds more expensive. Yet in practice, total inference costs drop because clear documentation eliminates dead-end guesses and redundant tool-calling loops.
  • Tool-centric beats task-centric: Unlike traditional agent memory—which retrieves past tasks that look similar—attaching insights directly to tools means any future task using those tools immediately inherits the wisdom, enabling clean zero-retrieval transfer across domains and agent frameworks.

Key Results

Iterative accuracy gains and component ablations across LLM backbones.

Iterative accuracy gains and component ablations across LLM backbones.
  • Accuracy & Efficiency: Across all six domains, OPTOOL achieves 40.9% average accuracy on GPT-4o-mini (+7.6% absolute gain over the strongest baseline, SEER, while cutting average steps from 3.52 to 3.04) and 46.1% on Qwen3.5-plus (+7.1% over SEER, cutting steps from 3.39 to 2.36).
  • Plug-and-Play Boost: Dropping OPTOOL-evolved docs into seven existing agent frameworks (including ReAct, ExpeL, Chameleon, and DRAFT) improves average accuracy by +8% to +10% while trimming reasoning steps by 0.24 to 0.45 per task.
  • Low Offline Overhead: Evolving a domain's documentation offline costs an average of just $1.87 with GPT-4o-mini and $0.94 with Qwen3.5-plus.

Limitations and Future Work

The authors note two primary limitations (detailed further in their appendix):

  1. Backbone Dependency: Because insight extraction, credit assignment, and semantic compression all rely on prompting a frozen LLM, the quality and speed of evolution depend on the reasoning strength of the underlying model (stronger models hit their performance ceiling in fewer iterations).
  2. Modality Constraints: OPTOOL currently operates strictly on text-based tools and documentation.

For future work, the authors suggest training specialized, lightweight models dedicated specifically to extracting tool insights, as well as extending the evolutionary framework to multi-modal agents and environments.

Summary updated

BibTeX
@inproceedings{qiu2026optimizing,
  author = {Hanchen Qiu and Haojia Zhu and Yifan Meng and Jiahui Jin},
  title = {{Optimizing Agent Tool-Use via Trajectory-based Insight Evolution}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=YhqhX9eS3E},
}
Figure