SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.07768 · 2025

ToolLibGen: Scalable Automatic Tool Creation and Aggregation for LLM Reasoning

Huan Wang, Caiming Xiong, Silvio Savarese, Ziyu Yao, Liangwei Yang, Shelby Heinecke, Zuxin Liu, Jianguo Zhang, Murong Yue, Zhiwei Liu, Haolin Chen

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 0 no recorded run), measured 2026-11-22; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2510.07768.json · badge: /api/ran/2510.07768.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
SalesforceAIResearch/ToolLibGen canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
calculate_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SalesforceAIResearch/ToolLibGen/backup/old_src/KTCE_baseline_implement.py
code served (permissive licence) · get_code("9821b52e07e3a011")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Q_tool_values: a tensor that will be summed
Q_tool_values = torch.randn(2, 4)

# Q_set: a scalar value (used directly in arithmetic)
Q_set = 1.5

# alpha: scalar coefficient
alpha = 0.8

# beta: scalar coefficient
beta = 0.6

# gamma: scalar coefficient
gamma = 0.4

# n: integer value
n = 10

# k: integer value
k = 3

ARGS = {
    "Q_tool_values": Q_tool_values,
    "Q_set": Q_set,
    "alpha": alpha,
    "beta": beta,
    "gamma": gamma,
    "n": n,
    "k": k,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_experience_pool Ran
ran; our contract draft was wrong, not the code
SalesforceAIResearch/ToolLibGen/backup/old_src/KTCE_baseline_implement.py
code served (permissive licence) · get_code("c8054269e992ed93")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import logging

# The function takes a single parameter: response (a string)
# It uses re.search() with a pattern to find XML-like tags
# and extracts content between <experience_list> and </experience_list> tags

ARGS = {
    'response': '<experience_list>\nSome experience data here\nwith multiple lines\n</experience_list>\nOther content'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_useful_tools Ran
ran, honoured the contract we drafted
SalesforceAIResearch/ToolLibGen/backup/old_src/KTCE_baseline_implement.py
code served (permissive licence) · get_code("c65c5803ad8777f4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import logging

torch_imported = False
try:
    import torch
    torch_imported = True
except ImportError:
    pass

# Test cases for the function
response_1 = "<answer>5</answer>"
response_2 = "<answer>[1, 2, 3]</answer>"
response_3 = "<answer>10</answer> some text <answer>20</answer>"
response_4 = "<answer>invalid_var</answer>"
response_5 = "<answer>3.14</answer>"
response_6 = "no answer tags here"
response_7 = "<answer>[100, 200, 300]</answer>"

ARGS = {
    "response": response_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
setup_logging Ran
ran; our contract draft was wrong, not the code
SalesforceAIResearch/ToolLibGen/src/ToolAggregationAgent.py
code served (permissive licence) · get_code("d8b1384934a717ba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging
from pathlib import Path
from datetime import datetime
import tempfile

# Create a temporary directory for logs
temp_log_dir = tempfile.mkdtemp()

ARGS = {
    'debug': False,
    'log_folder': temp_log_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
validate_code_syntax Ran
ran; our contract draft was wrong, not the code
SalesforceAIResearch/ToolLibGen/src/utils.py
code served (permissive licence) · get_code("f26ad4e857dc7f46")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import signal

ARGS = {
    "code": "x = 1\ny = 2\nz = x + y\nprint(z)",
    "timeout": 5,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
validate_code_syntax_exec Ran
ran; our contract draft was wrong, not the code
SalesforceAIResearch/ToolLibGen/src/utils.py
code served (permissive licence) · get_code("a7010a79f9ac80e7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import base64

ARGS = {
    "code": "print('hello world')",
    "timeout": 5,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
validate_tools_syntax Ran
ran; our contract draft was wrong, not the code
SalesforceAIResearch/ToolLibGen/src/utils.py
code served (permissive licence) · get_code("2b8eea92acc171ab")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import ast
import signal

# Test case 1: Valid Python code
valid_code_1 = """
def hello():
    print("Hello, world!")
    return 42
"""

# Test case 2: Valid Python code
valid_code_2 = """
x = [1, 2, 3, 4, 5]
y = sum(x)
"""

# Test case 3: Invalid syntax - missing colon
invalid_code_1 = """
def broken_function()
    return None
"""

# Test case 4: Invalid syntax - indentation error
invalid_code_2 = """
if True:
print("Missing indent")
"""

# Test case 5: Valid but empty code
empty_code = ""

# Test case 6: Valid code with complex logic
valid_code_3 = """
class MyClass:
    def __init__(self):
        self.value = 10
    
    def method(self):
        return self.value * 2
"""

# Construct tools list with various code samples
tools = [
    {'code': valid_code_1, 'tool_number': 'tool_1'},
    {'code': valid_code_2, 'tool_number': 'tool_2'},
    {'code': invalid_code_1, 'tool_number': 'tool_3'},
    {'code': invalid_code_2, 'tool_number': 'tool_4'},
    {'code': empty_code, 'tool_number': 'tool_5'},
    {'code': valid_code_3, 'tool_number': 'tool_6'},
]

ARGS = {
    'tools': tools,
    'timeout': 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models (LLMs) equipped with external tools have demonstrated enhanced performance on complex reasoning tasks. The widespread adoption of this tool-augmented reasoning is hindered by the scarcity of domain-specific tools. For instance, in domains such as physics question answering, suitable and specialized tools are often missing. Recent work has explored automating tool creation by extracting reusable functions from Chain-of-Thought (CoT) reasoning traces; however, these approaches face a critical scalability bottleneck. As the number of generated tools grows, storing them in an unstructured collection leads to significant retrieval challenges, including an expanding search space and ambiguity between function-related tools. To address this, we propose a systematic approach to automatically refactor an unstructured collection of tools into a structured tool library. Our system first generates discrete, task-specific tools and clusters them into semantically coherent topics. Within each cluster, we introduce a multi-agent framework to consolidate scattered functionalities: a code agent refactors code to extract shared logic and creates versatile, aggregated tools, while a reviewing agent ensures that these aggregated tools maintain the complete functional capabilities of the original set. This process transforms numerous question-specific tools into a smaller set of powerful, aggregated tools without loss of functionality. Experimental results demonstrate that our approach significantly improves tool retrieval accuracy and overall reasoning performance across multiple reasoning tasks. Furthermore, our method shows enhanced scalability compared with baselines as the number of question-specific increases. Our codes are available in https://github.com/SalesforceAIResearch/ToolLibGen.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2510.07768")
get_code_for_paper("2510.07768")
have("2510.07768")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2510.07768.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2510.07768.svg)](https://syntology.ai/paper/2510.07768)

Connect an agent — have() is free.