Build a Go/No-Go File for an Unattended AI Worker
说明与用途
创建 gates.json 文件和 runner.py 脚本,确保无人值守的 AI 工作器仅在满足所有预定义条件时启动,防止无控制的进程和隐藏成本。
问题
Running an AI worker unattended can lead to runaway processes, unnecessary costs, and silent failures when remote services become unavailable.
结果
The worker runs only when all safety gates are satisfied, preventing runaway execution, ensuring cost control, and providing clear failure diagnostics.
工作流
- 1. Create gates.json with required parameters (heartbeat_path, max_wall_seconds, max_remote_calls, empty_output_policy, output_allowlist, stop_file, stub_command, min_free_mb, probe_attempts, probe_timeout_seconds).
- 2. Ensure the stub command (e.g., python stub_classify.py) is available on PATH.
- 3. Run the go/no-go checker script (runner.py) before launching the worker. It validates all gates and writes a heartbeat file.
- 4. If the checker exits with code 0, start the worker; otherwise, abort or wait.
- 5. The worker writes output only to allowed directories and respects the heartbeat and stop file signals.
证据
The runner never calls the remote model. It only answers go or no-go for launch.
Eight gates I refuse to skip
- 记录日期: 2026-09-16T15:30:27.680Z