Trace-Driven Co-Optimization of Workflow Code and Prompts for Video Grounding Agents
Abstract
When an agent built on a frozen video-language model mislocalizes an event, the cause is usually not a lack of capability in the model but a mismatch in how the agent uses it: a query decomposed at the wrong granularity, a proposal stage that never covers the true interval, or a refinement step that drifts toward salient but irrelevant content. Practitioners fix these issues by reading traces and editing the agent, coordinating changes between the workflow code and the prompts, a process that is effective but does not scale because agent workflows and instructions must be kept consistent by hand. This paper automates that loop, and in doing so automatically evolves agent harnesses for grounding. We represent the grounding agent as a fill-in-the-blank program: a fixed skeleton specifying the stage interfaces and the data passed between them, with blanks for each stage's logic and instructions. A refinement procedure examines per-example execution records, attributes each failure to a stage, and generates targeted edits to the corresponding blank. Rather than a single greedy trajectory, the procedure keeps a small population of agents branching from different edit histories, so that an edit that helps a subset of queries is preserved and made available for continued refinement in combination with others. Agents are promoted based on held-out grounding performance, not on the development examples that motivated the edits, which limits overfitting to idiosyncratic failures. Across Charades-STA, ActivityNet Captions, and TACoS the refined agents outperform their hand-designed starting points and prompt-only optimization baselines, while the frozen backbone itself is never touched. Separating the contributions of code edits and prompt edits shows that both are required for the full improvement, and that the sequence in which they are applied matters: structural changes to the workflow tend to be discovered first and create room for instruction refinements that would not help in the original structure.
BibTeX
@misc{wang2026trace,
author = {Zhen Wang},
title = {{Trace-Driven Co-Optimization of Workflow Code and Prompts for Video Grounding Agents}},
year = {2026},
url = {https://openreview.net/forum?id=SqSZegKyGa},
howpublished = {OpenReview},
}Ask Althea to put this paper to the test.
Loading related content...