ToolSmith: An Automatic Tool-Generation Framework for Multimodal Search Agents

Rui Sun, Junhua Huang, Luca Zancato, Md Mofijul Islam, Kai-Wei ChangarXiv 2026

TL;DR

Instead of giving AI agents a static, "frozen" toolbox, ToolSmith teaches them to be digital blacksmiths. It’s a framework that allows multimodal search agents to automatically generate, verify, and reuse new Python tools whenever they hit a "capability gap," leading to significant performance boosts across both familiar and entirely new tasks.

What Problem Does This Paper Address?

Imagine you’re trying to solve a complex puzzle, but you’re only allowed to use a hammer and a screwdriver. If you run into a bolt that needs a hex key, you’re stuck.

Current multimodal search agents—AI that can "see" images and "read" the live web—suffer from this exact problem. They rely on a small, hand-crafted library of tools (like OCR or basic web search). These libraries are expensive to build and, more importantly, they are brittle. When an agent encounters a new type of query or a weird data format it wasn't programmed for, it fails.

Humans don't work this way. If we don't have the right tool, we fashion a new one from parts we already understand. The authors of ToolSmith argue that AI agents should do the same: organically growing their own capabilities rather than waiting for a developer to ship an update.

Methods

ToolSmith operates as a four-phase pipeline that turns an agent's failures into new features:

  1. Trajectory Mining: The system runs the agent on a training pool. When the agent gets an answer wrong, an "LLM Critic" analyzes the failure. If the failure happened because a specific capability was missing, it’s flagged as a Capability Gap.
  2. Reuse-or-Grow Decision: Before building something new, the system checks if any existing tool (even a previously generated one) can fill the gap using a similarity check. If not, it’s time to head to the forge.
  3. Tool Generation: A Vision-Language Model (VLM), like GPT-5, is prompted to write a new Python tool. This isn't just a snippet; it’s a full class with a schema and execution logic, often chaining together existing "primitive" tools.
  4. Two-Gate Verification: To ensure the new tool isn't a hallucinated mess, it passes through two gates:
  5. Gate 1 (Sandbox): A static check and a "smoke test" in a secure environment to ensure the code actually runs and doesn't do anything dangerous.
  6. Gate 2 (LLM Code Review): Another LLM scores the tool on axes like "abstractness" (is it useful for a class of queries, or just one?) and "task alignment."

At inference time, the agent doesn't see every tool ever made (which would overwhelm its context window). Instead, it uses a lightweight retrieval step to grab the top $K$ most relevant generated tools for the specific question at hand.

Figure 2: Overview of the TOOLSMITH pipeline: capability gaps mined from agent trajectories on a training pool are filtered through reuse-or-grow against the tool catalog, passed to an LLM that authors each new tool as Python source, and admitted only after verification gates with a feedback-driven retry on rejection.

Datasets

The authors trained ToolSmith using a pool of trajectories from three knowledge-intensive benchmarks: FVQA, InfoSeek, and EncyclopedicVQA.

To see if these tools actually generalize, they evaluated the system on 10 out-of-domain (OOD) benchmarks, including MMSearch, LiveVQA, and RealX-Bench. These OOD tasks were never seen during the tool-generation phase, providing a true test of whether the "forged" tools are broadly useful.

Key Insights and Ideas

  • The "Perceive-Then-Query" Pattern: One of the most common "aha" moments was seeing the agent generate tools that enforced a specific order of operations. Base agents often jump straight to text search without identifying what’s in the image first. Generated tools often chain a "reverse image search" with a "structured database lookup," forcing the agent to identify the entity before asking questions about it.
  • The Goldilocks Zone of Clustering: You can't make a new tool for every single failed query—that leads to a bloated, redundant library. By clustering failures, ToolSmith finds the "just right" number of tools (around 500 clusters in their tests) that provide broad coverage without overwhelming the agent.
  • Stronger Blacksmiths make Better Swords: The choice of the generator model matters more than the inference model. Using a powerful model like GPT-5 to author the tools provided gains even when those tools were used by much smaller, open-source models like Qwen3-VL-8B.

Key Results

ToolSmith consistently outperformed the base library across the board:

  • In-Domain: Using the Qwen3-VL-8B model, ToolSmith improved accuracy by +2.20 percentage points (pp).
  • Out-of-Domain: It showed a +1.33pp improvement on completely unseen benchmarks, proving the tools weren't just memorizing training data.
  • Scalability: Larger backbone models reaped even greater rewards, with the 32B variant seeing a +2.98pp boost on out-of-domain tasks.
Figure 1: We propose an automatic tool-generation framework for multimodal search agents. In the ex- ample shown, an agent restricted to a fixed tool library is bound to its pre-defined primitives and fails on queries that no original tool can directly resolve. Our frame- work instead grows the library: the agent operates over an extended tool library that includes newly generated tools and can invoke them freely when solving real queries. Here, the newly generated Event In Image tool resolves the query through finer-grained informa- tion verification and image search.

Limitations and Future Work

While ToolSmith is a major step toward self-evolving agents, it has its limits. It currently doesn't generate tools that create images, only tools that process them. It also relies on live search APIs, which can be unpredictable over time.

The authors suggest that future work could involve using code-specialized LLMs as the "blacksmith" to further improve tool quality and exploring "self-correction" where agents refine their own tools during a live task. For now, ToolSmith proves that the best way to handle a complex world isn't to have every tool ready—it's to know how to make the one you need.

Summary updated

BibTeX
@misc{sun2026toolsmith,
  author = {Rui Sun and Junhua Huang and Luca Zancato and Md Mofijul Islam and Kai-Wei Chang},
  title = {{ToolSmith: An Automatic Tool-Generation Framework for Multimodal Search Agents}},
  year = {2026},
  eprint = {2611.31198},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31198},
}
Figure