title, created, updated, type, tags, sources, confidence
| title |
created |
updated |
type |
tags |
sources |
confidence |
| Circuit Breaker Pattern(熔断器模式) |
2026-06-29 |
2026-06-29 |
concept |
| safety |
| loop-engineering |
| reliability |
| pattern |
|
| prompt-to-loop-engineering-2026 |
|
|
high |
Circuit Breaker Pattern
在 loop-engineering 中,熔断器是 loop-contract 的 BUDGET 维度固化为硬约束的安全机制——连续失败 N 次即跳闸。
核心参数
- max_consecutive_failures:连续失败次数上限。一旦连续报错 N 次,系统立即跳闸并回退代码,将当前运行栈日志打包成工单转交人工
- max_runtime_min:墙上时间上限。超时无条件熔断,不等待当前操作完成
设计原理
熔断器来自分布式系统设计模式,在自主 Agent 循环中承担 安全预算执行者 角色:
- 失败计数:跟踪连续失败次数
- 阈值触发:达到 max_consecutive_failures → OPEN 状态(拒绝所有操作)
- 优雅降级:回退代码 → 打包日志 → 转交人工,而非静默丢失
与看门狗的分工
| 机制 |
监控对象 |
触发条件 |
响应 |
| [[circuit-breaker-pattern |
熔断器]] |
任务级失败 |
连续失败 N 次 |
| [[watchdog-pattern |
看门狗]] |
进程级异常 |
CPU 满载 + 无 I/O |
相关概念