This package converts heterogeneous agent traces into the single schema consumed by the detector.
Each detector-ready trajectory JSON contains:
{
"messages": [
{"step": 0, "role": "user", "name": "human", "content": "..."}
],
"metadata": {
"dataset": "example",
"task_id": "task-1",
"task_description": "...",
"reward": 0,
"annotation": {
"critical_error_step": 7,
"critical_error_type": "act.WrongTool"
},
"extra": {}
}
}Required invariants:
messagesis non-empty andmessages[i].step == i.roleis one ofuser,assistant,tool, orsystem.contentis a string.rewardis0or1.- A non-null
critical_error_stepis a valid unified-message index and does not point to ausermessage. - Successful trajectories have null critical-error annotations.
schema.py defines and validates this contract.
The checked-in files under data/trajerrbench, data/agentdebugbench, and
data/whoandwhen are already converted and can be passed directly to the
detector. Rebuilding is optional and does not download upstream data.
To rebuild, obtain the relevant upstream release under its own terms and place the source files under:
data/sources/
├── AgentDebugBench/{ALFWorld,GAIA,WebShop}/
├── Who_and_When/{Hand-Crafted,Algorithm-Generated}/
└── TrajErrBench/{Tau2Bench,SWEBenchPro}/
You may instead pass --src and --labels explicitly. Generated files default
to data/generated/<dataset-key>/, so rebuilding never overwrites the
checked-in public release.
From the repository root:
python -m data_processing.build_unified_dataset --all
python -m data_processing.build_unified_dataset --dataset trajerrbench_zh_tau2benchRegistered conversion keys are agentdebugbench_alfworld,
agentdebugbench_gaia, agentdebugbench_webshop,
whoandwhen_handcrafted, whoandwhen_algorithm_generated,
trajerrbench_zh_tau2bench, and trajerrbench_zh_swebenchpro.
- Add
data_processing/<name>.pywithconvert_directory(src, out[, labels]). - Normalize roles and assign contiguous zero-based
stepvalues. - Construct the required metadata and map labels to
<module>.<subtype>when available. - Validate every output with
validate_unified. - Register the converter in
DATASETSinbuild_unified_dataset.py. - Add dataset-specific judging/compression settings to
dataset_config.jsonwhen needed.
For message-style sources similar to ALFWorld, GAIA, or WebShop, reuse _standard_messages.convert_standard_record. For custom structures, construct the schema directly; whoandwhen.py, tau2bench.py, and swebenchpro.py are examples.
Build and run:
python -m data_processing.build_unified_dataset \
--dataset my_dataset \
--src data/MyDataset \
--out data/generated/my_dataset
python -m data_processing.validate_dataset --path data/generated/my_datasetDetector outputs default to outputs; data conversion never writes detector outputs.