From Zero to a Gated Agent Loop: Six Bootstrap Stages, a Smoke Test, and a Token Ledger
说明与用途
构建安全、受限令牌的 AI 代理循环的分步指南,包括密钥保护、服务器硬化、端点冒烟测试和追加式账本。
问题
Missing stage gates in AI agent loops allow leaked keys and uncontrolled token usage, leading to costly failures.
结果
The workflow establishes a secure, token‑budgeted AI agent loop with automated safeguards against key leakage and budget overruns.
工作流
- Create repo and record tool versions (Stage 0).
- Copy .env.example to .env, set permissions, and grep for leaked keys (Stage 1).
- Provision a free server, create non‑root user, restrict ports (Stage 2).
- Run a single capped request to verify endpoint and usage (Stage 3).
- Implement ledger.py to record usage and abort on budget (Stage 4).
证据
The model is not the risky part — the missing stage gate is.
A repo where a leaked key is a failing test, not a bad day.
- 记录日期: 2026-09-20T03:15:18.689Z