遇见数据集

snorkelai/Tau2-Bench-Airline-With-Code-Agents

收藏
Hugging Face2025-12-03 更新2025-11-15 收录
官方服务:

资源简介:

--- dataset_info: features: - name: task_id dtype: string - name: model dtype: string - name: version dtype: string - name: user_scenario struct: - name: instructions struct: - name: domain dtype: string - name: known_info dtype: string - name: reason_for_call dtype: string - name: task_instructions dtype: string - name: unknown_info dtype: string - name: persona dtype: 'null' - name: db_update_required dtype: bool - name: trace list: - name: content dtype: string - name: role dtype: string - name: timestamp dtype: string - name: tool_calls dtype: string - name: turn_idx dtype: int64 - name: reward dtype: float64 - name: reward_breakdown struct: - name: COMMUNICATE dtype: float64 - name: DB dtype: float64 - name: db_diff dtype: string - name: db_diff_by_table struct: - name: flights dtype: string - name: reservations dtype: string - name: users dtype: string - name: db_diff_verbose dtype: string - name: __index_level_0__ dtype: int64 splits: - name: train num_bytes: 14972433 num_examples: 500 download_size: 4452463 dataset_size: 14972433 configs: - config_name: default data_files: - split: train path: data/train-* license: apache-2.0 task_categories: - text-generation language: - en tags: - agent - code --- # Dataset Card for a Code Agent Version of Tau Bench 2 Airline ## Dataset Summary This dataset includes sample traces and associated metadata from multi-turn interactions between an code agent and AI assistant. The dataset is based on the Airline environment from [Tau^2 Bench](https://github.com/sierra-research/tau2-bench) and contains traces from both the original version and a version made at Snorkel AI using code agents to solve the same tasks (indicator in the `version` field; details below). - **Curated by:** Snorkel AI - **License:** Apache-2.0 License Example snippet of a trace from Claude Sonnet 4.5 self-correcting after an exception: <img src="trace_eg1.png" style="width:50%;"> ## Quickstart To load the dataset, use the following code: ```python from datasets import load_dataset ds = load_dataset("snorkelai/Tau2-Bench-Airline-With-Code-Agents") ``` ## Dataset Results There is a lot of rich information in this dataset. The top-line result to highlight here is the differential effect of enabling code-generation on task reward depending on whether a database update is required. Models appear to do better when they are only challenged to make inferences and fail nearly every time for write operations. However, it is also worth noting that write operations are possible, which we see in a few examples with Claude Sonnet 4.5 and GPT-5 (as well as ad hoc testing we did). <img src="main_result.png" style="width:50%;"> Breakdown of database difference types by version (more verbose summaries of differences in the dataset, see below). | db_diff | code-generation (%)| original (%)| |:----------------------------------------------------------|------------------:|-----------:| | Database incorrectly updated. | 22.8 | 22.8 | | Database not updated at all but updates were required. | 33.6 | 14.4 | | Database updated when none was required for the task. | 5.6 | 7.6 | | No database: session terminated due to max steps reached. | 2 | 0.4 | | Perfect match with no required updates. | 33.2 | 32.4 | | Perfect match with required updates. | 2.8 | 22.4 | | Total | 100 | 100 | A more granular analysis by database table. | % | ('flights', 'code-generation') | ('flights', 'original') | ('reservations', 'code-generation') | ('reservations', 'original') | ('users', 'code-generation') | ('users', 'original') | |:-------------------------------------------------|---------------------------------:|--------------------------:|--------------------------------------:|-------------------------------:|-------------------------------:|------------------------:| | Not updated at all and no updates were required. | 74 | 74.7 | 10 | 10 | 34.7 | 34.7 | | Not updated at all but updates were required. | 21.3 | 6 | 46 | 16 | 43.3 | 19.3 | | Update required and correctly made. | 0 | 13.3 | 6 | 36.7 | 2.7 | 30.7 | | Update required and incorrectly made. | 1.3 | 4 | 36.7 | 36.7 | 16.7 | 13.3 | | Updated but no updates were required. | 2 | 1.3 | 0 | 0 | 1.3 | 1.3 | | No database produced. | 1.3 | 0.7 | 1.3 | 0.7 | 1.3 | 0.7 | | Total | 100 | 100 | 100 | 100 | 100 | 100 | Preliminary analysis suggests that code agents are capable of making the required updates but often fail to do so. For example, there were no cases where updates to available flight seating were correctly made, with attempts that were often slightly off. In the original version with tools, the logic is hard coded into the method booking flights. ## Dataset Rationale The purpose of this dataset is to allow further investigation into the differences, advantages and disadvantages of using code agents versus agents with action spaces more contrained by bespoke tools. You can find another example [here](https://huggingface.co/datasets/snorkelai/Multi-Turn-Insurance-Underwriting-Code-Gen). ## Dataset Structure The dataset contains one rollout for each of the 50 tasks in the original environment, for each version (original and code-agent versions). Rollouts were produced for the following models: - GPT-5 (medium) - Claude Sonnet 4.5 - Gemini 2.5 Pro (default settings) - Kimi K2 Instruct - Qwen3-Coder 480B A35B Instruct All dataset fields are munged information from the original repo, with a few additional highlighted: - `task_id (string)`: Unique identifier of task from original Tau Bench 2 repo. - `model (string)`: The AI assistant model used to generate responses. - `version (string)`: Either `original` or `code-generation` for the code-agent version. - `user_scenario (dict)`: Task-level information from original repo. - `db_update_required (bool)`: Whether or not the task requires an update to the database (determined by differencing expected hashes). - `trace (list of dictionaries in json format)`: Contains the full trace including an initial question, many steps of reasoning interleaved with questions/answers between the assistant and underwriter, and a final answer to the question. - Each step in the trace contains (all values serialized): - `turn_idx`: Turn number for that trace - `role`: The role for that step - user or assistant - `content`: The text content of that step - 'time_stamp': Timestamp - 'tool_calls': Optional data about tool use - `reward (float)`: Overall reward computed with default evaluators (see below for how we did this for the code agents). - `reward_breakdown (dict)`: Breakdown of reward. - `db_diff (string)`: Brief summary of differences between expected and actual database after interaction. - `db_diff_by_table (dict)`: Summary of differences between expected and actual database for each table. - `db_diff_verbose (string)`: More verbose summary of the differences in the expected and actual databases when updates were required but incorrect. ## Code Agent Adaptation We made the code-agent version by removing all tools from the environment except one mocking an action represented by pure text. We replaced the rest with a code interpreter, which we confirmed could be used to successfully update the database as required. ### Code interpreter tool ``` from langchain_experimental.tools import PythonAstREPLTool ... def code_evaluation(self, expression: str) -> str: """ Execute a Python expression, assuming access to variables: 'db': the Pydantic model representing the database. the database is a Pydantic model with information about passengers, flights, reservations etc. 'data_models': a dictionary containing relevant Pydantic models useful for updating the database, 'airport_codes': a variable representing airport codes. Each entry in 'airport_codes' is a dictionary mapping IATA codes to AirportInfo objects. HINT: To see the output of an expression you need to print it. Output is required to be fewer than 100,000 tokens, otherwise an error will be returned. Args: expression (str): Python expression with 'db' and 'airport_codes' variables Returns: str: result of the expression """ custom_locals = {'db': self.db, 'data_models': self.data_models, 'airport_codes': self.airport_codes} repl_tool = PythonAstREPLTool(locals=custom_locals) try: result = repl_tool.run(expression) token_count = token_counter(text=result) if token_count > 100_000: result = f"TOOL ERROR: {token_count} tokens in output of code execution, output needs to be < 100,000 tokens. Please execute code that produces results under that limit." else: pass except Exception as e: result = f"TOOL ERROR: {str(e)[:1000]}..." return result ``` ## Code Agent Evaluation The original Tau Bench 2 repo computes reward online. For database checks (is the database updated appropriately if at all), this means executing expected tool use patterns to derive the expected updated database. We therefore refactored evaluation to occur offline with expected database hashes generated from the original version with tool use. We confirmed in a handful of examples that with a code interpreter, models are capable of making the same updates. We also evaluated the differences in generated and expected database updates using GPT-5 when updates were made at all, provided in the `db_diff_summary (string)` field. #### Personal and Sensitive Information The dataset was developed based on synthetic information so there is no sensitive data risk. ## Citation If you find this dataset helpful, please cite us: ``` @misc{snorkelai2025tau2benchcodeagents, author = {Snorkel AI}, title = {Tau^2 Bench Airline With Code Agents}, year = {2025}, howpublished = {\url{https://huggingface.co/datasets/snorkelai/Tau2-Bench-Airline-With-Code-Agents}}, } ```

A dataset of multi-turn interaction sample traces and associated metadata based on the Airline environment from Tau^2 Bench, including both the original version and the version with code agents, providing task ID, model type, version, user scenario, and other information.

提供机构:
snorkelai
搜集汇总
数据集介绍
构建方式
该数据集由Snorkel AI基于Tau² Bench中的航空领域环境构建,旨在对比代码代理(code agent)与原始工具驱动代理在任务执行中的表现差异。构建过程中,研究者将原始环境中除纯文本模拟动作外的所有工具替换为Python代码解释器,允许代理通过编程方式直接操作数据库。每个任务均采集了原始版本与代码代理版本的完整交互轨迹,并覆盖GPT-5、Claude Sonnet 4.5、Gemini 2.5 Pro、Kimi K2 Instruct及Qwen3-Coder 480B A35B Instruct五种模型。评估采用离线方式,通过原始版本生成的期望数据库哈希值作为基准,计算实际数据库差异与奖励分数。
特点
数据集的核心特色在于提供了多轮交互的细粒度轨迹数据,每条记录包含任务标识、模型名称、版本类型、用户场景结构、数据库更新需求标志以及完整的对话历史。轨迹中每个步骤均标注了角色、时间戳、文本内容与可选工具调用信息。尤为独特的是,数据集不仅记录了整体奖励分数,还分解为通信与数据库两个维度,并提供了按数据库表(航班、预订、用户)划分的差异摘要与详细描述,便于深入分析代理在读写操作中的失败模式。初步分析显示,代码代理在仅需推理的任务中表现良好,但在涉及数据库写操作时成功率显著下降。
使用方法
用户可通过HuggingFace Datasets库直接加载数据:使用`load_dataset("snorkelai/Tau2-Bench-Airline-With-Code-Agents")`即可获取包含500条训练样本的数据集。每条样本的`trace`字段存储了完整的交互序列,可用于复现代理行为或训练多轮对话模型。`db_diff`及其衍生字段提供了数据库状态变更的语义化总结,适合用于评估代理工具使用能力或开发数据库操作检测算法。数据集采用Apache-2.0许可,研究者可自由用于学术探索,引用时需注明Snorkel AI的原始工作。
背景与挑战
背景概述
在人工智能代理(AI Agent)研究领域,如何设计高效且鲁棒的代理动作空间一直是核心议题。传统方法通常依赖于预定义的定制工具(bespoke tools)来约束代理行为,而新兴的代码生成(code generation)范式则赋予代理通过编写代码与环境交互的灵活性。snorkelai/Tau2-Bench-Airline-With-Code-Agents 数据集由 Snorkel AI 于2025年创建,基于 Sierra Research 的 Tau²-Bench 航空环境,旨在系统比较这两类代理范式在复杂多轮任务中的表现差异。该数据集包含了 GPT-5、Claude Sonnet 4.5、Gemini 2.5 Pro 等前沿模型在50个任务上的完整交互轨迹,每个任务均以原始工具版本和代码代理版本分别执行,为探究代码生成代理在数据库读写操作中的优势与局限提供了丰富实证。该数据集的核心研究问题聚焦于:当代理从受限工具切换到自由代码生成时,其任务完成奖励、数据库操作准确性及错误模式会发生何种变化,这一研究对构建更通用、更可靠的对话式AI系统具有重要指导意义。
当前挑战
该数据集所揭示的核心挑战在于代码代理在执行数据库写操作时表现出的显著脆弱性。具体而言,1)在领域问题层面,尽管代码代理在仅需推理推理的任务中表现良好,但在需要实际修改数据库(如更新航班座位或预订信息)的场景下,其成功率远低于传统工具代理——例如在航班座位更新任务中,代码代理从未正确完成更新,而工具代理的成功率可达13.3%。这种“推理强、执行弱”的失衡揭示了当前代码生成代理在安全、精确地执行副作用操作上的根本性不足。2)在构建过程中,研究团队面临的主要挑战是如何公平地比较两种范式:原始版本依赖硬编码的工具逻辑,而代码版本需通过Python解释器动态执行。为此,他们移除了除纯文本模拟外的所有工具,并设计了离线评估方案,通过对比预期数据库哈希值与实际结果来量化差异。此外,代码执行产生的超长输出(超过10万token)和异常处理(如工具错误截断)也增加了数据收集与评估的复杂性。
常用场景
经典使用场景
在人工智能体(AI Agent)研究领域,Tau2-Bench-Airline-With-Code-Agents数据集为评估和比较不同智能体架构在多轮交互任务中的表现提供了标准化基准。该数据集基于航空客服场景,包含50个真实世界任务,覆盖了从信息查询到数据库更新的多样化操作。其核心设计在于对比传统基于预定义工具的智能体与新兴的代码生成型智能体(Code Agent)之间的性能差异。研究人员可利用该数据集中丰富的交互轨迹、奖励信号及数据库差异标注,系统性地分析两种范式在推理能力、任务完成度及错误模式上的优劣,从而推动更鲁棒、更灵活的智能体系统设计。
实际应用
在产业应用中,该数据集直接服务于航空、金融、医疗等需要智能体与后端数据库频繁交互的领域。例如,航空公司可利用此类数据训练客服智能体,使其能够根据用户需求自主查询航班信息、修改预订记录或调整座位配置。然而,数据集的实证结果警示工程团队:当前代码智能体在执行关键写入操作时存在显著风险,可能导致数据库状态不一致(如错误更新或未执行必要修改)。因此,实际部署中需引入人工审核环节或混合策略——即对高风险写操作强制使用经过验证的预定义工具,而对低风险查询任务开放代码生成能力,从而在效率与可靠性间取得平衡。
衍生相关工作
该数据集已催生一系列重要的衍生研究。Snorkel AI团队基于相同框架构建了保险核保场景的代码生成数据集(Multi-Turn-Insurance-Underwriting-Code-Gen),将对比实验拓展至金融领域。此外,数据集中对数据库差异的细粒度标注(按flights、reservations、users三表分类)直接支撑了关于智能体错误模式分类学的研究,例如区分“未执行必要更新”与“错误更新”两类失败的本质差异。更有工作聚焦于利用该数据集的奖励分解结构(COMMUNICATE与DB维度)设计分层奖励函数,以训练更擅长处理写操作的智能体。这些衍生工作共同构建了一个从诊断到改进的完整研究闭环。
以上内容由遇见数据集搜集并总结生成
二维码
社区交流群
二维码
科研交流群
商业服务