# How do you build agent trajectory datasets for post-training?

> Source: <https://discuss.huggingface.co/t/how-do-you-build-agent-trajectory-datasets-for-post-training/192530#post_2>
> Published: 2026-11-25 11:05:23+00:00

**Recommendation:** Retain failed trajectories and dead ends as negative examples when building SFT or preference-tuning data, and use model-generated trajectories with human review rather than purely human-authored data to scale.
More in the playbook "Fine-tuning and data": <https://wpnews.pro/playbooks/training-data>

The OpenAI messages format is a solid baseline. It’s common to extend it by adding a `tool_calls` list to the assistant message and a `tool_outputs` list to a subsequent `tool` role message. For metadata, track the original `task_description`, the full `tool_definitions` available, and a final `outcome` status (e.g., `success`, `failure`). This structure is flexible and maps well to most inference APIs.

Definitely keep failed attempts and dead ends; they are your most valuable negative examples. A dataset of only “golden paths” produces brittle agents that can’t recover from errors. For generation, model-generated trajectories with human review and correction is the most scalable approach. Purely human-authored data is too slow and expensive for large-scale SFT or preference tuning.

The ToolBench dataset and its accompanying paper (“ToolLLM”) are a comprehensive reference. They detail a full pipeline for instruction generation, response generation with a solver model, and evaluation. The GAIA benchmark is another good example of complex, multi-step tasks requiring robust trajectories for both training and evaluation.
