AIFeed

Sentry:面向 LLM 智能体的外部自我改进故障管理层

Translation(model translation, not the source's own text)

Sentry:面向 LLM 智能体的外部自我改进式故障管理层

Sentry 与你的智能体循环并行运行,用于检测故障、引导恢复,并从经过验证的恢复中学习可复用的经验。

快速开始 | 论文(arXiv) | 许可证

什么是 Sentry?

Sentry 是面向 LLM 智能体的外部运行时故障管理层。它帮助智能体修正无效动作,并在智能体陷入循环、偏离任务或做出无依据假设时恢复。与提供固定建议的典型运行时监控器不同,Sentry 从有效的恢复中学习并不断演进。通过检测故障、引导恢复并检查修复是否生效,Sentry 帮助智能体在各类任务中变得更可靠,同时不会让上下文变得杂乱。

演示

Sentry 演示
Sentry 演示

关键结果

论文中报告的结果:

  • 在 WebShop、AppWorld、SWE-bench Lite 和 Mind2Web Replay 上,相较最强的运行时干预基线,平均相对提升 37%。
  • 在留出的 WebShop 和 Mind2Web Replay 任务上,相较最强的上下文演化基线,平均相对提升 39%。
  • 基础智能体 token 用量为 1.54×,而 AgentForesight 为 2.44×。
  • 在 SWE-bench Lite(节省 31.7s)和 AppWorld(节省 45.6s)上,平均任务延迟低于基础智能体。
  • 在 939 个检测到的故障中,恢复率为 81.7%。

快速开始

安装

Sentry 需要 Python 3.10 或更高版本。


        git clone https://github.com/nuglifeleoji/Sentry.git
cd Sentry
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .
      

配置模型

复制 OpenAI 配置模板,然后设置你的模型 ID:


        mkdir -p outputs
cp configs/providers/openai.yaml outputs/sentry.yaml
export OPENAI_API_KEY="your-api-key"
      

在 outputs/sentry.yaml 中,将 YOUR_DEPLOYMENT_MODEL_ID 替换为你账户可用的确切模型 ID。然后验证配置:


        sentry-validate outputs/sentry.yaml
      

验证会以 JSON 形式打印解析后的配置,且不会发起模型请求。其他提供商或本地端点,请参见模型提供商。

尝试一次恢复

从仓库根目录运行这个 Python 示例。它提交一个故意格式错误的动作,并要求配置的模型重写它:


        from Sentry import SentryRunner, agent_step_from_parts

runner = SentryRunner.from_yaml("outputs/sentry.yaml")
runner.start_task(
    objective="Inspect item 42 to check its price.",
    action_schema='Return JSON: {"tool": "inspect", "args": {"item_id": <integer>}}',
)

try:
    step = agent_step_from_parts(
        step_id=0,
        reasoning="Open the item details before deciding whether to buy.",
        raw_action="inspect item 42",
        observation="Item 42 is visible; its price has not been inspected.",
        parsed_ok=False,
        schema_valid=False,
        parser_error="Expected a JSON object; received plain text.",
    )
    repair = runner.step(step)
    if repair is not None:
        print("Repair route:", repair.route)
        print("Next action:", runner.generate_repair(repair))
finally:
    runner.finalize()
      

路由为 hard_repair;下一个动作由模型生成,并应遵循 JSON schema。此示例发起一次模型请求,且不执行返回的动作。

对于真实智能体,将每个动作-观察周期提交给 Sentry,并在生成下一个动作时纳入任何返回的指导。你的应用负责动作生成、验证、执行和任务完成。完整生命周期和有效性规则请参见智能体集成。

工作原理

Sentry 框架:故障检测、修复、验证和 playbook 学习
Sentry 框架:故障检测、修复、验证和 playbook 学习
  • 故障检测:Sentry 监控最近的智能体步骤,以发现无效动作和行为故障。
  • 硬修复:Sentry 要求智能体以要求的格式重试无效动作。
  • Soft Repair:进度失败和推理失败会从相关 playbook 经验中获得针对性指导。
  • Recovery Verification:Sentry 检查 agent 在后续步骤中是否恢复。
  • Online Playbook Learning:经过验证的 soft recovery 会成为可复用经验,用于跨任务中的类似失败。

Documentation

各指南按推荐阅读顺序排列:model-provider 设置、配置、agent 集成、playbook 与日志,以及 AppWorld 基准测试。

指南内容
Model providers凭据、provider 模板和端点配置
Configuration模型和存储选项、固定算法设置以及配置校验
Agent integration任务生命周期、步骤输入、修复指导和恢复验证
Playbook and logging跨任务记忆、持久化、显式加载和运行时日志
AppWorld benchmark环境设置、任务选择、运行限制和结果文件

论文还考察了条件化经验暴露、细粒度检索、向未见任务的迁移,以及将 Sentry 与上下文演化相结合。

Release Status

此代码检出包含 Sentry 运行时、model-provider 适配器、配置模板、测试以及一个 AppWorld 参考基准测试。基准测试运行器目前支持 AppWorld dev 任务。论文中报告的其他基准测试在此代码检出中尚无运行器。

Contributing

欢迎为 Sentry 做贡献,包括缺陷修复、集成示例和文档改进。

缺陷报告和功能请求可通过 GitHub Issues 提交。代码和文档变更可作为 pull request 提交。

Citation

如果你在研究中使用 Sentry,请引用:


        @article{ji2026sentry,
  title={Sentry: Learning to Recover from LLM Agent Failures at Test Time},
  author={Ji, Changxiu and Lu, Amy and Zhang, Qizheng and Olukotun, Kunle},
  journal={arXiv preprint arXiv:2610.02994},
  year={2026}
}
      

License

Sentry 在 MIT License 下发布。

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗