How to Build an Agent Trajectory Dataset
Puzzleheaded_Box2842 · reddit · 2026-07-13
The author argues that if you want to train or fine-tune a tool-using agent, you shouldn't start with messy chat logs; instead, you should first define what constitutes a "good trajectory."
A useful trajectory should contain at least:
- The task itself
- The agent's reasoning state
- Tool calls
- Tool inputs
- Observations returned by the environment
- The final answer
Recommended Data Pipeline:
- Record trajectories in a structured format
- Generate tasks that require actual tool calls
- Run in a sandbox to ensure safe tool usage
- Save both successful and failed samples, as failures are crucial for evaluation and improvement
- Score based on success rate, efficiency, consistency, and correctness of tool usage
- Filter out low-signal or malformed trajectories
- Maintain sufficient diversity, covering different tools, task depths, and recovery patterns
- Rerun or repair "promising but imperfect" trajectories
Core Viewpoint
The author treats agent traces as training data assets, rather than just debug logs for humans. This approach creates a closed loop: if the model constantly misuses a tool, synthesize targeted trajectories; if it struggles with long tasks, generate deeper traces.
The post also mentions that OpenDCAI/DataFlow is an open-source project pushing in this direction.
More from coding & agent
- Soft Clamp cuts tool-call overuse in multi-teacher distillation, from 13.7% to 9.0% — antgroup · 2026-07-21
- Agent harness memory loss and compaction are still a major usability problem — adityaag · 2026-07-21
- SpecJudge runs locally on Ollama to pick the right-sized AI model for your project — jokiruiz · 2026-07-21
- A developer maps out six design rules for CLIs that humans and AI agents can both use — yujiezha · 2026-07-21
- A coding-agent skill that forces ADHD-friendly, answer-first output — ayghri · 2026-07-21
- A set of agent skills for CAD, robotics, and hardware design — earthtojake · 2026-07-21