Shepherd: A Runtime Substrate Empowering Meta-Agents with a Formalized Execution Trace
2026-05-11 • Artificial Intelligence
Artificial IntelligenceProgramming LanguagesSoftware Engineering
AI summaryⓘ
The authors created Shepherd, a programming system that treats controlling one agent with another (meta-agent) like functions you can replay and explore easily. Shepherd tracks all interactions in a detailed log, allowing quick copying and re-running of past agent states much faster than Docker. They show Shepherd helps in three ways: improving coding session success rates, exploring better optimization paths, and boosting performance in training simulations. Overall, the authors present Shepherd as a fast tool for experimenting with complex agent behaviors and share it openly for others to use.
functional programmingmeta-agentLean theorem proverexecution traceagent-environment interactionprocess forkingprompt-cacheruntime interventioncounterfactual optimizationreinforcement learning
Authors
Simon Yu, Derek Chong, Ananjan Nandi, Dilara Soylu, Jiuding Sun, Christopher D Manning, Weiyan Shi
Abstract
We introduce Shepherd, a functional programming model that formalizes meta-agent operations on target agents as functions, with core operations mechanized in Lean. Shepherd records every agent-environment interaction as a typed event in a Git-like execution trace, enabling any past state to be forked and replayed. The system forks the agent process and its filesystem $5\times$ faster than Docker, achieving $>95\%$ prompt-cache reuse on replay. We demonstrate the model through three applications. First, in runtime intervention, a live supervisor increases pair coding pass rates from 28.8% to 54.7% on CooperBench. Second, in counterfactual meta-optimization, branching exploration outperforms baselines across four benchmarks by up to 11 points while reducing wall-clock time by up to 58%. Third, in Tree-RL training, forking rollouts at selected turns improves TerminalBench-2 performance from 34.2% to 39.4%. These results establish Shepherd as an efficient infrastructure for programming meta-agents. We open-source the system to support future research.