shepherd-agents/shepherd

GitHub: shepherd-agents/shepherd

Shepherd 是一个将智能体执行转化为可逆、可检查轨迹的运行时框架,使元智能体能够监督、优化和训练其他智能体。

Stars: 1412 | Forks: 104

Shepherd

Shepherd: Programmable Meta-Agents via Reversible Execution Traces

![Status: Alpha](https://img.shields.io/badge/status-alpha-orange?style=for-the-badge) [![PyPI](https://img.shields.io/pypi/v/shepherd-ai?style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/shepherd-ai/) [![Python](https://img.shields.io/pypi/pyversions/shepherd-ai?style=for-the-badge&logo=python&logoColor=white&label=)](https://pypi.org/project/shepherd-ai/) [![Homepage](https://img.shields.io/badge/Homepage-4d8cd8?style=for-the-badge&logo=google-chrome&logoColor=white)](https://shepherd-agents.ai/) [![Docs](https://img.shields.io/badge/Docs-4d8cd8?style=for-the-badge&logo=materialformkdocs&logoColor=white)](https://docs.shepherd-agents.ai/) [![Paper](https://img.shields.io/badge/Paper-2605.10913-red?style=for-the-badge)](https://arxiv.org/abs/2605.10913) [![Blog](https://img.shields.io/badge/Blog-4d8cd8?style=for-the-badge)](https://shepherd-agents.ai/blog)

安装 | 快速开始 | 示例 | 文档 | 引用

**Shepherd** 是一个 runtime 底座,专为需要检查、可逆性和监督的 agent 工作而设计。它将 agent 的运行记录为持久、可检查的执行 trace,并保留工作区输出,以便在被选择、发布或丢弃之前进行审查。 ## 安装 ``` pip install shepherd-ai ``` 想要直接参与 Shepherd 的开发?请改为安装本地可编辑环境: `python -m venv .venv && . .venv/bin/activate && pip install -r requirements-dev.txt` (参见 [CONTRIBUTING.md](https://github.com/shepherd-agents/shepherd/blob/main/CONTRIBUTING.md))。 ## 快速开始 Shepherd 是一个 agent 框架:一个任务的实现可以是一个沙箱化的 agent,其工作成果将以**可审查的提案**形式返回——在你接受之前,任何内容都不会触碰你的文件。在这里,一个任务的整个主体*就是*一个 Claude agent。 任务是一个没有函数体的普通 Python 函数;其签名和 docstring 是 agent 在 runtime 需要履行的契约: ``` def write_program(repo, prompt: str, output_path: str = "program.py") -> None: """Write a small, self-contained Python program that does what `prompt` asks. Save it to output_path. It must run with plain `python3`, read no input, and finish on its own within about ten seconds. """ ``` 设置一个临时工作区并检查 agent 通道是否准备就绪: ``` mkdir /tmp/agent-task && cd /tmp/agent-task shepherd init # turn this directory into a Shepherd workspace shepherd doctor claude # confirm claude CLI, sign-in/key, and sandbox are ready ``` 获取 demo 并让 agent 开始工作(大约需要一分钟): ``` shepherd demo write agent-task > agent_task.py python agent_task.py ``` agent 会编写 `donut.py` —— 但不会写入你的目录。它会以**保留输出**的形式出现:这是一个被安全放置在一旁的提案,你可以运行它而无需应用任何更改: ``` shepherd run changeset --latest --read donut.py | python3 - ``` 直接从保留输出中体验十秒钟的旋转 ASCII 甜甜圈。如果你喜欢,就保留它;如果不喜欢,就扔掉它——无论哪种方式,trace 都会记录下来(demo 会打印出带有真实 run id 的两条命令): ``` shepherd run select # keep it shepherd run discard # ...or not ``` 修改 `agent_task.py` 中的 `PROMPT` 并重新运行以提出其他任何需求——契约保持不变。如果需要一个能编辑现有文件的 agent,请参阅 `shepherd demo write claude-readme`。 ## 离线快速开始 无需 API key。这会通过 Shepherd 的确定性 provider 运行相同的保留输出机制——即上面的 agent 通道,去掉了 agent: ``` mkdir /tmp/shepherd-quickstart && cd /tmp/shepherd-quickstart shepherd init # turn this directory into a workspace shepherd demo write quickstart > quickstart_demo.py python quickstart_demo.py # register + run a task, retaining its result shepherd run list # the run and its status shepherd run changeset --latest # what it wrote, kept as a retained output ``` 使用 `shepherd run show --latest` 检查完整记录(在任何读取命令中添加 `--json` 以获取持久化的机器 payload);有关后端选择和完整的 `run` 接口,请参阅[文档](https://docs.shepherd-agents.ai/)。 ## 示例 上面的 demo 脚本是 Python 接口的一个缩影——检入的副本位于[`examples/quickstart/`](https://github.com/shepherd-agents/shepherd/tree/main/examples/quickstart)。 可视化 notebook 位于 [`examples/notebooks/visual_artifact/notebooks/`](https://github.com/shepherd-agents/shepherd/tree/main/examples/notebooks/visual_artifact/notebooks) —— 使用 `make notebooks` 启动它们。 ## 开发 实用的本地测试关卡: ``` make dev-install uv run pytest integration-tests/test_quickstart_core.py -q make baseline ``` ## 文档 完整文档位于 **[docs.shepherd-agents.ai](https://docs.shepherd-agents.ai/)**。在本仓库中,文档编撰于 [`docs/shepherd/`](https://github.com/shepherd-agents/shepherd/tree/main/docs/shepherd) 下,请从[快速开始指南](https://github.com/shepherd-agents/shepherd/blob/main/docs/shepherd/start/quickstart.md)和[概念](https://github.com/shepherd-agents/shepherd/blob/main/docs/shepherd/concepts/index.md)开始阅读——包括 tasks、effects、scopes、permissions 以及 trace。 ## 复现论文结果 完整的实验代码——包含 meta-agent 应用和框架性能微基准测试——位于一个配套仓库中:**[shepherd-agents/shepherd-experiments](https://github.com/shepherd-agents/shepherd-experiments)**。它捆绑了用于论文的冻结底座快照,因此数值在面对生成它们的准确版本时依然可以复现。 ## 引用 ``` @misc{yu2026shepherdenablingprogrammablemetaagents, title={Shepherd: Enabling Programmable Meta-Agents via Reversible Agentic Execution Traces}, author={Simon Yu and Derek Chong and Ananjan Nandi and Dilara Soylu and Jiuding Sun and Christopher D Manning and Weiyan Shi}, year={2026}, eprint={2605.10913}, archivePrefix={arXiv}, primaryClass={cs.AI}, url={https://arxiv.org/abs/2605.10913}, } ``` ## License 本项目基于 MIT License 授权——有关详情,请参阅 [LICENSE](https://github.com/shepherd-agents/shepherd/blob/main/LICENSE) 文件。
标签:DLL 劫持, 人工智能, 元学习, 大语言模型, 安全规则引擎, 开发框架, 执行回溯, 用户模式Hook绕过, 运行时环境, 逆向工具