Continuous Agent Improvement via Trace Mining
AI Engineergo watch the original →
the gist
Improve agent performance by treating trace data as a training set, using agents to mine these traces for feedback, and iterating between harness engineering and fine-tuning.
The Data-Driven Agent Loop
Continuous improvement for agents relies on treating trace data as the primary substrate for learning. Instead of manual inspection, developers should treat agent traces as a dataset to be mined by other agents. This process involves collecting all tool calls, outputs, and API interactions to create a feedback loop where the agent's past performance informs future prompt, tool, or orchestration updates. The core workflow involves shipping the agent to collect real-world traces, using an agentic system to query those traces for specific behaviors, and then running experiments to validate improvements.
Harness Engineering and Fine-Tuning
Performance optimization follows a cyclical pattern of harness engineering and fine-tuning. Initial improvements are best achieved through harness engineering, which provides rapid feedback cycles. Once a performance ceiling is reached with prompt engineering, teams should transition to fine-tuning base models on domain-specific tasks. This approach allows for the distillation of behavior from larger frontier models into smaller, more cost-effective open models. In high-inference scenarios, shifting from token-based costs to dedicated hardware clusters often provides better economic scaling.
Scaling Trace Analysis
As agent activity grows, manual review becomes impossible. Effective trace mining requires moving beyond simple RAG-based context injection. Because long-running agent traces can exceed memory limits, developers must treat trace context as an external, queryable object. This allows for automated evaluation generation and the creation of human-readable summaries for high-trust domains like legal or medical applications. The ultimate goal is to move toward a continual learning architecture where agents autonomously update their own prompts and memory based on the feedback captured in their historical traces.