We put a spend gate in front of our AI agents. It denied 35 of its first 43 decisions
Описание и применение
В компании внедрён шлюз, который блокирует любые запросы к поставщикам, если токен агента невалиден, лимиты не соблюдены или решение не зафиксировано в неизменяемом журнале. Из 43 решений 35 были отказами, 8 – разрешениями, общие расходы составили 0,024 Евро.
Задача
Prevent AI agents from spending money without a deterministic pre‑call check and ensure every decision is immutable in a ledger.
Результат
Out of 43 decisions, 35 were denials (33 due to bad or unscoped token, 1 for unknown provider, 1 for daily cap) and 8 were allows (2 test rows, 6 real image generation calls). Total external spend was EUR 0.024.
Рабочий процесс
- Configure agents to point to http://127.0.0.1:8899/anthropic
- Run gate as root on loopback port 8899 forwarding to real provider with key
- On each request: 1) Verify agent identity via SHA256 token digest; 2) Check caps (per request, per day, per month, token limits); 3) Reserve worst‑case cost atomically; 4) Forward request to provider; 5) On success, settle metered cost; 6) On failure or vault lookup error, release reservation and deny; 7) Append decision to ledger with hash chain; 8) Write denial to alerts.jsonl
Доказательства
Six agents run against a local proxy instead of talking to providers directly.
The ledger is append-only JSONL. One record per decision, each carrying a prev field with the previous record's hash, and a separate head file with the current tip.
As of the read for this post (2026-10-13 01:27 EEST, pinned with the batch) it holds 43 records: 35 denies, 8 allows
- Дата записи: 2026-10-12T23:41:00.837Z