Agents

Researchers Release Shepherd to Fork and Replay AI Runs

Researchers from Northeastern and Stanford have released Shepherd, an open-source Python substrate that lets developers fork and replay AI agent runs to prevent costly execution restarts.

MarkTechPost2 days agoAgents
Image: MarkTechPost

Northeastern University and Stanford University researchers have introduced Shepherd, an open-source Python runtime substrate designed to address the high costs of debugging long-running AI agents. When an agent makes an error late in a run, restarting from scratch is expensive and non-deterministic, while patching forward inflates token costs. Shepherd solves this by recording agent-environment interactions as typed events in a Git-like trace. This allows developers to fork and replay live processes and filesystems together using copy-on-write commits, enabling a return to any past state.

Currently available in early alpha under an MIT license, Shepherd can be installed via PyPI using pip install shepherd-ai and requires Python 3.11 or higher. The framework enforces security permissions, such as a May[GitRepo, ReadOnly] binding, at the native syscall jail using macOS Seatbelt or Linux Landlock in a privileged container. According to the research team, Shepherd forks agent processes and filesystems five times faster than Docker, while achieving over 95% prompt-cache reuse during replays.

The substrate's ability to fork runs enables meta-agents to supervise and optimize agent behavior in real time. In testing, a live supervisor using runtime intervention boosted pair-coding pass rates on CooperBench from 28.8% to 54.7%. For counterfactual meta-optimization, branching exploration outperformed baselines across four benchmarks by up to 11 points while slashing wall-clock time by up to 58%. Additionally, forking rollouts at specific turns during Tree-RL training improved TerminalBench-2 scores from 34.2% to 39.4%.

For practitioners in software engineering, DevOps, quantitative finance, and security research, Shepherd changes how long-horizon agent runs are managed. Instead of losing progress to a single incorrect tool call, developers can deploy meta-agents to monitor execution traces and revert bad writes before they commit. This architecture organizes agent frameworks into tasks, effects, runs, and workspaces, transforming live execution into a highly controllable, branchable environment.

This is our own summary of reporting by MarkTechPost

More in Agents