Skip to main content

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

GitHub license Arxiv PyPI

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}, 
}

Metadata

Release files for toolgrad 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toolgrad 0.2.0
File Size Uploaded Provenance
toolgrad-0.2.0.tar.gz 851.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for toolgrad 0.2.0
File Interpreter ABI Platform
toolgrad-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.7 MB

Release files / toolgrad-0.2.0.tar.gz

Download URL toolgrad-0.2.0.tar.gz
Size 851.5 kB
Tags Source
SHA-256 checksum
How to use checksums
113d888f073a8a5dad04d472f85435b25d8faf0da0cdfcedff1d2dce54feaee6
BLAKE2b-256 checksum
How to use checksums
9e6bf4334755f79888a4e2d11689f6bda2d2ac27c46838896a1939a967de3c32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 19, 2026.

Transparency log

Release files / toolgrad-0.2.0-py3-none-any.whl

Download URL toolgrad-0.2.0-py3-none-any.whl
Size 874.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36dd7b35edc67c14021a5695a04f07fba61a9e0e702ef0c3468d9cd7bb8a7409
BLAKE2b-256 checksum
How to use checksums
533a0bda41ba78117ea811ec1a3f9c502e09723253668c4260527444d6fdf511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 19, 2026.

Transparency log

Security for toolgrad 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for toolgrad-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page