Rui Sun♠, Junhua Huang♠, Luca Zancato♣, Md Mofijul Islam♣†, Kai-Wei Chang♠†
UCLA NLP ♠University of California, Los Angeles AWS ♣AWS GenAI
†Equal advising
EMNLP 2026
ToolSmith teaser

Hand-crafted tool libraries are frozen at deployment. ToolSmith lets a multimodal search agent grow its own tools from its failures: mined capability gaps become new, verified, reusable Python tools that lift accuracy across 13 benchmarks.

Abstract

Recent multimodal search agents use reasoning, vision, and live web search across many turns to answer questions beyond parametric knowledge by orchestrating a small library of hand-crafted search and visual tools. However, the library is laborious to create and maintain, and frozen when new query types, evidence formats, and failure modes are encountered in the wild. Human practitioners, by contrast, cope with insufficient tools by fashioning new ones from familiar parts and reusing them across tasks. Inspired by this, we propose ToolSmith, an automatic tool-generation framework that grows and reuses modules on top of a lean base tool library. We evaluate ToolSmith on three in-domain multimodal search benchmarks and ten out-of-domain benchmarks under a VLM-as-a-Judge protocol. ToolSmith consistently improves over the base library across deployed agents of varying scales, with larger backbones reaping greater gains, demonstrating the scalability of the approach. Our code and data will be publicly available.

Method

ToolSmith framework

ToolSmith runs a four-phase pipeline on top of an eight-primitive base library. Phase 1 (Trajectory Mining) clusters the agent's failed trajectories into capability gaps. Phase 2 (Reuse-or-Grow) checks each gap against the current catalog and escalates to generation only when no existing tool fits. Phase 3 (Tool Generation) prompts a generator LLM to author the new tool as Python source under structural and anti-hardcode constraints. Phase 4 (Two-Gate Verification) admits a candidate only after a sandboxed execution check and an LLM static code review. At inference, a lightweight retriever routes the top-K generated tools to each query alongside the always-visible base primitives.

Results

Across 3 in-domain and 10 out-of-domain benchmarks, tools generated by ToolSmith (GPT-5 generator) consistently improve over an already strong base-tool agent:

Inference modelID avg (base → +ToolSmith)OOD avg (base → +ToolSmith)
Qwen3-VL-8B47.94 → 50.14 (+2.20)26.57 → 27.90 (+1.33)
Qwen3-VL-32B55.47 → 57.14 (+1.67)31.27 → 34.25 (+2.98)
GPT-551.80 → 52.84 (+1.04)39.80 → 42.20 (+2.40)

Gains appear in 36 of 39 backbone×benchmark cells. Ablations show the tool-generation model should be as strong as possible, while the trajectory-mining model should match the inference model; a cluster-count sweep exposes a quality–coverage trade-off.

Generated Tools in Action

BibTeX

@article{sun2026toolsmith,
  title   = {ToolSmith: An Automatic Tool-Generation Framework for Multimodal Search Agents},
  author  = {Sun, Rui and Huang, Junhua and Zancato, Luca and Islam, Md Mofijul and Chang, Kai-Wei},
  journal = {arXiv preprint},
  year    = {2026},
  note    = {arXiv link coming soon}
}