ToolGym
一种使用可扩展代理测试环境的开放世界工具
  
概述
ToolGym是一个大规模的开放世界基准,用于评估LLM代理的工具使用能力。建立在 5571实际工具 横跨 204应用程序ToolGym通过以下方式实现了逼真的测试:
- 长期工作流程:需要复杂工具协调的多步骤任务
- 野生约束:必须满足的自然语言要求
- 健壮性测试:用于系统扰动测试的状态控制器
关键统计数据
| 度量 | 值 |
|---|---|
| 工具总数 | 5571 |
| 应用程序 | 204 |
| 任务实例 | 3091 |
| 每项任务的平均工具 | 4.77 |
| 每个任务的平均步骤 | 7.46 |
建筑
┌─────────────────────────────────────────────────────────────────┐
│ ToolGym │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ Task Creation │ │ Tool Retrieval │ │ State │ │
│ │ Engine │ │ Index │ │ Controller │ │
│ │ │ │ │ │ │ │
│ │ • Workflow │ │ • BGE-M3 │ │ • Tool-level │ │
│ │ Synthesis │ │ • FAISS │ │ • State-level│ │
│ │ • Constraint │ │ • 5,571 tools │ │ • Constraint │ │
│ │ Generation │ │ │ │ -level │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
│ │
├─────────────────────────────────────────────────────────────────┤
│ Planner-Actor Framework │
│ ┌─────────────────┐ ┌─────────────────────────┐ │
│ │ Planner │ ──prompts──▶ │ Actor │ │
│ │ (Decomposes │ │ (Executes tools via │ │
│ │ into subtasks)│ ◀─feedback── │ ReAct reasoning) │ │
│ └─────────────────┘ └─────────────────────────┘ │
│ │
├─────────────────────────────────────────────────────────────────┤
│ LLM-as-Judge │
│ Multi-model evaluation with majority voting │
└─────────────────────────────────────────────────────────────────┘安装
# Clone the repository
git clone https://github.com/Ziqiao-git/ToolGym.git
cd ToolGym
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your API keys快速开始
运行代理
# Basic usage with semantic tool discovery
python runtime/run_react_agent.py "Search for latest AI news"
# With trajectory logging
python runtime/run_react_agent.py "Find GitHub repos about ML" --save-trajectory
# Custom model
python runtime/run_react_agent.py "Your query" \
--model anthropic/claude-3.5-sonnet \
--max-iterations 10核心组件
1.任务创建引擎
通过以下方式综合现实、长期的任务:
- 工作流综合:将链工具调用成连贯的任务序列
- 约束生成:添加自然语言要求
- 多样性抽样:确保跨工具类别的覆盖范围
地点: task_creation_engine/
2.工具检索索引
语义搜索超过5571个工具,使用:
- 嵌入:BGE-M3(多语言,1024维)
- 索引:FAISS用于高效的相似性搜索
- 动态负载:按需MCP服务器连接
地点: tool_retrieval_index/
3.状态控制器
三种控制类型的系统稳健性测试:
| 控制类型 | 策略 |
|---|---|
| 工具级别 | 超时、速率限制、不可用、架构更改、部分故障 |
| 国家级 | 响应延迟、数据损坏、截断、会话超时、数据失效 |
| 约束级别 | 添加约束、修改约束、收紧截止日期、资源限制 |
地点: toolgym/state_controller/
4.规划师-演员框架
两阶段代理架构:
- 规划师:将任务分解为子任务序列
- 男演员:使用ReAct推理和工具调用执行子任务
地点: Orchestrator/mcpuniverse/agent/
5.法学硕士作为评委评估
多维评估,包括:
- 5个评分维度:任务完成、接地、工具选择、工具执行、需求满足
- 多模型投票:使用多个法学硕士评委以增强稳健性
- 多数票表决:共识的最终得分
地点: Orchestrator/mcpuniverse/evaluator/
项目结构
ToolGym/
├── README.md # This file
├── docs/ # GitHub Pages website
│ └── index.html # Leaderboard & documentation
│
├── task_creation_engine/ # Task synthesis
│ └── query_generate.py # Workflow generation
│
├── tool_retrieval_index/ # Semantic tool search
│ └── server.py # MCP server with search
│
├── toolgym/ # Core library
│ └── state_controller/ # Robustness testing
│
├── Orchestrator/ # Agent framework
│ └── mcpuniverse/
│ ├── agent/ # Planner-Actor implementation
│ └── evaluator/ # LLM-as-Judge
│
├── MCP_INFO_MGR/ # Tool data management
│ ├── mcp_data/ # Tool metadata
│ └── semantic_search/ # FAISS index
│
├── runtime/ # Agent runtime
│ └── run_react_agent.py # CLI interface
│
└── evaluation/ # Evaluation scripts数据集
ToolGym数据集可在HuggingFace上获得:
🤗 ToolGym
内容:
- 3091个具有地面实况工具序列的任务实例
- 204个应用程序中5571个工具的工具元数据
- 约束注释和扰动配置
引用
@inproceedings{toolgym2025,
title={ToolGym: An Open-world Tool-using Environment for LLM Agent Evaluation},
author={...},
booktitle={Proceedings of ACL 2025},
year={2025}
}许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
致谢
- 基于模型上下文协议(MCP)生态系统构建
- 工具数据来源于Smithery和其他MCP注册表
- 受最近法学硕士作为法官研究启发的评估框架
______________________________________________________________________
网站: 数据集: https://huggingface.co/ToolGym GitHub:
