Shepherd: A Runtime Substrate Empowering Meta-Agents with a Formalized Execution Trace
Simon Yu, Derek Chong, Ananjan Nandi, Dilara Soylu, Jiuding Sun + 2 more
TLDR
Shepherd is a functional programming model for meta-agents that uses a Git-like execution trace for fast state forking and replay.
Key contributions
- Introduces Shepherd, a functional programming model for meta-agents with operations mechanized in Lean.
- Records agent-environment interactions as typed events in a Git-like execution trace for state forking and replay.
- Achieves 5x faster forking than Docker and >95% prompt-cache reuse on replay.
- Demonstrates improved performance in runtime intervention, meta-optimization, and Tree-RL training.
Why it matters
Shepherd provides a novel and efficient infrastructure for programming and managing meta-agents. Its ability to formalize operations and rapidly fork/replay states significantly enhances development, debugging, and optimization of complex agent systems. This work opens new avenues for research in meta-agent programming and AI system reliability.
Original 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.
📬 Weekly AI Paper Digest
Get the top 10 AI/ML arXiv papers from the week — summarized, scored, and delivered to your inbox every Monday.