Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseResearch Paper · For R&DIEEE Spectrum AI→ original

Shepherd from Northeastern and Stanford gives AI agents "Git" and rollback for their mistakes

Agents that run for a long time without supervision sometimes do something irreversible: wipe an entire mailbox or hack websites. In Shepherd, every agent step is saved as a "commit," as in Git, and a supervisor agent intercepts a dangerous action and rolls the work back. An email, for example, first lands in a sandbox and goes out for real only after review. Anyone building agents should borrow this technique.

AI-processed from IEEE Spectrum AI; edited by Hamidun News
Shepherd from Northeastern and Stanford gives AI agents "Git" and rollback for their mistakes
Source: IEEE Spectrum AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceIEEE Spectrum AI ↗
Editor-in-Chief
Key metric #1The code is open on GitHub, but it is still an alpha version, not ready for production
Tested on three taskspair programming, optimization, RL training
Key metric #3The paper will be presented at NeurIPS in December 2026

AI agents are launched to run for long stretches without supervision, and the longer they work, the higher the chance that one of them does something irreversible. There have already been cases where an agent wiped an entire mailbox, hacked websites, or even launched cyberattacks. Researchers at Northeastern University and Stanford have proposed a fix that every developer will recognize: do for agents what Git does for code.

Every agent step is saved as a "commit" (a snapshot of state), so you can return to any moment. Imagine an agent about to send a client an email that contains a mistake. In a typical system, the email has already gone out.

In Shepherd, a sandbox intercepts it, and a supervisor agent or a human decides whether to send the email for real or to roll the agent back one step. If your agent touches email, files, or deployments, this technique is worth adopting now.

The shepherd and the sheep

The idea's author, Northeastern professor Weiyan Shi, explains it this way: working agents are like wandering sheep, and the meta-agent is a shepherd that brings them back onto the right path. Hence the framework's name, Shepherd. The meta-agent observes behavior, checks the quality of the work, and escalates a problem to a human when appropriate. The human stays in charge: they can step in and steer the meta-agent itself.

The principle is familiar to anyone who works on a team. A junior does the task, a team lead reviews the result, and in contested cases calls in a manager. Shepherd uses the same hierarchy, except models fill the roles. According to Shi, this "middle layer" is needed because the longer agents work, the more likely errors and unsafe actions become.

How it works: version control for actions

On systems like GitHub, programmers can make a copy of the code (a "fork"), save a version (a "commit"), review changes, and roll back if something breaks. Shepherd does the same with an agent's work. It is written in Python and builds on functional programming principles. Each agent action, together with its state and environment (a mailbox, a file system, and so on), is recorded as a commit. The commits form a graph of steps.

The meta-agent can jump to any point in this graph. It watches the working agent, intercepts an erroneous action, returns the agent to the previous step, and launches a different variant from that point.

There is also a protective side. Stanford researcher Derek Chong says the working agent believes it lives in an ordinary world and sends emails. In reality, Shepherd's sandbox intercepts the action, and the meta-agent or a human then decides whether to send the email. Chong calls this a guardrail and a control mechanism.

Three scenarios and what is still unknown

To show that the idea works, the team built three examples:

  • A supervisor for parallel programmers. It stepped in when agents writing code in pairs came into conflict. This raised the share of passed tests on one of the benchmarks.
  • An optimizer for a finished workflow. It proposed targeted edits to an agent's already completed workflow and tested them by replaying only the affected parts of the run, not the entire run from scratch. The result improved.
  • A coach for reinforcement learning. It picked the steps at which to "branch" a run so the agent would take a better path, and rewarded the agent along the way.

IEEE Spectrum's write-up gives no specific figures for the gains, so the scale of the improvements can only be judged from the paper itself. It will be presented at the NeurIPS conference in December 2026. Shepherd is open on GitHub, but according to Chong, the team is still bringing it from an alpha version to production readiness.

What this means for practitioners

Even without waiting for a mature Shepherd, you can adopt the approach itself. First, write a log of steps together with state, so you can return to any moment. Second, send dangerous actions to a sandbox first and release them only after review. Third, put a separate checker above the working agents instead of asking a single model to supervise itself.

Shepherd is part of a broader initiative, the Agent Sciences Research Initiative (ASRI), founded by Chong and Shi. Researchers from Northeastern, Stanford, and UC Berkeley work in it. The group's goal is to make agents more reliable, evaluate them better, and improve safety. Chong believes that governing agents is becoming increasingly important: agents should be able to check each other and step into the work, as managers do.

Story

Key Questions Answered

What are the key details on The shepherd and the sheep?

The idea's author, Northeastern professor Weiyan Shi, explains it this way: working agents are like wandering sheep, and the meta-agent is a shepherd that brings them back onto the right path. Hence the framework's name, Shepherd. The meta-agent observes behavior, checks the quality of the work, and escalates a problem to a human when appropriate. The human stays in charge: they can step in and steer the meta-agent itself. The principle is familiar to anyone who works on a team.

How it works: version control for actions?

On systems like GitHub, programmers can make a copy of the code (a "fork"), save a version (a "commit"), review changes, and roll back if something breaks. Shepherd does the same with an agent's work. It is written in Python and builds on functional programming principles. Each agent action, together with its state and environment (a mailbox, a file system, and so on), is recorded as a commit. The commits form a graph of steps. The meta-agent can jump to any point in this graph.

What are the key details on Three scenarios and what is still unknown?

To show that the idea works, the team built three examples: A supervisor for parallel programmers. It stepped in when agents writing code in pairs came into conflict. This raised the share of passed tests on one of the benchmarks. An optimizer for a finished workflow. It proposed targeted edits to an agent's already completed workflow and tested them by replaying only the affected parts of the run, not the entire run from scratch. The result improved. A coach for reinforcement learning.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…