Lengthy-running brokers accumulate state that no transcript captures. A coding agent at step 10 holds edited information, a operating dev server, put in packages, and a heat immediate cache. When it misreads a traceback and rewrites a file that was already appropriate, neither out there restoration path is affordable: patching ahead grows the context and the token invoice, and restarting from the first step re-pays each mannequin and gear name whereas reproducing nothing precisely, as a result of runs are non-deterministic. Leaping again to step eight is the choice engineers really need, and it’s the one present runtimes can not supply. Git variations information, not a stay course of or a cache. Researchers at Northeastern College and Stanford College have launched Shepherd, a Python runtime substrate that information an agent run as a Git-like hint of typed occasions, so any previous state could be forked and replayed. The analysis crew experiences forks 5× sooner than Docker and over 95% prompt-cache reuse on replay.
Is it deployable?
Sure however it’s out there in early alpha and never prepared for manufacturing. Shepherd is MIT-licensed and installable with pip set up shepherd-ai from PyPI. It wants Python 3.11+. OS-level grant enforcement runs on macOS (Seatbelt) and Linux (Landlock, in a privileged container).
- Industries: Software program engineering and DevOps, AI infrastructure and agent-platform distributors, quantitative finance analysis, safety tooling and offensive-security analysis, and information engineering. The frequent trait shouldn’t be the vertical. It’s long-horizon agent runs in opposition to heavy sandbox state, the place a failed run is dear to redo.
- Functions: Stay supervision of coding brokers, with a meta-agent reverting a foul write earlier than it commits. Automated restoration from a improper software name, with no full restart. Branching exploration over candidate agent methods, in contrast aspect by aspect. Rollout era for reinforcement studying, forking at chosen turns.
What Shepherd modifications
Shepherd is a Python substrate that information an agent’s execution as a first-class object. Each agent-environment interplay turns into a typed occasion in a Git-like execution hint. Core operations are formalized as features and mechanized in Lean.
Every interplay is successfully a commit. Not like Git, the commit covers the agent course of and the filesystem collectively, copy-on-write. A department subsequently carries stay state, not simply information. Returning to an earlier level is a single fork from that commit.
The analysis crew experiences that Shepherd forks the agent course of and its filesystem 5× sooner than Docker. As a result of the immediate prefix by means of the department level is unchanged, replay achieves over 95% prompt-cache reuse.
The documentation organizes the framework round 4 ideas: duties, results, runs, and workspaces. A job is a typed perform whose physique the mannequin fills in, so the signature is the contract. An impact is each crossing of the duty boundary, and it may be watched, answered, or refused. A run is the sturdy file of these crossings.
Permissions are declared within the signature. A Could[GitRepo, ReadOnly] binding is compiled to that run’s writable roots and enforced on the native syscall jail.
Forking permits higher-order brokers that observe a hint and intervene earlier than a foul write commits. The analysis crew demonstrates three functions:
- In runtime intervention, a stay supervisor raised pair-coding move charges on CooperBench from 28.8% to 54.7%.
- In counterfactual meta-optimization, branching exploration beat baselines throughout 4 benchmarks by as much as 11 factors, whereas chopping wall-clock time by as much as 58%.
- In Tree-RL coaching, forking rollouts at chosen turns improved TerminalBench-2 from 34.2% to 39.4%.
Shepherd: replaying an agent run from a commit, not a transcript
Click on any step on the rail to fork the run from that time. Northeastern College & Stanford College, arXiv:2605.10913.
Execution hint — step 9 misreads a traceback
Principal department
Forked department
Why a message log shouldn’t be sufficient
A transcript information what the agent stated and which instruments it known as. It doesn’t file the stay course of, the dev server, the put in packages, or the immediate cache. Shepherd information each agent–setting interplay as a typed occasion, so a commit covers the agent course of and the filesystem collectively, copy-on-write.
Rewind to step 8 — what really comes again
Transcript + git checkout
Message historical pastrestored
Supply informationrestored
Working course ofnonetheless at step 9
Dev server / portsstale
Put in packagesdrifted
Immediate cachechilly
Shepherd fork from commit 8
Message historical pastrestored
Supply informationrestored
Working course offorked
Dev server / portsforked
Put in packagesforked
Immediate cache>95% reused
Immediate-cache reuse determine is reported within the paper summary for replay after a fork.
The boundary that isn’t reversible
Forking undoes filesystem and course of state contained in the sandbox. It doesn’t undo the skin world. A despatched e mail, an actual cost, or a third-party write stays despatched. Shepherd’s reply is refusal quite than rollback: each crossing is an impact {that a} handler in scope can watch, reply, or refuse earlier than it occurs.
Restoration technique — transfer the slider to set the place the run breaks
Break at step
9
Illustrative mannequin, not paper measurements. It assumes a restart re-pays each step and re-prefills the context, whereas a fork re-pays solely the steps after the department level and reuses the cached prefix. The 2 verified anchors are the reported fork velocity and the reported replay cache reuse.
Reported within the paper
CooperBench pair-coding move chargeno supervisor
 + Tree-RL fork coaching
5×
Quicker fork of agent course of + filesystem than Docker
>95%
Immediate-cache reuse on replay after a fork
+11 pts
Peak achieve from branching exploration throughout 4 benchmarks
−58%
Peak wall-clock discount from counterfactual meta-optimization
‘+(i===BREAK?’break’:’c’+i)+’
‘;
d.onclick=perform(){choose(+this.dataset.i)};
R.appendChild(d);
}
}
perform choose(i){
sel=i;draw();
F.innerHTML=”;FL.type.show=’block’;
var sp=doc.createElement(‘div’);sp.className=”spacer”;
sp.type.width=((i-1)*41)+’px’;F.appendChild(sp);
var n=0;
var t=setInterval(perform(){
n++;if(n>3){clearInterval(t);return}
var e=doc.createElement(‘div’);e.className=”fdot”;e.textContent=i+n;F.appendChild(e);
},170);
M.innerHTML=i
:’Commit ‘+i+’ is at or after the dangerous write. Forking right here inherits the damaged file. Choose a commit earlier than step ‘+BREAK+’.’;
}
draw();
M.innerHTML=’Steps 1–8 are appropriate. At step ‘+BREAK+’ the agent misreads a traceback and rewrites a file that was superb. Click on a decide to fork from it.’;
var tabs=doc.querySelectorAll(‘#mtp-shep-x .tab’),panes={a:’pa’,b:’pb’,c:’laptop’,d:’pd’};
tabs.forEach(perform(t){t.onclick=perform(){
tabs.forEach(perform(x){x.classList.take away(‘on’)});this.classList.add(‘on’);
for(var okay in panes)doc.getElementById(panes[k]).classList.take away(‘on’);
doc.getElementById(panes[this.dataset.p]).classList.add(‘on’);
if(this.dataset.p===’d’)bars();
}});
perform bars(){
doc.querySelectorAll(‘#mtp-shep-x .fill’).forEach(perform(f){
f.type.width=”0″;setTimeout(perform(){f.type.width=(+f.dataset.w*1.6)+’%’},60);
});
}
var S=doc.getElementById(‘sl’);
perform sim(){
var n=+S.worth;doc.getElementById(‘slv’).textContent=n;
var patch=n*1.9+14, restart=n*1.0+4, fork=(n-8>0?n-8:1)*0.9+1.2;
if(restart
