Stanford Researchers Release Shepherd: Git-Like Reversible Execution for AI Agents
Shepherd records every agent step as a commit, enabling instant rollback to any point with 95% computation reuse and automatic meta-agent supervision.
Stanford researchers have open-sourced Shepherd, a runtime substrate that gives AI agents Git-like reversible execution traces. When an agent makes an error, Shepherd rolls back to the last correct step instead of restarting the entire task, reusing up to 95% of prior computations through KV-cache retention. A meta-agent monitors execution and triggers rollbacks automatically without human intervention. The project is available under the MIT license at .
How the reversible trace works
Shepherd records each execution step as a durable commit that captures the workspace files and the state of running processes. The system uses a copy-on-write fork mechanism that the team measures at roughly five times the speed of docker commit. Because the key-value cache from earlier steps is preserved, replaying from a rolled-back point avoids recomputing the majority of work — the repository cites ~95% KV-cache reuse on replay.
Developers can inspect, fork, replay, or revert any run with a single call. The trace remains intact whether a proposed change is accepted, merged onto a workspace that has since moved forward, or discarded.
Meta-agent supervision
A meta-agent sits above the working agent and watches for errors. When it detects a failure, it initiates an immediate rollback to the last known-good commit and resumes execution from there. This supervision loop runs without human input, turning error recovery into an automated part of the agent lifecycle rather than a manual debugging session.
Permission model enforced at the syscall level
Shepherd expresses permissions in the task function signature. A parameter annotated as repo: sp.GitRepo grants read-write access to a repository; May[GitRepo, ReadOnly] restricts the agent to read-only. These grants are compiled into writable roots for the run and enforced by the operating system sandbox — macOS Seatbelt or Linux Landlock inside a privileged container. A write to a read-only path or an ungranted directory is refused at the syscall before it can mutate state. Windows is not supported; the documentation recommends WSL.
Installation and requirements
Shepherd requires Python 3.11 or newer. Install the package from PyPI:
pip install shepherd-aiA quickstart demonstrates the workflow: initialize a workspace, run a demo task that writes a program into a retained output, inspect the changeset, and then select, apply, or discard the proposal. The same machinery works offline with a deterministic provider for keyless testing.
Research backing and reproducibility
The design is described in the paper "Shepherd: Enabling Programmable Meta-Agents via Reversible Agentic Execution Traces" (arXiv:2605.10913). Full experiment code, including meta-agent applications and framework microbenchmarks, lives in the companion repository shepherd-agents/shepherd-experiments, which pins the exact substrate snapshot used for the published numbers.
Related reading
Sources
Related news
AI AgentsInteraction-Centric Taxonomy for Localizing AI Agent FailuresResearchers introduce a new taxonomy of 41 failure modes to distinguish between model errors and harness engineering issues in AI agent systems.·by shared tag
- AI AgentsSix Plugins for DeepSeek Harness to Optimize Tokens and ContextA selection of plugins for DeepSeek Harness designed to reduce token consumption, organize context, and expand AI agent capabilities.·by shared tag
- Open SourceVercel Labs open-sources agent-desktop for OS automationVercel Labs released agent-desktop, a CLI and C library that lets AI agents operate desktop apps via accessibility trees instead of screenshots.·by shared tag
- Open SourceGoogle Harness²: Open-Source Framework for Recursive AI Agent ManagementGoogle releases Harness², an open-source framework enabling AI agents to recursively improve workflows and adapt to new tasks without model retraining.·by shared tag
Comments
Weekly digest
The best of vibe coding, AI agents and open source — once a week, no spam.