Switchback: A Long-Horizon Agent System for Ultrarunning Training
Abstract
Preparing for an ultratrail race is a months-long experiment in physiological adaptation. Training decisions must account for long-term goals, fitness gains, short-term fatigue, recovery, illness, weather, and imperfect wearable data, with significant consequences for athlete health. We present Switchback, an open-source agent system that combines a structured constitution, user-owned memory, task-specific skills, an exercise science knowledge base, and tools for accessing wearable data. We deployed Switchback for 174 days while the author-runner prepared for three ultratrail races, covering 102 runs, 1,154 km, 34,554 m of climbing, and 180 elapsed hours, alongside more than 3,100 user and agent messages and 39.3 million non-cached API tokens. Lessons from this six-month collaboration shaped UltraBench, a 60-scenario synthetic benchmark evaluating training agents for safety, adaptation, constructive planning, memory stewardship, and tool orchestration. We refined Switchback on 12 development scenarios and evaluated it on 48 held-out scenarios across six models from three providers. Against baseline CLI agents with identical access to files and tools, Switchback raised the cross-model mean score from 70.0 points to 77.1 points, a paired gain of 7.1 points (95% CI 4.6–9.4). Together, these results show that a structured agent system can measurably improve health-aware training decisions across model families while preserving personalized context through six months of training, setbacks, and racing.