Skip to main content

Official Repo for ToolGrad: Efficient Tool-use Dataset Generation with Textual “Gradients”

Project description

ToolGrad: Efficient Tool-use Dataset Generation with Textual "Gradients" (ACL 26 Finding)

GitHub license Arxiv PyPI

[!WARNING] Notes: The current repo contains out-of-dated code. We will actively update the repo to align with our paper on ACL 2026. The following is a roadmap.

  • [ ] Update data generation pipeline
  • [ ] Update toolgrad package
  • [ ] post-training code
  • [ ] evaluate code

TODOs: Open In Colab Dataset on HF Model on HF

This is an official repo for <ToolGrad: Efficient Tool-use Dataset Generation with Textual “Gradients”>.

demo

demo

Get Started: A Quick Demo

Step 0: Install packages

Install nvm for MCP service:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
nvm install 20
nvm alias default 20

# verify npx
npx --version

Clone this repo and setup the uv env:

cd toolgrad
uv venv
uv sync
source .venv/bin/activate

Step 1: launch your first ToolGrad framework on a MCP service

# If you have no Gemini API key in your environment,
export GEMINI_API_KEY=YOUR_GEMINI_KEY

export PYTHONPATH=./
python examples/mcp_filesystem.py

During the execution, you should be able to see some useful logs to better understand the ToolGrad framework.

For example, the following is an example log of the API proposer.

INFO:root:[Iteration 2] Proposed 3 API proposals
INFO:root:  Proposal 1 (proposal_1): Read the content of the 'favorite_books.txt' file.
INFO:root:    └─ read_text_file
INFO:root:  Proposal 2 (proposal_2): Read the contents of 'favorite_books.txt', 'favorite_cities.txt', and 'favorite_songs.txt' simultaneously.
INFO:root:    └─ read_multiple_files
INFO:root:  Proposal 3 (proposal_3): List the contents of the current directory.
INFO:root:    └─ list_directory

The following is an example log of API executor.

INFO:root:[Iteration 2] Executed 3 proposals: 3 successful, 0 failed
INFO:root:   proposal_1: 1 tool call(s)
INFO:root:      Tool: read_text_file
INFO:root:      Input: {'path': 'favorite_books.txt'}
INFO:root:   proposal_2: 1 tool call(s)
INFO:root:      Tool: read_multiple_files
INFO:root:      Input: {'paths': ['favorite_books.txt', 'favorite_cities.txt', 'favorite_songs.txt']}
INFO:root:   proposal_3: 1 tool call(s)
INFO:root:      Tool: list_directory
INFO:root:      Input: {'path': '.'}

After the execution, you should be able to see the output data in examples/outputs/. It should look similar to examples/outputs/trace_example/00123.json and examples/outputs/example_seed=123__iter=3__num_apis=5.json.

ToolGrad-500

This is a TODO.

BibTex

@misc{zhou2025toolgradefficienttoolusedataset,
      title={ToolGrad: Efficient Tool-use Dataset Generation with Textual "Gradients"}, 
      author={Zhongyi Zhou and Kohei Uehara and Haoyu Zhang and Jingtao Zhou and Lin Gu and Ruofei Du and Zheng Xu and Tatsuya Harada},
      year={2025},
      eprint={2508.04086},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2508.04086}, 
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toolgrad-0.2.0.tar.gz (851.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toolgrad-0.2.0-py3-none-any.whl (874.4 kB view details)

Uploaded Python 3

File details

Details for the file toolgrad-0.2.0.tar.gz.

File metadata

  • Download URL: toolgrad-0.2.0.tar.gz
  • Upload date:
  • Size: 851.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for toolgrad-0.2.0.tar.gz
Algorithm Hash digest
SHA256 113d888f073a8a5dad04d472f85435b25d8faf0da0cdfcedff1d2dce54feaee6
MD5 e9912fe745e031d6c098597619a61167
BLAKE2b-256 9e6bf4334755f79888a4e2d11689f6bda2d2ac27c46838896a1939a967de3c32

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolgrad-0.2.0.tar.gz:

Publisher: publish.yml on zhongyi-zhou/toolgrad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file toolgrad-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: toolgrad-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 874.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for toolgrad-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36dd7b35edc67c14021a5695a04f07fba61a9e0e702ef0c3468d9cd7bb8a7409
MD5 1d1f11d4863e37eceaffa6786565df69
BLAKE2b-256 533a0bda41ba78117ea811ec1a3f9c502e09723253668c4260527444d6fdf511

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolgrad-0.2.0-py3-none-any.whl:

Publisher: publish.yml on zhongyi-zhou/toolgrad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page