Shepherd: A Runtime Substrate Empowering Meta-Agents with a Formalized Execution Trace

Hugging Face Daily Papers Papers

Summary

This paper introduces Shepherd, a functional programming model and runtime substrate for meta-agents that formalizes operations using Lean and records interactions in a Git-like execution trace. It demonstrates significant performance improvements in runtime intervention, counterfactual optimization, and RL training by enabling fast forking and replay of agent states.

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 5times 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.
Original Article
View Cached Full Text

Cached at: 05/12/26, 07:30 AM

Paper page - Shepherd: A Runtime Substrate Empowering Meta-Agents with a Formalized Execution Trace

Source: https://huggingface.co/papers/2605.10913

Abstract

WeintroduceShepherd,afunctionalprogrammingmodelthatformalizesmeta-agentoperationsontargetagentsasfunctions,withcoreoperationsmechanizedinLean.Shepherdrecordseveryagent-environmentinteractionasatypedeventinaGit-likeexecutiontrace,enablinganypaststatetobeforkedandreplayed.Thesystemforkstheagentprocessanditsfilesystem5timesfasterthanDocker,achieving>95%prompt-cachereuseonreplay.Wedemonstratethemodelthroughthreeapplications.First,inruntimeintervention,alivesupervisorincreasespaircodingpassratesfrom28.8%to54.7%onCooperBench.Second,incounterfactualmeta-optimization,branchingexplorationoutperformsbaselinesacrossfourbenchmarksbyupto11pointswhilereducingwall-clocktimebyupto58%.Third,inTree-RLtraining,forkingrolloutsatselectedturnsimprovesTerminalBench-2performancefrom34.2%to39.4%.TheseresultsestablishShepherdasanefficientinfrastructureforprogrammingmeta-agents.Weopen-sourcethesystemtosupportfutureresearch.

View arXiv pageView PDFAdd to collection

Get this paper in your agent:

hf papers read 2605\.10913

Don’t have the latest CLI?curl \-LsSf https://hf\.co/cli/install\.sh \| bash

Models citing this paper0

No model linking this paper

Cite arxiv.org/abs/2605.10913 in a model README.md to link it from this page.

Datasets citing this paper0

No dataset linking this paper

Cite arxiv.org/abs/2605.10913 in a dataset README.md to link it from this page.

Spaces citing this paper0

No Space linking this paper

Cite arxiv.org/abs/2605.10913 in a Space README.md to link it from this page.

Collections including this paper0

No Collection including this paper

Add this paper to acollectionto link it from this page.

Similar Articles