Learning to Retrieve from Agent Trajectories — arXiv2